:root {
  --bg: #04060b;
  --ink: #e9eef5;
  --muted: #8f9bb0;
  --faint: #5a6880;
  --amber: #ffb547;
  --ember: #ff8a3d;
  --hot: #fff3dc;
  --ok: #9fe3b0;
  --glass: rgba(8, 12, 20, 0.66);
  --panel: linear-gradient(180deg, rgba(9, 13, 22, 0.86), rgba(5, 8, 14, 0.92));
  --hair: rgba(255, 255, 255, 0.08);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --pad: 28px;
  --gap: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--ui); }
html { overflow: hidden; }
body { overflow-x: hidden; overflow-y: auto; }
/* Below this size the page scrolls instead of crushing the panels. */
@media (max-height: 639px), (max-width: 1023px) { html { overflow: auto; } }
body { background: radial-gradient(ellipse at 30% 60%, #0c1625 0%, var(--bg) 62%); }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }

/* ---------- atmosphere ---------- */
.grain {
  position: fixed; inset: -50%; pointer-events: none; z-index: 40; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at 50% 46%, transparent 55%, rgba(0, 0, 0, 0.7) 100%); }
.letterbox { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 30; transition: height 1.1s var(--ease); }
.letterbox.top { top: 0; } .letterbox.bottom { bottom: 0; }
body[data-phase="directing"] .letterbox { height: 10px; }

/* ---------- frame ---------- */
.app {
  position: relative; z-index: 5; width: 100vw; height: 100vh; height: 100dvh; min-width: 1024px; min-height: 640px;
  display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
  gap: 14px; padding: 20px var(--pad) 22px;
}

/* ---------- masthead ---------- */
.masthead { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; gap: 16px; align-items: center; cursor: pointer; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255, 181, 71, 0.6); position: relative; display: grid; place-items: center; box-shadow: 0 0 28px rgba(255, 181, 71, 0.2); }
.brand-mark i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }
.brand-mark i:nth-child(1) { transform: translate(-8px, 5px); }
.brand-mark i:nth-child(2) { transform: translate(0, -6px); background: var(--hot); box-shadow: 0 0 10px var(--amber); }
.brand-mark i:nth-child(3) { transform: translate(8px, 4px); }
.brand-name { font: 400 27px/1 var(--display); letter-spacing: 0.01em; }
.brand-sub { margin-top: 6px; font: italic 300 17px/1.2 var(--display); color: #d8c6a2; letter-spacing: 0.01em; }
.credits { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }

/* ---------- query bar ---------- */
.querybar {
  width: 100%; height: 72px; display: flex; align-items: center; gap: 18px; padding: 0 10px 0 28px;
  background: var(--glass); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--hair); border-radius: 999px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.4s, box-shadow 0.4s;
}
.querybar:focus-within { border-color: rgba(255, 181, 71, 0.45); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(255, 181, 71, 0.07); }
.q-kicker { font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--amber); white-space: nowrap; padding-right: 18px; border-right: 1px solid var(--hair); }
.querybar input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--ink); font: 300 22px var(--ui); letter-spacing: 0.005em; }
.querybar input::placeholder { color: #66748a; }
.querybar button {
  height: 54px; padding: 0 26px 0 28px; border: 0; border-radius: 999px; cursor: pointer; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #ffc867, var(--ember)); color: #1d1004; font-weight: 600; font-size: 17.5px; letter-spacing: 0.02em;
  box-shadow: 0 8px 30px rgba(255, 138, 61, 0.35); transition: transform 0.25s var(--ease), box-shadow 0.25s, opacity 0.3s;
}
.querybar button svg { width: 21px; height: 21px; }
.querybar button:hover { transform: translateX(2px); box-shadow: 0 10px 40px rgba(255, 138, 61, 0.55); }
.querybar button:disabled { opacity: 0.45; cursor: progress; transform: none; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; transition: opacity 0.5s; }
.chips button {
  border: 1px solid var(--hair); background: rgba(8, 12, 20, 0.5); border-radius: 999px; padding: 9px 18px;
  font: 14px var(--mono); color: #a6b1c3; cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s, opacity 0.3s;
}
.chips button:hover { color: var(--hot); border-color: rgba(255, 181, 71, 0.4); background: rgba(255, 181, 71, 0.06); }
body[data-phase="directing"] .chips { opacity: 0.35; pointer-events: none; }

/* ---------- stage ---------- */
.stage { display: grid; grid-template-columns: minmax(0, 40fr) minmax(0, 60fr); gap: var(--gap); min-height: 0; }
.right { display: grid; grid-template-rows: minmax(0, 63fr) minmax(0, 37fr); gap: var(--gap); min-height: 0; }
.panel {
  position: relative; min-height: 0; overflow: hidden; border-radius: 16px; background: var(--panel);
  border: 1px solid var(--hair); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: flex; flex-direction: column;
}
.panel-label {
  position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px 12px; font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.panel-label > span:last-child:not(:first-child) { color: var(--amber); letter-spacing: 0.14em; }

/* ---------- city map ---------- */
.map-panel { background: #04070d; }
.map-panel .panel-label { position: absolute; left: 0; right: 0; top: 0; background: linear-gradient(180deg, rgba(4, 7, 13, 0.9), transparent); }
.city-frame { position: absolute; inset: 0; overflow: hidden; }
.city-frame::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, transparent 52%, rgba(0, 0, 0, 0.6) 100%); }
.city { width: 100%; height: 100%; display: block; }

.gl { stroke: #101d2b; stroke-width: 0.6; opacity: 0.6; }
.gl.major { stroke: #162839; stroke-width: 0.9; }
.arterial { stroke: #1c3146; stroke-width: 1.7; opacity: 0.75; }
.river { fill: none; stroke: #16324c; stroke-width: 2.6; opacity: 0.6; stroke-linecap: round; }
.shore { fill: none; stroke: #2f7099; stroke-width: 1.4; opacity: 0.75; filter: url(#glow); }
.lake-lines path { fill: none; stroke: #10304a; stroke-width: 0.9; stroke-dasharray: 2 16; animation: lake 14s linear infinite; }
@keyframes lake { to { stroke-dashoffset: -180; } }
.island { fill: #0b1826; stroke: #2a5b80; stroke-width: 0.8; }
.lake-label { fill: #24435f; font: 500 15px var(--mono); letter-spacing: 16px; }
.compass line, .compass path { stroke: #3e5d79; fill: #3e5d79; stroke-width: 1; }
.compass text { fill: #3e5d79; font: 11px var(--mono); letter-spacing: 2px; }

.route-line { fill: none; stroke: var(--tint); stroke-width: 1.8; opacity: 0.24; stroke-linejoin: round; stroke-linecap: round; transition: opacity 0.8s; }
.route-flow { fill: none; stroke: var(--tint); stroke-width: 1.8; opacity: 0.5; stroke-dasharray: 2 24; animation: flow 7s linear infinite; transition: opacity 0.8s; }
@keyframes flow { to { stroke-dashoffset: -260; } }
.traffic { fill: var(--tint); filter: url(#glow); opacity: 0.9; }
.drive-tag circle { fill: var(--bg); stroke: var(--tint); stroke-width: 1.5; opacity: 0.95; }
.drive-tag text {
  fill: var(--tint); font: 600 16px var(--mono); letter-spacing: 2.4px; opacity: 0.92;
  paint-order: stroke; stroke: var(--bg); stroke-width: 6px; stroke-linejoin: round;
}

.node {
  fill: var(--tint); opacity: 0.5; cursor: pointer; transform-box: fill-box; transform-origin: center;
  transition: transform 0.6s var(--ease), opacity 0.6s, fill 0.6s;
}
.node:hover, .node.focus { opacity: 1; transform: scale(2.2); }
.node.cand { fill: var(--amber); opacity: var(--s, 0.7); transform: scale(1.5); filter: url(#glow); }
.node.pool { fill: #ffd894; opacity: 1; transform: scale(2); filter: url(#glow); animation: arrive 0.9s var(--ease); }
@keyframes arrive { 0% { transform: scale(3.4); fill: #fff; } 100% { transform: scale(2); } }
.city.has-cut .node.dim { opacity: 0.1; }
.city.has-cut .node.cand.dim, .city.has-cut .node.pool.dim { opacity: 0.25; }
.node.chosen { fill: var(--hot); opacity: 1; transform: scale(2.2); filter: url(#bloom); }
.city.has-cut .route-line { opacity: 0.12; }
.city.has-cut .route-flow { opacity: 0.18; }
.city.scanning .node { animation: flicker 1.4s infinite; }
.city.scanning .node:nth-child(3n) { animation-delay: 0.35s; }
.city.scanning .node:nth-child(5n) { animation-delay: 0.7s; }
.city.scanning .node:nth-child(7n) { animation-delay: 1.05s; }
@keyframes flicker { 0%, 100% { opacity: 0.35; } 45% { opacity: 1; fill: #ffe0a6; } }

.thread-glow { fill: none; stroke: var(--amber); stroke-width: 8; opacity: 0.12; filter: url(#glow); }
.thread-line { fill: none; stroke: #ffd48a; stroke-width: 1.8; opacity: 0.95; transition: stroke-dashoffset 2.6s var(--ease); }
.mark { opacity: 0; animation: markIn 0.7s var(--ease) forwards; transition: opacity 0.5s; transform-box: fill-box; }
.mark-halo { fill: var(--amber); opacity: 0.14; transform-box: fill-box; transform-origin: center; }
.mark-ring { fill: none; stroke: #ffe3ad; stroke-width: 1.6; }
.mark-core { fill: #fff; }
.mark text {
  fill: #ffe3ad; font: 600 19px var(--mono); letter-spacing: 1px;
  paint-order: stroke; stroke: var(--bg); stroke-width: 6px; stroke-linejoin: round;
}
@keyframes markIn { from { opacity: 0; transform: scale(2.4); } to { opacity: 1; } }
.city.is-playing .mark { opacity: 0.32; animation: none; }
.city.is-playing .mark.now, .mark.focus { opacity: 1; }
.mark.now .mark-halo, .mark.focus .mark-halo { animation: halo 1.3s ease-out infinite; opacity: 0.35; }
.mark.now .mark-ring { stroke: var(--amber); stroke-width: 2.4; }
.mark.now text { fill: #fff; }
@keyframes halo { from { transform: scale(0.6); opacity: 0.6; } to { transform: scale(3.4); opacity: 0; } }

.sweep {
  position: absolute; left: 50%; top: 50%; width: 1800px; height: 1800px; margin: -900px 0 0 -900px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg 292deg, rgba(255, 181, 71, 0.05) 330deg, rgba(255, 214, 150, 0.16) 358deg, transparent 360deg);
  -webkit-mask-image: radial-gradient(circle, transparent 2%, #000 8%, #000 22%, transparent 34%);
  mask-image: radial-gradient(circle, transparent 2%, #000 8%, #000 22%, transparent 34%);
  mix-blend-mode: screen; opacity: 0; pointer-events: none; transition: opacity 0.8s;
  animation: spin 3.4s linear infinite paused;
}
body[data-stage="search"] .sweep { opacity: 1; animation-play-state: running; }
.map-pulse {
  position: absolute; z-index: 2; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--amber); box-shadow: 0 0 18px rgba(255, 181, 71, 0.6); opacity: 0; will-change: transform, opacity;
}
.map-pulse.on { animation: mapPulse 1.3s ease-out infinite; }
@keyframes mapPulse { from { transform: scale(0.5); opacity: 0.9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.legend {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 34px 20px 16px;
  background: linear-gradient(0deg, rgba(4, 7, 13, 0.94) 30%, transparent);
  font-size: 13px; color: var(--muted); display: grid; gap: 7px; pointer-events: none;
}
.legend-row { display: flex; align-items: center; gap: 12px; letter-spacing: 0.03em; }
.legend-note { margin-top: 3px; color: var(--faint); line-height: 1.45; }
.lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.lg.node { background: #8fb4ff; opacity: 0.6; }
.lg.cand { background: var(--amber); box-shadow: 0 0 9px var(--amber); }
.lg.chosen { background: var(--hot); box-shadow: 0 0 0 3px rgba(255, 227, 173, 0.25), 0 0 12px var(--amber); }

/* ---------- evidence panel ---------- */
.welcome, .searches, .grid, .player { display: none; }
body[data-phase="idle"] .welcome { display: flex; }
body[data-phase="directing"] .searches, body[data-phase="directing"] .grid { display: flex; }
body[data-phase="directing"] .grid { display: grid; }
.welcome { flex: 1; min-height: 0; flex-direction: column; padding: 4px 28px 22px; animation: rise 0.7s var(--ease) both; }
.welcome-title { margin: 6px 0 10px; font: 300 clamp(28px, 2.4vw, 42px)/1.1 var(--display); color: var(--hot); letter-spacing: -0.01em; }
.welcome-copy { margin: 0 0 20px; max-width: 60ch; font: 300 19px/1.5 var(--ui); color: #b9c3d2; }
.recent { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); grid-auto-rows: 0; gap: 14px; }
.recent:empty { display: none; }
.recent-film { position: relative; min-height: 0; cursor: pointer; border: 0; padding: 0; background: #0b1019; border-radius: 10px; overflow: hidden; text-align: left; box-shadow: 0 0 0 1px var(--hair), 0 14px 40px rgba(0, 0, 0, 0.5); transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.recent-film:nth-child(n + 7) { display: none; }
.recent-film:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255, 181, 71, 0.4), 0 18px 50px rgba(0, 0, 0, 0.6); }
.recent-film img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.recent-film span { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 10px; background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent); font: italic 400 18px/1.25 var(--display); color: #f1f4f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.searches { flex-wrap: nowrap; overflow: hidden; gap: 8px; padding: 0 20px 12px; min-height: 0; flex: none; }
.searches span { flex: 0 1 auto; min-width: 0; font-size: 15px; color: #b8c2d2; padding: 6px 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: rise 0.5s var(--ease) both; }
.searches span b { color: var(--amber); font-weight: 500; margin-right: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.grid {
  flex: 1; min-height: 0; padding: 0 20px 20px; gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr));
}
.grid.cut { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile {
  position: relative; min-height: 0; border-radius: 8px; overflow: hidden; background: #0b1019; cursor: default;
  box-shadow: 0 0 0 1px var(--hair); transition: opacity 0.6s, filter 0.6s, box-shadow 0.5s, transform 0.5s var(--ease);
}
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%) -100% 0 / 200% 100%;
  animation: shimmer 2.2s linear infinite;
}
.tile.filled::before { display: none; }
@keyframes shimmer { to { background-position: 100% 0; } }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s; }
.tile.filled video { opacity: 1; }
.tile.filled::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash 0.7s ease-out forwards; pointer-events: none; }
@keyframes flash { from { opacity: 0.8; } to { opacity: 0; } }
.tile-meta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 22px 10px 7px; background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), transparent);
  font: 500 15px var(--mono); letter-spacing: 0.04em; color: #dfe5ee; opacity: 0; transition: opacity 0.4s;
}
.tile.filled .tile-meta { opacity: 1; }
.tile-meta b { color: var(--amber); font-weight: 600; }
.tile-meta em { font-style: normal; color: var(--muted); font-size: 13px; }
.tile-num {
  position: absolute; left: 8px; top: 8px; z-index: 3; padding: 2px 9px; border-radius: 5px; opacity: 0; transform: scale(1.6);
  font: 600 22px/1.2 var(--mono); color: #1d1004; background: linear-gradient(135deg, #ffd27a, var(--amber));
  box-shadow: 0 4px 20px rgba(255, 181, 71, 0.5); transition: opacity 0.5s, transform 0.6s var(--ease);
}
.grid.has-pick .tile:not(.chosen) { opacity: 0.22; filter: grayscale(0.8); }
.tile.chosen { box-shadow: 0 0 0 2px var(--amber), 0 0 28px rgba(255, 181, 71, 0.35); }
.tile.chosen .tile-num { opacity: 1; transform: none; }
.grid.cut .tile:not(.chosen) { display: none; }
.evidence-panel:has(.grid.cut) .searches { display: none; }
.grid.cut .tile-num { font-size: 30px; padding: 3px 12px; left: 12px; top: 12px; }
.grid.cut .tile-meta { font-size: 18px; padding: 30px 14px 10px; }
.grid.cut .tile-meta em { font-size: 15px; }
.yolo {
  position: absolute; right: 7px; top: 7px; z-index: 3; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 70%;
  font: 500 11.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; animation: rise 0.5s var(--ease) both; pointer-events: none;
}
.yolo span, .yolo em { padding: 2px 6px; border-radius: 4px; background: rgba(4, 6, 11, 0.72); color: #cfd7e2; font-style: normal; backdrop-filter: blur(4px); }
.yolo b { color: var(--hot); font-weight: 600; }
.yolo em { display: none; color: #76b900; border: 1px solid rgba(118, 185, 0, 0.45); }
.tile.chosen .yolo em { display: inline; }
.grid.cut .yolo { font-size: 13.5px; gap: 5px; right: 10px; top: 10px; }
.grid:not(.cut) .yolo span:nth-of-type(n + 3) { display: none; }
.yolo-boxes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.yolo-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 6px 22px 0; font-size: 16px; color: var(--muted); letter-spacing: 0.03em; }
.yolo-line:empty { display: none; }
.yolo-line em { font-style: normal; color: #76b900; letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.yolo-line b { color: var(--hot); font-weight: 500; }
.yolo-line .yolo-note { color: var(--faint); font-size: 13px; }
.tile.focus { box-shadow: 0 0 0 2px var(--hot), 0 0 32px rgba(255, 214, 150, 0.5); }

/* ---------- player ---------- */
.player {
  flex: 1; min-height: 0; padding: 0 20px 16px; gap: 8px 16px; animation: rise 0.8s var(--ease) both;
  display: none; grid-template-columns: minmax(0, 1fr) clamp(190px, 17vw, 300px); grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "box strip" "scrub strip";
}
body[data-phase="screening"] .player { display: grid; }
.player-box { grid-area: box; min-height: 0; container-type: size; display: grid; place-items: center; }
.screen {
  position: relative; width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9;
  border-radius: 12px; overflow: hidden; background: #000; cursor: pointer;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.07), 0 0 120px rgba(255, 181, 71, 0.05);
}
.screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.screen-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.1) 100%); transition: opacity 0.8s; }
.slate { position: absolute; left: 5%; right: 5%; bottom: 9%; transition: opacity 0.7s, transform 0.8s var(--ease); }
.slate-kicker { font-size: 14px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--amber); }
.slate h1 { margin: 10px 0 8px; font: 300 clamp(30px, 3vw, 54px)/1.04 var(--display); letter-spacing: -0.01em; color: #fff; }
.slate-question { margin: 0 0 12px; font: italic 300 20px/1.4 var(--display); color: #d0d7e2; max-width: 52ch; }
.slate-meta { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; color: #a0abbd; display: flex; gap: 18px; flex-wrap: wrap; }
.slate-meta b { color: var(--hot); font-weight: 500; }
.play {
  position: absolute; left: 50%; top: 40%; width: 108px; height: 108px; margin: -54px 0 0 -54px; border: 0; padding: 0; cursor: pointer;
  background: rgba(10, 12, 18, 0.35); border-radius: 50%; backdrop-filter: blur(6px); transition: transform 0.35s var(--ease), opacity 0.5s;
}
.play svg { width: 100%; height: 100%; }
.play path { fill: #fff; }
.play-ring { fill: none; stroke: rgba(255, 255, 255, 0.8); stroke-width: 1.2; }
.play::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 1px solid rgba(255, 181, 71, 0.5); animation: ring 2.4s ease-out infinite; }
@keyframes ring { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.35); opacity: 0; } }
.play:hover { transform: scale(1.06); }
.screen.started .screen-shade, .screen.started .slate, .screen.playing .play { opacity: 0; pointer-events: none; }
.screen.started .slate { transform: translateY(10px); }
.shot-credit {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 3% 12px; font-size: 16px; letter-spacing: 0.1em; text-transform: uppercase;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.7), transparent);
  color: rgba(255, 255, 255, 0.85); opacity: 0; transition: opacity 0.5s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot-credit b { color: var(--amber); font-weight: 600; margin-right: 12px; }
.screen.started .shot-credit { opacity: 1; }
.screen.loading .play { opacity: 0.3; pointer-events: none; }
.screen.loading .play::after { animation-duration: 1s; }
.screen.loading::after {
  content: "Buffering the final cut…"; position: absolute; left: 0; right: 0; top: calc(40% + 66px); text-align: center;
  font: 500 15px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber);
}

/* While the film plays, freeze ambient motion and drop costly filters so the decoder gets the frame budget. */
body.film-playing .grain { display: none; }
body.film-playing .route-flow, body.film-playing .lake-lines path, body.film-playing .rec i,
body.film-playing .stages li i, body.film-playing .process li i { animation: none; }
body.film-playing .city .node, body.film-playing .traffic, body.film-playing .shore,
body.film-playing .thread-glow { filter: none; }
body.film-playing .node { transition: none; }
body.film-playing .mark.now .mark-halo { animation: none; opacity: 0.3; }
body.film-playing .play::after { animation: none; }
body.film-playing .vignette { display: none; }
body.film-playing .panel { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03); }
body.film-playing .screen { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07); }
body.film-playing .shot.now { box-shadow: 0 0 0 2px var(--amber); transform: none; }
body.film-playing .shot.now::after { box-shadow: inset 0 0 0 2px var(--hot); animation: none; opacity: 0.6; }
body.film-playing .querybar, body.film-playing .querybar button { box-shadow: none; }

.scrubber { grid-area: scrub; position: relative; height: 26px; cursor: pointer; }
.scrub-track { position: absolute; left: 0; right: 132px; top: 10px; height: 5px; display: flex; gap: 3px; }
.scrub-track .seg { height: 100%; border-radius: 2px; background: rgba(255, 255, 255, 0.12); transition: background 0.3s; }
.scrub-track .seg.now { background: rgba(255, 181, 71, 0.85); }
.scrub-track .seg.done { background: rgba(255, 243, 220, 0.4); }
.scrub-head { position: absolute; top: 3px; width: 2px; height: 19px; background: var(--hot); box-shadow: 0 0 10px var(--amber); left: 0; transition: left 0.1s linear; }
.scrub-time { position: absolute; right: 0; top: 2px; font-size: 16px; color: var(--muted); letter-spacing: 0.06em; }

.shotstrip { grid-area: strip; min-height: 0; display: grid; grid-template-rows: repeat(6, minmax(0, 1fr)); gap: 8px; }
.shot {
  position: relative; min-height: 0; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; background: rgba(255, 255, 255, 0.025);
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; align-items: center; text-align: left;
  box-shadow: 0 0 0 1px var(--hair); transition: box-shadow 0.3s, background 0.3s, transform 0.3s var(--ease);
}
.shot img { height: 100%; aspect-ratio: 16 / 9; min-height: 0; object-fit: cover; border-radius: 5px; opacity: 0.7; transition: opacity 0.3s; display: block; }
.shot:hover img { opacity: 1; }
.shot-label { display: grid; gap: 2px; font: 500 15px var(--mono); color: #c9d1dd; white-space: nowrap; overflow: hidden; }
.shot-label b { color: var(--amber); font: 600 20px/1 var(--mono); }
.shot.now { background: rgba(255, 181, 71, 0.08); box-shadow: 0 0 0 2px var(--amber), 0 0 26px rgba(255, 181, 71, 0.35); transform: translateX(-3px); }
.shot.now img { opacity: 1; }
.shot.now::after { content: ""; position: absolute; inset: 0; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--hot), 0 0 18px rgba(255, 214, 150, 0.4); animation: pulse 1.3s ease-in-out infinite; pointer-events: none; }
@keyframes pulse { 50% { opacity: 0.15; } }

/* ---------- director's response ---------- */
.response { padding-bottom: 12px; }
.response .panel-label { padding-top: 12px; padding-bottom: 6px; }
.resp-title { display: inline-flex; align-items: center; gap: 12px; color: var(--hot); }
.rec { display: inline-flex; align-items: center; gap: 7px; font: 500 11px var(--mono); letter-spacing: 0.2em; color: #ff6b5a; border: 1px solid rgba(255, 107, 90, 0.35); padding: 3px 8px 3px 7px; border-radius: 4px; opacity: 0.3; transition: opacity 0.4s; }
.rec i { width: 7px; height: 7px; border-radius: 50%; background: #ff4d3d; box-shadow: 0 0 10px #ff4d3d; }
body[data-phase="directing"] .rec { opacity: 1; }
body[data-phase="directing"] .rec i { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }

.stages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; text-transform: none; letter-spacing: 0; }
.stages li { display: inline-flex; align-items: center; gap: 8px; font: 500 18px var(--ui); color: var(--faint); transition: color 0.4s; }
.stages li + li::before { content: "→"; color: #3b475a; margin-right: 2px; font-weight: 400; }
.stages li i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; transition: background 0.4s, box-shadow 0.4s; }
.stages li[data-state="active"] { color: var(--amber); }
.stages li[data-state="active"] i { background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: blink 1.1s steps(2) infinite; }
.stages li[data-state="done"] { color: var(--ok); }
.stages li[data-state="done"] i { background: var(--ok); border-color: var(--ok); }
.response.error .stages li[data-state="active"] { color: #ff8f80; }
.response.error .stages li[data-state="active"] i { background: #ff8f80; box-shadow: none; animation: none; }

.status { display: flex; align-items: baseline; gap: 18px; padding: 2px 22px 0; min-width: 0; }
.status-line { flex: none; font: italic 300 26px/1.2 var(--display); color: var(--hot); }
.status-detail { min-width: 0; font-size: 18px; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.response.error .status-line { color: #ff8f80; }
.response.error .status-detail { white-space: normal; }
.progress { position: absolute; left: 0; right: 0; top: 0; z-index: 4; height: 3px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--hot)); box-shadow: 0 0 12px var(--amber); transition: width 1.2s var(--ease); }
body[data-phase="screening"] .progress { opacity: 0; }

.process {
  flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
  margin: 0; padding: 14px 22px 4px; list-style: none;
}
.process li {
  position: relative; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px;
  border-radius: 10px; border: 1px solid var(--hair); background: rgba(255, 255, 255, 0.02); color: var(--faint);
  transition: color 0.4s, border-color 0.4s, background 0.4s, box-shadow 0.4s;
}
.process .p-n { font: 500 14px var(--mono); letter-spacing: 0.14em; display: flex; align-items: center; gap: 10px; }
.process .p-n i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; }
.process .p-name { font: 500 20px/1.2 var(--ui); color: #7d8aa0; transition: color 0.4s; }
.process .p-desc { font: 300 16px/1.45 var(--ui); color: var(--faint); }
.process li[data-state="active"] { color: var(--amber); border-color: rgba(255, 181, 71, 0.45); background: rgba(255, 181, 71, 0.05); box-shadow: 0 0 30px rgba(255, 181, 71, 0.08); }
.process li[data-state="active"] .p-name { color: var(--hot); }
.process li[data-state="active"] .p-desc { color: #b9c3d2; }
.process li[data-state="active"] .p-n i { background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: blink 1.1s steps(2) infinite; }
.process li[data-state="done"] { color: var(--ok); border-color: rgba(159, 227, 176, 0.22); }
.process li[data-state="done"] .p-name { color: #d5eedc; }
.process li[data-state="done"] .p-n i { background: var(--ok); }
.response.error .process li[data-state="active"] { color: #ff8f80; border-color: rgba(255, 143, 128, 0.4); }
.response:has(.narr-text:not(:empty)) .process { display: none; }
.response:has(.narr-text:empty) .stages { display: none; }
.response:has(.narr-text:empty) .narr { display: none; }

.narr { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 22px 0; scrollbar-width: thin; scrollbar-color: #2a3446 transparent; }
.narr-head { display: flex; gap: 16px; align-items: center; font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; transition: opacity 0.5s; }
.narr:has(.narr-text:empty) .narr-head { display: none; }
.narr-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); letter-spacing: 0.12em; }
.narr-badge.ok { color: var(--ok); }
.narr-badge.weak { color: var(--amber); }
.narr-badge svg { width: 14px; height: 14px; }
.narr-text { margin: 0; font: 300 20px/1.45 var(--display); color: rgba(233, 238, 245, 0.9); text-wrap: pretty; }
.narr-text .w { opacity: 0; animation: word 0.5s var(--ease) forwards; }
@keyframes word { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
.narr-text sup { font: 600 13px var(--mono); color: var(--amber); letter-spacing: 0.04em; margin: 0 5px 0 3px; vertical-align: 0.6em; cursor: default; }
.narr-text .framing { color: var(--amber); font-style: italic; }
body[data-phase="screening"] .narr-text .s { color: rgba(233, 238, 245, 0.42); transition: color 0.4s; }
body[data-phase="screening"] .narr-text .s .w { opacity: 1; animation: none; transition: color 0.25s; }
body[data-phase="screening"] .narr-text .s.now { color: rgba(233, 238, 245, 0.6); }
body[data-phase="screening"] .narr-text .s .w.lit { color: var(--hot); text-shadow: 0 0 18px rgba(255, 181, 71, 0.25); }
body[data-phase="screening"] .narr-text .s.done { color: rgba(233, 238, 245, 0.75); }

.summary { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 8px 22px 0; font-size: 16px; color: var(--muted); letter-spacing: 0.03em; border-top: 1px solid var(--hair); margin: 8px 22px 0; padding: 8px 0 0; }
.summary:empty { display: none; }
.summary b { color: var(--hot); font-weight: 500; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 380px; padding: 14px 16px; border-radius: 10px;
  background: rgba(6, 9, 15, 0.94); border: 1px solid var(--hair); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  opacity: 0; transform: translateY(4px); transition: opacity 0.18s, transform 0.18s;
}
.tooltip.on { opacity: 1; transform: none; }
.tooltip .tt-head { font: 500 13px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.tooltip .tt-streets { font: 13px var(--mono); color: var(--ok); margin-top: 5px; letter-spacing: 0.03em; }
.tooltip .tt-body { font-size: 15px; line-height: 1.5; color: #c9d1dd; margin-top: 7px; }

@media (max-height: 900px) {
  :root { --gap: 14px; }
  .app { gap: 10px; padding-top: 14px; padding-bottom: 16px; }
  .querybar { height: 64px; }
  .querybar button { height: 48px; }
  .legend-note { display: none; }
  .welcome-copy { margin-bottom: 14px; }
}
@media (max-height: 820px) {
  body:not([data-phase="idle"]) .chips { display: none; }
  .right { grid-template-rows: minmax(0, 58fr) minmax(0, 42fr); }
  .status-line { font-size: 23px; }
  .response .panel-label { row-gap: 4px; }
  .welcome-title { font-size: 28px; }
  .welcome-copy { font-size: 18px; }
  .grid:not(.cut) { grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .grid:not(.cut):not(.has-pick) .tile:nth-child(n + 13) { display: none; }
}
@media (max-width: 1400px) {
  :root { --pad: 20px; }
  .credits { display: none; }
  .grid:not(.cut) .tile-meta em { display: none; }
}
