:root {
  --ink: #d8e8ef;
  --muted: #8aa0ad;
  --cyan: #6fe7ff;
  --amber: #e8b86d;
  --danger: #ff6b6b;
  --panel: rgba(8, 16, 22, 0.86);
  --line: rgba(111, 231, 255, 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: #05080b;
  color: var(--ink);
  font-family: "Noto Serif SC", serif;
}

button, input {
  font-family: inherit;
}

.hidden { display: none !important; }

.grain,
.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
}

.grain {
  opacity: 0.08;
  background-image: radial-gradient(#fff 0.6px, transparent 0.6px);
  background-size: 3px 3px;
}

.vignette {
  box-shadow: inset 0 0 180px 40px #000;
}

.screen {
  min-height: 100vh;
}

.boot, .ending {
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(80, 140, 180, 0.18), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(180, 110, 40, 0.12), transparent 45%),
    linear-gradient(180deg, #0b141c, #05080b);
}

.boot-panel, .end-panel {
  max-width: 720px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 36px 32px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55);
}

.boot-kicker {
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.18em;
  color: var(--cyan);
  font-size: 12px;
  margin-bottom: 12px;
}

h1 {
  font-size: 34px;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.boot-lead, .end-panel p {
  line-height: 1.8;
  color: var(--muted);
}

.boot-panel button,
.end-panel button,
.keypad-grid button,
.modal-card button {
  margin-top: 24px;
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  padding: 10px 22px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.boot-panel button:hover,
.end-panel button:hover {
  background: rgba(111, 231, 255, 0.12);
}

.room {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: 100vh;
}

.hud {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  color: var(--cyan);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 11, 0.7);
}

.stage {
  position: relative;
  min-height: calc(100vh - 42px);
  overflow: hidden;
  background:
    linear-gradient(180deg, #0e1a24 0%, #162433 38%, #1a1a16 70%, #12100c 100%);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 80px),
    linear-gradient(180deg, transparent 62%, rgba(0,0,0,0.45) 100%);
}

.moon {
  position: absolute;
  top: 48px;
  left: 72px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f3f0e0, #c9c3a4 55%, #7d7a68 100%);
  box-shadow: 0 0 60px 18px rgba(210, 220, 230, 0.25);
}

.window-spot {
  top: 28px;
  left: 40px;
  width: 150px;
  height: 130px;
}

.stars {
  position: absolute;
  top: 18px;
  right: 40px;
  width: 280px;
  height: 110px;
  background-image:
    radial-gradient(#f4e9b0 1.4px, transparent 1.4px),
    radial-gradient(#f4e9b0 1.1px, transparent 1.1px),
    radial-gradient(#f4e9b0 1.6px, transparent 1.6px);
  background-position: 12px 18px, 80px 42px, 160px 20px, 210px 60px, 250px 30px;
  background-size: 70px 70px, 90px 90px, 110px 110px;
  opacity: 0.85;
}

.stars-spot {
  top: 10px;
  right: 30px;
  width: 300px;
  height: 130px;
}

.wall-note {
  position: absolute;
  left: 36px;
  top: 210px;
  width: 180px;
  padding: 14px 12px;
  background: #d9c7a1;
  color: #3b2a16;
  transform: rotate(-3deg);
  box-shadow: 4px 8px 0 rgba(0,0,0,0.25);
  font-size: 13px;
  line-height: 1.6;
}

.note-spot {
  left: 28px;
  top: 200px;
  width: 196px;
  height: 92px;
}

.table {
  position: absolute;
  left: 8%;
  bottom: 8%;
  width: 46%;
  height: 28%;
  background: linear-gradient(180deg, #5a4630, #2c2116);
  box-shadow: 0 18px 30px rgba(0,0,0,0.4);
}

.radio {
  position: absolute;
  left: 16%;
  top: -42%;
  width: 68%;
  height: 92%;
  background: linear-gradient(180deg, #2b3338, #15191c);
  border: 2px solid #6a767c;
  border-radius: 8px;
  padding: 10px;
}

.radio-screen {
  height: 42%;
  background: #06140f;
  border: 1px solid #2f7a62;
  color: #7dffb3;
  font-family: "Share Tech Mono", monospace;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 10px;
  font-size: 13px;
}

.radio-wave {
  margin-top: 6px;
  height: 8px;
  background: repeating-linear-gradient(90deg, #7dffb3 0 4px, transparent 4px 8px);
  animation: pulse 1.2s linear infinite;
}

.radio-knobs {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

.radio-knobs i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #d8d8d8, #555);
  display: block;
}

.radio-grille {
  height: 28%;
  background: repeating-linear-gradient(180deg, #111 0 3px, #333 3px 6px);
}

.radio-spot {
  left: 16%;
  top: -42%;
  width: 68%;
  height: 92%;
}

.door {
  position: absolute;
  right: 6%;
  top: 18%;
  width: 220px;
  height: 68%;
  background:
    linear-gradient(90deg, #1b242c 0 12px, transparent 12px),
    linear-gradient(180deg, #3a4650, #1c2328);
  border: 4px solid #6d7b86;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.door-bolts {
  position: absolute;
  right: 14px;
  top: 18%;
  display: flex;
  flex-direction: column;
  gap: 90px;
}

.door-bolts i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9aa7b0;
  display: block;
}

.keypad-face {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translateX(-50%);
  width: 92px;
  padding: 10px 8px;
  background: #0a1014;
  border: 1px solid var(--cyan);
  text-align: center;
  font-family: "Share Tech Mono", monospace;
}

.keypad-face span {
  display: block;
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.2em;
}

.keypad-face b {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  color: #fff;
  letter-spacing: 0.18em;
}

.door-spot {
  right: 6%;
  top: 18%;
  width: 220px;
  height: 68%;
}

.hotspot {
  position: absolute;
  background: transparent;
  border: 1px dashed transparent;
  cursor: pointer;
  z-index: 3;
}

.hotspot:hover {
  border-color: rgba(111, 231, 255, 0.45);
  background: rgba(111, 231, 255, 0.05);
}

.log-panel {
  background: #071015;
  border-left: 1px solid var(--line);
  padding: 18px 16px 90px;
  position: relative;
}

.log-panel h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

#note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.6;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

#note-list li {
  border-left: 2px solid var(--line);
  padding-left: 10px;
}

.muted { color: var(--muted); }
.warn { color: var(--amber); }
.bad { color: var(--danger); }
.ok { color: #7dffb3; }

#cmd-form {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
}

#cmd-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

#cmd {
  width: 100%;
  background: #04080b;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 12px;
  font-family: "Share Tech Mono", monospace;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(520px, 92vw);
  background: #0c151c;
  border: 1px solid var(--line);
  padding: 22px 22px 18px;
}

.modal-card h3 {
  margin-bottom: 10px;
}

.modal-card p {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 8px;
}

.clue-list {
  margin: 12px 0 4px;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.8;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.keypad-grid button {
  margin-top: 0;
  padding: 12px 0;
  font-family: "Share Tech Mono", monospace;
  font-size: 18px;
}

.end-pwd {
  font-family: "Share Tech Mono", monospace;
  color: var(--cyan) !important;
  font-size: 28px;
  margin: 10px 0 18px;
}

.rehearsal {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.rehearsal h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

@keyframes pulse {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .room {
    grid-template-columns: 1fr;
  }
  .stage {
    min-height: 62vh;
  }
  .log-panel {
    min-height: 38vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
