/* MURDERABOARD — terminal-noir HUD. Green phosphor meets Amtrak beige. */
:root {
  --bg: #0a0e0a;
  --panel: #101510f2;
  --ink: #c8e6c9;
  --hot: #66ff66;
  --dim: #6b8f6b;
  --accent: #ffb300;
  --danger: #ff5252;
  --blue: #4f8fde;
  --border: 1px solid #2e4d2e;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--mono); }
button { font-family: var(--mono); cursor: pointer; }
input, select { font-family: var(--mono); }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* ---------- join screen ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0d140d 0%, #050705 100%); overflow-y: auto; }
.join-card { max-width: 420px; width: 92%; padding: 24px; border: var(--border); background: var(--panel);
  box-shadow: 0 0 40px #00330055; }
.ansi { color: var(--hot); font-size: 13px; line-height: 1.15; text-shadow: 0 0 8px #00ff0044; margin-bottom: 12px; }
.tagline { font-size: 13px; line-height: 1.5; margin-bottom: 18px; }
.dim { color: var(--dim); } .small { font-size: 11px; }
.join-card label { display: block; color: var(--hot); font-size: 12px; margin: 12px 0 6px; }
.join-card input { width: 100%; padding: 10px; background: #0a120a; border: var(--border); color: var(--ink);
  font-size: 16px; outline: none; }
.join-card input:focus { border-color: var(--hot); }
.skin-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.skin-picker .swatch { aspect-ratio: 1; border: 2px solid #2e4d2e; cursor: pointer; }
.skin-picker .swatch.sel { border-color: var(--hot); box-shadow: 0 0 8px #66ff6677; }
.btn-primary { width: 100%; margin-top: 18px; padding: 12px; background: #123312; color: var(--hot);
  border: 1px solid var(--hot); font-size: 15px; letter-spacing: 1px; }
.btn-primary:active { background: var(--hot); color: #052005; }
.join-card .small { margin-top: 10px; text-align: center; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#routeTicker { position: absolute; top: 0; left: 0; right: 0; height: 22px; background: #000c; overflow: hidden;
  border-bottom: 1px solid #333; }
#tickerText { display: inline-block; white-space: nowrap; color: var(--accent); font-size: 12px; line-height: 22px;
  padding-left: 100%; animation: ticker 50s linear infinite; }
@keyframes ticker { to { transform: translateX(-200%); } }
#chapterBadge { position: absolute; top: 30px; left: 10px; font-size: 11px; color: var(--hot); background: #000a;
  padding: 4px 8px; border: var(--border); }
#objective { position: absolute; top: 56px; left: 10px; max-width: 62vw; font-size: 11px; color: var(--ink);
  background: #000a; padding: 4px 8px; border-left: 2px solid var(--accent); }
#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #ffffffaa;
  font-size: 24px; text-shadow: 0 0 4px #000; }
#interactHint { position: absolute; top: 58%; left: 50%; transform: translateX(-50%); color: var(--hot);
  background: #000c; border: var(--border); padding: 6px 12px; font-size: 13px; }
#toast { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); background: #000d; color: var(--accent);
  border: 1px solid var(--accent); padding: 8px 14px; font-size: 13px; max-width: 86vw; text-align: center; z-index: 40;
  pointer-events: auto; cursor: pointer; }
.toast-hint { color: var(--dim); font-size: 10px; margin-left: 8px; white-space: nowrap; }
.log-ch { color: var(--hot); font-size: 11px; margin: 10px 0 4px; }
.log-line { margin-bottom: 6px; border-left: 2px solid #1d3d1d; padding-left: 8px; }
#hudButtons { position: absolute; top: 30px; right: 10px; display: flex; gap: 8px; pointer-events: auto; }
#hudButtons button { width: 42px; height: 42px; font-size: 20px; background: #000a; border: var(--border); color: var(--ink); }
#hudButtons button:active { background: #123312; }

/* mobile control zones */
#joyZone { position: absolute; left: 0; bottom: 0; width: 45%; height: 45%; pointer-events: auto; display: none; }
#lookZone { position: absolute; right: 0; bottom: 0; width: 55%; height: 60%; pointer-events: auto; display: none; }
.touch #joyZone, .touch #lookZone { display: block; }
#joyKnob { position: absolute; width: 56px; height: 56px; border-radius: 50%; background: #66ff6633;
  border: 2px solid #66ff6699; transform: translate(-50%, -50%); pointer-events: none; }
#joyBase { position: absolute; width: 110px; height: 110px; border-radius: 50%; border: 1px dashed #66ff6644;
  transform: translate(-50%, -50%); pointer-events: none; }
#actBtn { position: absolute; right: 18px; bottom: 110px; width: 74px; height: 74px; border-radius: 50%;
  background: #123312dd; border: 2px solid var(--hot); color: var(--hot); font-size: 14px; pointer-events: auto; z-index: 20; }
#actBtn:active { background: var(--hot); color: #052005; }

/* ---------- panels ---------- */
.panel { position: fixed; z-index: 30; background: var(--panel); border: var(--border);
  box-shadow: 0 8px 40px #000c; display: flex; flex-direction: column; pointer-events: auto; }
#puzzle, #board, #journal, #dance { top: 5vh; left: 50%; transform: translateX(-50%); width: min(680px, 94vw); max-height: 88vh; }
#btnDance { display: none; }             /* secret on desktop (konami); a button only on touch */
.touch #btnDance { display: block; }
.dance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 4px 0; }
.dance-pick { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #0d130d;
  border: var(--border); color: var(--ink); font-size: 14px; text-align: left; }
.dance-pick:hover, .dance-pick:active { border-color: var(--hot); color: var(--hot); }
.dance-emoji { font-size: 26px; }
.dance-stop { grid-column: 1 / -1; justify-content: center; border-color: var(--danger); color: var(--danger); }
.db-title { color: var(--hot); font-size: 13px; margin: 14px 0 2px; }
.db-sub { color: var(--dim); font-size: 10px; font-style: italic; margin-bottom: 8px; }
.db-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-bottom: 1px solid #1d3d1d; font-size: 13px; }
.db-rank { width: 34px; text-align: center; }
.db-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-time { color: var(--accent); font-variant-numeric: tabular-nums; }
.db-me { background: #123312; color: var(--hot); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: var(--border);
  color: var(--hot); font-size: 13px; flex-wrap: wrap; }
.panel-head .closeX { margin-left: auto; background: none; border: var(--border); color: var(--danger);
  width: 30px; height: 30px; font-size: 14px; }
#puzzleBody, #boardBody, #journalBody { overflow-y: auto; padding: 14px; font-size: 13px; line-height: 1.5; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: var(--border); color: var(--dim); padding: 4px 10px; font-size: 11px; }
.tab.active { color: var(--hot); border-color: var(--hot); }

/* ---------- dialogue ---------- */
#dialogue { left: 50%; transform: translateX(-50%); bottom: 12px; width: min(640px, 96vw); flex-direction: row;
  gap: 0; min-height: 130px; }
#dlgPortrait { width: 96px; min-width: 96px; border-right: var(--border); image-rendering: pixelated;
  background-size: cover; background-position: center; }
#dlgBody { padding: 10px 14px; flex: 1; display: flex; flex-direction: column; }
#dlgName { color: var(--accent); font-size: 12px; margin-bottom: 6px; }
#dlgText { font-size: 14px; line-height: 1.55; flex: 1; white-space: pre-wrap; }
#dlgChoices { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#dlgChoices button { text-align: left; background: #0a120a; border: var(--border); color: var(--ink);
  padding: 8px 10px; font-size: 13px; }
#dlgChoices button:hover, #dlgChoices button:active { border-color: var(--hot); color: var(--hot); }
#dlgNext { align-self: flex-end; color: var(--dim); font-size: 11px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* ---------- chat ---------- */
#chat { position: fixed; right: 10px; bottom: 10px; width: min(340px, 92vw); z-index: 25; background: var(--panel);
  border: var(--border); display: flex; flex-direction: column; pointer-events: auto; }
