/* What The Prompt. Design language v2: "The Detective File" (Design DNA `detective`, native dark), 1.11.2026.
   Tokens and patterns come from design-v2/board.html option 1. Every puzzle is a case file: the image is the
   evidence photo, the five rows are the clues, a solved game is stamped Case closed.
   The puzzle image never gets a filter, because its palette and light are part of the answer.
   Logical properties throughout, so a Hebrew RTL interface can drop in later. */

:root {
  --bg: #0D1626;          /* midnight */
  --bg2: #14213A;
  --bg3: #07090F;         /* the darkroom under the film */
  --card: #F6EDDA;        /* case-file cream */
  --paper: #FFFBF2;
  --ink: #16243A;
  --line: #3A4C6B;
  --text: #F2E9D5;
  --muted: #A8B9D4;
  --ctext: #16243A;
  --cmuted: #5F5744;
  --accent: #F98A2B;      /* warm orange */
  --accent-hi: #E0641E;
  --accent2: #5C87C4;
  --accent-ink: #A15316;
  --ok: #3E9B6B;
  --danger: #C43520;
  --stamp: #B3301C;       /* rubber-stamp red, darkened from danger so small stamps pass AA on cream */
  --on-accent: #141414;
  --on-ok: #141414;
  --focus: #F98A2B;
  --radius: 4px;
  --shadow: 7px 7px 0 var(--line);
  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --body: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --sym: "DejaVu Sans", "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", sans-serif;
  --gutter: 16px;
  --bar-h: 76px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { background: var(--bg); }
body {
  position: relative; font-family: var(--body); color: var(--text); line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; overflow-x: hidden;
}
/* Halftone dots, the noir comic texture, fading out down the page (on main, so the strip stays in the normal flow) */
main { position: relative; }
main::before {
  content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; height: 760px; z-index: 0; pointer-events: none;
  opacity: 0.1; background-image: radial-gradient(circle, #F98A2B 1px, transparent 1.6px); background-size: 14px 14px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent);
}
main > * { position: relative; z-index: 1; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
svg.i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.g { font-family: var(--sym); font-weight: 400; }
mark {
  background: transparent; color: inherit; font-weight: 700;
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px;
}
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip {
  position: absolute; inset-inline-start: 8px; inset-block-start: -60px; z-index: 30;
  background: var(--accent); color: var(--on-accent); padding: 10px 16px; border: 2.5px solid var(--ink); border-radius: var(--radius);
  font-weight: 700; font-size: 14px; text-decoration: none;
}
.skip:focus { inset-block-start: 8px; }

/* Shared detective devices */
.kick, .lbl {
  font-family: var(--display); font-weight: 500; font-size: 13px; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase;
}
.stamp {
  display: inline-block; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; line-height: 1.1;
  padding: 5px 12px; color: var(--stamp); border: 4px solid var(--stamp); border-radius: 6px; font-size: 19px;
  transform: rotate(-7deg); background: rgba(196, 53, 32, 0.06); white-space: nowrap;
}
.tape {
  position: absolute; z-index: 4; inset-block-start: -11px; width: 78px; height: 24px;
  background: rgba(246, 237, 218, 0.78); border: 1.5px dashed rgba(22, 36, 58, 0.35); pointer-events: none;
}
.tape.tl { inset-inline-start: 18px; transform: rotate(-6deg); }
.tape.tr { inset-inline-end: 18px; transform: rotate(5deg); }
.illus {
  position: absolute; z-index: 3; inset-block-start: 8px; inset-inline-start: 8px; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; font-family: var(--body); font-size: 11px; font-weight: 500; line-height: 1.3; letter-spacing: 0.02em;
  color: #FFFFFF; background: rgba(8, 8, 10, 0.78); border-radius: var(--radius); pointer-events: none;
}
.illus svg { width: 12px; height: 12px; stroke-width: 2; }

/* Under construction strip (shared markup from _shared/wip-strip.html, restyled in the detective tokens).
   First child of body, in normal flow above the header, so it never overlaps the header or the game. */
.wip-strip {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 16px;
  background: var(--accent); color: var(--on-accent); border-block-end: 2.5px dashed var(--ink);
  font: 500 14px/1.45 var(--body); text-align: center;
}
.wip-strip strong { font-weight: 700; }
.wip-strip svg { width: 22px; height: 22px; flex: none; transform-origin: 50% 90%; }
@media (prefers-reduced-motion: no-preference) {
  .wip-strip svg { animation: wip-wobble 4s ease-in-out infinite; }
  @keyframes wip-wobble {
    0%, 80%, 100% { transform: rotate(0); }
    85% { transform: rotate(-8deg); }
    90% { transform: rotate(7deg); }
    95% { transform: rotate(-4deg); }
  }
}
@media print { .wip-strip { display: none; } }

/* Header */
.hdr {
  height: 64px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-inline: var(--gutter); background: var(--bg); border-block-end: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; min-width: 0; border-radius: var(--radius); }
.brand .badge {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 2.5px 2.5px 0 rgba(0, 0, 0, 0.5);
}
.brand .badge svg { width: 20px; height: 20px; stroke-width: 2.4; }
.brand .wm {
  display: block; font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  line-height: 1.2; white-space: nowrap;
}
.brand .by { display: block; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.3; }
.brand .by b { color: var(--text); font-weight: 500; }
.icons { display: flex; gap: 6px; flex: none; }
.navbtn {
  min-width: 44px; height: 44px; border-radius: var(--radius); border: 2px solid var(--line); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 9px;
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
}
.navbtn svg { width: 21px; height: 21px; }
.navbtn .tx { display: none; }
.navbtn:hover { border-color: var(--accent); color: var(--accent); }
.navbtn[aria-current="page"] { background: var(--accent); border-color: var(--ink); color: var(--on-accent); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45); }

/* Layout */
main { flex: 1 0 auto; width: 100%; }
.kick { display: block; }
.wrap { width: 100%; max-width: 640px; margin-inline: auto; padding-inline: var(--gutter); }
.loading { padding: 48px var(--gutter); text-align: center; color: var(--muted); font-size: 14px; font-weight: 500; }

/* Puzzle: the case file */
.pz { padding-block-start: 18px; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 30px; margin-block-end: 18px; }
.case {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; background: var(--accent); color: var(--on-accent);
  font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.05em; line-height: 1.4;
  border: 2.5px solid var(--ink); border-radius: var(--radius); transform: rotate(-2deg); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
}
.case .ck { text-transform: uppercase; letter-spacing: 0.08em; }
.meta .n { display: inline-flex; align-items: center; gap: 8px; }
.meta .d { font-family: var(--display); font-size: 13.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); text-align: end; }
.tag {
  display: inline-block; font-family: var(--body); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.4;
  background: var(--ink); color: var(--text); border-radius: var(--radius); padding: 1px 7px;
}
.ev {
  position: relative; background: var(--card); padding: 10px 10px 0; border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.photo { width: 100%; aspect-ratio: 1 / 1; overflow: hidden; background: #E6DCC5; position: relative; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .img-fail {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px; text-align: center; font-size: 14px; color: var(--cmuted); border: 2px dashed rgba(22, 36, 58, 0.4);
}
.photo .img-fail b { color: var(--ctext); font-size: 16px; font-weight: 700; }
.ev-cap {
  display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px 9px; font-family: var(--display);
  font-size: 13px; font-weight: 600; line-height: 1.4; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ctext);
}
.ev-cap span + span { color: var(--cmuted); font-weight: 500; }
.pz-side { padding-block-start: 26px; }
.pz-side > .kick { color: var(--muted); margin-block-end: 4px; }
.subject { font-family: var(--display); font-size: 27px; font-weight: 600; line-height: 1.15; letter-spacing: 0.01em; margin-block-end: 26px; }
.subject:focus { outline: none; }

.file {
  --focus: var(--ink);
  position: relative; background: var(--card); color: var(--ctext); border: 3px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) var(--radius); box-shadow: var(--shadow); padding: 14px 10px;
}
.file-tab {
  position: absolute; z-index: 1; inset-inline-start: -3px; inset-block-start: -27px; padding: 3px 14px; background: var(--card);
  color: var(--ctext); border: 3px solid var(--ink); border-block-end: 0; border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--display); font-weight: 600; font-size: 13px; line-height: 1.5; letter-spacing: 0.1em; text-transform: uppercase;
}
.rows { display: flex; flex-direction: column; gap: 12px; }
.r { display: flex; flex-direction: column; gap: 7px; padding-block-end: 12px; border-block-end: 1.5px dashed rgba(22, 36, 58, 0.3); }
.r:last-child { padding-block-end: 0; border-block-end: 0; }
.rl { display: flex; align-items: center; gap: 8px; min-height: 24px; flex-wrap: wrap; }
.rl .cn { font-family: var(--display); font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cmuted); }
.rl b { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; color: var(--ctext); }
.rl .st { margin-inline-start: auto; }
.st {
  font-size: 12px; font-weight: 700; line-height: 1; border-radius: var(--radius); padding: 4px 7px;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; border: 2px solid var(--ink);
}
.st .g { font-size: 12px; }
.st.ok { background: var(--ok); color: var(--on-ok); }
.st.close { background: var(--accent); color: var(--on-accent); }
.st.no { background: transparent; color: var(--cmuted); border-style: dashed; border-color: rgba(22, 36, 58, 0.55); }
.opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.o {
  position: relative; min-height: 50px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper);
  color: var(--ctext); font-size: 12.5px; font-weight: 500; line-height: 1.2; display: grid; place-items: center;
  text-align: center; padding: 6px 2px; min-width: 0; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.o input { position: absolute; opacity: 0; width: 1px; height: 1px; inset: 50% auto auto 50%; margin: 0; pointer-events: none; }
