@font-face{font-family:'Special Elite';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/special-elite-latin-400-normal.woff2') format('woff2')}
@font-face{font-family:'Courier Prime';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/courier-prime-latin-400-normal.woff2') format('woff2')}
@font-face{font-family:'Courier Prime';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/courier-prime-latin-700-normal.woff2') format('woff2')}
@font-face{font-family:'Courier Prime';font-style:italic;font-weight:400;font-display:swap;src:url('/fonts/courier-prime-latin-400-italic.woff2') format('woff2')}
@font-face{font-family:'Courier Prime';font-style:italic;font-weight:700;font-display:swap;src:url('/fonts/courier-prime-latin-700-italic.woff2') format('woff2')}
@font-face{font-family:'Kalam';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/kalam-latin-400-normal.woff2') format('woff2')}
@font-face{font-family:'Kalam';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/kalam-latin-700-normal.woff2') format('woff2')}
:root{padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}body{margin:0}img{max-width:100%}[hidden]{display:none!important}
/* Layout: one column of papers lying on a walnut desk. Folders hold the products, typed paper holds the
   story, handwriting holds the player's answers, rubber stamps carry state. A single dark desk by design;
   every colour below is a token, and paper surfaces redefine the contextual tokens for what sits on them. */
:root {
  --desk: #2b2118; --desk-2: #3b2d20; --desk-ink: #f3ebdc; --desk-dim: #cdbf9f; --desk-line: rgba(243, 235, 220, .18);
  --folder: #d9b978; --folder-2: #c7a35f; --folder-ink: #2a2620;
  --paper: #f3ebdc; --paper-2: #e8dcc4; --ink: #2a2620; --ink-dim: #5f5647; --rule: rgba(42, 38, 32, .24);
  --red: #b23a2e; --blue: #2a4a8a; --pencil: #7d7566;
  --note: #fbfaf5; --note-rule: #c9d8ec; --note-margin: #d98a8a; --tape: rgba(232, 221, 181, .85);
  --ok: #3f7a4c; --bad: #b23a2e; --hl: rgba(255, 214, 102, .55);
  --sq-ok: #4f8a5b; --sq-mid: #c9a227; --sq-hi: #d07a35; --sq-bad: #b23a2e;
  --flap: #101513; --flap-2: #1a201d; --flap-ink: #f2c66b; --flap-dim: #6f6a58;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 18px 30px -18px rgba(0, 0, 0, .85);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .12), 0 8px 16px -10px rgba(0, 0, 0, .6);
  --font-type: "Special Elite", "Courier New", monospace;
  --font-body: "Courier Prime", "Courier New", ui-monospace, monospace;
  --font-hand: "Kalam", "Bradley Hand", "Segoe Print", cursive;
  --font-mono: var(--font-body);
  --font-display: var(--font-type);
  /* contextual tokens: on the desk */
  --fg: var(--desk-ink); --fg-dim: var(--desk-dim); --line: var(--desk-line); --surface: rgba(243, 235, 220, .07);
  --btn-fg: var(--desk-ink); --btn-line: rgba(243, 235, 220, .6); --btn-p-bg: var(--paper); --btn-p-fg: var(--ink);
  --kick: var(--desk-dim); --link: #f0dfb8; --focus: #f2c66b;
  color-scheme: dark;
}
/* everything printed on paper uses ink-coloured contextual tokens */
.paper, .doc, .puzzle, .panel, .sharebox, .sheet, .drawer .ev, .memo, .rolecard, .objective, .solved-banner, .toast,
main > .prose, .report, .envelope, .sign, .passcover, .claiming, .ev {
  --fg: var(--ink); --fg-dim: var(--ink-dim); --line: var(--rule); --surface: rgba(42, 38, 32, .05);
  --btn-fg: var(--ink); --btn-line: rgba(42, 38, 32, .6); --btn-p-bg: var(--ink); --btn-p-fg: var(--paper);
  --kick: var(--red); --link: var(--red); --focus: var(--blue);
  color: var(--fg);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
:root[data-ts="s"] { font-size: 93.75%; }
:root[data-ts="l"] { font-size: 112.5%; }
:root[data-ts="xl"] { font-size: 125%; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--fg);
  background-color: var(--desk);
  background-image: repeating-linear-gradient(92deg, rgba(0, 0, 0, .09) 0 2px, rgba(0, 0, 0, 0) 2px 9px),
    repeating-linear-gradient(88deg, rgba(255, 220, 170, .025) 0 1px, rgba(0, 0, 0, 0) 1px 23px);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before { /* the desk lamp */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(70% 50% at 50% 0%, rgba(255, 214, 150, .14), rgba(0, 0, 0, 0) 70%), radial-gradient(120% 90% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .35) 100%);
}
#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
[tabindex="-1"]:focus { outline: none; }
a { color: var(--link); text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: 41rem; margin-inline: auto; padding-inline: 16px; }
main.wrap { padding-block: 1.25rem 4rem; flex: 1; }
@media (min-width: 640px) { .wrap { padding-inline: 24px; } }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--font-type); font-weight: 400; letter-spacing: .02em; line-height: 1.12; margin: 0 0 .5rem; text-wrap: balance; color: var(--fg); }
h1 { font-size: clamp(2.05rem, 8.5vw, 2.85rem); }
h2 { font-size: clamp(1.5rem, 6vw, 1.95rem); }
h3 { font-size: 1.22rem; }
.kicker { font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; color: var(--kick); margin: 0 0 .35rem; }
.prose p { margin: 0 0 .95em; max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }
.prose .line { padding-left: .85rem; border-left: 2px solid var(--line); }
.prose .who { display: block; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; color: var(--red); margin-bottom: .1rem; }
.muted { color: var(--fg-dim); }
.small { font-size: .9rem; }
.fine { font-size: .84rem; color: var(--fg-dim); margin: 0; line-height: 1.5; }
.meta { font-size: .86rem; color: var(--fg-dim); margin: 0; }
.mono-s { font-family: var(--font-body); font-weight: 700; letter-spacing: .04em; }
.lead { font-size: 1.08rem; color: var(--fg-dim); font-style: italic; margin: 0 0 1rem; }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.7rem; }
.stack > *, .stack-lg > *, .sharebox > *, .sheet .wrap > *, .panel > *, .paper > *, .puzzle > * { min-width: 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.field-label { font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; color: var(--fg-dim); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: 0 1.1rem;
  border-radius: 4px; border: 2px solid var(--btn-line); background: transparent; color: var(--btn-fg);
  font-family: var(--font-body); font-weight: 700; font-size: .98rem; letter-spacing: .07em; text-transform: uppercase; text-decoration: none; line-height: 1.15; text-align: center;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease; touch-action: manipulation;
}
.btn:hover { border-color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--btn-p-bg); color: var(--btn-p-fg); border-color: var(--btn-p-bg); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.btn-primary:hover { border-color: var(--btn-p-bg); filter: brightness(1.06); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 .8rem; font-size: .84rem; }
.btn-icon { min-width: 44px; min-height: 44px; padding: 0; border-color: transparent; }
.btn-icon:hover { border-color: transparent; background: var(--surface); }
.btn svg { width: 20px; height: 20px; flex: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: .92rem; text-align: left; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(33, 25, 18, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--desk-line); }
.topbar .wrap { display: flex; align-items: center; gap: .25rem; min-height: 56px; }
.topbar .title { flex: 1; min-width: 0; font-family: var(--font-type); text-transform: uppercase; letter-spacing: .1em; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; color: var(--desk-ink); }
.topbar .clock { font-size: .85rem; color: var(--desk-dim); padding: 0 .4rem; font-variant-numeric: tabular-nums; }
.badge { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .25rem; border-radius: 999px; background: var(--red); color: #fff; font-weight: 700; font-size: .7rem; line-height: 1; }
.nb-btn { position: relative; }
.nb-btn .badge { position: absolute; top: 4px; right: 2px; }

/* ---------- typewriter title ---------- */
.typed { display: inline; }
.typed .k { display: inline-block; }
.typed.anim .k { animation: strike .16s ease-out both; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
@keyframes strike { 0% { opacity: 0; transform: translateY(-.12em) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 1; transform: none; } }

/* ---------- stamps ---------- */
.stamp {
  display: inline-block; font-family: var(--font-type); text-transform: uppercase; letter-spacing: .08em; font-size: .86rem; line-height: 1.2;
  color: var(--red); border: 2px solid currentColor; border-radius: 6px; padding: .12rem .5rem; transform: rotate(-5deg); opacity: .88; white-space: nowrap;
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0, 0, 0, .78) 61%), linear-gradient(#000, #000);
}
.stamp.blue { color: var(--blue); }
.stamp.corner { position: absolute; top: .85rem; right: .85rem; transform: rotate(8deg); }

/* ---------- folders and paper ---------- */
.folder { position: relative; margin-top: 1.1rem; background: var(--folder); border-radius: 5px 14px 8px 8px; padding: 1.7rem .7rem .75rem; box-shadow: var(--shadow); color: var(--folder-ink); }
.folder > .tab { position: absolute; top: -1.05rem; left: .9rem; max-width: calc(100% - 1.8rem); background: var(--folder); border-radius: 8px 8px 0 0; padding: .32rem .9rem .1rem; font-family: var(--font-type); font-size: .9rem; letter-spacing: .05em; color: var(--folder-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder > .paper { position: relative; background: var(--paper); padding: 1rem 1rem 1.05rem; box-shadow: 0 4px 10px rgba(0, 0, 0, .16); transform: rotate(-.35deg); display: grid; gap: .6rem; }
.folder > .paper h2, .folder > .paper h3 { margin: 0; }
/* state stamps sit on the folder itself, just above the paper's top-right corner */
.folder > .paper > .stamp.corner { top: -1.55rem; right: .1rem; transform: rotate(6deg); z-index: 1; }
.folder > .paper p { margin: 0; }
.folder.mini > .paper { transform: rotate(.3deg); }
.folder.dfile > .paper { transform: none; }
.sealed-file > .paper { gap: .7rem; }
.sealed-file.flat { display: grid; gap: .5rem; }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.ticks li { position: relative; padding-left: 1.3rem; font-size: .95rem; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .6em; width: .75rem; height: 2px; background: var(--red); }
.paper { position: relative; }
.doc { position: relative; background: var(--paper); border-radius: 2px; padding: 1.05rem 1.1rem; box-shadow: var(--shadow); }
.doc.tilt-l { transform: rotate(-.7deg); }
.doc.tilt-r { transform: rotate(.6deg); }
.doc::before { /* a strip of tape holding the paper to the desk */
  content: ""; position: absolute; top: -.55rem; left: 50%; width: 5.5rem; height: 1.3rem; margin-left: -2.75rem; background: var(--tape); transform: rotate(-2deg); box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.doc.notes::before, .doc.record::before, .chalk::before { display: none; }
main > .prose, .report { background: var(--paper); padding: 1.05rem 1.15rem; box-shadow: var(--shadow); border-radius: 2px; }
.panel { background: var(--paper); border-radius: 3px; padding: 1rem 1.05rem; box-shadow: var(--shadow-sm); }
.panel.flat { background: var(--paper-2); box-shadow: none; }
.panel h3 { margin-bottom: .35rem; }

/* memo slips: tear-off notes for callouts, the follow block and challenges */
.memo { background: var(--note); border-top: 4px solid var(--note-margin); padding: .9rem 1rem 1rem; box-shadow: var(--shadow-sm); display: grid; gap: .6rem; transform: rotate(-.25deg); }
.memo p { margin: 0; }
.memo .kicker { margin: 0; }

/* ---------- home ---------- */
.intro { padding-block: 1.2rem .2rem; display: grid; gap: .3rem; }
.intro h1 { font-size: clamp(2.4rem, 12vw, 3.5rem); margin: 0; color: var(--desk-ink); }
.intro .tag { margin: .2rem 0 0; color: var(--desk-dim); font-size: 1.04rem; max-width: 34ch; }
.how h2 { font-size: 1.4rem; margin: 0; }
.how .prose { color: var(--desk-ink); }
.foot { padding-block: 1.6rem 2.4rem; color: var(--desk-dim); font-size: .84rem; border-top: 1px solid var(--desk-line); margin-top: 1rem; display: grid; gap: .5rem; }
.foot p { margin: 0; }
.foot .links { display: flex; flex-wrap: wrap; gap: .2rem .4rem; align-items: baseline; }
.foot a, .foot .linkish { color: var(--link); font-size: .84rem; }

/* ---------- the frozen departures board (an object inside the case) ---------- */
.board { background: var(--flap); color: var(--flap-ink); border-radius: 8px; padding: .4rem; box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, .04); }
.board-head { display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .6rem; padding: .45rem .7rem .3rem; font-weight: 700; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--flap-dim); }
.dep { display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .6rem; align-items: center; width: 100%; text-align: left; padding: .8rem .7rem; border: 0; border-top: 1px solid rgba(255, 255, 255, .06); background: transparent; color: var(--flap-ink); }
.dep .t { font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dep .t b { font-family: var(--font-type); font-weight: 400; font-size: 1.2rem; margin-right: .35rem; }
.board.trains .board-head, .board.trains .dep { grid-template-columns: 5.6rem minmax(0, 1fr) auto; }
.dep .d { min-width: 0; }
.dep .d b { display: block; font-weight: 700; font-size: 1.12rem; letter-spacing: .08em; text-transform: uppercase; line-height: 1.1; }
.dep .d span { display: block; font-size: .84rem; color: #c9c2ad; margin-top: .2rem; }
.dep .s { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .92rem; text-align: right; white-space: nowrap; }
.dep .s.dim { color: var(--flap-dim); }
.blankflap { display: inline-block; letter-spacing: .1em; color: var(--flap-dim); }

/* ---------- case documents ---------- */
.hand { font-family: var(--font-hand); font-size: 1.32rem; line-height: 1.32; color: #1f3f78; }
.note-card { background: var(--note); background-image: repeating-linear-gradient(transparent 0 1.72rem, var(--note-rule) 1.72rem calc(1.72rem + 1px)); padding-top: 1.3rem; }
.note-card .hand p { margin: 0 0 .55rem; }
.ticket-wrap { perspective: 1200px; max-width: 360px; margin-inline: auto; width: 100%; }
.ticket { position: relative; aspect-ratio: 1.85 / 1; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, .7, .2, 1); }
.ticket.flipped { transform: rotateY(180deg); }
.ticket .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 7px; background: #d4e3c6; color: #1d2a1f; box-shadow: var(--shadow-sm); overflow: hidden; }
.ticket .back { transform: rotateY(180deg); background: #dbe7cf; }
.ticket svg { width: 100%; height: 100%; display: block; }
.cf { background: #e9d2a4; color: #2a2114; }
.cf .grid2 { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .92rem; }
.cf .grid2 dt { color: #7a6440; text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; padding-top: .2rem; }
.cf .grid2 dd { margin: 0; }
.cf .hole { position: absolute; left: .7rem; top: .7rem; width: .9rem; height: .9rem; border-radius: 50%; background: var(--desk); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.cf .perf { position: absolute; right: 0; top: .5rem; bottom: .5rem; border-right: 2px dashed rgba(42, 33, 20, .35); }
.smudge { display: inline-block; width: .8em; height: 1em; vertical-align: -.12em; border-radius: 40%; background: radial-gradient(circle at 50% 50%, rgba(40, 30, 15, .75), rgba(40, 30, 15, .25) 60%, transparent 72%); }
.quote { border-left: 4px solid var(--red); }
.quote blockquote { margin: 0; font-style: italic; font-size: 1.02rem; }
.slip { font-size: .9rem; background: #f6f2e6; color: #2b2a26; border-top: 6px solid #6b7f74; }
.chalk { background: #24302b; background-image: radial-gradient(120% 80% at 30% 20%, rgba(255, 255, 255, .06), transparent 60%); color: #eef2ec; border-radius: 6px; padding: .75rem; border: 8px solid #6e5a3c; box-shadow: var(--shadow); }
.chalk .crow { display: grid; grid-template-columns: 3.6rem 1fr auto auto; gap: .6rem; align-items: baseline; width: 100%; text-align: left; padding: .5rem .5rem; border: 2px solid transparent; border-radius: 6px; background: transparent; color: inherit; font-family: var(--font-hand); font-size: 1.2rem; line-height: 1.15; }
.chalk .crow:hover { background: rgba(255, 255, 255, .05); }
.chalk .crow[aria-pressed="true"] { border-color: #f2c66b; background: rgba(242, 198, 107, .1); }
.chalk .crow .k { font-size: 1rem; opacity: .8; }
.record { background: #f2ecdc; color: #2a261c; }
.record .stamp { position: absolute; right: .9rem; bottom: 1.1rem; transform: rotate(8deg); font-size: .9rem; }
.seal-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.seal-opt { display: grid; justify-items: center; gap: .4rem; padding: .7rem .3rem .8rem; border-radius: 4px; border: 2px solid var(--rule); background: #fffdf7; color: var(--ink); }
.seal-opt[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.seal-opt .book { width: 100%; max-width: 110px; aspect-ratio: 3 / 4; border-radius: 4px 8px 8px 4px; background: linear-gradient(90deg, #121212 0 8%, #1d1d1d 8% 100%); display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.seal-opt .book svg { width: 74%; height: auto; }
.seal-opt .lbl { font-weight: 700; letter-spacing: .04em; white-space: nowrap; font-size: .92rem; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; text-align: center; }
.compare figure { margin: 0; display: grid; justify-items: center; gap: .35rem; padding: .7rem .4rem; border-radius: 4px; background: #fffdf7; border: 1px solid var(--rule); }
.compare figcaption { font-size: .85rem; color: var(--ink-dim); }
.compare svg { width: min(140px, 100%); height: auto; }
.seal-ref { width: 112px; height: 112px; }

/* ---------- puzzle cards ---------- */
.puzzle { background: var(--paper); padding: 1.05rem 1rem 1.1rem; box-shadow: var(--shadow); border-radius: 2px; position: relative; }
.puzzle > .spread h2 { font-size: 1.4rem; }
.step-h { display: flex; gap: .6rem; align-items: baseline; }
.step-h .n { font-family: var(--font-type); color: var(--red); white-space: nowrap; }
.feedback { min-height: 1.5rem; font-size: .96rem; }
.feedback.bad, .feedback .bad { color: var(--bad); }
.feedback.ok { color: var(--ok); }
.shake { animation: shake .42s ease; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); } }
.solved-banner { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; background: #eef2e6; border-left: 5px solid var(--ok); box-shadow: var(--shadow-sm); }
.solved-banner svg { flex: none; width: 26px; height: 26px; color: var(--ok); margin-top: .1rem; }
.pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes pop { 0% { transform: scale(.94); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* inputs: typed boxes; answers to puzzles are written by hand */
.input { min-height: 50px; border-radius: 3px; border: 0; border-bottom: 2px solid var(--ink); background: rgba(255, 255, 255, .55); padding: 0 .75rem; font-family: var(--font-body); font-size: 1.05rem; letter-spacing: .03em; width: 100%; color: var(--ink); }
.input::placeholder { color: #8f8676; }
.input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
form[data-form="p1"] .input, form[data-form="p4"] .input { font-family: var(--font-hand); color: var(--blue); font-size: 1.45rem; letter-spacing: .02em; }
.answer-row { display: flex; gap: .6rem; }
.answer-row .input { flex: 1; min-width: 0; }

/* segmented controls */
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button { min-height: 44px; min-width: 44px; padding: 0 .85rem; border-radius: 3px; border: 2px solid var(--rule); background: rgba(255, 255, 255, .4); color: var(--ink); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .86rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.setting { display: grid; gap: .5rem; padding: .9rem 0; border-top: 1px dashed var(--rule); }
.setting:first-child { border-top: 0; }
.setting .name { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .86rem; }
.setting .hint { font-size: .9rem; color: var(--ink-dim); }

/* ---------- the station: leads as index cards ---------- */
.objective { background: var(--note); border-top: 4px solid var(--note-margin); padding: .75rem .9rem; box-shadow: var(--shadow-sm); }
.objective .kicker { margin-bottom: .15rem; }
.signs { display: grid; gap: .55rem; }
.sign { display: grid; grid-template-columns: 2.3rem 1fr auto; gap: .7rem; align-items: center; width: 100%; text-align: left; min-height: 64px; padding: .7rem .85rem; border-radius: 2px; border: 0; border-top: 3px solid rgba(217, 138, 138, .85); background: #fffdf6; box-shadow: var(--shadow-sm); }
.sign .arrow { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); }
.sign .arrow svg { width: 17px; height: 17px; }
.sign b { display: block; font-family: var(--font-type); font-weight: 400; font-size: 1.08rem; line-height: 1.15; }
.sign span { display: block; font-size: .86rem; color: var(--ink-dim); }
.sign .st { font-family: var(--font-type); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; padding: .1rem .4rem; border: 2px solid currentColor; border-radius: 4px; color: var(--ink-dim); white-space: nowrap; transform: rotate(-4deg); }
.sign .st.new { color: var(--red); }
.sign .st.done { color: var(--blue); }
.sign .st.sealed { color: var(--red); }
.sign[disabled] { opacity: .55; cursor: not-allowed; }
.sign.is-sealed { background-color: #f4efe3; }
.paths { display: grid; gap: .5rem; }
.pathrow { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; font-size: .95rem; }
.pips { display: flex; gap: .3rem; }
.pip { width: .72rem; height: .72rem; border-radius: 50%; border: 2px solid var(--ink-dim); }
.pip.on { background: var(--blue); border-color: var(--blue); }

/* ---------- torn timetable ---------- */
.strip-stage { background: rgba(42, 38, 32, .06); border: 1px dashed var(--rule); border-radius: 4px; padding: .6rem; overflow: hidden; color: var(--ink); }
.strip-stage svg { width: 100%; height: auto; display: block; }
.tray { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; min-height: 4.5rem; }
.tray button { border: 1px solid var(--rule); background: #fffdf7; border-radius: 3px; padding: .35rem; display: grid; gap: .25rem; justify-items: center; box-shadow: var(--shadow-sm); }
.tray button svg { height: 140px; width: auto; display: block; }
.tray button span { font-weight: 700; font-size: .74rem; letter-spacing: .1em; color: var(--ink-dim); }

/* ---------- padlock ---------- */
.dials { display: flex; justify-content: center; gap: .55rem; }
.dial { display: grid; justify-items: center; gap: .3rem; }
.dial button { width: 56px; height: 44px; border-radius: 4px; border: 2px solid var(--rule); background: #fffdf7; color: var(--ink); display: grid; place-items: center; }
.dial .digit { width: 56px; height: 72px; display: grid; place-items: center; border-radius: 8px; font-size: 2.2rem; font-weight: 700; color: #2b1d07; background: linear-gradient(180deg, #8a6a2c, #e6c27a 22%, #f3d79a 50%, #d2a95c 78%, #7d5e25); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35), var(--shadow-sm); }
.padlock { display: grid; justify-items: center; gap: 1rem; }

/* ---------- choices ---------- */
.choices { display: grid; gap: .7rem; }
.choice { display: grid; grid-template-columns: 3rem 1fr; gap: .9rem; text-align: left; width: 100%; padding: .9rem; border-radius: 3px; border: 2px solid var(--rule); background: #fffdf7; color: var(--ink); }
.choice[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.mono { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-type); background: var(--ink); color: var(--paper); }
.choice b { display: block; font-family: var(--font-type); font-weight: 400; font-size: 1.12rem; }
.choice .lbl { display: block; font-size: .82rem; color: var(--ink-dim); margin-bottom: .2rem; text-transform: uppercase; letter-spacing: .08em; }
.choice q { display: block; font-style: italic; quotes: none; }
.trainpick { display: grid; gap: .5rem; }
.trainpick button { display: grid; grid-template-columns: 2.4rem 1fr; gap: .7rem; align-items: center; padding: .7rem .8rem; border-radius: 3px; border: 2px solid var(--rule); background: #fffdf7; color: var(--ink); text-align: left; }
.trainpick button[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.trainpick .letter { font-family: var(--font-type); font-size: 1.6rem; color: var(--red); text-align: center; }
.trainpick .info b { font-weight: 700; letter-spacing: .03em; display: block; }
.trainpick .info span { font-size: .85rem; color: var(--ink-dim); }
.evpick { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); }
.evpick button { text-align: left; padding: .5rem .7rem; border-radius: 3px; border: 1px solid var(--rule); background: #fffdf7; font-size: .88rem; line-height: 1.35; color: var(--ink-dim); }
.evpick button[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: #f1f4fb; }
.evpick button b { font-weight: 700; display: block; color: var(--ink); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(12, 8, 5, .62); z-index: 40; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; overflow: auto; background: var(--paper); border-radius: 10px 10px 0 0;
  padding: .6rem 0 calc(1.2rem + env(safe-area-inset-bottom, 0px)); animation: up .28s cubic-bezier(.2, .8, .2, 1) both; box-shadow: 0 -18px 40px -20px rgba(0, 0, 0, .7); }
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet .grab { width: 44px; height: 4px; border-radius: 4px; background: var(--rule); margin: 0 auto .6rem; }
.sheet .wrap { display: grid; gap: .9rem; }
.sheet h2 { font-size: 1.5rem; }
@media (min-width: 760px) { .sheet { left: 50%; right: auto; width: 640px; transform: translateX(-50%); bottom: auto; top: 7vh; border-radius: 6px; animation: fade .2s ease both; max-height: 86vh; } }
.drawer { position: fixed; top: 0; bottom: 0; right: 0; z-index: 41; width: min(100%, 440px); background: var(--folder); color: var(--ink); display: flex; flex-direction: column; animation: slide .28s cubic-bezier(.2, .8, .2, 1) both; padding-top: env(safe-area-inset-top, 0px); box-shadow: -18px 0 40px -20px rgba(0, 0, 0, .7);
  --fg: var(--ink); --fg-dim: var(--ink-dim); --line: var(--rule); --btn-fg: var(--ink); --btn-line: rgba(42, 38, 32, .6); --kick: var(--red); --focus: var(--blue); }
@keyframes slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer header { display: flex; align-items: center; gap: .5rem; padding: .6rem 16px; border-bottom: 2px solid var(--folder-2); }
.drawer header h2 { flex: 1; margin: 0; font-size: 1.4rem; }
.drawer .body { flex: 1; min-height: 0; overflow: auto; padding: .9rem 16px calc(2rem + env(safe-area-inset-bottom, 0px)); }
.drawer .body > * + * { margin-top: .8rem; }
.filters { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; flex: none; min-height: 40px; }
.filters button { flex: none; min-height: 36px; padding: 0 .75rem; border-radius: 999px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .78rem; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--folder); }
.ev { background: var(--paper); border-radius: 2px; padding: .75rem .85rem; display: grid; gap: .3rem; box-shadow: var(--shadow-sm); }
.ev .top { display: flex; gap: .5rem; align-items: center; }
.ev .top b { flex: 1; font-family: var(--font-type); font-weight: 400; font-size: 1.02rem; }
.ev .kind { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .66rem; color: var(--ink-dim); border: 1px solid var(--rule); border-radius: 3px; padding: .05rem .35rem; white-space: nowrap; }
.ev .new { color: #fff; background: var(--red); border-color: transparent; }
.ev p { margin: 0; font-size: .94rem; }
.pin { width: 36px; height: 36px; border-radius: 4px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--ink-dim); }
.pin[aria-pressed="true"] { color: var(--red); border-color: var(--rule); }
.pin svg { width: 18px; height: 18px; }
.toast { position: fixed; left: 0; right: 0; margin-inline: auto; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--paper); color: var(--ink); padding: .65rem 1rem; border-radius: 3px; font-size: .95rem; box-shadow: var(--shadow); max-width: calc(100% - 32px); width: max-content; animation: toastIn .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* hints from the porters' room sit at the top, clear of the picker sheet at the bottom */
.toast.memo { top: calc(env(safe-area-inset-top, 0px) + 64px); bottom: auto; background: var(--note); border-top: 4px solid var(--note-margin); width: min(26rem, calc(100% - 32px)); text-align: left; cursor: pointer; line-height: 1.45; }
@media (min-width: 1100px) { .toast.memo { top: auto; bottom: 1.5rem; left: auto; right: 1.5rem; margin: 0; } }
.toast .from { display: block; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; color: var(--red); margin-bottom: .2rem; }
.pause-cover { position: fixed; inset: 0; z-index: 50; background: var(--desk); color: var(--desk-ink); display: grid; place-items: center; text-align: center; padding: 16px; }
.claiming { display: grid; gap: .6rem; justify-items: center; text-align: center; padding: 1.2rem 0 .6rem; }

/* hint envelopes */
.envelopes { display: grid; gap: .7rem; }
.envelope { position: relative; display: grid; gap: .3rem; width: 100%; text-align: left; border-radius: 3px; padding: 1rem 1.05rem; box-shadow: var(--shadow-sm); }
.envelope.sealed { border: 0; min-height: 76px; background: var(--folder); background-image: linear-gradient(160deg, rgba(0, 0, 0, .07) 0 50%, transparent 50%), linear-gradient(200deg, rgba(0, 0, 0, .07) 0 50%, transparent 50%); background-size: 50% 2.4rem, 50% 2.4rem; background-position: left top, right top; background-repeat: no-repeat; color: var(--ink); }
.envelope.sealed::after { content: ""; position: absolute; right: 1rem; top: 50%; width: 1.7rem; height: 1.7rem; margin-top: -.85rem; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #c2503f, #8b2a22 65%, #6a1d18); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.envelope.sealed[disabled] { opacity: .55; cursor: not-allowed; }
.envelope.open { background: var(--note); border-top: 4px solid var(--note-margin); }
.env-h { margin: 0; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .76rem; color: var(--red); padding-right: 2.6rem; }
.env-b { margin: 0; line-height: 1.5; }
.env-cta { font-family: var(--font-type); font-size: 1.05rem; padding-right: 2.6rem; }

/* role cards */
.rolecard { background: var(--note); border-radius: 2px; padding: 1.15rem; box-shadow: var(--shadow); border-top: 6px solid var(--red); }
.rolecard h3 { margin-bottom: .45rem; }
.rolecard .talk { margin-top: .7rem; padding-top: .6rem; border-top: 1px dashed var(--rule); font-size: .92rem; color: var(--ink-dim); }
.passcover { display: grid; place-items: center; text-align: center; gap: 1rem; padding: 2.2rem 1rem; border-radius: 4px; background: var(--folder); box-shadow: var(--shadow); }

/* endings and results */
.ending-mark { font-size: 3rem; line-height: 1; color: var(--red); font-family: Georgia, "Times New Roman", serif; }
.facts { margin: 0; padding-left: 1.2rem; display: grid; gap: .55rem; }
.facts li { padding-left: .2rem; }
.sq { display: inline-block; width: 1.3rem; height: 1.3rem; border-radius: 2px; vertical-align: middle; opacity: .92; }
.sq.ok { background: var(--sq-ok); } .sq.mid { background: var(--sq-mid); } .sq.hi { background: var(--sq-hi); } .sq.bad { background: var(--sq-bad); } .sq.none { background: var(--rule); }
.sqgrid { display: inline-grid; gap: 4px; }
.sharebox { position: relative; display: grid; gap: .8rem; padding: 1rem; background: var(--paper); border-radius: 2px; box-shadow: var(--shadow); }
.sharebox h3 { font-size: 1.35rem; }
.sharetext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; background: rgba(42, 38, 32, .06); border-radius: 3px; padding: .7rem .8rem; border: 1px dashed var(--rule); user-select: all; -webkit-user-select: all; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; text-align: center; }
.stats b { display: block; font-family: var(--font-type); font-weight: 400; font-size: 1.8rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stats span { font-size: .76rem; color: var(--ink-dim); }
.bars { display: grid; gap: .3rem; }
.bar { display: grid; grid-template-columns: 5.4rem 1fr; gap: .5rem; align-items: center; font-size: .82rem; }
.bar i { display: block; height: 1.15rem; border-radius: 2px; background: var(--rule); min-width: 1.2rem; text-align: right; padding-right: .35rem; font-style: normal; font-size: .76rem; line-height: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.bar i.me { background: var(--blue); color: #fff; }
.countdown { font-variant-numeric: tabular-nums; }

/* ---------- daily: the teletype reconstruction form ---------- */
.form-head { display: grid; gap: .05rem; }
.form-head b { font-family: var(--font-type); font-weight: 400; font-size: 1.12rem; letter-spacing: .04em; text-transform: uppercase; }
.form-head span { font-size: .84rem; color: var(--ink-dim); }
.dgrid { display: grid; column-gap: .35rem; min-width: 0; }
.dgrid .h { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .72rem; padding: .2rem .15rem .3rem; border-bottom: 2px solid var(--ink); }
.dgrid .tm { font-size: .98rem; display: flex; align-items: center; padding: 0 .15rem; font-variant-numeric: tabular-nums; border-bottom: 1px dotted rgba(42, 38, 32, .35); }
.cell { position: relative; min-height: 54px; border: 0; border-bottom: 1px dotted rgba(42, 38, 32, .35); background: transparent; color: var(--ink); padding: .2rem .25rem .25rem; text-align: left; display: flex; align-items: center; min-width: 0; border-radius: 0; }
.cell:not(.placed)::before { content: ""; position: absolute; left: .25rem; right: .5rem; bottom: .62rem; border-bottom: 2px dashed rgba(42, 38, 32, .22); }
.cell:hover { background: rgba(42, 38, 32, .045); }
.cell.sel::after { content: ""; position: absolute; inset: 3px 0 4px; border: 2.5px solid var(--red); border-radius: 50%; transform: rotate(-2.5deg); }
.cell .val { font-family: var(--font-hand); color: var(--blue); font-size: 1.32rem; line-height: 1.05; overflow-wrap: anywhere; }
.dgrid.c3 .cell .val { font-size: 1.12rem; }
.cell .val { overflow-wrap: break-word; }
@media (max-width: 400px) { .folder.dfile > .paper.form { padding-inline: .7rem; } .folder.dfile { padding-inline: .55rem; } .dgrid.c3 .cell .val { font-size: 1.05rem; } }
.cell .cands { position: relative; display: flex; flex-wrap: wrap; gap: 0 .3rem; font-family: var(--font-hand); font-size: .84rem; color: var(--pencil); line-height: 1.15; margin-bottom: .55rem; }
.cell.placed .val { animation: ink .4s ease both; }
@keyframes ink { from { opacity: 0; transform: translateY(-2px) rotate(-2deg); } to { opacity: 1; transform: none; } }
.cell .mk { position: absolute; top: 5px; right: 3px; width: 7px; height: 7px; border-radius: 50%; }
.cell .mk.m1 { background: var(--sq-mid); } .cell .mk.m2 { background: var(--sq-hi); } .cell .mk.m3 { background: var(--sq-bad); }
.cell:disabled { cursor: default; }
.notes { background: var(--note); border-top: 4px solid var(--note-margin); padding: 1rem .9rem .9rem; transform: rotate(.35deg); }
.notes .clip { position: absolute; top: -18px; right: 26px; width: 20px; height: 46px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 46'%3E%3Cpath d='M6 42V9a4 4 0 0 1 8 0v27a2.2 2.2 0 0 1-4.4 0V13' fill='none' stroke='%238d949c' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain; }
.notes .kicker { margin-bottom: .2rem; }
.notes ol { margin: 0; padding: 0; list-style: none; display: grid; counter-reset: n; }
.notes li { counter-increment: n; }
.notes li + li { border-top: 1px solid var(--note-rule); }
.notes li button { display: grid; grid-template-columns: 1.7rem 1fr; gap: .35rem; width: 100%; text-align: left; border: 0; background: transparent; padding: .55rem .2rem; border-radius: 2px; color: var(--ink); font-size: 1rem; line-height: 1.45; }
.notes li button::before { content: counter(n) "."; font-weight: 700; color: var(--red); }
.notes li button:hover { background: rgba(42, 38, 32, .04); }
.notes li.done button { color: #8a8273; text-decoration: line-through; text-decoration-color: var(--blue); text-decoration-thickness: 2px; }
.notes li.hl button { background: var(--hl); }
.notes .fine { margin-top: .5rem; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(9.5rem, 100%), 1fr)); gap: .5rem; }
.opt { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .4rem .75rem; border-radius: 3px; border: 1px solid var(--rule); background: #fffdf7; color: var(--ink); font-weight: 700; font-size: 1rem; text-align: left; box-shadow: 0 2px 0 rgba(42, 38, 32, .08); }
.opt .nm { min-width: 0; overflow-wrap: anywhere; }
.opt.x { opacity: .6; }
.opt.x .nm { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.opt.taken { opacity: .38; }
.opt small { white-space: nowrap; font-weight: 400; font-size: .76rem; color: var(--ink-dim); }
.modes { display: flex; gap: .4rem; }

/* motion off */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; } }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }

/* ---------- plain pages (terms, 404) ---------- */
.legal { display: grid; gap: 1.1rem; padding-block: 1.6rem 3rem; }
.legal > .kicker a { color: var(--desk-dim); text-decoration: none; }
.legal h1 { margin: 0; }
.legal .report h2 { font-size: 1.3rem; margin-bottom: .4rem; }
.legal .report p { margin: 0 0 .75em; max-width: 64ch; }
.legal .report p:last-child { margin-bottom: 0; }
.legal .fine { color: var(--desk-dim); }
