/* ─────────────────────────────────────────────────────────────────────────
   The Register — a walnut desk, a cream book, a box of highlighters.
   ───────────────────────────────────────────────────────────────────────── */
/* IBM Plex Mono (SIL Open Font License, fonts/OFL.txt), served from here, not a font CDN. */
@font-face {
  font-family: "IBM Plex Mono"; font-display: block;
  src: url("fonts/ibm-plex-mono-latin.814fe1615d4d.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-display: block;
  src: url("fonts/ibm-plex-mono-latin-ext.17a5b2a15bf5.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
: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;
  /* Names in the register, so letters can be counted by eye. Plex Mono is 0.6em
     per character and the system fallbacks at most 0.602em; the three-column
     page is sized on that. */
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;

  --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;
  --focus: var(--ui-ink);
  --good: #8fcf8a;
  --bad: #ff8f7d;

  --paper: #fbf6e9;
  --paper-2: #f3ead6;
  --ink: #2b2219;
  --ink-soft: #75685a;
  --ink-faint: #a99a83;  /* rules and dots only: as text it's too faint (use --ink-soft) */
  --rule: #d6c7a7;
  --oxblood: #8e2a1e;
  --flag: #c0392b;       /* the Sergeant's flag on a name: The Register's own red, not a mistake */

  /* The house rules' tokens (docs/design-system.md), the same small set
     every UO game declares: five type roles, five spaces, one way to show a
     pick. Here a pick is a brass outline on the lifted panel, as the mode
     picker draws it. */
  --t-display: 44px;
  /* The one named exception to the type scale (docs/design-language.md, "Layout and type"): the home's masthead. */
  --t-masthead: 84px;
  --t-heading: 20px;
  --t-body: 16px;
  --t-label: 16px;
  --t-note: 14px;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px;
  --pick-tint: var(--panel-2);
  --pick-ring: inset 0 0 0 1px var(--brass);
  --pick-weight: 600;

  /* What the house kit's sheets, toasts and rows read (house/house.css): the
     desk's panel, ink and brass, so a sheet is a page of the same book. */
  --house-surface: var(--panel);
  --house-ink: var(--ui-ink);
  --house-soft: var(--ui-muted);
  --house-edge: 1px solid var(--line-2);
  --house-line: var(--line-2);
  --house-radius: 14px;
  --house-display: var(--display);
  --house-display-weight: 400;
  --house-font: var(--ui);
  --house-focus: var(--focus);
  --house-field-edge: 1px solid var(--line-2);
  --house-btn-radius: 8px;
  --house-toast-edge: 1px solid var(--line-2);
  --house-scrim: rgba(10, 7, 5, .62);
  --house-shadow: 0 30px 80px rgba(0, 0, 0, .5);

  color-scheme: dark;
}
@media (max-width: 640px) { :root { --t-display: 32px; } }
@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: #574a3c; --brass: #634511; --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: var(--t-body)/var(--lh-body) 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 {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px;
  min-height: var(--btn-h); padding: 0 var(--btn-pad); font-size: var(--t-label); font-weight: 600; letter-spacing: .01em; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--brass); }
.btn:active { transform: translateY(1px); }
.btn:disabled { border-style: dashed; color: var(--ui-muted); background: transparent; cursor: default; transform: none; }
.btn.ghost:disabled { border-color: var(--line-2); }
.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); }
/* A tool: a bar's, a dock's, a page's (docs/design-language.md, "Layout and type"). */
.btn.small { min-height: var(--tool-h); padding: 0 12px; font-size: var(--t-small); }
.btn.icon span:not(.gl) { 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);
}
.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: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: color-mix(in srgb, var(--ui-muted) 75%, var(--ui-ink)); 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 ─────────────────────────────────────────────────────────────── */
/* The page's skeleton is the house's (docs/design-language.md, "Layout and
   type"): the bar's tools at the gutter, then a --page-max column. */
.home { height: 100%; overflow-y: auto; padding: 0 0 max(var(--s4), env(safe-area-inset-bottom, 0px)); }
.home-grid, .files, .moved, .home-foot, .home > .house-about, .home > .house-start-more { width: calc(100% - 2 * var(--gutter)); max-width: var(--page-max); }
/* About The Register (docs/adr/0081): in the column, over the footer. With
   the Trophy Case's row it comes in one band (house/about.js), which takes
   the column instead, so neither touches the window's edges (David's
   playtest, 2026-11-09). */
