/* Chronicle — "Archive Codex" design system. Light archive base: parchment
   and cream surfaces, aged-gold tooling, burgundy + forest accents.
   Tokens live in css/brand-tokens.css (imported before this file).
   Mobile-first for iPhone (390x844). */

:root {
  --paper: var(--ch-paper);
  --ink: var(--ch-text-primary);
  --muted: var(--ch-text-muted);
  --rule: var(--ch-line);
  --soft: var(--ch-parchment);
  --sel: var(--ch-pale-gold);      /* selected cell */
  --selword: #C9D6C6;              /* selected word — muted sage, archive-ink */
  --green: var(--ch-forest);
  --red: var(--ch-burgundy);
  --gold: var(--ch-gold);
  --serif: var(--ch-font-display);
  --sans: var(--ch-font-ui);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; overflow-x: hidden; }
body {
  font-family: var(--ch-font-text);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
}
/* iOS (html.ios set by js/app.js) gets its native rubber band back — the
   real thing, momentum flicks included; the queen pull rides it. Everywhere
   else keeps the solid stop above: Android Chrome's built-in pull-to-refresh
   would fight the gesture, and desktop has no bounce to give. */
html.ios, html.ios body { overscroll-behavior: auto; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
#app { max-width: 600px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

.view { display: flex; flex-direction: column; min-height: 100dvh; }
.view[hidden] { display: none; }
.safe-top { padding-top: max(12px, env(safe-area-inset-top)); }
.scroll-main { flex: 1; overflow-y: auto; padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); }
.center-main { display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; gap: 8px; }

/* ---------- Home ---------- */
#view-home { background-color: var(--ch-paper); background-image: radial-gradient(rgba(11,11,11,.09) 1px, transparent 1.2px); background-size: 14px 14px; }
/* min-height: the David sticker is absolutely positioned, so the masthead must
   be guaranteed tall enough to contain him — a one-line wordmark alone is
   shorter than he is, and he'd hang over the panel below (rename, 4 Aug).
   Fluid (4 Aug, masthead scale-up): both the wordmark and sticker now grow
   with viewport width via --mh-sticker-w, so min-height tracks the sticker's
   rotated footprint (top offset + size + a little breathing room) instead of
   a fixed number tuned only for the old 76px sticker. */
.masthead {
  text-align: left; padding: 18px 20px 12px; border-bottom: 3px solid var(--ch-ink);
  margin: 0 20px; position: relative;
  --mh-sticker-w: clamp(84px, 27vw, 130px);
  min-height: clamp(114px, calc(6px + var(--mh-sticker-w) * 1.1 + 14px), 166px);
}
.masthead-seal { width: 44px; height: 44px; display: block; margin: 0 auto 6px; border-radius: 11px; }
/* One unbroken word (rename, 4 Aug 2026): the mark is never split across
   lines or detached — it scales down on narrow phones instead, staying clear
   of the absolutely-positioned David sticker on the right. */
.masthead h1 {
  font-family: var(--ch-font-display); font-size: clamp(28px, 7.4vw, 44px);
  letter-spacing: -0.02em; margin: 0; white-space: nowrap;
  font-weight: 400; line-height: .92; color: var(--ch-text-primary); text-transform: uppercase;
}
/* The drawn wordmark (CMYK misregistration on the NERD block) replaces the
   type-set h1. Ratio 3.9:1; capped so it never runs under the David sticker.
   Fluid (4 Aug, masthead scale-up): grows with viewport width so phones get
   a proper newspaper-masthead-sized mark, while staying clear of
   --mh-sticker-w (the sticker's own fluid width) and capping sensibly once
   the #app shell hits its 600px ceiling. */
.masthead-wordmark {
  display: block; height: auto;
  width: clamp(150px, calc(100vw - var(--mh-sticker-w) - 76px), 258px);
}
/* padding-right keeps the dateline clear of the absolutely-positioned
   David sticker, which now scales with --mh-sticker-w. */
.dateline { margin: 8px 0 0; padding-right: calc(var(--mh-sticker-w) + 8px); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--ch-text-primary); font-family: var(--ch-font-ui); }

/* P1.5: the one-shot explicit wrong-guess line (first wrong guess anywhere)
   and the polite screen-reader live region (visually hidden, never seen). */
.df-wrong-note { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--df-red); font-family: var(--ch-font-ui); }

/* The three-choices ultimate clue (28 Jul 2026): full-width stacked options
   so the three names read as a ballot, not a row of squeezed pills. */
.mcq-chips { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mcq-chips .mcq-opt { width: 100%; max-width: 420px; text-align: center; font-weight: 700; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Fluid (4 Aug, masthead scale-up): width tracks --mh-sticker-w (set on
   .masthead) so the sticker, the wordmark's available width, and the
   dateline's clearance all move together off one number. */
.masthead-sticker { position: absolute; right: 12px; top: 6px; width: var(--mh-sticker-w); transform: rotate(6deg); }

/* Masthead punch card: this week as die-punched ticket squares (streak). */
#punch-card { display: flex; gap: 5px; align-items: center; margin: 8px 0 2px; }
#punch-card .punch-day {
  width: 17px; height: 17px; border: 2px solid var(--ch-ink); background: var(--ch-cream);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--ch-font-ui); font-weight: 700; font-size: 8.5px; color: var(--ch-text-muted);
}
#punch-card .punch-day.future { border-color: var(--ch-line-soft); color: var(--ch-sage); }
#punch-card .punch-day.today { box-shadow: 2px 2px 0 var(--ch-ink); }
#punch-card .punch-day.punched i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--ch-ink);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.35);
}
#punch-card .punch-count {
  margin-left: 7px; font-family: var(--ch-font-ui); font-weight: 700; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ch-ink);
}

/* Celebration milestone postmark (streak days 2/3/5/7/10/25/50/100). */
.dd-postmark { display: flex; justify-content: center; margin: 2px 0 8px; }
.dd-postmark .postmark {
  width: 76px; height: 76px; border: 2.5px solid var(--ch-ink); border-radius: 50%;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  transform: rotate(-8deg); position: relative; color: var(--ch-ink);
}
.dd-postmark .postmark::after { content: ''; position: absolute; inset: 4px; border: 1px solid var(--ch-ink); border-radius: 50%; }
.dd-postmark b { font-family: var(--ch-font-display); font-size: 24px; line-height: 1; font-weight: 400; }
.dd-postmark small { font-family: var(--ch-font-ui); font-weight: 700; font-size: 6.5px; letter-spacing: .14em; text-transform: uppercase; text-align: center; line-height: 1.5; }

/* ---------- Game rows (NYT-Games-style: hero + day-card strip + Archive) --
   Built by js/app.js (renderGameRows). Each row carries its own accent tint
   via inline custom properties (--row-tint-strong/--row-tint-soft) computed
   once from GAME_ROWS so the CSS below stays purely structural. */
.home-rows { flex: 1; padding: 10px 0 14px; display: flex; flex-direction: column; gap: 18px; }
.game-row { display: flex; flex-direction: column; }
.game-strip {
  display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden;
  padding: 0 24px 10px; scroll-padding: 0 24px; scroll-snap-type: x proximity;
  scrollbar-width: none; -ms-overflow-style: none;
}
.game-strip::-webkit-scrollbar { display: none; }
/* .day-cards is just a semantic wrapper around the day-card buttons in the
   markup; display:contents lifts its children to be direct flex items of
   .game-strip (siblings of .hero-card) without an extra nested flex layer. */
.day-cards { display: contents; }