.o:hover { background: #FBE6CF; }
.o.sel, .o.sel:hover {
  background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px) rotate(-1.2deg);
}
.o.win, .o.win:hover { background: var(--ok); color: var(--on-ok); font-weight: 700; cursor: default; box-shadow: 3px 3px 0 var(--ink); }
.o.dim, .o.dim:hover { background: transparent; color: var(--cmuted); border: 2px dashed rgba(22, 36, 58, 0.35); cursor: default; }
.o.off, .o.off:hover {
  background: #EDE3CC; color: var(--cmuted); border: 2px dashed rgba(22, 36, 58, 0.45); cursor: not-allowed;
  text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 2px;
}
.o:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; z-index: 1; }

.bar {
  position: sticky; inset-block-end: 0; z-index: 5; margin: 14px -10px -14px; padding: 12px 10px;
  background: var(--card); border-block-start: 3px solid var(--ink);
}
.bar-in { display: flex; align-items: center; gap: 14px; min-height: 50px; }
.att {
  display: flex; flex-direction: column; gap: 7px; font-family: var(--display); font-size: 14px; font-weight: 500;
  letter-spacing: 0.05em; color: var(--ctext); white-space: nowrap;
}
/* Attempts as three magnifying glasses */
.pips { display: flex; gap: 10px; }
.pip { position: relative; width: 15px; height: 15px; border: 2px solid var(--ink); border-radius: 50%; }
.pip::after { content: ""; position: absolute; inset-inline-end: -6px; inset-block-end: -4px; width: 7px; height: 2.5px; background: var(--ink); transform: rotate(45deg); }
.pip.used { background: var(--accent); }
.note { font-size: 13px; color: var(--muted); font-weight: 400; line-height: 1.45; margin-block-start: 8px; }
.file .note { color: var(--cmuted); }