.home > .house-about, .home > .house-start-more { margin: var(--s5) auto 0; }
.house-start-more > .house-about { margin-top: var(--s5); }
.home > .home-bar + * { margin-top: var(--bar-gap); }
.home-grid { margin: 0 auto; display: grid; grid-template-columns: 1.2fr .8fr; gap: var(--s5); align-items: center; }
.brand-kicker { font: 700 var(--t-kicker)/1.3 var(--ui); letter-spacing: var(--kicker-spacing); text-transform: uppercase; color: var(--brass); }
/* The masthead is the Register's one display larger than the scale's (--t-masthead), on this page only. */
.brand-title { font: 400 var(--t-masthead)/1 var(--display); margin: var(--s2) 0 var(--s3); letter-spacing: -.01em; }
.brand-sub { font: var(--t-lead)/var(--lh-body) var(--book); color: var(--ui-muted); max-width: 38em; margin: 0 0 var(--s4); }
.credit { margin: var(--s4) 0 0; max-width: 38em; font-size: var(--t-note); line-height: var(--lh-note); 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: var(--s3); }
.continue-card {
  width: 100%; max-width: 560px; text-align: left; display: grid; gap: 4px; padding: var(--panel-pad);
  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: 700 var(--t-kicker) var(--ui); letter-spacing: var(--kicker-spacing); text-transform: uppercase; color: var(--brass); }
.cc-title { font: 26px var(--display); }
.cc-meta { color: var(--ui-muted); font-size: var(--t-note); }
.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 { margin: var(--s5) 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 var(--t-heading)/var(--lh-heading) 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: var(--t-note); }
.file.is-solved .f-bar i { background: var(--good); }
.empty { padding: 20px 0; }
/* (a soft line, so a note: the house's note size) */
.files .empty { font-size: var(--t-note); }
.home-foot { margin: var(--s5) auto 0; display: flex; justify-content: space-between; color: var(--ui-muted); font-size: 13px; gap: var(--s3); flex-wrap: wrap; }
.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: var(--t-note); }
.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: var(--t-note); 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: var(--t-note); }
.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 ──────────────────────────────────────────────────────── */
/* The bar is the house's (docs/design-language.md, "Layout and type"): --bar-h
   tall at --bar-top, its first and last things at the gutter, as on the home;
   its tools one size. The bottom bar is the dock, at the same gutter. */
/* (what changed, said for a screen reader: off screen) */
.say-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.game { height: 100%; display: grid; grid-template-rows: auto 1fr 56px; grid-template-columns: minmax(0, 1fr); }
.topbar, .bottombar { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0 var(--gutter); z-index: 5; }
.topbar { margin-top: calc(var(--frame) + var(--bar-top)); min-height: var(--bar-h); box-shadow: 0 1px 0 var(--line); }
.bottombar { background: color-mix(in srgb, var(--panel) 92%, transparent); border-top: 1px solid var(--line); }
.topbar .btn, .home-bar .btn { min-height: var(--tool-h); padding: 4px var(--tool-pad); font: var(--w-tool) var(--t-tool)/1.1 var(--ui); }
.tb-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-name { font: var(--t-bar)/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { font-size: 13px; 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"] { color: color-mix(in srgb, var(--ui-muted) 80%, var(--ui-ink)); }
.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: 13px; color: var(--ui-muted); }
.tb-actions { display: flex; align-items: center; gap: 2px; }
/* Undo and Redo are always in the bar; their words only where there's room (the title needs the space). */
.tb-actions .ico { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-undo span, .tb-redo span { display: none; }
@media (min-width: 1500px) { .game:not(.compact) .tb-undo span, .game:not(.compact) .tb-redo span { display: inline; } }
.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 var(--gutter); }
.cb-tab { flex: 1; background: none; border: 0; padding: 12px 4px 10px; color: var(--ui-muted); font-weight: 600; font-size: var(--t-small); border-bottom: 2px solid transparent; }
.cb-tab.on { color: var(--ui-ink); border-bottom-color: var(--brass); }
.cb-body { overflow-y: auto; padding: 14px var(--gutter) 24px; flex: 1; display: flex; flex-direction: column; }
.cb-hint { font-size: var(--t-note); line-height: var(--lh-note); 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; }
/* (a clue's source and how close it comes wrap onto a second line in a narrow panel, rather than both being cut to "The Neighbor Acro…") */
.ev-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 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: 12px; opacity: .85; 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: var(--t-body)/1.4 var(--book); color: var(--ui-ink); }
.cb-case p { font: var(--t-body)/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: var(--t-note); }
.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; }