.hero-card {
  width: calc(100% - 40px); margin: 0 20px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  text-align: left; border: 2.5px solid var(--ch-ink); border-left: 12px solid var(--row-tint-strong, var(--ch-ink));
  padding: 16px 18px; background: var(--ch-cream);
  box-shadow: var(--ch-shadow-card); min-height: 118px;
  transition: transform .12s ease;
}
.hero-card:active { transform: scale(.985); }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-text { flex: 1; min-width: 0; }
.hero-name { font-family: var(--ch-font-display); font-weight: 400; margin: 0 0 4px; font-size: 26px; text-transform: uppercase; letter-spacing: .01em; color: var(--ch-text-primary); }
.hero-tagline { margin: 0; color: var(--ch-text-secondary); font-size: 14px; line-height: 1.4; }
/* Icons are framed mini-prints (Daniel, 4 Aug 2026): the art carries its own
   cream paper ground, so the ink frame + hard shadow makes that deliberate.
   104px earned by demoting the Play chip — the whole card is the button. */
.hero-glyph { width: 104px; height: 104px; flex: none; display: block; border: 2px solid var(--ch-ink); box-shadow: 2.5px 2.5px 0 var(--ch-ink); background: var(--ch-cream); }
.hero-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-edition {
  font-size: 11px; text-transform: uppercase; letter-spacing: var(--ch-tracking-smallcaps);
  font-weight: 700; color: var(--ch-text-label); font-family: var(--ch-font-ui); white-space: nowrap;
}
.hero-status { font-size: 12px; font-weight: 700; color: var(--ch-text-muted); font-family: var(--ch-font-ui); white-space: nowrap; }
/* P1.4: the expected-time whisper on each hero card — quiet lowercase
   voice riding the edition line. */
.hero-time { text-transform: none; font-weight: 600; letter-spacing: normal; color: var(--ch-text-muted); }
/* "Play ›" demoted from ink chip to quiet uppercase text (Daniel, 4 Aug
   2026): the WHOLE hero card is the button, and the freed space bought the
   104px icon. Supersedes the conversion-audit chip; watch tap-through in
   the Session D tester round. */
.hero-card:not(.row-done):not(.row-progress) .hero-status {
  color: var(--ch-ink); font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase;
}
.hero-card.row-done .hero-status { color: var(--ch-forest); }
.hero-card.row-progress .hero-status { color: var(--ch-gold); }

.day-card {
  flex: 0 0 27%; max-width: 27%; scroll-snap-align: start;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px;
  text-align: left; border: 2px solid var(--ch-ink);
  padding: 10px 12px; background: var(--ch-cream); min-height: 92px;
}
.day-card:active { transform: scale(.97); }
.day-weekday { font-family: var(--ch-font-ui); font-weight: 700; font-size: 15px; text-transform: uppercase; color: var(--ch-text-primary); line-height: 1.15; }
.day-status { font-size: 10px; font-family: var(--ch-font-ui); color: var(--ch-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.day-card.day-done { background: var(--row-tint-strong, var(--ch-pale-gold)); }
.day-card.day-done .day-status { color: var(--ch-ink); font-weight: 700; }

.row-archive {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: calc(100% - 40px); margin: 0 20px; padding: 9px 0;
  background: var(--ch-cream); border: 2px solid var(--ch-ink); border-top: none;
  font-size: 12px; font-weight: 700; letter-spacing: var(--ch-tracking-smallcaps); text-transform: uppercase;
  color: var(--ch-text-label); font-family: var(--ch-font-ui);
}
.row-archive:active { background: var(--ch-parchment); }
.row-archive-glyph { width: 14px; height: 14px; color: var(--ch-ink); }

.home-foot { text-align: center; color: var(--ch-text-muted); font-size: 12px; padding: 4px 0 calc(16px + env(safe-area-inset-bottom)); font-family: var(--ch-font-ui); }
.foot-toggle { background: none; border: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.home-foot a { color: inherit; }
.home-foot br { content: ''; display: block; margin-top: 4px; }

/* ---------- Archive ---------- */
.archive-filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 20px; border-bottom: 1px solid var(--ch-line); background: var(--ch-paper); }
.archive-chip { flex: none; border-color: var(--ch-line); color: var(--ch-text-muted); font-family: var(--ch-font-ui); }
.archive-chip.active { background: var(--ch-ink); color: var(--ch-text-inverse); border-color: var(--ch-ink); }
.archive-row { width: 100%; }
.archive-marks { display: flex; gap: 5px; flex: none; }
.archive-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ch-line); display: inline-block; }
.archive-dot.done { background: var(--ch-forest); }
.archive-dot.progress { background: var(--ch-gold); }

/* Back Issues calendar (The Morgue): one month per section, Monday-first. */
.cal-month { padding: 12px 20px 2px; }
.cal-title { font-family: var(--ch-font-display); font-weight: 400; font-size: 20px; text-transform: uppercase; margin: 8px 0 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-family: var(--ch-font-ui); font-size: 10px; font-weight: 700; color: var(--ch-text-muted); padding-bottom: 2px; }
.cal-cell {
  position: relative; aspect-ratio: 1; padding: 0; cursor: pointer;
  border: 1.5px solid var(--ch-line-soft); background: var(--ch-paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-family: var(--ch-font-ui);
}
.cal-cell b { font-size: 13px; font-weight: 700; color: var(--ch-ink); line-height: 1; }
button.cal-cell:active { background: var(--ch-parchment); }
.cal-cell.blank, .cal-cell.dead { border-color: transparent; background: transparent; cursor: default; }
.cal-cell.dead { color: var(--ch-text-muted); font-size: 12px; opacity: .35; }
.cal-cell.future { opacity: .45; }
.cal-cell.today { border: 2.5px solid var(--ch-ink); box-shadow: 2px 2px 0 var(--ch-ink); cursor: default; }
.cal-dots { display: flex; gap: 3px; }
.cal-dots .archive-dot { width: 6px; height: 6px; }

.conn-list-intro { margin: 12px 20px 0; color: var(--ch-text-secondary); font-size: 14px; font-style: italic; line-height: 1.4; }

#install-tip {
  margin: 0 20px 10px; padding: 12px 38px 12px 14px; position: relative;
  background: var(--ch-cream); border: 1px solid var(--ch-line); border-radius: 12px; font-size: 14px;
  font-family: var(--ch-font-ui); color: var(--ch-text-primary);
}
#install-tip p { margin: 0; }
#install-tip .share-glyph { width: 13px; height: 17px; vertical-align: -3px; color: var(--ch-forest); }
#install-tip-close { position: absolute; right: 8px; top: 6px; font-size: 20px; color: var(--muted); padding: 4px 8px; }
.install-steps { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.install-step { line-height: 1.45; }
.install-step b {
  display: inline-block; width: 18px; height: 18px; margin-right: 4px;
  border: 1.5px solid var(--ch-forest); border-radius: 50%;
  font-size: 11px; line-height: 15px; text-align: center; color: var(--ch-forest);
}
#install-btn { margin-top: 10px; }

/* The stranger's landing (see applyStrangerMode): headline + one door for
   visitors with no play history; the regulars' furniture below stays hidden
   until their first finished daily. */
#stranger-hero { margin: 14px 24px 4px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.stranger-headline {
  margin: 0; padding: 10px 12px;
  background: var(--ch-cream); border: 2px solid var(--ch-ink); box-shadow: 3px 3px 0 var(--ch-ink);
  font-family: var(--ch-font-ui); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; line-height: 1.55; color: var(--ch-text-primary);
}
.is-stranger .df-week, .is-stranger .row-archive, .is-stranger #punch-card { display: none !important; }
/* The one door gets the house magenta and a periodic nudge — enough to say
   "press me", quiet enough not to feel like an ad. */