#chatLog { max-height: 30vh; overflow-y: auto; padding: 8px; font-size: 12px; line-height: 1.5; }
#chatLog .who { color: var(--blue); }
#chatLog .sys { color: var(--dim); font-style: italic; }
#chatRow { display: flex; border-top: var(--border); }
#chatInput { flex: 1; background: #0a120a; border: none; color: var(--ink); padding: 10px; font-size: 14px; outline: none; }
#chatSend { width: 46px; background: #123312; border: none; color: var(--hot); font-size: 16px; }

/* ---------- title cards ---------- */
#titleCard { position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center;
  background: #000d; animation: fadein 0.4s; pointer-events: none; }
#titleCardInner { text-align: center; }
#tcChapter { color: var(--dim); font-size: 14px; letter-spacing: 4px; }
#tcTitle { color: var(--hot); font-size: clamp(22px, 6vw, 44px); margin: 10px 0; text-shadow: 0 0 20px #00ff0044; }
#tcSub { color: var(--accent); font-size: 13px; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- finale: scene dim + rolling credits ---------- */
#finaleDim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 6; transition: opacity 1.4s ease; }
#finaleDim.show { opacity: 0.42; }
#credits { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.credits-roll { position: absolute; left: 50%; top: 0; width: 92%; max-width: 460px; text-align: center;
  transform: translate(-50%, 100vh); animation: creditRoll 16s linear forwards;
  color: var(--accent); font-family: monospace; text-shadow: 0 0 16px #00ff0055; }
