/* ─────────────────────────────────────────────────────────────────────────
   The Register — a walnut desk, a cream book, a box of highlighters.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --book: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display: "Baskerville", "Libre Baskerville", "Iowan Old Style", Georgia, serif;
  --hand: "Noteworthy", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --desk: #17120e;
  --desk-2: #221a14;
  --panel: #241c16;
  --panel-2: #2e241c;
  --line: rgba(255, 236, 210, 0.09);
  --line-2: rgba(255, 236, 210, 0.16);
  --ui-ink: #efe5d3;
  --ui-muted: #ad9f88;
  --brass: #d1ab62;
  --accent: #b8432f;
  --accent-ink: #fff4ec;
  --good: #8fcf8a;
  --bad: #ff8f7d;

  --paper: #fbf6e9;
  --paper-2: #f3ead6;
  --ink: #2b2219;
  --ink-soft: #75685a;
  --ink-faint: #a99a83;
  --rule: #d6c7a7;
  --oxblood: #8e2a1e;

  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --desk: #d8cdb9; --desk-2: #cbbfa8; --panel: #efe7d8; --panel-2: #e6dcc9;
    --line: rgba(60, 40, 20, 0.10); --line-2: rgba(60, 40, 20, 0.18);
    --ui-ink: #2b2219; --ui-muted: #6f6151; --brass: #8a6420; --good: #2f7d32; --bad: #b3261e;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% 40%, var(--desk-2), var(--desk));
  color: var(--ui-ink);
  font: 15px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; background: var(--line); padding: 1px 5px; border-radius: 4px; }
kbd { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--panel-2); }
.muted { color: var(--ui-muted); }
.bad { color: var(--bad); }
.good { color: var(--good); }

/* ── buttons & inputs ─────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px;
  padding: 8px 14px; font-weight: 550; letter-spacing: .01em; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--brass); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #8e2a1e; border-color: #8e2a1e; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line); border-color: transparent; }
.btn.ghost.on { background: var(--line-2); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 14px 22px; font-size: 16px; }
.btn.icon span { margin-left: 2px; }
.danger-text { color: var(--bad); }
.input {
  width: 100%; background: var(--desk); color: var(--ui-ink); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 10px 12px; font: 16px var(--ui); outline: none;
}
.input:focus { border-color: var(--brass); }
.input.tiny { width: 64px; padding: 4px 8px; display: inline-block; font-size: 14px; }
textarea.input { resize: vertical; font-family: ui-monospace, Menlo, monospace; }
.pill { display: inline-block; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ui-muted); vertical-align: middle; }
.check, .radio { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.row { display: flex; gap: 10px; }
.row select { width: 150px; flex: none; }

/* ── home ─────────────────────────────────────────────────────────────── */
.home { height: 100%; overflow-y: auto; padding: 56px 24px 32px; }
.home-grid { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: 1.2fr .8fr; gap: 56px; align-items: center; }
.brand-kicker { font: 600 12px var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--brass); }
.brand-title { font: 400 84px/1 var(--display); margin: 14px 0 18px; letter-spacing: -.01em; }
.brand-sub { font: 19px/1.55 var(--book); color: var(--ui-muted); max-width: 34em; margin: 0 0 32px; }
.credit { margin: 28px 0 0; max-width: 36em; font-size: 12.5px; line-height: 1.5; color: var(--ui-muted); }
.credit cite { font-style: italic; color: var(--ui-ink); }
.home-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.continue-card {
  width: 100%; max-width: 560px; text-align: left; display: grid; gap: 4px; padding: 18px 20px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-2); border-radius: 12px;
  transition: border-color .15s, transform .15s;
}
.continue-card:hover { border-color: var(--brass); transform: translateY(-1px); }
.cc-kicker { font: 650 11px var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--brass); }
.cc-title { font: 26px var(--display); }
.cc-meta { color: var(--ui-muted); font-size: 13.5px; }
.cc-bar, .f-bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.cc-bar i, .f-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--brass); }
.cover { perspective: 1400px; display: flex; justify-content: center; }
.cover-inner {
  width: 300px; height: 400px; border-radius: 4px 12px 12px 4px; position: relative;
  background: radial-gradient(400px 300px at 30% 20%, #7d2a1f, #4a1610 70%), #4a1610;
  box-shadow: inset 14px 0 18px -10px rgba(0,0,0,.6), inset -2px 0 0 rgba(255,255,255,.05), 0 30px 60px rgba(0,0,0,.45), 0 4px 0 #2c0d09;
  transform: rotateY(-14deg) rotateX(4deg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: #e8c983; text-align: center; font-family: var(--display);
}
.cover-inner::before { content: ''; position: absolute; inset: 18px 18px 18px 28px; border: 1.5px solid rgba(232, 201, 131, .55); border-radius: 3px; }
.cv-kicker { font-size: 13px; letter-spacing: .3em; text-transform: uppercase; }
.cv-title { font-size: 44px; line-height: 1.05; }
.cv-num { font-size: 15px; letter-spacing: .25em; opacity: .8; }
.cv-rule { width: 60px; height: 1px; background: rgba(232, 201, 131, .6); }
.files { max-width: 1080px; margin: 64px auto 0; }
.files-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.files-head h2 { font: 400 24px var(--display); margin: 0; }
.files-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.file-main { flex: 1; display: grid; text-align: left; gap: 3px; background: none; border: 0; padding: 14px 6px; border-radius: 8px; }
.file-main:hover .f-title { color: var(--brass); }
.f-title { font: 19px var(--display); }
.f-meta { color: var(--ui-muted); font-size: 13px; }
.file.is-solved .f-bar i { background: var(--good); }
.empty { padding: 20px 0; }
.home-foot { max-width: 1080px; margin: 48px auto 0; display: flex; justify-content: space-between; color: var(--ui-muted); font-size: 12.5px; gap: 16px; flex-wrap: wrap; }
.home-back { color: var(--brass); text-decoration: none; }
.home-back:hover { text-decoration: underline; }
.share-link { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.diff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.mode { text-align: left; display: grid; gap: 6px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; }
.mode .d-name { font: 21px var(--display); }
.mode .d-blurb { color: var(--ui-muted); font-size: 13.5px; }
.mode.on { border-color: var(--brass); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--brass); }
.mode.on .d-blurb { color: var(--ui-ink); }
.small-print { font-size: 12.5px; margin: 12px 0 0; }
.diff { text-align: left; display: grid; gap: 8px; align-content: start; padding: 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); }
.diff:hover { border-color: var(--brass); }
.diff.rec { border-color: rgba(209, 171, 98, .5); }
.d-name { font: 24px var(--display); }
.d-blurb { color: var(--ui-ink); }
.d-meta { color: var(--ui-muted); font-size: 12.5px; }
.checks { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: start; }
.checks li > span { font-weight: 700; width: 18px; }
.checks li.ok > span { color: var(--good); }
.checks li.bad > span { color: var(--bad); }
.balance { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.balance th { text-align: left; font-weight: 600; color: var(--ui-muted); font-size: 11.5px; padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.balance td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.balance td:first-child { font-family: var(--display); color: var(--brass); }
.checks em { display: block; color: var(--ui-muted); font-style: normal; font-size: 13px; }

/* ── game chrome ──────────────────────────────────────────────────────── */
.game { height: 100%; display: grid; grid-template-rows: 56px 1fr 56px; grid-template-columns: minmax(0, 1fr); }
.topbar, .bottombar { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: color-mix(in srgb, var(--panel) 92%, transparent); border-bottom: 1px solid var(--line); z-index: 5; }
.bottombar { border-bottom: 0; border-top: 1px solid var(--line); }
.tb-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-name { font: 19px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { font-size: 12px; color: var(--ui-muted); white-space: nowrap; }
.save-state::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; }
.save-state[data-state="saving"]::before { background: var(--brass); }
.save-state[data-state="offline"]::before, .save-state[data-state="conflict"]::before { background: var(--bad); }
.save-state[data-state="saved"] { opacity: .7; }
.tb-count { display: flex; align-items: baseline; gap: 8px; padding: 0 12px; }
.tb-num { font: 26px var(--display); font-variant-numeric: tabular-nums; color: var(--brass); }
.tb-lbl { font-size: 12.5px; color: var(--ui-muted); }
.tb-actions { display: flex; align-items: center; gap: 2px; }
.desk { display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.game.no-sidebar .desk { grid-template-columns: 0 1fr; }
.game.no-sidebar .casebook { visibility: hidden; }

/* casebook */
.casebook { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cb-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.cb-tab { flex: 1; background: none; border: 0; padding: 12px 4px 10px; color: var(--ui-muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; }
.cb-tab.on { color: var(--ui-ink); border-bottom-color: var(--brass); }
.cb-body { overflow-y: auto; padding: 14px 14px 24px; flex: 1; display: flex; flex-direction: column; }
.cb-hint { font-size: 13px; color: var(--ui-muted); margin: 0 0 12px; }
.ev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ev { display: flex; gap: 8px; align-items: stretch; border-radius: 10px; border: 1px solid transparent; }
.ev.active { border-color: var(--brass); background: var(--panel-2); }
.swatch { flex: none; width: 14px; border-radius: 6px; border: 0; background: var(--c); margin: 8px 0 8px 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.swatch:hover { box-shadow: 0 0 0 2px var(--ui-ink); }
.ev-main { flex: 1; text-align: left; background: none; border: 0; padding: 8px 8px 9px 2px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; min-width: 0; }
.ev-head { display: flex; align-items: baseline; gap: 7px; font-size: 12px; color: var(--ui-muted); }
.ev-head b { font: 600 15px var(--display); color: var(--ui-ink); min-width: 24px; }
.ev-src { flex: 0 1 auto; min-width: 0; font-variant: small-caps; letter-spacing: .04em; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-tier { flex: 0 1 auto; min-width: 0; font-size: 10.5px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-head b, .ev-count { flex: none; }
.ev-count { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12px; }
.ev-text { font: 15px/1.4 var(--book); color: var(--ui-ink); }
.cb-case p { font: 15.5px/1.55 var(--book); margin: 0 0 12px; }
.cb-case h4 { font: 600 12px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--brass); margin: 22px 0 8px; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 14px; }
.stats dt { color: var(--ui-muted); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.stats.inline { grid-template-columns: repeat(4, auto); justify-content: center; text-align: center; margin-top: 20px; gap: 2px 26px; }
.stats.inline dt { grid-row: 2; font-size: 12px; }
.stats.inline dd { grid-row: 1; text-align: center; font: 22px var(--display); }

/* stage */
.stage { position: relative; display: grid; grid-template-rows: 40px minmax(0, 1fr) 52px; min-width: 0; min-height: 0; overflow: hidden; }
.scroller { overflow: auto; display: flex; min-height: 0; padding: 4px 56px 8px; scrollbar-width: thin; }
.book-wrap { position: relative; flex: none; margin: auto; filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)); }
.stage.zoomed .scroller { cursor: default; }
.stage.zoomed .flip { background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--ui-ink); }
.stage.zoomed .thumbs { opacity: .92; }

/* reserved strip for messages — never overlaps the book */
.msg-slot { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 60px; font-size: 13.5px; color: var(--ui-ink); opacity: 0; transition: opacity .2s; pointer-events: none; }
.msg-slot.show { opacity: 1; pointer-events: auto; }
.msg-slot > span { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.msg-slot .btn { flex: none; }

/* full-size page actions under each visible page */
.page-actions { display: flex; justify-content: center; align-items: center; gap: 0; padding: 0 56px; }
.pa-group { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: nowrap; min-width: 0; overflow: hidden; }
.pa-label { font: 15px var(--display); color: var(--ui-muted); margin-right: 4px; white-space: nowrap; }
.page-actions .btn { white-space: nowrap; padding: 7px 11px; font-size: 13px; }
.pa-pair { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.pa-pair .btn { padding: 5px 10px; }
.pen-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.book { position: absolute; left: 0; top: 0; width: 1632px; height: 1056px; transform-origin: 0 0; display: flex; }
.book.single { width: 816px; }
.slot { width: 816px; height: 1056px; position: relative; }
.slot.empty { visibility: hidden; }
.slot.left .page { border-radius: 6px 0 0 6px; }
.slot.right .page { border-radius: 0 6px 6px 0; }
.slot.only .page { border-radius: 6px; }
.slot.left .page::after, .slot.right .page::after { content: ''; position: absolute; top: 0; bottom: 0; width: 70px; pointer-events: none; }
.slot.left .page::after { right: 0; background: linear-gradient(to left, rgba(80,55,25,.20), transparent); }
.slot.right .page::after { left: 0; background: linear-gradient(to right, rgba(80,55,25,.24), transparent); }
.book .page { animation: pagein .18s ease-out; }
@keyframes pagein { from { opacity: .4; } to { opacity: 1; } }
.flip { position: absolute; top: calc(50% - 6px); transform: translateY(-50%); z-index: 3; width: 44px; height: 88px; border-radius: 10px; border: 0; background: transparent; color: var(--ui-muted); font-size: 40px; line-height: 1; }
.flip:hover:not(:disabled) { background: var(--line); color: var(--ui-ink); }
.flip:disabled { opacity: .15; cursor: default; }
.flip.prev { left: 10px; }
.flip.next { right: 46px; }
.thumbs {
  position: absolute; right: 6px; top: 8px; bottom: 8px; z-index: 3;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; scrollbar-width: none;
}
.thumbs::-webkit-scrollbar { display: none; }
/* Tabs shrink to fit a long book (52,000 names runs to 40-odd chapters); below
   their minimum the column scrolls instead. The auto margins centre a short list. */
.thumb { flex: 0 1 24px; min-height: 13px; width: 30px; border: 0; border-radius: 4px 0 0 4px; background: var(--panel-2); color: var(--ui-muted); font: 600 11px/1 var(--ui); position: relative; overflow: hidden; padding: 0; }
.thumb:first-child { margin-top: auto; }
.thumb:last-child { margin-bottom: auto; }
.thumb span { position: relative; z-index: 1; }
.thumb i { position: absolute; left: 0; bottom: 0; top: 0; width: calc(var(--done, 0) * 100%); background: rgba(209, 171, 98, .28); }
.thumb:hover { color: var(--ui-ink); }
.thumb.here { background: var(--brass); color: #1a140f; }
.thumb.cleared span { text-decoration: line-through; opacity: .55; }

/* bottom bar */
/* padding leaves room for the raised, shadowed active chip — an x-scrolling box clips vertically too */
.tray { display: flex; gap: 4px; align-items: center; overflow-x: auto; max-width: 52%; min-width: 0; flex: 0 1 auto; scrollbar-width: none; padding: 6px 4px 4px; }
.chip { flex: none; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; border: 2px solid transparent; background: var(--c); color: #2b2219; font: 700 12px var(--display); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.chip.on { border-color: var(--ui-ink); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.scrub { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 160px; }
.scrub input { flex: 1; accent-color: var(--brass); }
.scrub-label { font-size: 12.5px; color: var(--ui-muted); white-space: nowrap; min-width: 0; max-width: 240px; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.bb-right { display: flex; align-items: center; gap: 4px; flex: none; }
.bottombar .btn, .topbar .btn { white-space: nowrap; }
.goto { width: 110px; padding: 6px 10px; font-size: 13px; background: var(--desk); color: var(--ui-ink); border: 1px solid var(--line-2); border-radius: 7px; }

/* menus, popovers, toast, modal */
.ctx-menu, .palette-pop { position: fixed; z-index: 60; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.45); min-width: 220px; }
.cm-title { font: 17px var(--display); padding: 2px 6px 6px; }
.cm-title span { font: 12px var(--ui); color: var(--ui-muted); margin-left: 6px; }
.cm-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ui-muted); padding: 4px 6px; }
.cm-pens { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 6px 8px; max-width: 280px; }
.cm-pens button { min-width: 30px; height: 26px; border-radius: 13px; border: 2px solid transparent; background: var(--c); color: #2b2219; font: 700 11px var(--display); }
.cm-pens button.on { border-color: var(--ui-ink); }
.cm-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 6px; }
.cm-item:hover { background: var(--line); }
.cm-item span { display: block; font-size: 12px; color: var(--ui-muted); }
.pp-title { font-size: 12px; color: var(--ui-muted); padding: 0 2px 8px; }
.pp-grid { display: grid; grid-template-columns: repeat(5, 32px); gap: 6px; }
.pp-grid button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.pp-grid button.on, .pp-grid button:hover { border-color: var(--ui-ink); }
.zoom { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; margin-right: 6px; }
.zoom .btn { padding: 4px 9px; min-width: 30px; }
.zoom-level { min-width: 52px !important; font-variant-numeric: tabular-nums; }
#toast { position: fixed; left: 50%; bottom: 76px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; z-index: 80; background: #2e241c; color: #efe5d3; border: 1px solid rgba(255,236,210,.16); border-radius: 10px; padding: 10px 14px; display: flex; gap: 14px; align-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.4); max-width: min(640px, 92vw); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast .muted { color: #ad9f88; }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(10, 7, 5, .62); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadein .15s; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 22px 24px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal.wide { width: min(760px, 100%); }
.modal-title { font: 400 26px var(--display); margin: 0 0 12px; }
.modal-body p { margin: 0 0 12px; }
.modal-body .lead { font: 18px/1.5 var(--book); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.results { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 2px; }
.results button { width: 100%; display: flex; justify-content: space-between; align-items: baseline; background: none; border: 0; padding: 8px 10px; border-radius: 7px; text-align: left; }
.results button:hover, .results button.first { background: var(--line); }
.results b { font: 400 18px var(--display); }
.results span { font-size: 12.5px; color: var(--ui-muted); }
.results .none { color: var(--ui-muted); padding: 8px 10px; font-style: italic; }
.standing { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.standing .cm-label { width: 100%; padding: 0; }
.standing button { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 10px; font: 16px var(--display); }
.standing button span { font: 11px var(--ui); color: var(--ui-muted); margin-left: 6px; }
.standing button.on { border-color: var(--accent); background: rgba(184, 67, 47, .18); }
.accused-card { margin-top: 12px; border: 1px dashed var(--accent); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.ac-name { font: 28px var(--display); }
.sg-options { display: grid; gap: 8px; margin: 8px 0 14px; }
.sg-options .btn { text-align: left; font: 16px var(--book); }
.verdict { font: 17px/1.5 var(--book); padding: 10px 12px; border-radius: 8px; background: var(--panel-2); }
.verdict.good { border-left: 3px solid var(--good); }
.verdict.bad { border-left: 3px solid var(--bad); }
.clue-mini { border-left: 4px solid var(--c); padding: 8px 12px; background: var(--panel-2); border-radius: 0 8px 8px 0; margin: 4px 0 10px; font: 16px/1.45 var(--book); }
.pen-inline { background: var(--c); color: #2b2219; padding: 0 6px; border-radius: 4px; }
.solved-modal { text-align: center; }
.solved-modal p { font: 18px/1.6 var(--book); max-width: 36em; margin: 0 auto 12px; }
.solved-name { font: 56px var(--display); color: var(--brass); margin: 4px 0 18px; }
.help .howto { padding-left: 20px; margin: 0 0 18px; display: grid; gap: 10px; font: 16.5px/1.5 var(--book); }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; font-size: 13.5px; margin-bottom: 16px; padding: 14px; background: var(--panel-2); border-radius: 10px; }
.print-opts hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.print-tip { margin-top: 14px; font-size: 13px; color: var(--ui-muted); background: var(--panel-2); border-radius: 8px; padding: 10px 12px; }

#loading { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: radial-gradient(900px 600px at 50% 45%, var(--desk-2), var(--desk)); }
#loading[hidden] { display: none; }
.ld-card { text-align: center; width: min(420px, 90vw); }
.ld-orn { font-size: 34px; color: var(--brass); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.ld-title { font: 34px var(--display); margin: 8px 0 6px; }
.ld-label { color: var(--ui-muted); font: italic 17px var(--book); min-height: 1.5em; }
.ld-bar { height: 3px; background: var(--line); margin-top: 22px; border-radius: 3px; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: calc(var(--p, .05) * 100%); background: var(--brass); transition: width .25s; }

/* ── the page (shared by screen and print) ────────────────────────────── */
.page {
  width: 816px; height: 1056px; position: relative; overflow: hidden;
  padding: 64px 80px 0; background: var(--paper); color: var(--ink);
  font-family: var(--book); font-variant-numeric: oldstyle-nums;
  background-image: radial-gradient(1200px 900px at 50% 40%, transparent 60%, rgba(160, 120, 60, .06));
}
.folio { position: absolute; left: 0; right: 0; bottom: 46px; text-align: center; font-size: 15px; color: var(--ink-soft); letter-spacing: .08em; }
.folio::before, .folio::after { content: '·'; margin: 0 10px; color: var(--ink-faint); }

/* register pages */
.rh { display: flex; justify-content: space-between; align-items: baseline; height: 38px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; font-size: 15px; color: var(--ink-soft); font-variant: small-caps; letter-spacing: .06em; }
.rh .gw { flex: 1; }
.rh .gw.r { text-align: right; }
.rh-mid { font: 20px var(--display); color: var(--oxblood); letter-spacing: 0; }
.opener { height: 262px; text-align: center; padding-top: 22px; }
.ch-kicker { font-variant: small-caps; letter-spacing: .2em; font-size: 15px; color: var(--ink-soft); }
.ch-letter { font: 118px/1 var(--display); color: var(--oxblood); margin: 6px 0 8px; }
.ch-blurb { font-style: italic; font-size: 16px; color: var(--ink-soft); margin: 0 auto; max-width: 30em; }
.cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; margin-top: 18px; }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 18px; }
.cols.c3 .ln { width: 27px; padding-right: 8px; font-size: 11px; }
.cols.c3 .tx { font-size: 21px; padding: 0 4px; }
/* Full names (first + surname) in three columns: a size that fits 20 characters. */
.cols.c3.full .tx { font-size: 16.5px; letter-spacing: -.005em; }
.cols.c3.full .ln { width: 24px; padding-right: 7px; }
.rh.novel { font-size: 14px; letter-spacing: .1em; }
.rh.novel .rh-mid { font-size: 15px; }
.rh.hidden { visibility: hidden; }
.opener.novel { padding-top: 6px; }
.ch-word { font: italic 400 68px/1.05 var(--display); color: var(--oxblood); margin: 4px 0 2px; }
.ch-orn { color: var(--oxblood); font-size: 20px; margin: 4px 0 10px; opacity: .8; }
.toc-ch.novel .toc-name { font-variant: small-caps; letter-spacing: .04em; }
.col { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-rows: 33px; align-content: start; }
.nm { display: flex; align-items: center; height: 33px; position: relative; }
.book .nm { cursor: var(--pen-cursor, pointer); }
.ln { flex: none; width: 34px; padding-right: 12px; text-align: right; font: 12px var(--ui); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tx { font-size: 23.5px; color: #1f1811; position: relative; padding: 0 6px; z-index: 0; white-space: nowrap; user-select: none; -webkit-user-select: none; }
.nm.m .tx::before {
  content: ''; position: absolute; inset: 4px -3px 3px -3px; z-index: -1;
  background: var(--mc, #ffd84a); opacity: .7; mix-blend-mode: multiply;
  border-radius: 3px 7px 4px 8px; transform: skewX(-8deg) rotate(-.6deg);
}
.strike .nm.m .tx, .print-strike .nm.m .tx { text-decoration: line-through; text-decoration-color: rgba(70, 45, 30, .6); text-decoration-thickness: 1.5px; }
.nm.victim .tx { color: var(--oxblood); text-decoration: line-through; text-decoration-thickness: 1px; }
.dagger { font-style: normal; margin-left: 4px; font-size: 17px; }
.nm.culprit .tx::after { content: ''; position: absolute; inset: -3px -8px -2px -8px; border: 2.5px solid var(--oxblood); border-radius: 50%; transform: rotate(-3deg); }
.nm.flag .tx { outline: 2px dashed #c0392b; outline-offset: 1px; border-radius: 3px; }
.nm.flash .tx { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(184, 67, 47, .35); box-shadow: 0 0 0 6px rgba(184, 67, 47, .25); } 100% { background: transparent; box-shadow: none; } }
.book .nm:hover .tx { box-shadow: inset 0 -2px 0 rgba(43, 34, 25, .25); }

/* front matter */
.title-wrap { height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 120px; }
.tp-kicker { font-variant: small-caps; letter-spacing: .2em; color: var(--ink-soft); font-size: 15px; }
.tp-rule { width: 120px; border-top: 1px solid var(--rule); margin: 26px 0 40px; }
.tp-title { font: 400 44px/1.15 var(--display); margin: 0; letter-spacing: .02em; max-width: 620px; }
.tp-title small { display: block; font-size: 26px; color: var(--ink-soft); letter-spacing: .03em; }
.tp-title span { display: block; font-size: 64px; line-height: 1.05; color: var(--oxblood); margin: 10px 0; }
.tp-sub { font-style: italic; font-size: 20px; color: var(--ink-soft); margin-top: 22px; }
.tp-orn { font-size: 30px; color: var(--oxblood); margin: 40px 0; }
.tp-blurb { font-size: 16px; line-height: 1.6; max-width: 31em; color: var(--ink-soft); }
.tp-foot { margin-top: auto; margin-bottom: 110px; font-variant: small-caps; letter-spacing: .12em; color: var(--ink-faint); font-size: 14px; }
.fm-heading { font: 400 34px/1.15 var(--display); text-align: center; margin: 24px 0 26px; }
.fm-heading.small { margin: 24px 0 18px; }
.fm-kicker { display: block; font: 15px var(--book); font-variant: small-caps; letter-spacing: .22em; color: var(--oxblood); margin-bottom: 8px; }
.prose p { font-size: 17px; line-height: 1.55; margin: 0 0 11px; text-align: justify; hyphens: auto; }
.prose .dropcap::first-letter { float: left; font: 64px/0.9 var(--display); color: var(--oxblood); padding: 4px 8px 0 0; }
.guide { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 14px; }
.guide h3 { font: 15px var(--book); font-variant: small-caps; letter-spacing: .18em; color: var(--ink-soft); text-align: center; margin: 0 0 12px; font-weight: 400; }
.guide ul { margin: 0; padding-left: 20px; display: grid; gap: 5px; font-size: 14.5px; line-height: 1.4; }
.ev-intro { text-align: center; font-style: italic; color: var(--ink-soft); font-size: 16px; margin: -8px 30px 22px; }
.clues { display: grid; gap: 18px; }
.clue { display: grid; grid-template-columns: 52px 1fr; }
.clue-num { font: 22px var(--display); color: var(--oxblood); padding-top: 1px; }
.clue-src { font-variant: small-caps; letter-spacing: .1em; font-size: 14px; color: var(--ink-soft); }
.clue-src span { letter-spacing: .04em; color: var(--ink-faint); }
.clue-quote { font-style: italic; font-size: 15.5px; line-height: 1.48; margin: 3px 0 6px; color: #4d4135; }
.clue-text { font-size: 17.5px; line-height: 1.48; margin: 0; font-weight: 600; }
.clue.sealed .clue-num, .clue.sealed .clue-src { color: var(--ink-faint); }
.clue.sealed .clue-quote { color: var(--ink-faint); border: 1px dashed var(--rule); border-radius: 6px; padding: 8px 12px; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc li { display: flex; align-items: baseline; gap: 6px; font-size: 16px; height: 27px; }
.toc.chapters li { height: 25.5px; font-size: 15px; }
/* Long registers (52,000 names) have too many chapters for one column. */
.toc.chapters.two { columns: 2; column-gap: 30px; }
.toc.chapters.two li { font-size: 13px; break-inside: avoid; }
.toc.chapters.two .toc-pg { min-width: 28px; }
.book .toc li { cursor: pointer; }
.book .toc li:hover .toc-name { color: var(--oxblood); }
.toc-name b { display: inline-block; width: 26px; font: 18px var(--display); color: var(--oxblood); font-weight: 400; }
.toc-name em { font-style: normal; color: var(--ink-soft); }
.toc-dots { flex: 1; border-bottom: 1.5px dotted var(--ink-faint); transform: translateY(-4px); }
.toc-pg { min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.toc-sub { font: 14px var(--book); font-variant: small-caps; letter-spacing: .2em; text-align: center; color: var(--ink-soft); margin: 18px 0 8px; font-weight: 400; }
.blank-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: italic; color: var(--ink-faint); font-size: 14px; }

/* ── print ────────────────────────────────────────────────────────────── */
#print-root { display: none; }
body.printing { overflow: auto; }
body.printing #print-root { display: block; }
body.printing > :not(#print-root) { display: none !important; }
body.printing #print-root .page { margin: 0 auto 24px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }

@page { size: 8.5in 11in; margin: 0; }
@media print {
  :root { --paper: #ffffff; }
  html, body { background: #fff !important; height: auto; overflow: visible !important; }
  body > :not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .page { margin: 0 !important; box-shadow: none !important; background-image: none; break-after: page; page-break-after: always; break-inside: avoid; }
  #print-root .page:last-child { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .nm.m .tx::before { mix-blend-mode: normal; opacity: .55; }
}

/* ── small screens ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .tb-lbl, .tb-actions .btn.icon span { display: none; }
  .desk { grid-template-columns: 300px 1fr; }
}
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .cover { display: none; }
  .brand-title { font-size: 56px; }
  .diff-grid { grid-template-columns: 1fr; }
  .desk { grid-template-columns: 0 1fr; }
  /* The Casebook floats over the page here, so the stage must keep the wide column. */
  .stage { grid-column: 2; }
  .casebook { visibility: hidden; }
  .game:not(.no-sidebar) .casebook { visibility: visible; position: absolute; top: 56px; bottom: 56px; left: 0; width: min(360px, 90vw); z-index: 10; box-shadow: 20px 0 40px rgba(0,0,0,.4); }
  .tb-actions [data-act="mark-pages"], .tb-actions [data-act="print"], .scrub-label { display: none; }
  .tray { max-width: 40%; }
}

/* ── The Inquiry ─────────────────────────────────────────────────────── */
.ev.next-witness { border: 1px dashed var(--line-2); border-radius: 10px; padding: 10px 12px; gap: 10px; color: var(--ui-muted); }
.nw-num { font: 600 15px var(--display); min-width: 24px; color: var(--ui-muted); }
.nw-body { display: grid; gap: 3px; font-size: 13px; }
.nw-body b { color: var(--ui-ink); font-weight: 600; font-size: 13.5px; }
.nw-count { color: var(--brass); font-variant-numeric: tabular-nums; font-weight: 600; }
.witness-card { border-left: 4px solid var(--c); background: var(--panel-2); border-radius: 0 10px 10px 0; padding: 10px 14px; margin: 0 0 12px; }
.wc-head { font-size: 13px; color: var(--ui-muted); font-variant: small-caps; letter-spacing: .05em; }
.wc-head b { font: 600 16px var(--display); color: var(--ui-ink); margin-right: 6px; font-variant: normal; }
.wc-quote { font: italic 15.5px/1.45 var(--book); color: var(--ui-muted); margin: 6px 0; }
.wc-text { font: 600 17px/1.45 var(--book); margin: 0; }
/* ── Strike by position ──────────────────────────────────────────────── */
.pos-field { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 10px; margin: 8px 0; }
.pos-field > span { font-size: 13px; color: var(--ui-muted); }
.pos-cols { display: flex; gap: 16px; }
.pos-cols .check { margin: 0; }
.results-more { font-size: 12.5px; margin: 6px 0 0; }

/* ── Phone layout (.game.compact — see COMPACT in game.js) ─────────────────
   One page at a time, reflowed to the screen's width: each column becomes a
   list under its own heading. Tap to strike, long-press for options, swipe
   to turn. Print is untouched: it renders its own pages in #print-root. */
.game:not(.compact) .m-only { display: none !important; }
.game.compact .d-only { display: none !important; }
.game.compact {
  height: 100dvh; grid-template-rows: 48px auto minmax(0, 1fr) 56px;
  touch-action: manipulation; position: relative;
}
.game.compact .topbar { gap: 2px; padding: 0 4px; }
.game.compact .topbar .btn { padding: 8px 10px; }
.game.compact .topbar [data-act="home"] { font-size: 22px; line-height: 1; padding: 6px 12px; }
.game.compact .tb-title { flex: 0 0 auto; }
.game.compact .tb-name, .game.compact .tb-title .pill { display: none; }
.game.compact .save-state { font-size: 0; }
.game.compact .save-state::before { margin: 0; }
.game.compact .save-state[data-state="offline"], .game.compact .save-state[data-state="conflict"] { font-size: 11px; white-space: normal; line-height: 1.2; max-width: 120px; }
.game.compact .tb-count { display: grid; gap: 1px; padding: 0 6px; flex: 1; min-width: 0; line-height: 1; }
.game.compact .tb-num { font-size: 22px; }
.game.compact .tb-lbl { display: block; font-size: 10.5px; }
.game.compact .tb-actions .btn.icon { font-size: 19px; min-width: 40px; padding: 6px 8px; }
.game.compact .tb-actions .btn.icon span { display: none; }
.game.compact .tb-actions .btn.primary { margin-left: 4px; padding: 8px 12px; }

/* the active clue */
.clue-strip {
  display: flex; align-items: stretch; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  background: var(--panel); padding: 8px 10px 8px 8px; min-width: 0; z-index: 4;
}
.cs-bar { flex: none; width: 6px; border-radius: 3px; background: var(--c); }
.cs-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cs-text { font: 15px/1.35 var(--book); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cs-text b { font: 600 15px var(--display); margin-right: 4px; color: var(--brass); }
.cs-next { font-size: 12px; color: var(--brass); }
.cs-next:empty { display: none; }
.cs-more { flex: none; align-self: center; font-size: 12.5px; color: var(--ui-muted); white-space: nowrap; }

/* the page: reflowed, one at a time */
.game.compact .desk { display: block; position: relative; min-height: 0; }
.game.compact .stage { display: flex; flex-direction: column; height: 100%; }
.game.compact .flip, .game.compact .thumbs { display: none; }
.game.compact .page-actions {
  order: -1; flex: none; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding: 6px 10px;
  border-bottom: 1px solid var(--line); background: var(--desk-2);
}
.pa-where { margin-right: auto; background: none; border: 0; padding: 6px 4px; font: 17px var(--display); color: var(--ui-ink); }
.pa-where span { font: 13px var(--ui); color: var(--ui-muted); }
.game.compact .page-actions .btn { padding: 7px 11px; }
.game.compact .scroller { display: block; flex: 1; padding: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.game.compact .book-wrap { width: auto !important; height: auto !important; margin: 0; filter: none; }
.game.compact .book { position: static; width: auto; height: auto; transform: none; display: block; }
.game.compact .slot { width: auto; height: auto; }
.game.compact .slot .page { border-radius: 0; }
.game.compact .book .page { width: auto; height: auto; min-height: 100%; overflow: visible; padding: 14px 14px 40px; animation: none; }
.game.compact .page .folio { display: none; }
.game.compact .book { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

.game.compact .rh { height: auto; font-size: 12.5px; padding-bottom: 6px; }
.game.compact .opener { height: auto; padding: 10px 0 4px; }
.game.compact .ch-word { font-size: 44px; }
.game.compact .ch-letter { font-size: 72px; }
.game.compact .ch-blurb { font-size: 15px; }
.game.compact .cols, .game.compact .cols.c3 { display: block; margin-top: 4px; }
.col-wrap { margin-top: 10px; }
.col-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  margin: 0 -14px; padding: 6px 14px; background: var(--paper-2); border-bottom: 1px solid var(--rule);
  font: 13px var(--ui); color: var(--ink-soft);
}
.col-name { font: 600 13px var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.col-count { margin-right: auto; font-variant-numeric: tabular-nums; }
.col-head .pa-pair { border-color: var(--rule); }
.col-head .btn { color: var(--ink); background: var(--paper); border-color: var(--rule); padding: 6px 10px; }
.col-head .btn.ghost { background: transparent; border-color: transparent; }
.game.compact .col { display: block; }
.game.compact .nm { height: 42px; border-bottom: 1px solid rgba(214, 199, 167, .45); }
.game.compact .cols .ln, .game.compact .cols.c3 .ln, .game.compact .cols.c3.full .ln { width: 34px; padding-right: 12px; font-size: 12px; }
.game.compact .cols .tx, .game.compact .cols.c3 .tx, .game.compact .cols.c3.full .tx { font-size: 19px; letter-spacing: 0; }
.game.compact .book .nm:hover .tx { box-shadow: none; }

/* front matter, reflowed */
.game.compact .title-wrap { height: auto; padding: 28px 0 8px; }
.game.compact .tp-rule { margin: 18px 0 24px; }
.game.compact .tp-title { font-size: 30px; }
.game.compact .tp-title small { font-size: 19px; }
.game.compact .tp-title span { font-size: 40px; }
.game.compact .tp-sub { font-size: 17px; }
.game.compact .tp-orn { margin: 24px 0; }
.game.compact .tp-foot { margin: 28px 0 0; }
.game.compact .fm-heading { font-size: 27px; margin: 8px 0 18px; }
.game.compact .prose p { font-size: 16.5px; text-align: left; hyphens: manual; }
.game.compact .prose .dropcap::first-letter { font-size: 52px; }
.game.compact .ev-intro { margin: -6px 0 18px; }
.game.compact .clue { grid-template-columns: 40px 1fr; }
.game.compact .toc li { height: 40px; font-size: 16px; }
.game.compact .toc.chapters li { height: 40px; }
.game.compact .toc.chapters.two { columns: 1; }
.game.compact .toc.chapters.two li { font-size: 16px; }
.game.compact .blank-note { position: static; padding: 80px 0; }

/* bottom bar: turn pages, choose a highlighter */
.game.compact .bottombar { gap: 0; padding: 0 2px; }
.mnav-btn { flex: none; width: 48px; height: 48px; font-size: 30px; line-height: 1; padding: 0 !important; }
.game.compact .tray { flex: 1; max-width: none; padding: 8px 6px 6px; gap: 6px; scroll-padding: 0 12px; }
.game.compact .chip { min-width: 38px; height: 36px; border-radius: 18px; font-size: 13px; }

/* toasts float above the bottom bar instead of reserving a strip */
.game.compact .msg-slot { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 6; padding: 0; justify-content: center; }
.game.compact .msg-slot > span { white-space: normal; box-shadow: 0 10px 28px rgba(0,0,0,.45); }

/* the Casebook as a sheet over the page */
.game.compact .casebook {
  position: fixed; left: 0; right: 0; bottom: 0; top: 56px; width: auto; z-index: 30; visibility: hidden;
  border: 1px solid var(--line-2); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -20px 50px rgba(0,0,0,.5);
  transform: translateY(105%); transition: transform .25s ease, visibility .25s;
}
.game.compact.sheet-open .casebook { visibility: visible; transform: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(10, 7, 5, .55); opacity: 0; pointer-events: none; transition: opacity .25s; }
.game.compact.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.cb-close { flex: none; background: none; border: 0; color: var(--brass); font-weight: 650; padding: 12px 10px 10px; }
.game.compact .ev-main { padding: 10px 8px 11px 2px; }
.game.compact .swatch { width: 22px; }
.game.compact .ev-text { font-size: 16px; }

/* phone dialogs */
.nav-sheet .nav-go { margin-bottom: 12px; }
.nav-sheet .nav-go .input { flex: 1; }
.nav-front { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.nav-chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 46vh; overflow-y: auto; }
.nav-chapters button { position: relative; overflow: hidden; width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.nav-chapters b { font: 400 17px var(--display); position: relative; z-index: 1; }
.nav-chapters span { font-size: 12.5px; color: var(--ui-muted); position: relative; z-index: 1; }
.nav-chapters i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--done) * 100%); background: rgba(209, 171, 98, .16); }
.nav-chapters .cleared b { text-decoration: line-through; opacity: .6; }
.touch-tips { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 6px; color: var(--ui-muted); font-size: 14px; }

@media (max-width: 720px) {
  .home { padding: 28px 16px 24px; }
  .brand-title { font-size: 48px; }
  .brand-sub { font-size: 17px; }
  .files { margin-top: 40px; }
  .files-head { flex-wrap: wrap; gap: 8px; }
  .files-tools { justify-content: flex-start; }
  .file { flex-wrap: wrap; padding-bottom: 8px; }
  .file-main { flex-basis: 100%; }
  .mode-grid { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px 14px; }
  .modal-title { font-size: 23px; }
  .keys { grid-template-columns: 1fr; }
  .pos-field { grid-template-columns: 64px 1fr; }
  .pos-cols { flex-wrap: wrap; gap: 4px 12px; }
  .results b { font-size: 17px; }
  .solved-name { font-size: 40px; }
  .stats.inline { gap: 2px 16px; }
}
/* Phones on their side: every bar slimmer, so the page keeps most of the height. */
@media (max-height: 520px) {
  .game.compact { grid-template-rows: 44px auto minmax(0, 1fr) 48px; }
  .game.compact .clue-strip { padding: 5px 10px 5px 8px; }
  .game.compact .cs-text { -webkit-line-clamp: 1; font-size: 14px; }
  .game.compact .page-actions { padding: 3px 10px; }
  .game.compact .page-actions .btn { padding: 4px 10px; }
  .game.compact .pa-where { padding: 3px 4px; font-size: 15px; }
  .game.compact .rh { display: none; }
  .game.compact .col-head { padding: 3px 14px; }
  .game.compact .col-head .btn { padding: 3px 9px; }
  .game.compact .nm { height: 38px; }
  .game.compact .chip { height: 32px; min-width: 34px; }
  .game.compact .mnav-btn { height: 44px; }
  .game.compact .casebook { top: 8px; }
}

/* ── the Unnecessary Obstacles hub: daily cases, posted scores ─────────── */
.dailies { max-width: 1080px; margin: 48px auto 0; }
.dailies a.btn { color: var(--ui-ink); text-decoration: none; }
.daily-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.daily-case { display: grid; gap: 4px; text-align: left; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 18px; }
.daily-case:hover { border-color: var(--brass); transform: translateY(-1px); }
.daily-case b { font: 400 24px var(--display); }
.daily-case span { font-size: 13px; color: var(--ui-muted); }
.daily-case em { font-style: normal; font-size: 13.5px; font-weight: 600; color: var(--brass); margin-top: 6px; }
/* the leaderboard is the section's call to action: brass, not a ghost */
.btn.lb { border-color: var(--brass); color: var(--brass); background: transparent; }
.btn.lb:hover { background: color-mix(in srgb, var(--brass) 14%, transparent); }
.files-tools a.btn { text-decoration: none; }
.files-tools a.btn:not(.lb) { color: var(--ui-ink); }
.file-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 720px) { .daily-grid { grid-template-columns: 1fr; gap: 8px; } .daily-case { grid-template-columns: 1fr auto; align-items: baseline; } .daily-case em { grid-column: 1 / -1; margin-top: 0; } }
.daily-case.done em { color: var(--good); }
.posted-note { margin-top: 14px !important; font: 15px var(--ui) !important; color: var(--ui-muted); }
.posted-note a { color: var(--brass); }

/* "This game has moved" — shown where a page sets data-moved */
.moved { max-width: 1080px; margin: 0 auto 36px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--brass); border-radius: 12px; padding: 14px 18px; font-size: 14.5px; }
.moved > div:first-child { flex: 1 1 420px; }
.moved a { color: var(--brass); }
.moved-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.moved-actions a.btn { text-decoration: none; color: var(--accent-ink); }

/* the case file (from "Case file" on a case row): story and progress, no spoilers */
.case-file .cf-meta { font-size: 13px; margin-bottom: 14px; }
.cf-story p { font: 17px/1.6 var(--book); margin: 0 0 12px; }
.cf-head { font: 600 12px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--brass); margin: 22px 0 10px; }
.cf-stats { max-width: 440px; }
.cf-bar { height: 4px; max-width: 440px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 12px; }
.cf-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--brass); }
.cf-workings { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; }
.cf-workings summary { cursor: pointer; color: var(--ui-muted); font-size: 13px; }