#stranger-play {
  background: var(--df-magenta); border-color: var(--ch-ink);
  animation: cta-nudge 3s ease-in-out infinite;
}
#stranger-play:active { background: color-mix(in srgb, var(--df-magenta) 84%, var(--ch-ink)); }
@keyframes cta-nudge {
  0%, 86%, 100% { scale: 1; }
  91% { scale: 1.03; }
  96% { scale: 0.995; }
}
@media (prefers-reduced-motion: reduce) { #stranger-play { animation: none; } }

/* Edition-closed strip (Change A): the quiet ending for a day finished but not
   swept — top of Home + the destination of "Close the issue ›". Receipt-
   adjacent (cream/ink, dashed rule), no CMYK: consolation, not celebration. */
#issue-closed { margin: 12px 20px 2px; padding: 14px 16px; background: var(--ch-cream); border: 2px solid var(--ch-ink); box-shadow: var(--ch-shadow-card); }
.ic-verdict { margin: 0; font-family: var(--ch-font-ui); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; line-height: 1.5; color: var(--ch-text-primary); }
.ic-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 2px dashed var(--ch-line-soft); }
.ic-label { font-family: var(--ch-font-ui); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ch-text-muted); }
.ic-row b { font-family: var(--ch-font-display); font-weight: 400; font-size: 30px; line-height: 1; color: var(--ch-text-primary); font-variant-numeric: tabular-nums; }
.ic-countdown { margin: 10px 0 0; font-family: var(--ch-font-ui); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ch-text-muted); }
.ic-countdown b { display: block; margin-top: 2px; font-family: var(--ch-font-display); font-weight: 400; font-size: 22px; letter-spacing: .02em; color: var(--ch-text-primary); }

/* Farewell strip (cutover, 4 Aug 2026): shown by app.js only on deadfamous.*.
   Deliberately LOUD — magenta plate, top of Home — because for a stranded
   installed app this is the only road sign out. */
#moving-note { margin: 12px 20px 2px; padding: 14px 16px; background: var(--ch-cream); border: 2.5px solid var(--ch-ink); box-shadow: var(--ch-shadow-card); }
.moving-kicker { margin: 0; display: inline-block; padding: 2px 8px; background: var(--df-magenta); color: var(--ch-ink); font-family: var(--ch-font-ui); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; border: 2px solid var(--ch-ink); }
.moving-body { margin: 10px 0 12px; font-size: 15px; line-height: 1.45; color: var(--ch-text-primary); }
#moving-note .pill { width: 100%; text-align: center; }

/* First-run intro card (Change B, rebuilt v164): one shared overlay, per-game
   content, laid out as a full-bleed poster — the game's art bleeds edge to
   edge across the top, a mono kicker plate in the game's accent is punched
   over the border seam, and the copy + Play pill sit on the dot-grid paper
   below. The topbar "?" reopens the same card over a live game (tap-outside
   to close). Accent colour arrives as --intro-accent / --intro-accent-ink,
   set on .intro-sheet by fillIntro() in js/app.js. */
.intro-overlay {
  position: fixed; inset: 0; z-index: 30;
  background-color: var(--ch-paper);
  background-image: radial-gradient(rgba(11,11,11,.09) 1px, transparent 1.2px); background-size: 14px 14px;
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  padding: 0;
}
.intro-overlay[hidden] { display: none; }
/* Capped to the same 600px column as #app so the poster never sprawls on a
   desktop window; min-height:100% keeps the pill on the bottom edge when the
   copy is short, and lets the sheet grow (and the overlay scroll) when it
   isn't — nothing is ever clipped on a 320x568 screen. */
.intro-sheet {
  display: flex; flex-direction: column; text-align: left;
  width: 100%; max-width: 600px; min-height: 100%;
  --intro-accent: var(--df-magenta); --intro-accent-ink: var(--ch-ink);
}
.intro-art { position: relative; flex: none; }
.intro-art img {
  display: block; width: 100%;
  height: 48vh; min-height: 168px; max-height: 420px;
  object-fit: cover; background: var(--ch-parchment);
  border-bottom: 3px solid var(--ch-ink);
}
.intro-kicker {
  position: absolute; left: 16px; bottom: -13px;
  padding: 4px 10px; background: var(--intro-accent); color: var(--intro-accent-ink);
  font-family: var(--ch-font-ui); font-weight: 700; font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  border: 2px solid var(--ch-ink); box-shadow: 2.5px 2.5px 0 var(--ch-ink);
}
.intro-body {
  flex: 1; display: flex; flex-direction: column; gap: 8px;
  padding: 30px 20px calc(20px + env(safe-area-inset-bottom));
}
.intro-body .start-title {
  margin: 0; font-size: 32px; line-height: .98; text-transform: uppercase; letter-spacing: -0.01em;
}
.intro-body .start-copy { margin: 0; max-width: none; }
.intro-sheet .pill.big {
  margin-top: auto; max-width: none;
  background: var(--intro-accent); color: var(--intro-accent-ink);
  border-color: var(--ch-ink); box-shadow: 3px 3px 0 var(--ch-ink);
}
.intro-sheet .pill.big:active {
  background: color-mix(in srgb, var(--intro-accent) 86%, var(--ch-ink));
  transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ch-ink);
}
/* Short screens (320x568 and friends): the poster gives up height first so the
   title and first line of copy still land above the fold. */
@media (max-height: 640px) {
  .intro-art img { height: 33vh; }
  .intro-body { gap: 7px; padding-top: 22px; }
  .intro-body .start-title { font-size: 27px; }
}
@media (min-width: 700px) {
  .intro-sheet { border-left: 2.5px solid var(--ch-ink); border-right: 2.5px solid var(--ch-ink); }
}
.topbar-help { font-family: var(--ch-font-ui); font-weight: 700; font-size: 18px; }

/* "New edition off the presses" bar: appears (via js/app.js) once a freshly
   deployed version has installed underneath the running page. Fixed over
   every view — the pull-to-refresh, or tapping it, reloads into the update. */
#new-edition {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--ch-ink); color: var(--ch-text-inverse);
  border: none; border-bottom: 3px solid var(--df-magenta);
  font-family: var(--ch-font-ui); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; text-align: center;
  cursor: pointer; animation: new-edition-in 320ms cubic-bezier(.2,1,.4,1);
}
#new-edition b { color: var(--df-yellow); font-weight: 700; }
@keyframes new-edition-in { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 2.5px solid var(--ch-ink);
  background: var(--ch-paper); position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-family: var(--ch-font-display); font-weight: 400; font-size: 18px; text-transform: uppercase; letter-spacing: .02em; margin: 0; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ch-text-primary); }
#view-conn .topbar h2, #view-connsum .topbar h2 {
  white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.1; padding: 2px 0;
}
.topbar-right { display: flex; align-items: center; gap: 6px; min-width: 44px; justify-content: flex-end; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 50%; font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  color: var(--ch-text-primary);
}
.iconbtn:active { background: var(--ch-parchment); }
#map-score { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ch-text-muted); font-family: var(--ch-font-ui); }

/* ---------- Buttons ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--ch-ink); border-radius: 0;
  padding: 9px 18px; font-size: 14px; font-weight: 700; background: var(--ch-cream);
  color: var(--ch-text-primary); font-family: var(--ch-font-ui); text-transform: uppercase; letter-spacing: .03em;
}
.pill:active { background: var(--ch-parchment); }
.pill.primary { background: var(--ch-ink); color: var(--ch-text-inverse); border-color: var(--ch-ink); box-shadow: 4px 4px 0 rgba(11,11,11,.28); }
.pill.primary:active { background: #2A2A26; transform: translate(2px,2px); box-shadow: 2px 2px 0 rgba(11,11,11,.28); }
.pill.ghost { border-color: var(--ch-line); color: var(--ch-text-secondary); background: transparent; }
.pill.warn { border-color: var(--ch-burgundy); color: var(--ch-burgundy); }
.pill.small { padding: 7px 13px; font-size: 13px; }
.pill.big { width: 100%; padding: 15px; font-size: 16px; font-family: var(--ch-font-display); font-weight: 400; letter-spacing: .05em; }
.pill:disabled { opacity: .35; pointer-events: none; }
/* Costs read as losses (Daniel, 28 Jul 2026): the minus is red, everywhere. */
.pill .cost { font-weight: 400; color: var(--df-red); opacity: .85; font-size: .85em; }

