/* Block Party Whodunit: case file on the left, the player's notebook on the right,
   then the encoding. Tokens match the garden planner so the two apps feel related. */
:root{
  --bg:#edf0e6; --surface:#f8faf3; --ink:#1e2a1b; --muted:#5a6855; --line:#cbd3c0; --accent:#3d6a29; --accent-ink:#ffffff; --warn:#a6402c; --link:#2d5f1c;
  --scene:#f3e3a0; --hot:color-mix(in srgb, #8f6b14 22%, transparent); --guilty:#b83a32;
  --display:"Young Serif", Georgia, "Times New Roman", serif;
  --body:"Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:"IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r:6px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --bg:#131a11; --surface:#1b2418; --ink:#e2e9d8; --muted:#9ba892; --line:#2f3b2a; --accent:#94c46e; --accent-ink:#13200c; --warn:#f08a6e; --link:#b6e08f;
  --scene:#4c4521; --hot:color-mix(in srgb, #e2b752 22%, transparent); --guilty:#f08a7e; color-scheme:dark }}
:root[data-theme="dark"]{
  --bg:#131a11; --surface:#1b2418; --ink:#e2e9d8; --muted:#9ba892; --line:#2f3b2a; --accent:#94c46e; --accent-ink:#13200c; --warn:#f08a6e; --link:#b6e08f;
  --scene:#4c4521; --hot:color-mix(in srgb, #e2b752 22%, transparent); --guilty:#f08a7e; color-scheme:dark }

*,*::before,*::after{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);font-size:15px;line-height:1.5;
  padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px));padding-block:28px 56px}
a{color:var(--link)}
.wrap{max-width:1180px;margin:0 auto;display:flex;flex-direction:column;gap:24px}
h1,h2,h3{font-family:var(--display);font-weight:400;text-wrap:balance;margin:0;line-height:1.15}
h1{font-size:clamp(2rem,4.5vw,3rem)}
h2{font-size:1.4rem}
h3{font-size:1.05rem}
p{margin:0}
.eyebrow{font-size:.72rem;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);font-weight:600}
header{display:flex;flex-direction:column;gap:10px;max-width:68ch}
header .lede{color:var(--muted);font-size:1.02rem}
.hint{font-size:.82rem;color:var(--muted)}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.spacer{flex:1}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
[hidden]{display:none!important}

.site-nav{display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid var(--line);padding-bottom:14px}
.site-nav a{color:var(--ink);text-decoration:none}
.site-nav a:hover{text-decoration:underline}
.site-brand{font-family:var(--display);font-size:1.2rem}
.site-nav .back{font-size:.9rem}

/* toolbar + status */
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:4px;overflow:hidden;background:var(--surface)}
.segbtn{border:0;background:transparent;padding:8px 14px;font-size:.88rem}
.segbtn + .segbtn{border-left:1px solid var(--line)}
.segbtn[aria-pressed="true"]{background:var(--accent);color:var(--accent-ink);font-weight:600}
.btn{border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);border-radius:4px;padding:8px 16px;font-weight:600;min-height:40px}
.btn:disabled{opacity:.45;cursor:default}
.smallbtn{font-size:.78rem;padding:4px 10px;border:1px solid var(--line);background:var(--surface);border-radius:4px}
.smallbtn[aria-pressed="true"]{border-color:var(--accent);color:var(--accent);font-weight:600}
.record{font-family:var(--mono);font-size:.82rem;color:var(--muted)}
.status{display:flex;gap:10px;align-items:center;flex-wrap:wrap;font-size:.9rem;min-height:26px}
.pill{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:3px 11px;font-size:.78rem;font-weight:600;border:1px solid var(--line);background:var(--surface)}
.pill.ok{border-color:var(--accent);color:var(--accent)}
.pill.busy::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--accent);animation:pulse 1s infinite}
.pill.err{border-color:var(--warn);color:var(--warn)}
@keyframes pulse{50%{opacity:.25}}
@media (prefers-reduced-motion:reduce){.pill.busy::before{animation:none}}