/* A reserved strip above the book: the house toast (below) shows over it, so a message never covers the names. */
.msg-slot { pointer-events: 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: 0 12px; }
.pa-pair { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.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(--ink-soft); 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: var(--gutter); }
.flip.next { right: 58px; }
.thumbs {
  position: absolute; right: var(--gutter); 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 12px/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: 13px; 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, .home-bar .btn { white-space: nowrap; }
.goto { width: 110px; padding: 6px 10px; font-size: var(--t-small); background: var(--desk); color: var(--ui-ink); border: 1px solid var(--line-2); border-radius: 7px; }

/* menus, popovers, the house toast and sheets */
.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: 0 9px; min-width: 30px; }
.zoom-level { min-width: 52px !important; font-variant-numeric: tabular-nums; }
/* The house toast sits over the reserved strip under the top bar on a desk, and above the bottom bar on a phone;
   while a sheet is open the kit moves it to the top (house.css). */
body > .house-toasts { top: 76px; translate: -50% 0; }
@media (max-width: 720px), (max-height: 520px) and (max-width: 1000px) {
  body > .house-toasts { top: auto; bottom: 66px; }
}
/* Sheets: the old dialogs' widths (the kit's own are wider), and the page's type inside them. */
.house-scrim-dialog .house-sheet { --house-sheet-width: 520px; }
.house-scrim-dialog .house-sheet.house-wide { --house-sheet-width: 760px; }
.house-body p { margin: 0 0 12px; }
.house-body .lead { font: var(--t-lead)/var(--lh-body) var(--book); }
.house-body .row { margin-bottom: 4px; }
.results { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 2px; }
.results button { width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 12px; 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 16px var(--mono); white-space: nowrap; }
/* Where a long name leaves no room, its page and line drop below it, whole. */
.results span { margin-left: auto; font-size: 12.5px; color: var(--ui-muted); text-align: right; }
.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: 15px var(--mono); white-space: nowrap; }
.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: 22px var(--mono); white-space: nowrap; }
.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; }
/* Case closed: the result sheet (house/end.js), the killer's name as its emblem and the solution beneath. */
/* wide enough for all five actions on one row */
.house-scrim-result .house-sheet.house-result { --house-sheet-width: 780px; }
/* A link dressed as a button (Leaderboard) wears the button's ink, not the browser's link blue. */
.house-foot a.btn { display: inline-flex; align-items: center; justify-content: center; color: var(--ui-ink); text-decoration: none; }
.house-foot a.btn.primary { color: var(--accent-ink); }
.house-result .house-result-body { gap: var(--s2); }
.solution p { font: 17px/1.55 var(--book); max-width: 36em; margin: 0 auto 10px; text-align: center; }
.solved-name { font: 52px/1.1 var(--display); color: var(--brass); margin: 2px 0 6px; }
.house-result .house-post a { color: var(--brass); }
.print-opts hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.print-tip { margin-top: 14px; font-size: var(--t-note); 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: 16px; }
.cols.c3 .ln { width: 27px; padding-right: 8px; font-size: 11px; }
.cols.c3 .tx { font-size: 20px; padding: 0 4px; }
/* Full names (first + surname) in three columns, at most 20 characters
   (MAX_FULL_NAME): a column is (816 - 2 × 64 - 2 × 16) / 3 ≈ 218.7px, less 24px of line
   number and 6px of padding leaves 188.7px; 20 × 0.602em × 15.5px = 186.6px. */