.view-game { height: 100dvh; overflow: hidden; }

/* ---------- Sheets, modals, toast ---------- */
.sheet { position: fixed; inset: 0; background: rgba(43,33,24,.4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card {
  background: var(--ch-paper); border-radius: 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: 600px; max-height: 86dvh; display: flex; flex-direction: column; gap: 10px;
  border-top: 3px solid var(--ch-ink);
}
.sheet-card h3 { margin: 4px 0 2px; font-size: 12px; font-family: var(--ch-font-ui); text-transform: uppercase; letter-spacing: var(--ch-tracking-smallcaps); font-weight: 700; color: var(--ch-text-label); }
.sheet-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-close { margin-top: 8px; }
.confirm-msg { margin: 6px 0 10px; font-size: 16px; font-weight: 600; color: var(--ch-text-primary); }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01s !important; transition-duration: .01s !important; }
}

/* ---------- Map game ---------- */
.b-birth { color: var(--ch-map-destination); }
.b-death { color: var(--ch-map-origin); }
#map-panel { position: relative; background: var(--ch-parchment); border-bottom: 1px solid var(--ch-line); }
#map-svg { display: block; width: 100%; height: 38dvh; }
.map-land { fill: var(--ch-parchment); stroke: var(--ch-line-soft); stroke-width: .6; }
.mk-dot { stroke: var(--ch-cream); stroke-width: .8; }
.mk-birth { fill: var(--ch-map-destination); }
.mk-death { fill: var(--ch-map-origin); }
.mk-label { font-family: var(--ch-font-ui); font-weight: 700; paint-order: stroke; stroke: var(--ch-map-origin-halo); fill: var(--ch-map-label); }
#map-streak {
  position: absolute; top: 8px; right: 10px; background: var(--ch-ink); color: var(--ch-text-inverse);
  font-size: 12px; font-weight: 700; border-radius: 0; padding: 4px 10px; font-family: var(--ch-font-ui); border: 2px solid var(--ch-ink);
}
.map-main { flex: 1; overflow-y: auto; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; background: var(--ch-cream); }
#map-question { margin: 0; font-size: 15px; color: var(--ch-text-primary); }
#map-form { display: flex; gap: 8px; }
#map-input {
  flex: 1; font-family: var(--ch-font-ui); font-size: 15px; padding: 12px 14px;
  border: 2px solid var(--ch-ink); border-radius: 0; min-width: 0; background: var(--ch-cream);
  color: var(--ch-text-primary); text-transform: uppercase;
}
#map-input:focus { outline: 3px solid var(--ch-gold); outline-offset: 1px; }
#map-input.shake { animation: shake .35s ease; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
#map-hints { display: flex; gap: 8px; flex-wrap: wrap; }
#map-feedback { border-radius: 0; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
#map-feedback.good { background: var(--ch-cream); border: 2px solid var(--ch-ink); border-left: 10px solid var(--ch-thread-green); }
#map-feedback.info { background: var(--ch-cream); border: 2px solid var(--ch-ink); }
#map-feedback b.fig { font-family: var(--ch-font-display); font-weight: 400; font-size: 17px; }
#map-feedback .pts { font-weight: 800; color: var(--ch-gold); }
/* Lifeline reveal line (Change 4): a fun-fact reward, same weight as the rest
   of the feedback prose — just its own line, like Face Value's blurb text. */
#map-feedback .fig-fact { display: block; margin-top: 6px; }
#map-guesses { display: flex; flex-wrap: wrap; gap: 6px; }
#map-next { position: sticky; bottom: 2px; }
.guess-chip {
  font-size: 12px; color: var(--ch-text-muted); background: var(--ch-cream); font-family: var(--ch-font-ui);
  border: 1.5px solid var(--ch-line-soft); border-radius: 0; padding: 4px 10px; text-decoration: line-through; text-transform: uppercase;
}
.hint-chip { font-size: 13px; background: var(--ch-pale-gold); border: 2px solid var(--ch-ink); border-radius: 0; padding: 8px 12px; color: var(--ch-text-primary); font-family: var(--ch-font-ui); }

/* ---------- Zoom In game (Face Value / Relic) ---------- */
/* The image frame keeps a dark neutral backing (#111) — artwork needs it —
   but its chrome/border goes parchment+gold per the brand spec. */
#rv-panel { position: relative; background: var(--ch-parchment); border-bottom: 1px solid var(--ch-line); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 12px; }
/* Positioning context for the verdict badge: it sits OUTSIDE the frame so the
   frame's overflow:hidden can never clip the stamp. Sized to the frame's
   content width, so the badge's negative offsets land on the frame's corner. */
#rv-frame-wrap { position: relative; }
#rv-frame-wrap.pz-active { overflow: hidden; }
#rv-frame-wrap .df-moment-badge { z-index: 5; }
#rv-frame {
  width: min(80vw, 40dvh); aspect-ratio: 1 / 1; border-radius: 0; position: relative;
  background-repeat: no-repeat; background-color: #111; overflow: hidden;
  box-shadow: var(--ch-shadow-card); border: 3px solid var(--ch-ink);
  transition: width .35s ease, aspect-ratio .35s ease;   /* morph to the image's shape on reveal */
}
/* P3.3: discreet tap-to-expand photo credit — ink-coloured glyph at low
   opacity so it reads as quiet furniture, not a UI control competing with
   the reveal moment; only shown post-resolution (see resolveRound). */
.rv-credit-btn {
  position: absolute; right: 6px; bottom: 6px; z-index: 5;
  width: 30px; height: 30px; border-radius: 50%; border: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--ch-font-ui); font-size: 16px; line-height: 1;
  background: rgba(11,11,11,.4); color: rgba(245,242,232,.92);
}
.rv-credit-btn:active { background: rgba(11,11,11,.6); }
.rv-credit-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  background: rgba(242,239,230,.95); color: var(--ch-text-primary);
  border-top: 2px solid var(--ch-ink);
  font-family: var(--ch-font-ui); font-size: 11px; line-height: 1.45;
  padding: 8px 30px 8px 10px;
}
.rv-credit-panel a { color: var(--ch-text-primary); }
.rv-credit-panel .rv-report-link { display: block; margin-top: 4px; color: var(--ch-text-muted); font-size: 10px; }

/* P3.5: same muted "Report a problem" link, on each daily summary screen */
.sum-report-link {
  display: block; text-align: center; margin: 14px 0 0;
  font-family: var(--ch-font-ui); font-size: 11px; color: var(--ch-text-muted);
}
#rv-timerbar {
  width: min(76vw, 38dvh); height: 6px; border-radius: 999px;
  background: rgba(43,33,24,.12); overflow: hidden;
}
#rv-timerfill { height: 100%; width: 100%; background: var(--ch-forest); }
#rv-streak {
  position: absolute; top: 14px; right: 16px; background: var(--ch-ink); color: var(--ch-text-inverse);
  font-size: 12px; font-weight: 700; border-radius: 0; padding: 4px 10px; font-family: var(--ch-font-ui); border: 2px solid var(--ch-ink);
}
#rv-pause {
  font-size: 12px; font-weight: 700; padding: 4px 12px;
  background: var(--ch-forest); color: var(--ch-text-inverse); border-color: var(--ch-forest);
}
#rv-prompt { margin: 0; font-size: 15px; font-weight: 700; color: var(--ch-text-primary); }
#rv-form { display: flex; gap: 8px; }
#rv-input {
  flex: 1; font-family: var(--ch-font-ui); font-size: 15px; padding: 12px 14px;
  border: 2px solid var(--ch-ink); border-radius: 0; min-width: 0; background: var(--ch-cream);
  color: var(--ch-text-primary); text-transform: uppercase;
}
#rv-input:focus { outline: 3px solid var(--ch-gold); outline-offset: 1px; }
#rv-input.shake { animation: shake .35s ease; }
#rv-controls { display: flex; gap: 8px; flex-wrap: wrap; }
#rv-guesses { display: flex; flex-wrap: wrap; gap: 6px; }
#rv-feedback { border-radius: 0; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
#rv-feedback.good { background: var(--ch-cream); border: 2px solid var(--ch-ink); border-left: 10px solid var(--ch-thread-green); }
#rv-feedback.info { background: var(--ch-cream); border: 2px solid var(--ch-ink); }
#rv-feedback b.fig { font-family: var(--ch-font-display); font-weight: 400; font-size: 17px; }
#rv-feedback .pts { font-weight: 800; color: var(--ch-gold); }
#rv-next { position: sticky; bottom: 2px; }