/* Buttons */
.btn {
  min-height: 50px; border-radius: var(--radius); border: 3px solid var(--ink); background: var(--accent); color: var(--on-accent);
  font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 22px; white-space: nowrap;
  text-decoration: none; cursor: pointer; box-shadow: 4px 4px 0 var(--ink); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn svg { width: 20px; height: 20px; }
.btn.wide { width: 100%; }
.bar .btn { flex: 1; }
.btn.sec { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.sm { min-height: 44px; font-size: 15px; padding: 0 14px; }
.btn.sm svg { width: 18px; height: 18px; }
.btn:disabled, .btn[aria-disabled="true"] { background: transparent; color: var(--cmuted); border-color: rgba(22, 36, 58, 0.45); box-shadow: none; cursor: not-allowed; }
.btn:not(:disabled):not(.sec):hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn.sec:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
/* On a dark surface the hard shadow is black, on the cream file it is ink */
.res .btn:not(.sec), .empty .btn:not(.sec) { box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5); }

/* Reveal: rows show their verdict in order */
@media (prefers-reduced-motion: no-preference) {
  .reveal .st { animation: pop 0.32s ease-out both; animation-delay: calc(var(--i, 0) * 160ms); }
  .reveal .o.win, .reveal .o.off { animation: fadein 0.32s ease-out both; animation-delay: calc(var(--i, 0) * 160ms); }
  @keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fadein { from { opacity: 0.35; } to { opacity: 1; } }
  .stamp.slam { animation: slam 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.25s both; }
  @keyframes slam { from { transform: scale(2.2) rotate(-14deg); opacity: 0; } to { transform: rotate(-7deg); opacity: 1; } }
}

/* Empty, unavailable and error states: a case file still pending */
.empty {
  --focus: var(--ink);
  position: relative; background: var(--card); color: var(--ctext); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 22px 24px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  margin-block: 40px 32px;
}
.empty .stamp { position: absolute; inset-block-start: 18px; inset-inline-end: 16px; font-size: 15px; border-width: 3px; }
.empty .mark {
  width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--ink); border: 2.5px solid var(--ink);
  display: grid; place-items: center; box-shadow: 3px 3px 0 var(--ink);
}
.empty .mark svg { width: 26px; height: 26px; }
.empty .kick { color: var(--cmuted); }
.empty h1 { font-family: var(--display); font-size: 27px; font-weight: 600; line-height: 1.15; }
.empty p { font-size: 15px; color: var(--ctext); line-height: 1.55; }
.empty .acts { display: flex; flex-direction: column; gap: 12px; width: 100%; margin-block-start: 8px; }
.empty .btn:not(.sec) { box-shadow: 4px 4px 0 var(--ink); }
.empty .btn.sec { color: var(--ctext); border-color: var(--ink); }
.empty .btn.sec:hover { color: var(--accent-ink); border-color: var(--accent-ink); }

