@font-face { font-family: 'VT323'; src: url('../fonts/VT323-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Pixelify'; src: url('../fonts/PixelifySans.ttf') format('truetype'); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #0a0910;
  --bg-2: #121019;
  --panel: #17141f;
  --panel-2: #1f1b29;
  --line: #312b3e;
  --line-2: #463e57;
  --ink: #f5eee6;
  --ink-2: #cfc6d6;
  --muted: #9a90a6;
  --coral: #ff7366;
  --coral-deep: #d9493c;
  --coral-glow: rgba(255, 115, 102, 0.35);
  --amber: #ffb347;
  --amber-dim: #b97a2a;
  --phosphor: #ffc36b;
  --good: #ffd27a;
  --bad: #ff5a4e;
  --pixel: 'Pixelify', 'Trebuchet MS', system-ui, sans-serif;
  --term: 'VT323', 'Courier New', monospace;
  --r: 6px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'clig' 0; font-synthesis: none; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--term);
  font-size: 21px;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(255, 115, 102, 0.08), transparent 60%),
    radial-gradient(900px 700px at 0% 110%, rgba(255, 179, 71, 0.05), transparent 60%),
    var(--bg);
  overflow: hidden;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
img { image-rendering: pixelated; }

.app { position: relative; width: 100vw; height: 100vh; height: 100svh; }