/* ---------- Map start & summary ---------- */
.start-glyph { width: 200px; margin: 10px auto 0; }
.start-title { font-family: var(--ch-font-display); font-weight: 400; font-size: 27px; margin: 8px 0 0; color: var(--ch-text-primary); }
.start-copy { color: var(--ch-text-primary); font-size: 15px; line-height: 1.5; max-width: 330px; margin: 6px 0 0; }
.start-copy.small { color: var(--ch-text-muted); font-size: 13px; }
#map-best { margin-top: 4px; }
#map-start { margin-top: 14px; max-width: 330px; }

.sum-total { text-align: center; margin: 18px 0 0; }
.sum-total::before {
  content: ''; display: block; height: 5px; margin: 0 auto 12px; max-width: 160px;
  background: var(--ch-ink);
}
#sum-total { font-family: var(--ch-font-display); font-weight: 400; font-size: 64px; display: block; line-height: 1; color: var(--ch-text-primary); }
.sum-total-label { text-transform: uppercase; letter-spacing: 2px; font-size: 12px; color: var(--ch-text-muted); font-family: var(--ch-font-ui); }
.sum-remark { text-align: center; color: var(--ch-text-muted); margin: 6px 0 18px; font-style: italic; }
.sum-list { list-style: none; margin: 0 0 18px; padding: 0; }
.sum-list li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--ch-parchment); font-size: 15px; color: var(--ch-text-primary); }
.sum-list .sum-name { flex: 1; }
.sum-list .sum-name small { display: block; color: var(--ch-text-muted); font-size: 12px; }
.sum-list .sum-pts { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ch-gold); }
.sum-list .sum-pts.zero { color: var(--ch-text-muted); font-weight: 400; }
.sum-actions { display: flex; flex-direction: column; gap: 10px; }

/* P2.3: the one-time "saves aren't sticking" notice (quota/private mode).
   Created by js/storage.js only when a write actually throws — a brand-new
   element, so nothing existing changes visually. Sits below the NEW EDITION
   bar (z 90), above sheets/overlays. */
.df-save-toast {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 80; display: flex; align-items: center; gap: 10px;
  background: var(--ch-ink); color: var(--ch-paper);
  border: 2px solid var(--ch-ink); box-shadow: 3px 3px 0 rgba(11,11,11,.35);
  padding: 10px 12px; font-family: var(--ch-font-ui); font-size: 13px; font-weight: 700;
}
.df-save-toast-close {
  margin-left: auto; flex: 0 0 auto; background: none; border: 0; color: inherit;
  font-size: 20px; line-height: 1; padding: 2px 6px; cursor: pointer;
}

/* Desktop niceties */
@media (min-width: 700px) {
  body { background: #E4DFCE; }
  #app { background: var(--ch-paper); border-left: 2.5px solid var(--ch-ink); border-right: 2.5px solid var(--ch-ink); }
}

/* ---------- Connections (Thread) ---------- */
.conn-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px; margin: 10px 0;
}
.conn-tile {
  aspect-ratio: 1 / 1; border-radius: 0;
  background: var(--ch-cream); border: 2px solid var(--ch-ink); box-shadow: 2.5px 2.5px 0 var(--ch-ink);
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 13px; font-weight: 700;
  padding: 6px; cursor: pointer; user-select: none;
  transition: background .1s, transform .1s;
  line-height: 1.15; color: var(--ch-text-primary);
  /* Whole words only: never break mid-word. JS (fitConnTiles) shrinks the font
     so long single words fit on one line; multi-word tiles wrap at spaces. */
  min-width: 0; overflow: hidden; overflow-wrap: normal; word-break: normal; hyphens: manual;
}
/* P2.4: tiles are real <button>s now (keyboard + screen-reader play). These
   lines strip the UA button chrome so they render pixel-identical to the old
   divs; the focus ring is keyboard-only (:focus-visible), so touch and mouse
   play look exactly as before. */
.conn-tile {
  appearance: none; -webkit-appearance: none;
  font-family: inherit; letter-spacing: inherit; margin: 0;
}
.conn-tile:focus { outline: none; }
.conn-tile:focus-visible { outline: 2.5px solid var(--ch-ink); outline-offset: 2px; }
.conn-tile:active { transform: translate(2px,2px); box-shadow: .5px .5px 0 var(--ch-ink); }
.conn-selected { background: var(--df-cyan); color: var(--ch-ink); border-color: var(--ch-ink); }
.conn-grid.conn-shake { animation: shake .35s ease; }
.conn-group {
  border-radius: 0; border: 2px solid var(--ch-ink); box-shadow: 3px 3px 0 var(--ch-ink);
  padding: 12px 14px; margin-bottom: 10px; text-align: center;
}
/* Muted archive-ink versions of the classic yellow/green/blue/purple solved
   groups — kept clearly distinct from each other for gameplay clarity while
   fitting the parchment palette. Hex values also live as --ch-thread-* tokens
   in css/brand-tokens.css. */
.conn-group-yellow  { background: var(--ch-thread-yellow); color: var(--ch-text-primary); }
.conn-group-green   { background: var(--ch-thread-green); color: var(--ch-text-primary); }
.conn-group-blue    { background: var(--ch-thread-blue); color: var(--ch-text-primary); }
.conn-group-purple  { background: var(--ch-thread-purple); color: var(--ch-text-primary); }
.conn-group-label {
  font-size: 12px; font-family: var(--ch-font-display); font-weight: 400; text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 4px;
}
/* Card #12: colorblind print glyphs — always ink, never the group's own
   tinted text colour, so the shape reads regardless of hue perception. */
.conn-glyph { color: var(--ch-ink); opacity: .8; margin-right: 4px; font-size: 1em; }
.conn-group-items { font-size: 14px; font-weight: 600; }
.conn-actions {
  display: flex; gap: 8px; justify-content: center; margin: 10px 0;
}
.conn-feedback {
  text-align: center; font-size: 14px; font-weight: 700;
  padding: 10px; border-radius: 10px; margin: 4px 0;
}
.conn-wrong { background: var(--ch-cream); color: var(--ch-burgundy); border: 2px solid var(--ch-burgundy); }
.conn-mistakes-dots { display: flex; gap: 6px; align-items: center; }
.conn-dot {
  width: 10px; height: 10px; border-radius: 0; border: 1.5px solid var(--ch-ink);
  background: var(--ch-cream);
}
.conn-dot-on { background: var(--ch-ink); border-color: var(--ch-ink); }