/* layout */
.app{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:24px;align-items:start}
@media (max-width:900px){.app{grid-template-columns:minmax(0,1fr)}}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:18px;display:flex;flex-direction:column;gap:14px;min-width:0}
.panel-h{display:flex;justify-content:space-between;align-items:baseline;gap:8px;flex-wrap:wrap}

/* case file */
.story{font-size:1rem;max-width:62ch}
.story .rule{display:block;margin-top:8px;padding:6px 10px;border-left:3px solid var(--accent);background:var(--bg);border-radius:0 4px 4px 0;font-weight:600}
.clues{margin:0;padding-left:1.7em;display:flex;flex-direction:column;gap:4px}
.clues li::marker{font-family:var(--display);color:var(--accent)}
.clues button{display:block;width:100%;text-align:left;border:0;background:transparent;padding:5px 8px;border-radius:4px;line-height:1.4}
.clues button:hover{background:var(--bg)}
.clues li.used button{text-decoration:line-through;color:var(--muted)}
.clues li.hot button{background:var(--hot)}
.accuse{display:flex;flex-direction:column;gap:10px;border-top:1px solid var(--line);padding-top:14px}
.suspects{display:flex;flex-wrap:wrap;gap:8px}
.suspect{border:1px solid var(--ink);background:transparent;border-radius:4px;padding:8px 16px;font-weight:600;min-height:40px}
.suspect:hover{background:var(--bg)}

/* verdict */
.verdict{display:flex;flex-direction:column;gap:10px;border-top:1px solid var(--line);padding-top:14px}
.verdict h3{font-size:1.3rem}
.verdict h3.ok{color:var(--accent)}
.verdict h3.bad{color:var(--warn)}
.whylist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}
.why{border:1px solid var(--line);background:var(--bg);border-radius:4px;padding:6px 10px;text-align:left;width:100%}
.why:hover{border-color:var(--accent)}
details summary{cursor:pointer;font-weight:600;font-size:.9rem}
details[open] summary{margin-bottom:8px}
.truth{border-collapse:collapse;font-size:.88rem;margin-bottom:6px}
.truth th,.truth td{padding:4px 12px 4px 0;text-align:left}
.truth thead th{font-size:.72rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600}
.truth tr.guilty th{color:var(--guilty)}
.truth small{margin-left:4px;color:var(--muted);font-weight:700}

/* notebook */
.grids{display:flex;flex-direction:column;gap:18px}
.grid h3{font-family:var(--body);font-size:.72rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);font-weight:600;margin-bottom:6px}
.grid table{border-collapse:collapse;width:100%;table-layout:fixed}
.grid thead th{font-size:.74rem;font-weight:600;color:var(--muted);padding:0 2px 6px;vertical-align:bottom;line-height:1.15;overflow-wrap:anywhere}
.grid thead th.scene{color:var(--ink)}
.grid tbody th{text-align:left;font-weight:600;font-size:.88rem;padding-right:8px;width:4.6em}
.grid thead td{width:4.6em}
.grid td{padding:2px}
.grid td.scene{background:var(--scene)}
.grid thead th.scene{background:var(--scene);border-radius:4px 4px 0 0}
.mark{width:100%;height:36px;border:1px solid var(--line);background:var(--bg);border-radius:4px;font-size:1rem;line-height:1;display:grid;place-items:center}
.mark.no{color:var(--muted)}
.mark.yes{color:var(--accent);border-color:var(--accent);font-size:1.1rem}

/* encoding */
.enc{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:24px;align-items:start}
@media (max-width:900px){.enc{grid-template-columns:minmax(0,1fr)}}
.rules{display:flex;flex-direction:column;gap:12px;max-width:62ch}
.rules ol{margin:0;padding-left:1.2em;display:flex;flex-direction:column;gap:8px}
.rules li::marker{font-family:var(--display);color:var(--accent)}
pre{margin:0;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:14px 16px;overflow-x:auto;font-family:var(--mono);font-size:.8rem;line-height:1.55;max-height:560px}
pre .c{color:var(--muted);font-style:italic}
.codehead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap}
.codehead .row{gap:6px}
footer{font-size:.78rem;color:var(--muted);max-width:75ch}