.page.register { padding-left: 64px; padding-right: 64px; }
.cols.c3.full .tx { font-size: 15.5px; padding: 0 3px; }
.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-soft); font-variant-numeric: tabular-nums; }
.tx { font-family: var(--mono); font-size: 22px; 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; }
/* Hung just past the name, so a 20-character victim needs no extra room in the column. */
.dagger { position: absolute; left: 100%; font: normal 17px var(--book); }
.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 var(--flag); 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-soft); 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-soft); }
.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-soft); }
.clue.sealed .clue-quote { color: var(--ink-soft); 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-soft); 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:not(.gl) { display: none; }
  .desk { grid-template-columns: 300px 1fr; }
}
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .cover { display: none; }
  :root { --t-masthead: 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: calc(var(--frame) + var(--bar-top) + var(--bar-h)); 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: auto auto minmax(0, 1fr) calc(56px + env(safe-area-inset-bottom, 0px));
  touch-action: manipulation; position: relative;
}
.game.compact .topbar { gap: 2px; }
.game.compact .gl { font-size: 19px; line-height: 1; }
.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: 12px; 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: 20px; }
.game.compact .tb-lbl { display: block; font-size: 12px; white-space: nowrap; }
.game.compact .tb-actions .btn.icon span:not(.gl) { display: none; }
/* Undo and Redo stay in the bar on a phone, so everything else gives a little room. */
.game.compact .tb-actions .btn.icon { min-width: 36px; padding: 0 5px; }
/* (and the house kit's Feedback, last in the bar, is one of them: docs/adr/0068) */
.game.compact .tb-actions .house-fb-btn { min-width: 36px; }
.game.compact .tb-actions .btn.primary { margin-left: 2px; padding: 0 9px; }
.game.compact .tb-count { padding: 0 2px; }
/* On a phone (400px and under, since the bar starts with the way home too: D36,
   ADR 0100) Find moves into ⋯ and the count keeps its number (the bar has 288px
   between its gutters at 320). Find a name is in ⋯ wherever ⋯ shows, and / finds. */
@media (max-width: 400px) {
  .game.compact .tb-actions [data-act="find"] { display: none; }
  .game.compact .tb-lbl { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .game.compact .tb-actions .btn.icon { min-width: 32px; padding: 0 3px; }
  .game.compact .tb-actions .house-fb-btn { min-width: 32px; }
  .game.compact .tb-actions .btn.primary { padding: 0 7px; }
  .game.compact .tb-num { font-size: 18px; }
}
/* (the narrowest phones, 288px between the gutters: the tools sit side by side, a little narrower,
   and Accuse drops its "…", so every tool stays in the bar beside the way home: D36) */
@media (max-width: 360px) {
  .game.compact .topbar, .game.compact .tb-actions { gap: 0; }
  .game.compact .tb-actions .btn.icon, .game.compact .tb-actions .house-fb-btn { min-width: 30px; padding: 0 2px; }
  .game.compact .tb-actions .btn.primary { padding: 0 6px; }
  .game.compact .acc-dots { display: none; }
}

/* 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 var(--s3) 8px 8px; margin: 0 var(--gutter); width: auto; 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; }
.cs-count { display: none; }
/* (Accuse's "…" is its own span, to drop on the narrowest phones; it stays against the word) */
[data-act="accuse"] { gap: 0; }
/* On a phone (400px and under) the count leaves the bar, which holds the way home, the arrow, Undo,
   Redo, ⋯, Accuse and Feedback, and sits at the end of the clue strip under it, "38,999 left" over
   "Clues ▾" (David's call R1, D36; ADR 0100). The bar keeps it for a screen reader. */
@media (max-width: 400px) {
  .game.compact .tb-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; }
  .game.compact .tb-actions { margin-left: auto; }
  .game.compact .cs-more { display: grid; justify-items: end; gap: 3px; }
  .game.compact .cs-count { display: block; font: 600 14px/1 var(--ui); font-variant-numeric: tabular-nums; color: var(--brass); }
}

/* 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 var(--gutter);
  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 .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 var(--gutter) 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 calc(-1 * var(--gutter)); padding: 6px var(--gutter); 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: 0 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: 18px; }
.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-bottom: env(safe-area-inset-bottom, 0px); }
/* (the page arrows are drawn, so they sit in the middle of their 44px; a ‹ typed sat 3px low) */
.mnav-btn { flex: none; width: 44px; height: 44px; padding: 0 !important; }
.mnav-btn .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.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; }