/* Result: the closed case */
.res { padding-block: 22px 8px; display: flex; flex-direction: column; gap: 16px; }
.res-a, .res-b { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.case-card {
  --focus: var(--ink);
  position: relative; background: var(--card); color: var(--ctext); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 14px;
}
.top { display: flex; align-items: center; gap: 14px; }
.thumb-l { position: relative; width: 96px; flex: none; background: var(--paper); padding: 5px; border: 2.5px solid var(--ink); transform: rotate(-2deg); box-shadow: 3px 3px 0 rgba(22, 36, 58, 0.35); }
.thumb-l img { width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; }
.thumb-l .tape { width: 44px; height: 14px; inset-block-start: -8px; inset-inline-start: 24px; }
.scorebox { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scorebox .k { font-size: 13px; font-weight: 500; color: var(--cmuted); }
.scorebox .k:first-child { font-family: var(--display); letter-spacing: 0.06em; }
.scorebox .score { font-family: var(--display); font-size: 48px; font-weight: 700; line-height: 1.05; color: var(--accent-ink); letter-spacing: 0.01em; }
.res-subj { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.2; margin-block: 14px 4px; }
.scoreline { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px; }
.case-card .stamp { margin-block: 4px 2px; }
.grid {
  margin-block-start: 14px; padding-block-start: 12px; border-block-start: 3px solid var(--ink);
  display: grid; gap: 4px; font-size: 14px; line-height: 1.5;
}
.grid .gl { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 8px; }
.grid .gl > span:first-child { font-family: var(--display); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.grid .gs { font-family: var(--sym); letter-spacing: 3px; font-size: 15px; }
.lbl { color: var(--accent); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-block-end: 10px; }
.dossier { background: var(--bg2); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; }
.prompt { font-size: 16px; line-height: 1.65; color: var(--text); }
.why { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-block-start: 10px; }
.why li { font-size: 14.5px; line-height: 1.5; padding-inline-start: 18px; position: relative; color: var(--muted); }
.why li::before { content: ""; position: absolute; inset-inline-start: 0; inset-block-start: 7px; width: 9px; height: 9px; border: 2px solid var(--accent); border-radius: 50%; }
.why li b { color: var(--text); font-weight: 700; }
.mg-link {
  display: inline-block; margin-block-start: 14px; font-family: var(--display); font-size: 13px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.4; color: var(--muted); text-decoration: underline;
  text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.mg-link:hover { color: var(--text); }
/* Countdown as a lab timer readout */
.count {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; font-family: var(--display);
  font-size: 14px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--bg3);
}
.count b { font-size: 24px; font-weight: 600; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--accent); }
.dlg .count { background: var(--ink); border-color: var(--ink); color: #D8E1EF; }
.ready { display: flex; flex-direction: column; gap: 10px; border-block-start: 2px solid var(--line); padding-block-start: 12px; font-family: var(--display); font-size: 17px; letter-spacing: 0.04em; }
.manual { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.manual textarea {
  width: 100%; min-height: 150px; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
  font-family: var(--sym); font-size: 13px; line-height: 1.45; color: var(--ctext); background: var(--paper); resize: vertical;
}

/* Footer */
.foot {
  flex: none; width: 100%; padding: 16px var(--gutter) 20px; border-block-start: 2px solid var(--line); background: var(--bg);
  font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 14px;
}
.foot a, .simpla {
  color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
}

/* Toast */
.toast {
  position: fixed; z-index: 40; inset-inline: 0; inset-block-end: calc(var(--bar-h) + 20px); margin-inline: auto; width: max-content;
  max-width: calc(100% - 32px); display: inline-flex; gap: 8px; align-items: center;
  background: var(--ok); color: var(--on-ok); font-weight: 700; font-size: 15px;
  border-radius: var(--radius); padding: 10px 16px; border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}
.toast svg { width: 20px; height: 20px; }

/* Dialogs: a case file on the desk */
dialog.dlg {
  --focus: var(--ink);
  margin: auto; padding: 0; width: calc(100% - 32px); max-width: 440px; max-height: calc(100dvh - 32px);
  background: var(--card); color: var(--ctext); border: 3px solid var(--ink); border-radius: var(--radius); overflow: auto;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.55);
}
dialog.dlg::backdrop { background: rgba(7, 9, 15, 0.8); }
.dlg-in { padding: 20px 20px 22px; }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; padding-block-end: 10px; border-block-end: 3px solid var(--ink); }
.dlg-h h2 { font-family: var(--display); font-size: 25px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.15; }
.x {
  width: 44px; height: 44px; border-radius: var(--radius); border: 2px solid var(--ink); background: var(--paper);
  display: grid; place-items: center; color: var(--ctext); flex: none;
}
.x:hover { background: #FBE6CF; }
.x svg { width: 22px; height: 22px; }
.p { font-size: 15px; line-height: 1.6; }
.p + .p { margin-block-start: 8px; }
.dlg mark { text-decoration-color: var(--accent-hi); }
.legend { margin: 14px 0; border: 2px dashed rgba(22, 36, 58, 0.45); border-radius: var(--radius); padding: 12px; background: var(--paper); }
.legend .r { padding: 0; border: 0; }
.legend .o { cursor: default; }
.legend .o:not(.sel):not(.off):hover { background: var(--paper); }
.lg { list-style: none; margin-block-start: 14px; display: flex; flex-direction: column; gap: 8px; }
.lg li { font-size: 14px; line-height: 1.4; display: flex; align-items: center; gap: 10px; }
.lg .st { min-width: 92px; justify-content: center; }
.small { font-size: 13.5px; color: var(--muted); line-height: 1.5; font-weight: 400; }
.dlg .small { color: var(--cmuted); }
.dlg .acts { margin-block-start: 16px; }
.dlg .btn { box-shadow: 4px 4px 0 var(--ink); }
.credit {
  display: flex; align-items: center; gap: 10px; margin-block-start: 18px; padding-block-start: 12px;
  border-block-start: 1.5px dashed rgba(22, 36, 58, 0.4); font-size: 13.5px; font-weight: 400; color: var(--cmuted); text-decoration: none;
}
.credit .ph { width: 48px; height: 48px; flex: none; border-radius: 50%; overflow: hidden; background: var(--paper); border: 2px solid var(--ink); }
.credit .ph img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.7); transform-origin: 50% 26%; }
.credit b { color: var(--ctext); font-weight: 700; }
.credit:hover b { text-decoration: underline; text-decoration-color: var(--accent-hi); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Stats */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-block-end: 18px; }
.tile { border: 2px solid var(--ink); border-radius: var(--radius); padding: 10px 2px 8px; text-align: center; background: var(--paper); }
.tile b { display: block; font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.15; color: var(--ctext); }
.tile span { font-size: 11.5px; font-weight: 500; color: var(--cmuted); line-height: 1.25; display: block; }
.dlg .lbl { color: var(--ctext); }
.dist { list-style: none; display: flex; flex-direction: column; gap: 7px; margin: 10px 0 16px; }
.dr { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.dr .k { width: 48px; flex: none; color: var(--cmuted); font-variant-numeric: tabular-nums; }
.dr .track { flex: 1; height: 22px; min-width: 0; }
.dr .fillb {
  height: 22px; width: 0; min-width: 30px; max-width: 100%; background: var(--paper); color: var(--ctext); border: 2px solid var(--ink); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: flex-end; padding-inline-end: 7px; font-weight: 700; font-size: 12px;
}
.dr.today .fillb { background: var(--accent); color: var(--on-accent); }
.dr.today .k { color: var(--ctext); font-weight: 700; }

/* Archive: the case drawer */
.arc { padding-block: 24px 16px; display: flex; flex-direction: column; }
.arc > .kick { color: var(--accent); }
.arc h1 { font-family: var(--display); font-size: 34px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.15; }
.arc .small { margin: 6px 0 16px; }
.list { list-style: none; margin-block-start: 22px; display: flex; flex-direction: column; gap: 14px; }
.it {
  --focus: var(--ink);
  display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 9px 12px 9px 10px; text-decoration: none;
  background: var(--card); color: var(--ctext); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--line);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.it:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--line); }