.credits-line { font-size: clamp(15px, 4.2vw, 22px); line-height: 2.05; letter-spacing: 2px; }
.credits-line:first-child { font-size: clamp(24px, 7vw, 40px); color: var(--hot); letter-spacing: 4px; margin-bottom: 6px; }
.credits-gap { height: 16px; }
@keyframes creditRoll { to { transform: translate(-50%, -120%); } }
@media (prefers-reduced-motion: reduce) { .credits-roll { animation: none; transform: translate(-50%, 6vh); } }

/* ---------- the roof easter egg: full-screen pixel-art cutscene ---------- */
.cutscene { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 1.2s ease; }
.cutscene.show { opacity: 1; }
.cutscene canvas { width: min(96vw, 940px); height: auto; image-rendering: pixelated; }

/* ---------- shared bits used by JS-built UI ---------- */
.clue-card { border: var(--border); border-left: 3px solid var(--accent); background: #0d130d; padding: 10px;
  margin-bottom: 10px; }
.clue-card h4 { color: var(--accent); font-size: 13px; margin-bottom: 4px; }
.clue-card.locked { border-left-color: #333; color: var(--dim); }
.suspect-card { display: flex; gap: 12px; border: var(--border); background: #0d130d; padding: 10px; margin-bottom: 10px; }
.suspect-card .face { width: 64px; height: 64px; min-width: 64px; image-rendering: pixelated; border: var(--border); }
.suspect-card h4 { color: var(--blue); font-size: 14px; }
.suspect-card .role { color: var(--dim); font-size: 11px; margin-bottom: 4px; }
.suspect-card .accuse { margin-left: auto; align-self: center; background: #331111; border: 1px solid var(--danger);
  color: var(--danger); padding: 8px 10px; font-size: 11px; }
.pin-card { border: var(--border); background: #0d130d; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; }
.pin-card .by { color: var(--blue); }
.pin-card .del { float: right; background: none; border: none; color: var(--danger); font-size: 12px; }
#boardPinForm { display: flex; gap: 6px; padding: 10px; border-top: var(--border); flex-wrap: wrap; }
#boardPinForm select, #boardPinForm input { background: #0a120a; border: var(--border); color: var(--ink); padding: 8px; font-size: 13px; }
#boardPinForm select { max-width: 40%; } #boardPinForm input { flex: 1; min-width: 120px; }
#boardPinForm button { background: #123312; border: 1px solid var(--hot); color: var(--hot); padding: 8px 12px; }
.chapter-row { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed #2e4d2e; font-size: 12px; }
.chapter-row .n { color: var(--hot); min-width: 40px; }
.chapter-row.locked { color: var(--dim); }
.chapter-row .when { margin-left: auto; color: var(--accent); }

/* puzzle shared styles */
.pz-desc { color: var(--ink); margin-bottom: 12px; white-space: pre-wrap; }
.pz-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pz-actions button, .pz-submit { background: #123312; border: 1px solid var(--hot); color: var(--hot); padding: 10px 14px; font-size: 13px; }
.pz-wrong { animation: shake 0.3s; border-color: var(--danger) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.term { background: #050805; border: var(--border); padding: 10px; font-size: 12px; line-height: 1.5;
  max-height: 40vh; overflow-y: auto; white-space: pre-wrap; }
.term .prompt { color: var(--hot); }
.term-input-row { display: flex; margin-top: 8px; }
.term-input-row span { color: var(--hot); padding: 8px 4px 8px 0; }
.term-input-row input { flex: 1; background: #050805; border: var(--border); color: var(--ink); padding: 8px; font-size: 14px; outline: none; }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; }
.keypad button { height: 52px; font-size: 18px; background: #0d130d; border: var(--border); color: var(--ink); }
.keypad button:active { background: #123312; }
.kp-display { text-align: center; font-size: 26px; letter-spacing: 8px; color: var(--accent); margin-bottom: 12px;
  border: var(--border); padding: 8px; background: #050805; }
.wiregrid { position: relative; height: 260px; border: var(--border); background: #050805; }
.wire-node { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #555;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: #000; font-weight: bold; }
.simon { display: grid; grid-template-columns: repeat(2, 90px); gap: 10px; justify-content: center; }
.simon button { height: 70px; border: 2px solid #222; opacity: 0.45; font-size: 20px; }
.simon button.lit { opacity: 1; box-shadow: 0 0 18px currentColor; }
.rf-meter { font-size: 15px; text-align: center; padding: 10px; border: var(--border); background: #050805; color: var(--hot); }
.stackzone { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stackzone .cell { aspect-ratio: 1; border: 1px dashed #2e4d2e; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stackzone .cell.filled { border-style: solid; background: #14201466; }

@media (max-width: 700px) {
  #puzzle, #board, #journal, #dance { top: 0; width: 100vw; max-height: 100vh; height: 100%; }
  #dialogue { bottom: 0; width: 100vw; }
  #objective { max-width: 55vw; }
  #chat { right: 0; bottom: 0; width: 100vw; }
}