/* no reserved strip on a phone: its toasts float above the bottom bar (body > .house-toasts) */
.game.compact .msg-slot { position: absolute; width: 0; height: 0; }

/* the Casebook as a sheet over the page */
.game.compact .casebook {
  position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--frame) + var(--bar-top) + var(--bar-h)); 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; min-height: 44px; }
.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; }

@media (max-width: 720px) {
  :root { --t-masthead: 48px; }
  .files { margin-top: var(--s5); }
  .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; }
  .pos-field { grid-template-columns: 64px 1fr; }
  .pos-cols { flex-wrap: wrap; gap: 4px 12px; }
  .solved-name { font-size: 38px; }
  .ac-name { font-size: 18px; }
  .standing button { text-align: left; }
  .standing button span { display: block; margin-left: 0; }
  .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: auto auto minmax(0, 1fr) 48px; }
  .game.compact .clue-strip { padding: 5px var(--s3) 5px 8px; }
  .game.compact .cs-text { -webkit-line-clamp: 1; font-size: 14px; }
  .game.compact .page-actions { padding: 3px var(--gutter); }
  .game.compact .pa-where { padding: 3px 4px; font-size: 15px; }
  .game.compact .rh { display: none; }
  .game.compact .col-head { padding: 3px var(--gutter); }
  .game.compact .nm { height: 38px; }
  .game.compact .chip { height: 32px; min-width: 34px; }
  .game.compact .casebook { top: 8px; }
}

/* ── the Unnecessary Obstacles hub: its bar, posted scores ────────────── */
/* The home's top bar, like every game's: How to play, Leaderboard, your name or Sign in, at the right. */
.home-bar { margin-top: calc(var(--frame) + var(--bar-top)); min-height: var(--bar-h); padding: 0 var(--gutter); display: flex; align-items: center; justify-content: flex-end; }
.home-bar > .house-way, .home-bar > .house-back { margin-right: auto; }
.home-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 2px; }
.home-tools a.btn { text-decoration: none; color: var(--ui-ink); max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-q { display: none; }
/* On a phone: one row, How to play is ?, and a long name gives way. */
@media (max-width: 720px) {
  .home-tools { flex-wrap: nowrap; }
  .ht-word { display: none; }
  .ht-q { display: inline; font-weight: 700; }
  .home-tools .btn { min-width: 44px; }
  .home-tools a.btn { max-width: 9em; }
}
.file-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.files-head .head-links { margin-left: auto; display: flex; gap: var(--s3); }
.files-head .head-links a { font-size: var(--t-note); font-weight: 600; color: inherit; text-underline-offset: 3px; }
@media (pointer: coarse) { .files-head .head-links a { display: inline-block; padding: 12px 0; margin-block: -12px; } }
/* (on a narrow phone the bar has no room for Stats: it's beside Your cases instead) */
.files-head .to-stats { display: none; }
/* (Stats stays in the bar on a phone, as its icon: house.css's .house-bar-link) */

/* "This game has moved" — shown where a page sets data-moved */
.moved { margin: 0 auto var(--s4); 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: var(--s3); font-size: var(--t-note); }
.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; }

/* ── focus and motion (docs/design-language.md) ───────────────────────── */
/* One ring everywhere, never removed: 2px in the control's own ink, just
   inside its edge (a highlight stays in its place, ADR 0105). A link in a
   line of words keeps it outside, where inside would cross the letters. */
:is(button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Reduced motion: nothing travels or loops; changes land at once. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .ld-orn { animation: none; }
}
/* On a touch screen a clue chip and the page's name are a finger's size, or reach it
   (docs/design-language.md, "Fine details"); last, so a narrower phone's sizes don't undo it. */
@media (pointer: coarse) {
  .game .tray .chip { min-width: 44px; }
  .pa-where { min-height: 44px; }
  .game.compact .chip, .pa-where { position: relative; }
  .game.compact .chip::before, .pa-where::before { content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); translate: -50% -50%; }
}
