/* SCRIBE: the Dean's Daily look (hard rules, square corners, condensed caps), in ink-blue, with passages set in a
   book serif so they read like documents. One narrow scrolling column: the passage on a page card, the timeline below. */
:root {
  --paper: #edeae1; --card: #fbfaf6; --ink: #121212; --ink-2: #57554e; --rule: #121212; --soft: #d6d1c4;
  --accent: #3d4fc4; --accent-ink: #ffffff; --truth: #3d4fc4; --guess: #c2410c;
  --hard: 4px 4px 0 var(--accent);
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d0e10; --card: #16181c; --ink: #f1eee6; --ink-2: #a19f97; --rule: #f1eee6; --soft: #2e3036;
    --accent: #8d9bff; --accent-ink: #0d0e10; --truth: #8d9bff; --guess: #fb923c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d0e10; --card: #16181c; --ink: #f1eee6; --ink-2: #a19f97; --rule: #f1eee6; --soft: #2e3036;
  --accent: #8d9bff; --accent-ink: #0d0e10; --truth: #8d9bff; --guess: #fb923c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---------- top bar (the game switcher and streak come from /shared/gamebar.css) */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 2px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 5; min-height: 54px;
}
.topbar > * { min-width: 0; flex-shrink: 0; }
.dd-mark { font: 900 15px/1 var(--display); color: var(--paper); background: var(--ink); padding: 6px 5px 5px; text-decoration: none; letter-spacing: .02em; }
.brand { font: 900 24px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; }
body[data-screen="home"] .brand, body[data-screen="home"] #btn-home { visibility: hidden; }
.icon-btn { width: 36px; height: 36px; border: 2px solid var(--rule); background: var(--card); display: grid; place-items: center; font: 700 17px var(--sans); padding: 0; }
.icon-btn:hover { background: var(--accent); color: var(--accent-ink); }
body[data-screen="home"] .status { display: none; }
body[data-screen="home"] .topbar > .dd-streak { margin-left: auto; }
.status { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.status-label { font: 700 13px var(--sans); color: var(--ink-2); white-space: nowrap; }
.status-score { font: 900 26px/1 var(--display); min-width: 2.5ch; text-align: right; font-variant-numeric: tabular-nums; }
.ticks { display: flex; gap: 3px; }
.tick { width: 14px; height: 14px; border: 2px solid var(--rule); }
.tick.now { background: repeating-linear-gradient(45deg, var(--rule) 0 2px, transparent 2px 5px); }
.tick.yes { background: var(--accent); }

/* ---------- buttons */
.btn {
  padding: 10px 16px; font: 700 14px/1 var(--sans); letter-spacing: .01em;
  border: 2px solid var(--rule); background: var(--card); transition: transform .06s, box-shadow .06s; text-decoration: none; color: var(--ink); display: inline-block;
}
.btn:hover:not(:disabled) { background: var(--paper); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none !important; }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--rule); }
.btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.btn.wide { width: 100%; margin-top: 6px; padding: 14px; text-align: center; }
.linkish { border: 0; background: none; padding: 4px 2px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-size: 13.5px; text-align: left; }
.linkish:hover { color: var(--ink); }