.it:hover .s { text-decoration: underline; text-decoration-color: var(--accent-hi); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.thumb { width: 52px; height: 52px; flex: none; overflow: hidden; background: var(--paper); padding: 3px; border: 2px solid var(--ink); transform: rotate(-2deg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.it .tx { flex: 1; min-width: 0; }
.it .n { font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: 0.06em; color: var(--cmuted); display: flex; gap: 8px; align-items: center; }
.it .tag { background: var(--accent); color: var(--on-accent); }
.it .s { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .rs { font-family: var(--display); font-size: 19px; font-weight: 600; min-width: 70px; text-align: end; flex: none; color: var(--accent-ink); }
.it .btn { min-width: 76px; padding: 0 12px; flex: none; box-shadow: 3px 3px 0 var(--ink); font-size: 15px; min-height: 40px; }
.arc .btn.sec { align-self: flex-start; }
.arc-note { margin-block-start: 16px; }

/* ===== The film: developing the evidence photo, scrubbed by scroll ===== */
.scrub { position: relative; z-index: 1; background: var(--bg3); color: var(--text); border-block-start: 2px solid var(--line); margin-block-start: 36px; }
.sc-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.sc-media { position: absolute; inset: 0; overflow: hidden; background: #0A0507; }
.sc-media video, .sc-media .sc-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 66% 50%; }
.scrub.tall .sc-media video, .scrub.tall .sc-media .sc-poster { object-position: 50% 20%; }
.sc-poster { transition: opacity 0.6s ease; }
.sc-poster.gone { opacity: 0; pointer-events: none; }
/* A soft shade where the cards float, so the copy always reads */
.sc-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 9, 15, 0.7), transparent 16%),
    linear-gradient(0deg, rgba(7, 9, 15, 0.75), transparent 18%),
    linear-gradient(90deg, rgba(7, 9, 15, 0.72), rgba(7, 9, 15, 0.25) 45%, transparent 70%);
}
.scrub.tall .sc-shade {
  background:
    linear-gradient(180deg, rgba(7, 9, 15, 0.6), transparent 10%),
    linear-gradient(0deg, rgba(7, 9, 15, 0.85), rgba(7, 9, 15, 0.4) 42%, transparent 62%);
}
.sc-top { position: absolute; z-index: 5; inset-inline: 14px; inset-block-start: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sc-label { font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); line-height: 1.4; }
.sc-label .kick { display: block; color: var(--accent); font-size: 12px; }
.sc-cnt { font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap; }
.sc-cnt b { color: var(--text); font-weight: 600; }
.sc-sticky > .illus { inset-block-start: auto; inset-inline-start: auto; inset-block-end: 70px; inset-inline-end: 14px; }
.sc-copy { position: absolute; z-index: 5; }
.sc-ch {
  display: none; padding: 16px 16px 14px; background: rgba(13, 22, 38, 0.66);
  -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);
  border: 1.5px solid rgba(242, 233, 213, 0.22); border-radius: var(--radius); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}