/* ── buttons ─────────────────────────────── */
.btn {
  appearance: none; cursor: pointer;
  border: 2px solid var(--line-2); background: var(--panel-2);
  padding: 10px 18px; border-radius: var(--r);
  font-family: var(--term); font-size: 23px; letter-spacing: 0.02em; line-height: 1;
  box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,0.06);
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--coral); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; border-color: var(--line); }
.btn-primary {
  background: linear-gradient(180deg, #ff8577, var(--coral) 55%, var(--coral-deep));
  border-color: #ffb0a6; color: #1a0a08; font-weight: 700;
  box-shadow: 0 3px 0 #6b1d15, 0 0 24px var(--coral-glow);
}
.btn-primary:hover { border-color: #fff; }
.btn-big { font-size: 28px; padding: 12px 28px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px 0; font-size: 19px; }
.id-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.sound-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 50;
  background: rgba(10, 9, 16, 0.75); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 4px 14px; font-size: 19px; cursor: pointer; color: var(--ink-2); font-family: var(--term);
  backdrop-filter: blur(4px);
}
.sound-toggle:hover { border-color: var(--coral); color: var(--ink); }

/* ── screens ─────────────────────────────── */
.screen { position: absolute; inset: 0; display: none; }
.screen.is-active { display: block; animation: screenIn 0.35s ease-out; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* ── title ───────────────────────────────── */
#scr-title { overflow: hidden; }
.title-art {
  position: absolute; inset: 0;
  background: url('../art/title.webp') center right / cover no-repeat;
  animation: slowPan 30s ease-in-out infinite alternate;
  transform-origin: 70% 50%;
}
.title-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,9,16,0.96) 0%, rgba(10,9,16,0.85) 32%, rgba(10,9,16,0.1) 62%, rgba(10,9,16,0) 100%),
              linear-gradient(0deg, rgba(10,9,16,0.7), transparent 30%);
}
@keyframes slowPan { from { transform: scale(1.04) translateX(0); } to { transform: scale(1.1) translateX(-1.5%); } }
.title-copy {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 6vw; max-width: 640px;
}
.eyebrow { font-family: var(--term); color: var(--amber); font-size: 22px; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 6px; }
.logo {
  font-family: var(--pixel); font-weight: 700; margin: 0;
  font-size: clamp(64px, 11vw, 148px); line-height: 0.86; letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--coral-deep), 8px 8px 0 #3a1410, 0 0 40px var(--coral-glow);
  animation: logoIn 0.9s cubic-bezier(.16,1,.3,1) both;
}
@keyframes logoIn { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.tagline { font-size: 25px; color: var(--ink-2); margin: 22px 0 26px; max-width: 30em; }
.id-form { display: grid; gap: 10px; }
.id-label { font-family: var(--term); font-size: 22px; color: var(--phosphor); }
.id-label::after { content: '_'; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#inp-name {
  flex: 1 1 200px; min-width: 0;
  background: #07060b; border: 2px solid var(--line-2); border-radius: var(--r);
  color: var(--phosphor); font-family: var(--term); font-size: 26px; padding: 6px 12px;
}
#inp-name:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-glow); }
.welcome { font-family: var(--term); font-size: 26px; color: var(--phosphor); margin: 0 0 14px; }

/* ── case files ──────────────────────────── */
#scr-files { overflow-y: auto; }
.files-wrap { max-width: 980px; margin: 0 auto; padding: 56px 20px 40px; }
.files-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.files-head h2 { margin: 0; font-size: 42px; font-weight: 400; }
.files-rank { margin: 0; font-family: var(--term); font-size: 22px; color: var(--amber); flex: 1; }
.files-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.file-card {
  display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center;
  background: linear-gradient(180deg, #2a2233, #1c1824); border: 2px solid var(--line-2);
  border-radius: var(--r); padding: 12px; cursor: pointer; text-align: left; width: 100%;
  position: relative; box-shadow: 0 4px 0 #000;
}
.file-card::before { content: ''; position: absolute; top: -8px; left: 14px; width: 70px; height: 10px; background: #2a2233; border: 2px solid var(--line-2); border-bottom: 0; border-radius: 4px 4px 0 0; }
.file-card:hover:not(:disabled) { border-color: var(--coral); }
.file-card:disabled { cursor: not-allowed; opacity: 0.5; filter: grayscale(0.7); }
.file-card .pc-photo { width: 76px; height: 76px; }
.file-num { font-family: var(--term); color: var(--amber); font-size: 18px; margin: 0; }
.file-title { margin: 0; font-size: 25px; }
.file-stars { margin: 2px 0 0; font-size: 18px; letter-spacing: 2px; color: var(--good); }
.file-stars .off { color: var(--line-2); }

/* ── briefing ────────────────────────────── */
#scr-brief { overflow-y: auto; background: url('../art/title.webp') center / cover; }
#scr-brief::before { content: ''; position: fixed; inset: 0; background: rgba(8, 7, 12, 0.88); }
.brief-wrap { position: relative; max-width: 1040px; margin: 0 auto; padding: 60px 24px; display: grid; grid-template-columns: 280px 1fr; gap: 36px; align-items: start; }
.brief-portrait { width: 100%; border-radius: var(--r); border: 3px solid var(--line-2); box-shadow: var(--shadow), 0 0 0 6px #000; }
.brief-name { margin: 10px 0 0; font-size: 26px; }
.brief-name span { display: block; color: var(--muted); font-size: 20px; }
.brief-case { font-family: var(--term); color: var(--amber); font-size: 22px; margin: 0; letter-spacing: 0.08em; }
.brief-title { font-family: var(--pixel); font-size: clamp(34px, 4vw, 50px); margin: 0 0 14px; line-height: 1; }
.brief-text { font-family: var(--term); font-size: 27px; line-height: 1.25; color: var(--ink); min-height: 7em; }
.brief-text p { margin: 0 0 10px; }
.brief-text p.typing::after { content: '\2588'; color: var(--coral); animation: blink 0.7s steps(1) infinite; margin-left: 2px; }
.patient-card { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 10px; }
.pc-photo { width: 64px; height: 64px; flex: none; border-radius: 4px; background: #000 center / cover no-repeat; image-rendering: pixelated; border: 2px solid var(--line-2); }
.pc-name { margin: 0; font-size: 24px; color: var(--ink); }
.pc-drug, .pc-deadline { margin: 0; font-size: 19px; color: var(--ink-2); }
.pc-deadline { color: var(--coral); font-family: var(--term); font-size: 20px; }
.brief-patient { margin: 18px 0 22px; max-width: 460px; }
.brief-patient .pc-photo { width: 84px; height: 84px; }

/* ── game layout ─────────────────────────── */
#scr-game { overflow: hidden; }
.game-grid {
  height: 100%; max-width: 1500px; margin: 0 auto;
  display: grid; gap: 14px; padding: 52px 18px 16px;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: 'scene side' 'actions actions';
}
.scene {
  grid-area: scene; position: relative; overflow: hidden;
  border-radius: 8px; border: 3px solid #000;
  box-shadow: 0 0 0 2px var(--line-2), var(--shadow), 0 0 60px rgba(255,115,102,0.08);
  background: #000; min-height: 0;
}
.scene-img { position: absolute; inset: 0; background: #000 center / cover no-repeat; image-rendering: pixelated; transition: opacity 0.5s, filter 0.4s; }
.scene-img.dim { filter: brightness(0.45) saturate(0.8); }
.scene-img.enter { animation: sceneIn 1.2s ease-out; }
@keyframes sceneIn { from { transform: scale(1.08); filter: brightness(0.3); } to { transform: scale(1); filter: none; } }
.scene-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; }
.scene-plaque {
  position: absolute; left: 14px; top: 14px; margin: 0;
  background: rgba(8, 7, 12, 0.82); border: 2px solid rgba(255, 115, 102, 0.55);
  padding: 4px 12px; font-size: 24px; border-radius: 4px; line-height: 1.05;
}
.scene-plaque small { display: block; font-weight: 400; font-family: var(--term); font-size: 18px; color: var(--amber); letter-spacing: 0.06em; }

/* witness picker */
.witnesses {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px;
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  background: linear-gradient(0deg, rgba(8,7,12,0.95) 30%, rgba(8,7,12,0));
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.witness {
  width: 150px; cursor: pointer; text-align: center; padding: 8px;
  background: var(--panel); border: 2px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 4px 0 #000; transition: transform 0.12s, border-color 0.15s;
}
.witness:hover { transform: translateY(-4px); border-color: var(--coral); }
.witness .w-photo { width: 100%; aspect-ratio: 1; border-radius: 4px; background: #000 center / cover; image-rendering: pixelated; }
.witness .w-name { margin: 6px 0 0; font-size: 20px; line-height: 1; color: var(--ink); }
.witness .w-cost { margin: 2px 0 0; font-family: var(--term); font-size: 17px; color: var(--amber); }
.witness.heard { border-color: var(--line); }
.witness.heard .w-photo { filter: saturate(0.5) brightness(0.7); }
.witness.heard .w-cost { color: var(--muted); }
.witness-empty { font-family: var(--term); font-size: 24px; color: var(--ink-2); background: rgba(8,7,12,0.85); padding: 12px 16px; border-radius: var(--r); margin: 0; }

/* conversation */
.talk { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 0; padding: 16px; }
.talk-portrait {
  width: min(38%, 300px); aspect-ratio: 1; flex: none; align-self: flex-end;
  background: #000 center / cover; image-rendering: pixelated;
  border: 3px solid #000; border-radius: 6px; box-shadow: 0 0 0 2px var(--line-2), var(--shadow);
  animation: portraitIn 0.35s cubic-bezier(.16,1,.3,1);
  position: relative; z-index: 2; margin-bottom: 8px;
}
@keyframes portraitIn { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.talk-box {
  flex: 1; margin-left: -10px; padding: 14px 18px 14px 26px; min-height: 42%;
  background: rgba(10, 9, 16, 0.94); border: 2px solid var(--line-2); border-radius: 8px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.talk-who { margin: 0 0 6px; color: var(--coral); font-size: 22px; }
.talk-who span { color: var(--muted); margin-left: 8px; }
.talk-text { margin: 0; font-family: var(--term); font-size: 27px; line-height: 1.2; flex: 1; }
.talk-text.typing::after { content: '\2588'; color: var(--coral); animation: blink 0.7s steps(1) infinite; margin-left: 2px; }
.talk-next { align-self: flex-end; margin-top: 10px; background: none; border: 2px solid var(--line-2); border-radius: var(--r); padding: 4px 18px; cursor: pointer; font-family: var(--term); font-size: 22px; }
.talk-next:hover { border-color: var(--coral); }
.talk.dead .talk-box { border-color: var(--coral-deep); }

/* side panel */
.side { grid-area: side; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.clock-card { background: linear-gradient(180deg, #1b1724, #121019); border: 2px solid var(--line-2); border-radius: 8px; padding: 12px 14px; box-shadow: var(--shadow); }
.clock { margin: 0; font-family: var(--term); font-size: 44px; line-height: 1; color: var(--phosphor); text-shadow: 0 0 14px rgba(255, 195, 107, 0.45); }
.clock.bump { animation: clockBump 0.6s; }
@keyframes clockBump { 30% { color: #fff; transform: scale(1.05); } }
.due { margin: 4px 0 8px; font-size: 19px; color: var(--ink-2); }
.due b { color: var(--coral); }
.hours { display: flex; gap: 3px; flex-wrap: wrap; }
.hours i { width: 12px; height: 16px; background: var(--amber); border-radius: 2px; box-shadow: inset 0 -3px 0 var(--amber-dim); transition: background 0.4s; }
.hours i.spent { background: #2a2433; box-shadow: none; }
.hours i.warn { background: var(--coral); box-shadow: inset 0 -3px 0 var(--coral-deep); }
.hours-label { margin: 6px 0 0; font-family: var(--term); font-size: 19px; color: var(--ink-2); }
.side-patient .pc-photo { width: 56px; height: 56px; }
.coach {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start;
  background: #2a1714; border: 2px solid var(--coral); border-radius: 8px; padding: 10px;
  box-shadow: 0 0 24px var(--coral-glow); animation: slideUp 0.3s;
}
.coach img { width: 52px; height: 52px; border-radius: 4px; }
.coach p { margin: 0; font-size: 21px; line-height: 1.15; }
.coach p b { color: var(--coral); }
.feed { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.feed-item { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 19px; line-height: 1.12; animation: slideUp 0.3s; }
.feed-item .fi-who { color: var(--amber); }
.feed-item.sys { color: var(--muted); font-family: var(--term); font-size: 19px; background: transparent; border-style: dashed; }
.feed-item.bad { border-color: var(--coral-deep); color: var(--ink); }

/* action bar */
.actions { grid-area: actions; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.act {
  position: relative; cursor: pointer; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left;
  background: linear-gradient(180deg, #221d2c, #16131d); border: 2px solid var(--line-2); border-radius: 8px;
  padding: 10px 14px; box-shadow: 0 4px 0 #000;
  transition: transform 0.08s, border-color 0.15s;
}
.act:hover:not(:disabled) { border-color: var(--coral); }
.act:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.act:disabled { opacity: 0.4; cursor: not-allowed; }
.act .ico { grid-row: span 2; width: 44px; height: 44px; }
.act-label { font-size: 25px; line-height: 1; color: var(--ink); }
.act-cost { font-size: 19px; color: var(--amber); line-height: 1; }

.coach-target { position: relative; z-index: 5; animation: coachPulse 1.3s ease-in-out infinite; border-color: var(--coral) !important; }
@keyframes coachPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--coral-glow), 0 4px 0 #000; } 50% { box-shadow: 0 0 0 8px rgba(255,115,102,0.25), 0 0 30px var(--coral-glow), 0 4px 0 #000; } }

/* pixel icons (inline SVG data) */
.ico { background: center / contain no-repeat; image-rendering: pixelated; }
.ico-ask { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffb347' d='M3 1h4v1H3zM2 2h1v1H2zM7 2h1v1H7zM1 3h1v3H1zM8 3h1v3H8zM2 6h1v1H2zM7 6h1v1H7zM3 7h4v1H3zM8 7h1v1H8zM9 8h1v1H9zM10 9h1v2h-1zM9 10h1v1H9z'/%3E%3Cpath fill='%23ff7366' d='M3 3h1v1H3zM3 4h1v1H3z'/%3E%3C/svg%3E"); }
.ico-call { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffb347' d='M1 2h3v1H1zM1 3h2v3H1zM2 6h2v1H2zM3 7h2v1H3zM4 8h2v1H4zM6 9h2v1H6zM8 9h3v1H8zM9 8h2v1H9zM4 3h1v1H4zM8 7h1v1H8z'/%3E%3Cpath fill='%23ff7366' d='M7 1h1v1H7zM8 2h1v1H8zM9 3h1v2H9zM7 3h1v1H7zM8 4h1v1H8z'/%3E%3C/svg%3E"); }
.ico-finder { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffb347' d='M1 1h10v1H1zM1 2h1v6H1zM10 2h1v6h-1zM1 8h10v1H1zM4 9h4v1H4zM2 10h8v1H2z'/%3E%3Cpath fill='%23ff7366' d='M3 3h2v1H3zM3 5h4v1H3zM6 3h3v1H6z'/%3E%3C/svg%3E"); }
.ico-notes { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffb347' d='M2 1h7v1H2zM2 2h1v9H2zM9 2h1v9H9zM3 10h6v1H3z'/%3E%3Cpath fill='%23ff7366' d='M4 3h4v1H4zM4 5h4v1H4zM4 7h3v1H4z'/%3E%3C/svg%3E"); }

/* ── overlays ────────────────────────────── */
.overlay { position: absolute; inset: 0; z-index: 20; background: rgba(5, 4, 8, 0.8); display: flex; align-items: center; justify-content: center; padding: 50px 18px 18px; animation: screenIn 0.25s; }
.ov-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.ov-head h2 { margin: 0; font-size: 38px; font-weight: 400; }
.ov-head p { margin: 0; color: var(--ink-2); flex: 1; min-width: 220px; }

/* call board */
.board-inner { width: min(1200px, 100%); height: 100%; display: flex; flex-direction: column; }
.board-cork {
  position: relative; flex: 1; min-height: 0; border-radius: 10px; overflow: hidden;
  background: #1b1310 url('../art/corkboard.webp') center / cover; border: 3px solid #000; box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(160px, 0.8fr) 3fr; align-items: center; gap: 20px; padding: 24px;
}
.board-string { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.board-string path { fill: none; stroke: #e0392e; stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 2px 1px rgba(0,0,0,0.6)); }
.board-options { display: grid; grid-template-columns: repeat(2, minmax(0, 250px)); gap: 26px 34px; align-content: center; justify-content: center; }
.polaroid {
  position: relative; background: #efe7d8; padding: 8px 8px 10px; border-radius: 2px; color: #1a1410;
  box-shadow: 0 10px 22px rgba(0,0,0,0.6); transform: rotate(var(--rot, -2deg));
  transition: transform 0.15s, box-shadow 0.15s; text-align: center;
}
.polaroid::before { content: ''; position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff9a8f, var(--coral-deep) 60%, #6b1d15); box-shadow: 0 2px 2px rgba(0,0,0,0.5); z-index: 2; }
.polaroid .pol-img { aspect-ratio: 4 / 3; background: #000 center / cover; image-rendering: pixelated; }
.polaroid .pol-label { margin: 7px 0 0; font-size: 23px; line-height: 1; }
.polaroid .pol-sub { margin: 2px 0 0; font-size: 18px; color: #6d5d52; }
button.polaroid { cursor: pointer; border: 0; font: inherit; }
button.polaroid:hover { transform: rotate(0deg) scale(1.04); box-shadow: 0 16px 30px rgba(0,0,0,0.7), 0 0 0 3px var(--coral); z-index: 4; }
.polaroid.here { --rot: 2deg; width: 100%; max-width: 230px; justify-self: center; }
.polaroid.here .pol-sub { color: var(--coral-deep); }
.polaroid.dim { opacity: 0.35; filter: grayscale(1); }
.polaroid.chosen { box-shadow: 0 0 0 4px var(--coral), 0 16px 30px rgba(0,0,0,0.7); transform: rotate(0) scale(1.06); z-index: 4; }
.board-calling { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; background: rgba(8,7,12,0.9); border: 2px solid var(--coral); border-radius: 999px; padding: 8px 20px; font-family: var(--term); font-size: 24px; color: var(--phosphor); }

/* finder CRT */
.crt {
  width: min(1180px, 100%); height: 100%; display: flex; flex-direction: column; min-height: 0;
  background: radial-gradient(ellipse at center, #1a1206 0%, #0c0904 70%, #050302 100%);
  border: 10px solid #2a2520; border-radius: 18px; box-shadow: inset 0 0 80px rgba(0,0,0,0.9), 0 0 0 3px #000, var(--shadow);
  color: var(--phosphor); font-family: var(--term); position: relative; overflow: hidden; padding: 16px 20px;
}
.crt::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,0.25) 0 1px, transparent 1px 3px); }
.crt-head { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; border-bottom: 2px dashed rgba(255,195,107,0.3); padding-bottom: 10px; }
.crt-head h2 { margin: 0; font-size: 38px; letter-spacing: 0.12em; text-shadow: 0 0 12px rgba(255,195,107,0.5); font-weight: 400; }
.crt-head p { margin: 0; font-size: 21px; color: #d8a55a; flex: 1; min-width: 240px; }
.crt-head .btn { color: var(--ink); }
.crt-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; padding: 14px 2px; }
.trait { margin-bottom: 14px; }
.trait-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.trait-name { font-size: 26px; letter-spacing: 0.06em; text-transform: uppercase; }
.trait-help { font-size: 19px; color: #b88a4d; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  cursor: pointer; font-family: var(--term); font-size: 22px; line-height: 1;
  background: transparent; color: var(--phosphor); border: 2px solid rgba(255,195,107,0.45); border-radius: 4px; padding: 7px 12px;
  transition: background 0.12s;
}
.chip:hover { background: rgba(255,195,107,0.1); }
.chip.on { background: var(--phosphor); color: #1a0f02; border-color: var(--phosphor); box-shadow: 0 0 14px rgba(255,195,107,0.5); }
.chip-hint { font-size: 18px; color: #c9954f; margin: 6px 0 0; min-height: 1.2em; }
.income-chart { margin: 8px 0 0; font-size: 19px; color: #d8a55a; border: 1px dashed rgba(255,195,107,0.35); padding: 6px 10px; border-radius: 4px; }
.income-chart b { color: var(--phosphor); font-weight: 400; }

.prog-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.prog {
  position: relative; cursor: pointer; text-align: left; font-family: var(--term);
  background: rgba(255,195,107,0.05); border: 2px solid rgba(255,195,107,0.4); border-radius: 6px; padding: 8px; color: var(--phosphor);
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; overflow: hidden; padding-right: 130px; min-height: 68px;
  transition: opacity 0.3s, border-color 0.2s;
}
.prog:hover { border-color: var(--phosphor); }
.prog img { width: 52px; height: 52px; border-radius: 4px; }
.prog-name { font-size: 28px; line-height: 1; }
.prog-sub { font-size: 18px; color: #c9954f; line-height: 1.05; }
.prog.out { opacity: 0.4; }
.prog.out img { filter: grayscale(1); }
.prog .stamp {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%) rotate(-8deg);
  font-family: var(--term); font-size: 19px; color: var(--bad); border: 3px solid var(--bad); border-radius: 4px; padding: 1px 6px;
  background: rgba(20, 5, 3, 0.8); letter-spacing: 0.05em;
}
.prog .stamp.new { animation: stampIn 0.35s cubic-bezier(.16,1,.3,1); }
@keyframes stampIn { from { transform: translateY(-50%) rotate(-8deg) scale(2.2); opacity: 0; } to { transform: translateY(-50%) rotate(-8deg) scale(1); opacity: 1; } }
.prog.lone { border-color: var(--coral); box-shadow: 0 0 24px var(--coral-glow); background: rgba(255,115,102,0.12); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 40px rgba(255,115,102,0.55); } }
.prog.selected { outline: 2px dashed var(--phosphor); outline-offset: 2px; }

.dossier { margin-top: 12px; border: 2px solid rgba(255,195,107,0.4); border-radius: 6px; padding: 10px 12px; font-size: 20px; line-height: 1.15; background: rgba(0,0,0,0.3); }
.dossier h4 { margin: 0 0 4px; font-size: 26px; font-weight: 400; color: #fff3dc; }
.dossier p { margin: 0 0 6px; }
.dossier ul { margin: 0 0 6px; padding-left: 18px; }
.dossier .d-label { color: #c9954f; }
.dossier .d-no li::marker { content: '\2717  '; color: var(--bad); }
.dossier .d-yes li::marker { content: '\2713  '; color: var(--phosphor); }

.crt-foot { display: flex; gap: 16px; align-items: center; justify-content: space-between; border-top: 2px dashed rgba(255,195,107,0.3); padding-top: 10px; flex-wrap: wrap; }
.crt-foot p { margin: 0; font-size: 24px; flex: 1; min-width: 220px; }
.crt-foot p.ready { color: #fff; text-shadow: 0 0 12px var(--coral); }
.crt-foot p.none { color: var(--bad); }

/* notes */
.notes-inner { width: min(900px, 100%); height: 100%; display: flex; flex-direction: column; background: #efe7d8; color: #211a14; border-radius: 6px; padding: 18px 22px; box-shadow: var(--shadow); background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(80, 120, 170, 0.25) 31px 32px); }
.notes-inner .ov-head p { color: #5d4f45; }
.notes-inner .btn { color: var(--ink); }
.notes-list { flex: 1; overflow-y: auto; margin: 0; padding: 0 0 0 26px; font-family: var(--term); font-size: 23px; line-height: 1.2; }
.notes-list li { margin-bottom: 12px; }
.notes-list .n-who { color: #a8352a; }
.notes-list .n-where { color: #7a6a5e; font-size: 19px; }
.notes-empty { font-family: var(--term); font-size: 23px; color: #7a6a5e; }

/* confirm */
.confirm-box { width: min(480px, 100%); background: var(--panel); border: 2px solid var(--coral); border-radius: 10px; padding: 22px; text-align: center; box-shadow: var(--shadow), 0 0 40px var(--coral-glow); }
.confirm-icon { width: 96px; height: 96px; margin: 0 auto 10px; background: center / contain no-repeat; image-rendering: pixelated; }
.confirm-box p { font-size: 24px; margin: 0 0 18px; }
.confirm-box .id-row { justify-content: center; }

/* ── result ──────────────────────────────── */
#scr-result { overflow-y: auto; }
.result-wrap { max-width: 1200px; margin: 0 auto; padding: 56px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 30px; align-items: start; }
.result-art { position: sticky; top: 56px; aspect-ratio: 16 / 9; border-radius: 10px; border: 3px solid #000; box-shadow: 0 0 0 2px var(--line-2), var(--shadow); background: #000 center / cover; image-rendering: pixelated; }
.result-kicker { margin: 0; font-family: var(--term); font-size: 22px; color: var(--amber); letter-spacing: 0.08em; }
.result-body h2 { font-family: var(--pixel); font-size: clamp(34px, 4vw, 52px); line-height: 1; margin: 4px 0 12px; }
.result-body h2.good { color: var(--ink); text-shadow: 3px 3px 0 var(--coral-deep); }
.result-body h2.bad { color: var(--bad); }
.result-text { font-size: 23px; color: var(--ink-2); margin: 0 0 14px; }
.stars { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.star { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 6px; font-size: 20px; }
.star i { font-style: normal; font-size: 22px; color: var(--line-2); }
.star.on { border-color: var(--good); }
.star.on i { color: var(--good); animation: starPop 0.5s cubic-bezier(.16,1,.3,1) both; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.promo { background: linear-gradient(90deg, #3a1a14, #1f1b29); border: 2px solid var(--coral); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 21px; animation: slideUp 0.4s; }
.promo b { color: var(--coral); font-size: 27px; display: block; font-weight: 400; }
.debrief-h { margin: 6px 0 10px; font-size: 28px; font-weight: 400; color: var(--amber); }
.debrief { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.debrief li { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.debrief li.ok { border-color: rgba(255, 210, 122, 0.5); }
.debrief li.miss { border-color: var(--bad); background: #221214; }
.debrief li.skip { border-color: var(--line); }
.db-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 23px; color: var(--ink); }
.db-you { font-size: 19px; color: var(--muted); }
.db-you.miss { color: var(--bad); }
.db-quote { margin: 6px 0 0; font-family: var(--term); font-size: 21px; line-height: 1.15; color: var(--ink-2); }
.db-quote b { color: var(--amber); font-weight: 400; }
.db-rule { margin: 6px 0 0; font-size: 19px; color: var(--muted); }
.lesson { background: #2a1714; border: 2px solid var(--coral); border-radius: 8px; padding: 12px 14px; font-size: 22px; line-height: 1.15; }
.lesson b { color: var(--coral); }
.result-btns { margin-top: 16px; }

/* floating time cost */
.float-cost { position: absolute; z-index: 30; pointer-events: none; font-family: var(--term); font-size: 30px; color: var(--coral); text-shadow: 0 2px 0 #000; animation: floatUp 1.2s ease-out forwards; }
@keyframes floatUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-50px); opacity: 0; } }

/* ── responsive ──────────────────────────── */
@media (max-width: 1100px) {
  .talk-text { font-size: 24px; }
  .act { grid-template-columns: 36px 1fr; padding: 8px 10px; }
  .act .ico { width: 36px; height: 36px; }
  .act-label { font-size: 16px; }
}
@media (max-width: 860px) {
  body { font-size: 20px; overflow: auto; }
  .app { height: auto; min-height: 100svh; }
  .screen.is-active { position: relative; min-height: 100svh; }
  #scr-game { overflow: visible; }
  .game-grid { height: auto; grid-template-columns: 1fr; grid-template-rows: auto auto auto; grid-template-areas: 'scene' 'side' 'actions'; padding: 48px 12px 110px; gap: 10px; }
  .scene { aspect-ratio: 4 / 3.7; }
  .side { display: grid; grid-template-columns: 1fr 1fr; }
  .clock-card { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
  .clock { font-size: 34px; }
  .due { margin: 0; }
  .hours, .hours-label { grid-column: 1 / -1; }
  .side-patient, .coach { grid-column: 1 / -1; }
  .feed { grid-column: 1 / -1; max-height: 180px; }
  .actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(10,9,16,0.96); border-top: 2px solid var(--line-2); }
  .act { grid-template-columns: 1fr; grid-template-rows: auto auto auto; justify-items: center; text-align: center; padding: 6px 4px; row-gap: 2px; }
  .act .ico { grid-row: auto; width: 30px; height: 30px; }
  .act-label { font-size: 17px; line-height: 1; }
  .act-cost { font-size: 15px; }
  .talk { align-items: flex-end; padding: 8px; }
  .talk-portrait { width: 78px; margin-bottom: 4px; }
  .talk-box { margin-left: -6px; padding: 10px 10px 8px 16px; min-height: 0; max-height: 100%; overflow-y: auto; }
  .talk-text { font-size: 21px; }
  .scene-plaque { font-size: 19px; top: 8px; left: 8px; }
  .witnesses { padding: 10px; gap: 8px; }
  .witness { width: calc(33% - 6px); padding: 5px; }
  .witness .w-name { font-size: 16px; }
  .witness .w-cost { font-size: 15px; }
  .overlay { position: fixed; padding: 46px 8px 8px; align-items: stretch; }
  .board-cork { grid-template-columns: 1fr; padding: 16px; overflow-y: auto; align-content: start; }
  .polaroid.here { max-width: 200px; margin: 0 auto; }
  .board-options { gap: 14px; }
  .crt { border-width: 6px; padding: 10px 12px; }
  .crt-body { grid-template-columns: 1fr; }
  .crt-head h2 { font-size: 30px; }
  .brief-wrap { grid-template-columns: 1fr; padding: 50px 16px 30px; gap: 16px; }
  .brief-lead { display: flex; align-items: center; gap: 12px; }
  .brief-portrait { width: 96px; }
  .brief-text { font-size: 23px; min-height: 0; }
  .result-wrap { grid-template-columns: 1fr; padding: 50px 14px 30px; }
  .result-art { position: relative; top: 0; }
  .title-copy { padding: 70px 22px 40px; justify-content: flex-end; min-height: 100svh; }
  .title-art { background-position: 70% center; }
  .title-art::after { background: linear-gradient(0deg, rgba(10,9,16,0.97) 30%, rgba(10,9,16,0.6) 65%, rgba(10,9,16,0.2)); }
  .tagline { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* coach moved into overlays */
.coach { color: var(--ink); }
.crt-foot .coach, .ov-head .coach { flex-basis: 100%; order: -1; }
.crt-foot .coach p { font-size: 21px; }

/* walkable scenes */
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; image-rendering: pixelated; touch-action: manipulation; }
.scene.stage-on .scene-img { display: none; }
.scene .scene-scan { z-index: 1; }
.scene .scene-plaque, .scene .talk, .scene .witnesses { z-index: 3; }
.scene.stage-on .talk { pointer-events: none; }
.scene.stage-on .talk-box, .scene.stage-on .talk-portrait { pointer-events: auto; }
.scene.stage-on .talk-box { min-height: 0; }
.scene.stage-on .talk-portrait { width: min(22%, 170px); }
@media (min-width: 861px) {
  #scr-game.stage-mode .game-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); }
  #scr-game.stage-mode .clock { font-size: 38px; }
}

/* walkable rooms: the person is on screen, so dialogue is a caption, no portrait */
.scene.stage-on .talk { justify-content: center; padding: 12px 18px; }
.scene.stage-on .talk-portrait { display: none; }
.scene.stage-on .talk-box { margin-left: 0; width: 100%; max-width: 1000px; padding: 10px 18px 10px; background: rgba(10, 9, 16, 0.88); }
.scene.stage-on .talk-text { font-size: 26px; }
@media (max-width: 860px) {
  /* phones: a taller room so people are big enough to see and tap; Bev's tip right under it */
  #scr-game.stage-mode .scene { aspect-ratio: auto; height: clamp(300px, 58svh, 560px); }
  #scr-game.stage-mode .coach { order: -1; }
  .scene.stage-on .talk { padding: 8px; }
  .scene.stage-on .talk-box { padding: 8px 12px; }
  .scene.stage-on .talk-text { font-size: 21px; }
}
@media (max-width: 860px) and (orientation: landscape) and (max-height: 520px) {
  /* phone on its side: the room fills the screen above the button bar */
  #scr-game.stage-mode .scene { height: calc(100svh - 112px); min-height: 200px; }
  .game-grid { padding-top: 40px; }
  .actions { padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); }
  .act { grid-template-columns: 26px auto; grid-template-rows: auto auto; justify-content: center; column-gap: 6px; text-align: left; padding: 4px 6px; }
  .act .ico { grid-row: 1 / 3; width: 26px; height: 26px; }
  .act-label { font-size: 16px; }
  .act-cost { font-size: 14px; }
  .scene.stage-on .talk-box { padding: 6px 12px; }
  .scene.stage-on .talk-who { font-size: 17px; margin-bottom: 2px; }
  .scene.stage-on .talk-text { font-size: 18px; line-height: 1.1; }
  .scene.stage-on .talk-next { margin-top: 4px; padding: 2px 14px; font-size: 18px; }
}
.finder-note { color: var(--muted); }