.conn-shake { animation: shake .3s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* The queen pull (home, iOS only). The page's own motion — pull, flick,
   bounce, spring-back — is the OS rubber band (see the html.ios override up
   top), not ours; only the badge is scripted. #ptr-badge is a purely
   positional wrapper (JS drives its `translate`); .ptr-badge-face carries the
   visible chrome and is what actually rotates/scales, via the standalone
   `rotate`/`scale` CSS properties so JS's inline styles and the CSS keyframe
   animations below never fight over the same `transform` property. */
#ptr-badge {
  position: fixed; top: calc(env(safe-area-inset-top) * .5); left: 50%;
  width: 76px; height: 76px; margin-left: -38px; z-index: 40;
  pointer-events: none;
}
.ptr-badge-face {
  width: 100%; height: 100%; border-radius: 50%; box-sizing: border-box;
  background: var(--ch-cream); border: 2.5px solid var(--ch-ink);
  box-shadow: 4px 4px 0 var(--ch-ink);
  display: flex; align-items: center; justify-content: center;
  transform-origin: 50% 50%; rotate: 0deg; scale: .55;
}
.ptr-badge-face svg { width: 56%; height: 56%; fill: var(--ch-ink); display: block; }
.ptr-badge-face img { height: 74%; width: auto; display: block; }
@keyframes ptr-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes ptr-pop { 0% { scale: 1; } 38% { scale: 1.22; } 64% { scale: .93; } 100% { scale: 1; } }
#ptr-badge.ptr-armed .ptr-badge-face { animation: ptr-spin .85s linear infinite, ptr-pop .45s cubic-bezier(.3,1.5,.4,1) 1; }
@keyframes ptr-go-spin { 0% { rotate: 0deg; scale: 1; } 55% { scale: 1.25; } 100% { rotate: 720deg; scale: 1; } }
#ptr-badge.ptr-go .ptr-badge-face { animation: ptr-go-spin .65s cubic-bezier(.25,.75,.3,1.1) 1 forwards; }

/* On release the badge rides the same spring back up behind the top edge
   (its 0% mirrors the JS badgeY() formula below the arm threshold) while the
   face tucks itself away. */
@keyframes ptr-badge-settle {
  0%   { translate: 0 calc(var(--pull) * 1.04 - 76px); animation-timing-function: cubic-bezier(.26,.86,.32,1); }
  52%  { translate: 0 calc(var(--pull) * -0.088 - 76px); animation-timing-function: cubic-bezier(.34,0,.36,1); }
  100% { translate: 0 -76px; }
}
#ptr-badge.ptr-settle { animation: ptr-badge-settle .62s both; }
@keyframes ptr-face-away { 0%, 45% { opacity: 1; } 100% { scale: .3; opacity: 0; } }
#ptr-badge.ptr-settle .ptr-badge-face { animation: ptr-face-away .62s both; }

/* ================= DEAD FAMOUS components ================= */
/* Loud moment surfaces: full CMYK is allowed here ONLY. */
.view-loud { background: var(--df-magenta); }
.view-loud.loud-cyan { background: var(--df-cyan); }
.view-loud.loud-yellow { background: var(--df-yellow); }
.loud-block { background: var(--ch-cream); border: 3px solid var(--ch-ink); box-shadow: 6px 6px 0 var(--ch-ink); }

/* Latin sting: inked rubber stamp, session-level screens only. */
.df-stamp {
  display: inline-block; padding: 6px 14px; border: 3px double var(--df-red);
  color: var(--df-red); font-family: var(--ch-font-ui); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: 15px;
  transform: rotate(-7deg); opacity: .9; pointer-events: none;
  mix-blend-mode: multiply;
}
/* Interim art for the Alea Iacta Fest stamp: two inline dice flanking the
   text. Swapped for an illustrated PNG later (see HTML comment at call site);
   this fallback keeps the slot data-driven in the meantime. */
/* Illustrated stamp art (red ink on transparency) replaces the typographic
   dice fallback: the art brings its own lettering, so no border/padding. */
.df-stamp-alea { border: none; padding: 0; right: 12px; bottom: 4px; }
.df-stamp-alea img { width: 98px; display: block; }
/* Zero-score receipts trade the celebratory dice for the Roman erasure —
   scoring nothing in Dead Famous is being struck from the record. Same
   inked-rubber language as MEMENTO MORI / the .df-stamp base. */
.df-stamp-damnatio { text-align: center; line-height: 1.15; bottom: 18px; }
.df-stamp-damnatio small {
  display: block; font-size: 9px; font-weight: 700; letter-spacing: .14em;
  margin-top: 2px;
}

/* Receipt: the share object. */
.df-receipt {
  background: #FFFFFF; border: 2px solid var(--ch-ink); box-shadow: var(--ch-shadow-soft);
  font-family: var(--ch-font-ui); color: #111; padding: 20px 18px 86px; position: relative;
  margin: 16px 0;
}
.df-receipt-head { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; }
.df-receipt hr { border: none; border-top: 2px dashed #111; margin: 10px 0; }
.df-receipt-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; text-transform: uppercase; }
.df-receipt-row .pts { font-variant-numeric: tabular-nums; }
.df-receipt-row.zero { color: #8a8a8a; }
.df-receipt-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; }
.df-receipt-total b { font-family: var(--ch-font-display); font-size: 34px; font-weight: 400; }
.df-receipt-total span { font-size: 15px; font-weight: 700; text-transform: uppercase; }
.df-receipt-meta { font-size: 11px; color: #6a6a6a; text-transform: uppercase; margin-top: 6px; }
.df-receipt .df-stamp { position: absolute; right: 10px; bottom: 34px; }

/* Scrap-tear grid (Face Value / Relic) */
.df-scraps { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); }
.df-scrap {
  position: relative; border: 1px solid rgba(11,11,11,.5); cursor: pointer;
  background:
    radial-gradient(rgba(11,11,11,.08) 1px, transparent 1.2px) 0 0/9px 9px,
    linear-gradient(160deg, #F4F0E4 0%, #EDE7D5 55%, #E4DDC8 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .28s ease, transform .28s ease;
}
.df-scrap::after {
  content: 'DEAD FAMOUS'; font-family: var(--ch-font-ui); font-size: 8px; font-weight: 700;
  letter-spacing: .1em; color: rgba(11,11,11,.28); transform: rotate(-14deg);
}
.df-scrap:active { filter: brightness(.96); }
.df-scrap.torn { opacity: 0; transform: rotate(6deg) scale(1.06); pointer-events: none; }
/* Honest offline state: shown when a round's image never arrived — better to
   say "not downloaded" than deal nine scraps over a blank void. */
#rv-offline {
  position: absolute; inset: 0; z-index: 3; background: var(--ch-cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 18px; text-align: center;
}
#rv-offline p { font-family: var(--ch-font-ui); font-size: 14px; line-height: 1.5; margin: 0; }

.df-worth { font-family: var(--ch-font-ui); font-weight: 700; font-size: 14px; text-transform: uppercase; }
.df-worth b { color: var(--ch-gold); font-size: 17px; }

/* Moment card (correct / wrong) */
.df-moment { text-align: center; padding: 10px 20px 20px; }
.df-moment-frame {
  position: relative; width: min(72vw, 340px); margin: 18px auto 0;
  border: 3px solid var(--ch-ink); box-shadow: var(--ch-shadow-card); background: #111;
}
.df-moment-frame img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.df-moment-badge {
  position: absolute; top: -14px; right: -18px; transform: rotate(8deg);
  background: var(--ch-cream); border: 2.5px solid var(--ch-ink); box-shadow: 3px 3px 0 var(--ch-ink);
  padding: 8px 16px 6px; text-align: center;
}
.df-moment-badge b { display: block; font-family: var(--ch-font-display); font-weight: 400; font-size: 20px; letter-spacing: .02em; color: var(--df-magenta); text-transform: uppercase; }
.df-moment-badge small { font-family: var(--ch-font-ui); font-weight: 700; font-size: 11px; }
/* Wrong answer: a red rubber ink stamp, same language as .df-stamp — no cream
   card, double red border. A faint translucent paper backing (instead of
   mix-blend multiply) keeps the red legible over dark photo areas while
   still reading as ink rather than a sticker. */
.df-moment-badge.bad {
  background: rgba(242, 239, 230, .58); border: 3px double var(--df-red); box-shadow: none;
  color: var(--df-red); font-family: var(--ch-font-ui); font-weight: 700;
  text-transform: uppercase; transform: rotate(-8deg);
  opacity: .96;
}
.df-moment-badge.bad b { color: var(--df-red); font-family: var(--ch-font-ui); font-weight: 800; }
.df-moment-badge.bad small { color: var(--df-red); }
.df-moment-name { font-family: var(--ch-font-display); font-weight: 400; font-size: 30px; text-transform: uppercase; margin: 18px 0 2px; line-height: 1; }
.df-moment-dates { font-family: var(--ch-font-ui); font-weight: 700; font-size: 13px; color: var(--ch-text-muted); letter-spacing: .06em; }
.df-fact {
  margin: 14px auto 0; max-width: 340px; background: var(--ch-cream);
  border: 2px solid var(--ch-ink); box-shadow: 3px 3px 0 var(--ch-ink);
  padding: 12px 14px; font-family: var(--ch-font-text); font-size: 15.5px; line-height: 1.45; text-align: left;
}

/* Duotone/halftone treatment for moment + brand imagery (never during guessing) */
.df-duotone { position: relative; }
.df-duotone img { filter: grayscale(1) contrast(1.08) brightness(1.02); }
.df-duotone::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(rgba(11,11,11,.22) 1px, transparent 1.35px) 0 0/4px 4px;
  mix-blend-mode: overlay;
}
.df-duotone .df-moment-badge { filter: none; }