.sc-ch.on { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .sc-ch.on { animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
}
.sc-kick { margin-block-end: 6px; font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sc-kick .num { color: var(--accent); font-weight: 600; }
.sc-ch h3 { font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.03em; }
.sc-ch p.sc-t { margin-block-start: 8px; font-size: 16px; line-height: 1.55; color: var(--text); }
.sc-hint { display: flex; align-items: center; gap: 10px; margin-block-start: 14px; font-size: 13px; color: var(--muted); }
.sc-hint i { position: relative; width: 2px; height: 28px; background: rgba(242, 233, 213, 0.2); overflow: hidden; flex: none; }
.sc-hint i::after { content: ""; position: absolute; inset-inline: 0; top: -40%; height: 40%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .sc-hint i::after { animation: drip 1.8s ease-in-out infinite; }
  @keyframes drip { to { top: 100%; } }
}
.sc-end { margin-block-start: 10px; font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.sc-back { margin-block-start: 12px; min-height: 44px; font-size: 15px; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5); }
.sc-rail { position: absolute; z-index: 5; inset-inline: 12px; inset-block-end: 8px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sc-rail button {
  display: block; min-height: 44px; padding-block-start: 12px; cursor: pointer; font-family: var(--display); font-size: 11.5px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: start; background: none; border: 0;
}
.sc-rail button.on, .sc-rail button:hover { color: var(--text); }
.sc-rail .trk { display: block; height: 3px; margin: 0 0 6px; background: rgba(242, 233, 213, 0.22); border-radius: 2px; overflow: hidden; }
.sc-rail .fill { display: block; width: 0; height: 100%; background: var(--accent); }
.sc-rail .num { display: none; margin-inline-end: 5px; color: var(--accent); }

/* wide render (16:9): the tray sits right of centre, the cards on the quiet left */
.scrub.wide .sc-copy { inset-inline-start: 5%; top: 50%; width: min(27rem, 36%); transform: translateY(-50%); }
.scrub.wide .sc-ch h3 { font-size: 44px; }
.scrub.wide .sc-ch p.sc-t { font-size: 18px; }
.scrub.wide .sc-rail .num { display: inline; }
/* tall render (9:16): the tray in the top 55 percent, the cards in the quiet bottom */
.scrub.tall .sc-copy { inset-inline: 12px; inset-block-end: 62px; }
.scrub.tall .sc-ch h3 { font-size: 27px; }
.scrub.tall .sc-ch p.sc-t { font-size: 15.5px; }
.scrub.tall .sc-sticky > .illus { inset-block-start: 52px; inset-block-end: auto; }
@media (max-height: 700px) {
  .scrub.tall .sc-hint { display: none; }
  .scrub.tall .sc-ch { padding: 12px 14px 10px; }
}

/* static fallback: reduced motion, or the film fails. Five stills, each with its card */
.scrub.static .sc-sticky { position: relative; height: auto; overflow: visible; }
.scrub.static .sc-media, .scrub.static .sc-rail, .scrub.static .sc-cnt, .scrub.static .sc-shade, .scrub.static > .sc-sticky > .illus { display: none; }
.scrub.static .sc-top { position: static; padding: 22px 16px 0; }
.scrub.static .sc-copy { position: static; transform: none; width: auto; display: grid; gap: 14px; padding: 14px 16px 26px; }
.scrub.static .sc-ch {
  display: grid; grid-template-columns: 124px minmax(0, 1fr); column-gap: 14px; align-items: start; align-content: start;
  animation: none; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg2); border-color: var(--line);
}
.scrub.static .sc-ch > *:not(.sc-still) { grid-column: 2; }
.scrub.static .sc-ch h3 { font-size: 24px; }
.scrub.static .sc-hint { display: none; }
.sc-still { grid-column: 1; grid-row: 1 / span 6; position: relative; margin: 0; background: var(--paper); padding: 4px; border: 2px solid var(--ink); }
.sc-still img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.sc-still .illus { inset-block-start: 8px; inset-inline-start: 8px; font-size: 10px; padding: 2px 6px; }
.sc-still .illus svg { display: none; }

/* Desktop */
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  .hdr { height: 76px; padding-inline: 40px; }
  .brand .badge { width: 42px; height: 42px; }
  .brand .badge svg { width: 23px; height: 23px; }
  .brand .wm { font-size: 22px; }
  .brand .by { font-size: 13px; }
  .icons { gap: 10px; }
  .navbtn { padding: 0 14px; }
  .navbtn svg { width: 20px; height: 20px; }
  .navbtn .tx { display: inline; }
  .foot { padding: 16px 40px; }
  .pz-grid {
    max-width: 1180px; margin: 40px auto 24px; padding-inline: 40px;
    display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 56px; align-items: start;
  }
  .pz { padding-block-start: 0; position: sticky; top: 20px; }
  .pz-side { padding-block-start: 4px; }
  .subject { font-size: 36px; margin-block-end: 34px; }
  .file { padding: 18px 18px; }
  .rows { gap: 12px; }
  .r { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; gap: 12px; }
  .rl { flex-direction: column; align-items: flex-start; gap: 2px; }
  .rl .st { margin-inline-start: 0; margin-block-start: 4px; }
  /* the example row in How to play keeps the stacked phone layout inside the narrow dialog */
  .legend .r { display: flex; align-items: stretch; }
  .legend .rl { flex-direction: row; align-items: center; gap: 8px; }
  .legend .rl .st { margin-inline-start: auto; margin-block-start: 0; }
  .legend .o { font-size: 12.5px; min-height: 50px; }
  .opts { gap: 8px; }
  .o { font-size: 14px; min-height: 54px; }
  .bar { position: static; margin: 16px 0 0; padding: 16px 0 0; background: none; }
  .bar-in { gap: 22px; justify-content: space-between; }
  .bar .btn { flex: none; width: 220px; }
  .empty { margin-block: 56px 40px; padding: 36px 34px 30px; }
  .empty h1 { font-size: 34px; }
  .res { max-width: 1180px; padding: 40px 40px 8px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
  .case-card { padding: 22px 22px; }
  .thumb-l { width: 132px; }
  .scorebox .score { font-size: 64px; }
  .res-subj { font-size: 26px; }
  .dossier { padding: 20px; }
  .prompt { font-size: 17px; }
  .why li { font-size: 15px; }
  .toast { inset-block-end: 88px; }
  .arc { max-width: 760px; padding-block-start: 40px; }
  .arc h1 { font-size: 46px; }
  .scrub { margin-block-start: 56px; }
  .sc-top { inset-inline: 28px; inset-block-start: 22px; }
  .sc-sticky > .illus { inset-inline-end: 28px; inset-block-end: 84px; }
  .sc-rail { inset-inline: 28px; inset-block-end: 14px; gap: 12px; }
  .sc-rail button { font-size: 12.5px; }
  .scrub.static .sc-top { padding: 28px 40px 0; }
  .scrub.static .sc-copy { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 18px 40px 34px; }
  .scrub.static .sc-ch { grid-template-columns: 1fr; }
  .scrub.static .sc-ch > *:not(.sc-still) { grid-column: 1; }
  .sc-still { grid-row: auto; margin-block-end: 12px; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .pz-grid { gap: 36px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .res { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .pz-grid { padding-inline: var(--gutter); max-width: 640px; margin-inline: auto; }
}
@media (max-width: 359px) {
  .brand .wm { font-size: 14px; }
  .icons { gap: 4px; }
  .navbtn { min-width: 40px; padding: 0 6px; }
  .o { font-size: 11.5px; }
}
#main:focus, .subject:focus, .score:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .o.sel { transform: none; }
}