/* ---------- screens */
.screen { padding: 22px 16px 32px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
#game, #summary { max-width: 640px; margin: 0 auto; display: grid; gap: 16px; }
.loading { text-align: center; color: var(--ink-2); margin-top: 22vh; font: 700 15px var(--sans); }

/* ---------- home */
.hero { max-width: 980px; margin: 0 auto 22px; border-bottom: 2px solid var(--rule); padding-bottom: 14px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 24px; }
.wordmark { font: 900 clamp(64px, 14vw, 148px)/.82 var(--display); text-transform: uppercase; letter-spacing: -.01em; margin: 0; }
.tagline { font: 600 15px/1.4 var(--sans); color: var(--ink-2); margin: 0 0 6px; max-width: 320px; }
.dev-badge { font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .04em; background: var(--accent); color: var(--accent-ink); padding: 4px 8px; border: 2px solid var(--rule); align-self: center; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; max-width: 980px; margin: 0 auto; }
.mode-panel { background: var(--card); border: 2px solid var(--rule); box-shadow: var(--hard); padding: 16px 18px 18px; display: flex; flex-direction: column; min-width: 0; }
.panel-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; border-bottom: 2px solid var(--rule); padding-bottom: 10px; margin-bottom: 12px; }
.mode-panel h2 { font: 900 52px/.9 var(--display); text-transform: uppercase; margin: 0; }
.menu-count { font: 700 13px var(--sans); color: var(--ink-2); white-space: nowrap; }
.mode-panel p { margin: 0 0 16px; color: var(--ink-2); max-width: 42ch; }
.mode-actions { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; }
.next-in { font-size: 13.5px; color: var(--ink-2); }
.mode-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0 0; border-top: 2px solid var(--rule); }
.stat { padding: 8px 6px 0; border-left: 1px solid var(--soft); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat dt { font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.stat dd { margin: 0; font: 900 26px/1.1 var(--display); }
.mode-panel .rank-name { font: 900 40px/.95 var(--display); text-transform: uppercase; margin: 2px 0 8px; color: var(--accent); }
.bar { height: 12px; border: 2px solid var(--rule); margin: 0 0 10px; position: relative; background: var(--paper); }
.bar span { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.home-foot { max-width: 980px; margin: 28px auto 0; display: flex; gap: 16px; font-size: 13px; }
.home-foot a { color: var(--ink-2); }

/* ---------- a passage */
.eyebrow { margin: 0; font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.page { background: var(--card); border: 2px solid var(--rule); box-shadow: 6px 6px 0 var(--accent); padding: 20px; display: grid; gap: 12px; min-width: 0; }
.passage { margin: 0; font: 400 19px/1.55 var(--text); display: grid; gap: 12px; overflow-wrap: anywhere; }
.passage p { margin: 0; white-space: pre-line; }
.passage p:first-child::before { content: "\201C"; font: 900 40px/0 var(--display); color: var(--accent); vertical-align: -14px; margin-right: 4px; }
.clue { margin: 0; font-weight: 700; color: var(--accent); }

/* ---------- the timeline */
.dial { display: grid; gap: 10px; }
.year-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.year { text-align: center; font: 900 clamp(40px, 12vw, 56px)/1 var(--display); font-variant-numeric: tabular-nums; }
.nudge { border: 2px solid var(--rule); background: var(--card); width: 44px; height: 40px; font: 700 14px var(--sans); padding: 0; }
input[type=range] { width: 100%; -webkit-appearance: none; appearance: none; height: 44px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; background: var(--rule); }
input[type=range]::-moz-range-track { height: 6px; background: var(--rule); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 36px; margin-top: -15px; background: var(--accent); border: 2px solid var(--rule); }
input[type=range]::-moz-range-thumb { width: 24px; height: 32px; background: var(--accent); border: 2px solid var(--rule); border-radius: 0; }
.tl-ticks { position: relative; height: 18px; font: 600 10px var(--sans); color: var(--ink-2); margin: -6px 12px 0; }
.tl-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-ticks span:first-child { transform: none; }
.tl-ticks span:last-child { transform: translateX(-100%); }
@media (max-width: 420px) { .tl-ticks span:nth-child(2), .tl-ticks span:nth-child(6) { display: none; } }
.dial-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lock { padding: 14px 26px; font-size: 16px; }

/* ---------- the answer */
.result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.big { margin: 0; font: 900 clamp(30px, 9vw, 46px)/1 var(--display); text-wrap: balance; }
.pts { text-align: right; display: grid; }
.pts b { font: 900 40px/1 var(--display); color: var(--accent); }
.pts span { font-size: 14px; color: var(--ink-2); }
.line { position: relative; height: 20px; border-bottom: 2px solid var(--rule); margin: 0 6px; }
.mark { position: absolute; bottom: -8px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg); border: 2px solid var(--rule); }
.mark.truth, .k.truth { background: var(--truth); }
.mark.guess, .k.guess { background: var(--guess); }
.legend { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.k { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--rule); margin-left: 6px; }
.k:first-child { margin-left: 0; }
.src { margin: 6px 0 0; font: 900 28px/1.05 var(--display); text-transform: uppercase; text-wrap: balance; }
.who { margin: 0; font-weight: 600; }
.note { margin: 0; font: 400 18px/1.5 var(--text); }
.credit { margin: 0; font-size: 12px; color: var(--ink-2); }

/* ---------- the day's score */
.score { margin: 0; font: 900 88px/1 var(--display); font-variant-numeric: tabular-nums; }
.score small { font-size: 28px; color: var(--ink-2); }
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 2px solid var(--soft); }
.r-title { font-weight: 700; }
.r-years { grid-column: 1; font-size: 13px; color: var(--ink-2); }
.rows b { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 900 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.summary-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------- the notebook */
#notebook { max-width: 760px; margin: 0 auto; display: grid; gap: 18px; }
.nb-top { display: grid; gap: 4px; border-bottom: 2px solid var(--rule); padding-bottom: 12px; }
.nb-title-big { margin: 0; font: 900 clamp(40px, 11vw, 64px)/.95 var(--display); text-transform: uppercase; }
.nb-page { background: var(--card); border: 2px solid var(--rule); box-shadow: 4px 4px 0 var(--accent); padding: 14px 16px 16px; display: grid; gap: 10px; min-width: 0;
  background-image: repeating-linear-gradient(transparent 0 31px, color-mix(in srgb, var(--accent) 12%, transparent) 31px 32px); }
.nb-page.empty { box-shadow: none; opacity: .75; }
.nb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.nb-head h2 { margin: 0; font: 900 30px/1 var(--display); text-transform: uppercase; }
.nb-bar { height: 8px; border: 2px solid var(--rule); background: var(--paper); position: relative; }
.nb-bar span { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.nb-list { list-style: none; margin: 0; padding: 0; display: grid; }
.nb-list li { border-top: 1px solid var(--soft); }
.nb-list summary { cursor: pointer; display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 0 12px; padding: 8px 0; list-style: none; }
.nb-list summary::-webkit-details-marker { display: none; }
.nb-when { grid-row: 1 / span 2; font: 900 18px/1.1 var(--display); color: var(--accent); }
.nb-title { font-weight: 700; }
.nb-who { font-size: 13px; color: var(--ink-2); }
.nb-list details[open] { padding-bottom: 12px; }
.nb-list details > :not(summary) { margin-top: 8px; }
.passage.small { font-size: 16px; }
.nb-blank { margin: 0; color: var(--ink-2); font-size: 14px; }
.muted { margin: 0; color: var(--ink-2); }

/* ---------- how to play */
.modal { color: var(--ink); background: var(--card); width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 20px 22px 22px; border: 2px solid var(--rule); box-shadow: 6px 6px 0 var(--accent); }
.modal::backdrop { background: rgba(13, 14, 16, .55); }
.modal h2 { font: 900 44px/.95 var(--display); text-transform: uppercase; margin: 0 0 12px; }
.modal p { margin: 0 0 12px; }
.modal-x { float: right; }
.muted-text { color: var(--ink-2); font-size: 14px; }

@media (max-width: 640px) {
  .topbar { padding: 6px 10px; gap: 6px; min-height: 50px; }
  .dd-mark { font-size: 13px; padding: 5px 4px 4px; }
  .icon-btn { width: 34px; height: 34px; }
  .status-label { display: none; }
  body[data-screen="game"] .brand, body[data-screen="summary"] .brand { display: none; }
  .tick { width: 11px; height: 11px; }
  .status-score { font-size: 22px; }
  .screen { padding-top: 16px; }
  .score { font-size: 72px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* very zoomed-in phones: the year and its nudge buttons go on their own row above the slider */
@media (max-width: 300px) {
  .year-row { grid-template-columns: repeat(4, 1fr); }
  .year-row .year { grid-column: 1 / -1; grid-row: 1; }
  .nudge { width: auto; }
  .tl-ticks span:nth-child(3), .tl-ticks span:nth-child(5) { display: none; }
  .dial-actions { flex-direction: column; align-items: stretch; }
}
/* Endless lives (three X's) sit at the end of the line */
.sc-lives-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