/* Weekday strip (home rows) */
.df-week { display: flex; gap: 6px; padding: 8px 24px 0; }
.df-week span {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--ch-font-ui); font-weight: 700; font-size: 11px;
  border: 1.5px solid var(--ch-line-soft); color: var(--ch-text-muted); background: transparent;
}
.df-week span.done { background: var(--ch-ink); border-color: var(--ch-ink); color: var(--ch-text-inverse); }
.df-week span.today { border: 2px solid var(--ch-ink); color: var(--ch-ink); }
.df-week span.today.done { background: var(--row-tint-strong, var(--ch-ink)); color: var(--ch-ink); }

.df-receipt-list { list-style: none; margin: 0; padding: 0; }
.df-receipt-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: none; font-family: var(--ch-font-ui); font-size: 13px; text-transform: uppercase; color: #111; }
.df-receipt-list .sum-name small { display: none; }
.df-receipt-list .sum-pts { color: #111; font-weight: 700; }
.df-receipt-list .sum-pts.zero { color: #9a9a9a; }
.df-receipt-stamp { position: absolute; right: 22px; bottom: 6px; }
.df-receipt .df-receipt-total b { font-variant-numeric: tabular-nums; }
.sum-actions { margin-top: 14px; }

/* ---------- You Made History / You're History ---------- */
#view-daydone { background: var(--df-magenta); }
#view-daydone.obituary { background: #24211C; }
#view-daydone.obituary .dd-title { color: var(--ch-text-inverse); }
.dd-title { font-family: var(--ch-font-display); font-weight: 400; font-size: 46px; line-height: .95; text-transform: uppercase; text-align: left; margin: 18px 0 22px; color: var(--ch-ink); }
.dd-score, .dd-streak { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px; margin: 0 0 14px; position: relative; }
.dd-score span, .dd-streak span { font-family: var(--ch-font-ui); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.dd-score b, .dd-streak b { font-family: var(--ch-font-display); font-weight: 400; font-size: 40px; line-height: 1; }
#dd-stamp { position: absolute; right: 8px; top: -12px; font-size: 18px; }
.dd-countdown { font-family: var(--ch-font-ui); font-weight: 700; font-size: 14px; text-transform: uppercase; text-align: center; margin: 18px 0 6px; }
.dd-countdown b { font-family: var(--ch-font-display); font-weight: 400; font-size: 30px; display: block; }
.dd-carpet { text-align: center; margin: 4px 0 10px; }
#view-daydone .topbar h2 { text-align: left; }

#view-daydone.obituary .pill.ghost { border-color: var(--ch-text-inverse); color: var(--ch-text-inverse); }
#view-daydone.obituary .topbar { border-bottom-color: var(--ch-text-inverse) !important; }
#view-daydone.obituary .topbar h2, #view-daydone.obituary .iconbtn { color: var(--ch-text-inverse); }

/* Archive masthead: a typographic band standing in for a photo banner.
   Repeating diagonal stripes at very low contrast give it some print
   texture without competing with the sticker or title. */
.df-morgue-banner {
  position: relative; margin: 22px 20px 30px; min-height: 60px;
  display: flex; align-items: center; padding: 0 18px;
  background-color: var(--ch-ink);
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 2px, transparent 2px 11px);
  border: 2px solid var(--ch-ink); box-shadow: var(--ch-shadow-card);
  overflow: visible;
}
.df-morgue-title {
  font-family: var(--ch-font-display); font-weight: 400; font-size: 26px; line-height: 1;
  text-transform: uppercase; letter-spacing: .01em; color: var(--ch-text-inverse);
  white-space: nowrap; max-width: 65%; overflow: hidden; text-overflow: ellipsis;
}
.df-morgue-sticker {
  position: absolute; right: -8px; top: -16px; max-width: 118px; text-align: center;
  transform: rotate(-4deg);
  background: var(--df-yellow); border: 2px solid var(--ch-ink); color: var(--ch-ink);
  font-family: var(--ch-font-ui); font-weight: 700; text-transform: uppercase;
  font-size: 9.5px; letter-spacing: .02em; line-height: 1.25; padding: 5px 9px;
  box-shadow: 2px 2px 0 var(--ch-ink);
}

/* Adjacency tearing: only scraps touching an open scrap are tearable. */
.df-scrap.locked { cursor: not-allowed; }
.df-scrap.locked::after { opacity: .5; }
.df-scrap.tearable { border: 2px dashed rgba(11,11,11,.75); }
.df-scrap.tearable:active { filter: brightness(.94); }
/* Blocked tap: shake instead of silence. `translate` so the shake composes
   with each scrap's inline rotate and the torn transform. */
.df-scrap.deny { animation: scrap-deny .28s ease; }
@keyframes scrap-deny {
  0%, 100% { translate: 0 0; }
  30% { translate: -5px 0; }
  65% { translate: 5px 0; }
}
/* Reduced-motion equivalent: the shake above collapses to ~.01s under the
   global prefers-reduced-motion override further up this file, which reads
   as nothing happening. .deny-static is added/removed on a JS timer instead
   of a CSS animation duration (so that same override can't crush it too) and
   only ever paints under reduced motion — normal-motion appearance, and
   every scrap at rest, is unchanged either way. */
@media (prefers-reduced-motion: reduce) {
  .df-scrap.deny-static { outline: 3px solid var(--ch-gold); outline-offset: -3px; }
}
#rv-panel { padding-top: 24px !important; }
#rv-frame.df-duotone { background-color: #FFFFFF !important; }
#rv-prompt[hidden] { display: none; }

/* ---------- The Ledger (stats) ----------
   A press record book, not a stats modal: ruled lines, DF Mono tabular
   numerals, ONE red accent (the earned stamp only). Reads in both themes off
   the --ch-* tokens. */
#punch-card[role="button"] { cursor: pointer; }
#view-ledger { background-color: var(--ch-paper); background-image: radial-gradient(rgba(11,11,11,.09) 1px, transparent 1.2px); background-size: 14px 14px; }
[data-theme='candlelit'] #view-ledger { background-image: radial-gradient(rgba(242,239,230,.08) 1px, transparent 1.2px); }

.ledger-sheet {
  position: relative; margin: 16px 0 28px; background: var(--ch-cream);
  border: 2px solid var(--ch-ink); box-shadow: var(--ch-shadow-soft);
  padding: 20px 18px 30px; font-family: var(--ch-font-ui); color: var(--ch-text-primary);
}
.ledger-masthead { text-align: center; padding-bottom: 14px; border-bottom: 3px double var(--ch-ink); }
.ledger-kicker { display: block; font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--ch-text-muted); }
.ledger-title { font-family: var(--ch-font-display); font-weight: 400; font-size: 34px; line-height: 1; text-transform: uppercase; letter-spacing: .01em; margin: 4px 0 5px; color: var(--ch-text-primary); }
.ledger-since { display: block; font-size: 11px; letter-spacing: .04em; color: var(--ch-text-muted); }

/* Three headline tallies, ruled apart. */
.ledger-tallies { display: flex; margin: 16px 0 4px; }
.ledger-tally { flex: 1; text-align: center; padding: 4px 4px; }
.ledger-tally + .ledger-tally { border-left: 1.5px solid var(--ch-line-soft); }
.ledger-tally b { display: block; font-family: var(--ch-font-display); font-weight: 400; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ch-text-primary); }
.ledger-tally span { display: block; margin-top: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ch-text-muted); line-height: 1.3; }

/* Full-house streak pair. */
.ledger-streaks { display: flex; gap: 10px; margin: 14px 0 4px; padding: 12px 0; border-top: 2px dashed var(--ch-line-soft); border-bottom: 2px dashed var(--ch-line-soft); }
.ledger-streak { flex: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ledger-streak span { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ch-text-muted); }
.ledger-streak b { font-family: var(--ch-font-display); font-weight: 400; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ch-text-primary); }

/* Per-game ledger: DF Mono tabular columns, ruled rows. */
.ledger-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-variant-numeric: tabular-nums; }
.ledger-table thead th { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ch-text-muted); text-align: right; padding: 0 3px 8px; border-bottom: 2px solid var(--ch-ink); white-space: nowrap; }
.ledger-table thead th.ledger-desk { text-align: left; }
.ledger-table tbody th { text-align: left; font-family: var(--ch-font-ui); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .01em; color: var(--ch-text-primary); padding: 11px 3px; white-space: nowrap; }
.ledger-table tbody td { text-align: right; font-size: 12.5px; font-weight: 700; padding: 11px 3px; color: var(--ch-text-primary); white-space: nowrap; }
.ledger-table tbody tr + tr th, .ledger-table tbody tr + tr td { border-top: 1px solid var(--ch-line-soft); }
.ledger-legend { margin: 10px 0 0; font-size: 9.5px; letter-spacing: .02em; color: var(--ch-text-muted); text-transform: uppercase; }

/* One data-driven line in the house voice. */
.ledger-flourish { margin: 18px 0 0; padding-top: 14px; border-top: 3px double var(--ch-ink); font-family: var(--ch-font-text); font-size: 14px; line-height: 1.45; color: var(--ch-text-secondary); }

/* Inviting empty ledger — never a wall of zeros. */
.ledger-sheet.is-empty .ledger-table { opacity: .5; }
.ledger-empty-line { margin: 20px 0 0; padding-top: 16px; border-top: 3px double var(--ch-ink); font-family: var(--ch-font-display); font-weight: 400; font-size: 22px; text-transform: uppercase; line-height: 1.05; text-align: center; color: var(--ch-text-primary); }
.ledger-empty-sub { margin: 8px 0 0; text-align: center; font-size: 12px; letter-spacing: .03em; color: var(--ch-text-muted); }

/* The earned stamp: the page's single red accent. Reuses .df-stamp language. */
.ledger-stamp { position: absolute; right: 14px; bottom: 12px; text-align: center; line-height: 1.1; font-size: 13px; }
.ledger-stamp small { display: block; font-size: 8px; font-weight: 700; letter-spacing: .12em; margin-top: 3px; }

/* ---------- Carry: moving the record between origins ----------
   Deliberately the quietest thing in the app — a torn-off coupon at the foot
   of the record book. No new colours and no new geometry: ink rules, square
   corners, mono labels, and the same .pill buttons as everywhere else. */
/* The Ledger is the one .view with a footer under its scroll area, so it is
   also the one that must stop AT the fold rather than growing past it: capped
   here, the record book scrolls inside #ledger-body and the carry row stays
   put at the bottom of the page instead of hiding below it. */
#view-ledger { max-height: 100dvh; }
.carry-foot { flex: none; padding: 0 20px calc(14px + env(safe-area-inset-bottom)); background: var(--ch-paper); }
.carry-open {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; color: var(--ch-text-primary);
  border: 0; border-top: 2px dashed var(--ch-line-soft); border-radius: 0;
  padding: 12px 2px 2px; font-family: var(--ch-font-ui); font-size: 12px; letter-spacing: .03em;
}
.carry-open:active { background: var(--ch-parchment); }
.carry-open-kicker { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--ch-text-muted); margin-bottom: 3px; }
.carry-open b { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.carry-card { gap: 8px; overflow-y: auto; }
.carry-lede { margin: 0; font-family: var(--ch-font-text); font-size: 14px; line-height: 1.45; color: var(--ch-text-secondary); }

/* The manifest: what is in the crate. Reads as a packing list, not a table. */
.carry-manifest { margin: 4px 0 2px; padding: 0; list-style: none; }
.carry-manifest:empty { display: none; }
.carry-manifest li { position: relative; padding: 7px 0 7px 16px; border-bottom: 1px solid var(--ch-line-soft); font-family: var(--ch-font-ui); font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--ch-text-primary); }
.carry-manifest li::before { content: ''; position: absolute; left: 0; top: 12px; width: 7px; height: 7px; background: var(--ch-ink); }
.carry-manifest li:last-child { border-bottom: 0; }

.carry-label { display: block; margin-top: 10px; font-family: var(--ch-font-ui); font-size: 9.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ch-text-muted); }
/* The code itself: a stamped strip of machine text — monospace, wrapping and
   selectable, sized so a long code scrolls instead of swallowing the sheet. */
.carry-payload {
  display: block; width: 100%; margin: 5px 0 8px; padding: 8px 9px;
  font-family: var(--ch-font-ui); font-size: 11px; line-height: 1.35;
  color: var(--ch-text-primary); background: var(--ch-cream);
  border: 2px solid var(--ch-ink); border-radius: 0;
  resize: none; word-break: break-all; -webkit-appearance: none;
}
.carry-payload:focus { outline: 2px solid var(--ch-gold); outline-offset: 1px; }
.carry-help { margin: 6px 0 0; font-family: var(--ch-font-text); font-size: 12.5px; line-height: 1.4; color: var(--ch-text-muted); }
.carry-status { margin: 8px 0 0; font-family: var(--ch-font-ui); font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--ch-text-muted); }
.carry-status[hidden] { display: none; }
.carry-status.is-bad { color: var(--ch-burgundy); }

/* ---------- QA forcing panel (js/qa.js) ----------
   Only ever in the DOM when ?qa=1 / misc.qaMode is on. Deliberately looks
   like a dev tool rather than part of the app, so a screenshot taken with it
   open can never be mistaken for the real UI. */
#qa-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  background: #101014; color: #F2EFE6; font-family: var(--ch-font-ui);
  border-top: 3px solid var(--df-magenta);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  max-height: 52vh; overflow-y: auto;
}
#qa-panel .qa-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
#qa-panel .qa-bar strong { font-size: 11px; letter-spacing: .18em; color: var(--df-magenta); }
#qa-panel .qa-toggle { background: none; border: 1px solid #55555f; color: #F2EFE6; font-size: 11px; padding: 3px 8px; }
#qa-panel .qa-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#qa-panel .qa-btn {
  background: #1e1e24; color: #F2EFE6; border: 1px solid #3a3a44;
  font-size: 12px; line-height: 1.25; padding: 9px 8px; text-align: left;
  min-height: 40px; font-family: inherit;
}
#qa-panel .qa-btn:active { background: #2c2c35; }
#qa-panel .qa-danger { grid-column: 1 / -1; border-color: var(--df-red); color: #ff9b9b; }
#qa-panel .qa-off { grid-column: 1 / -1; border-color: #55555f; color: #b9b9c2; }
