/* Copyright © 2026 Synapse Creative. All rights reserved. */
/* The game's look: Design A "Sổ tay ký ức" (spec 2026-10-22 §3, docs/mockups/design-a.html), a memory notebook:
 * cream paper, ink, terracotta and teal. Fraunces for headings, names and epitaphs (italic); Be Vietnam Pro for
 * body text, labels and numbers (tabular-nums). The palette and font stacks are the tokens of src/ui/tokens.css
 * (linked first); this file adds only shades derived from them (darker text shades that keep 4.5:1 on the paper,
 * tints for states). Pixel scenes sit in a 4px ink frame, like photos pasted in a notebook.
 * Mobile first; no horizontal scroll from 360 px. Pixel canvases are scaled by whole device pixels
 * (src/ui/dom.js pixelScale) and drawn `pixelated`. prefers-reduced-motion: no transitions or entrance
 * animations (the scripts also stop scene and card animation). */

:root {
  /* Text shades for small text on the paper (--muted and --accent are 4.2:1 and 3.8:1 on --bg: large text only). */
  --muted-ink: #6b5f56;
  --accent-ink: #a94928;
  --teal-ink: #27756e;
  --up-ink: #2a7556;
  --note-ink: #4a4038; /* a real-world note: a step lighter than --ink */
  /* Surfaces and lines. */
  --paper-2: #efe5d4;
  --track: #e6dccb;
  --line-strong: #d9ccb8;
  --chosen: #f7e3d6;
  --tealbg: #e7f1ee;
  --accent-hover: #b34b28;
  --accent-ink-hover: #9a4224;
  --scrim: rgba(42, 36, 32, 0.45);
  --frame: 4px solid var(--ink);
  --radius: 12px;
  --gutter: 16px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--teal);
  --shadow: 0 1px 0 rgba(42, 36, 32, 0.04), 0 10px 28px -14px rgba(42, 36, 32, 0.28);
  --shadow-lg: 0 2px 0 rgba(42, 36, 32, 0.05), 0 24px 60px -24px rgba(42, 36, 32, 0.45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(255, 250, 241, 0.75), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 16px/1.55 var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, canvas { max-width: 100%; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.num { font-variant-numeric: tabular-nums; }

#app { min-height: 100vh; min-height: 100dvh; }
#app:empty::before {
  content: ""; display: block; width: 40px; height: 40px; margin: 40vh auto 0;
  border: 4px solid var(--track); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-error { max-width: 32rem; margin: 30vh auto 0; padding: 0 var(--gutter); text-align: center; color: var(--muted-ink); }

/* ---- buttons --------------------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0 1.25em;
  border: 1.5px solid var(--ink); border-radius: 10px;
  background: var(--panel); color: var(--ink);
  font: 700 1.05rem/1.1 var(--font-body); letter-spacing: 0.01em; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--chosen); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
/* Primary: terracotta with cream text. Its text stays at large-text size (≥ 19 px bold), where 4.3:1 passes. */
.btn-primary {
  background: var(--accent); color: var(--panel); border-color: var(--accent-ink);
  font-size: 1.2rem;
  box-shadow: inset 0 -3px 0 rgba(42, 36, 32, 0.22), 0 8px 20px -10px rgba(196, 85, 47, 0.7);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--panel); }
.btn-primary:focus-visible { box-shadow: var(--focus), inset 0 -3px 0 rgba(42, 36, 32, 0.22); }
.btn-ghost { background: transparent; border-color: var(--ink); }
.btn-ghost:hover { background: var(--panel); }
.btn-quiet { border-color: var(--line-strong); background: var(--panel); color: var(--ink); font-weight: 500; }
.btn-quiet:hover { border-color: var(--ink); background: var(--panel); }
.btn-xl { min-height: 58px; font-size: 1.4rem; padding: 0 1.6em; border-radius: 12px; }
.btn-lg { min-height: 52px; font-size: 1.2rem; }
.btn-sm { min-height: 40px; font-size: 0.95rem; padding: 0 0.9em; }
.btn-icon { font-size: 0.95em; font-weight: 400; }
.btn-sub { display: block; font: 400 0.85rem/1.25 var(--font-body); letter-spacing: 0; color: var(--muted-ink); }
/* A primary button with a small sub-line (Continue, "Name, age 34"): cream on terracotta is 4.3:1, enough for
 * the large label only, so this button is the deeper --accent-ink (5.5:1, hover 6.4:1) and the sub-line passes. */
.btn-primary:has(.btn-sub) { background: var(--accent-ink); border-color: var(--accent-ink-hover); }
.btn-primary:has(.btn-sub):hover { background: var(--accent-ink-hover); }
.btn-primary .btn-sub { color: var(--panel); font-size: 0.95rem; font-weight: 500; }
.btn.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(196, 85, 47, 0.55); } 100% { box-shadow: 0 0 0 16px rgba(196, 85, 47, 0); } }

/* When you are born (src/ui/screens/start.js eraPicker): Now · In the past · In the future, then a year. */
.era { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6px; }
.era-opts { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.era-opt { padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted-ink); font: 600 0.92rem/1.2 var(--font-body); cursor: pointer; }
.era-opt[aria-checked="true"] { background: var(--ink); color: var(--panel); }
.era-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.era-detail { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(100%, 360px); }
.era-detail[hidden] { display: none; }
.era-any { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--ink); cursor: pointer; }
.era-any input { width: 18px; height: 18px; accent-color: var(--teal); }
.era-slide { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.era-slide input[type="range"] { width: 100%; accent-color: var(--accent); }
.era-slide input[type="range"]:disabled { opacity: 0.4; }
.era-year { font-size: 0.85rem; color: var(--muted-ink); text-align: center; }
.switch {
  display: inline-flex; align-items: center; gap: 0.6em; min-height: 44px; padding: 0 0.4em;
  background: none; border: 0; cursor: pointer; color: var(--ink); font: 500 1rem/1 var(--font-body);
}
.switch-track {
  position: relative; width: 44px; height: 24px; border-radius: 12px; flex: none;
  background: var(--track); border: 1.5px solid var(--line-strong); transition: background-color 0.15s ease, border-color 0.15s ease;
}
.switch-thumb {
  position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--panel); box-shadow: 0 0 0 1.5px var(--muted); transition: transform 0.15s ease, background-color 0.15s ease;
}
.switch[aria-checked="true"] .switch-track { background: var(--teal); border-color: var(--teal-ink); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(20px); box-shadow: none; }
.switch-sm { font-size: 0.95rem; }

.badge {
  display: inline-block; margin-left: 0.5em; padding: 0.15em 0.55em; border-radius: 5px; vertical-align: 0.15em;
  background: var(--gold); color: var(--ink); font: 700 0.72rem/1.3 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase;
}
.eyebrow { font: 700 0.78rem/1.2 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); }
.navlink { font: 500 0.95rem/1 var(--font-body); color: var(--muted-ink); text-decoration: none; padding: 0.75em 0.55em; border-radius: 8px; }
.navlink:hover { color: var(--ink); background: rgba(255, 250, 241, 0.7); }

/* Change chips (▲ Wealth +9 / ▼ Love −5): the result of a choice, in the dialog and the log. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 0.25em; padding: 3px 9px; border-radius: 999px;
  font: 700 0.78rem/1.3 var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--paper-2); color: var(--muted-ink);
}
.chip.up { background: var(--upbg); color: var(--up-ink); }
.chip.down { background: var(--downbg); color: var(--down); }

/* ---- helpline (sensitive topics) ------------------------------------------------------------------- */

.helpline {
  margin-top: 0.35em; padding: 0.55em 0.75em; border-radius: 10px;
  background: var(--tealbg); border: 1px solid rgba(42, 127, 120, 0.28);
  color: var(--ink); font-size: 0.875rem; line-height: 1.45;
}
.helpline a { color: var(--teal-ink); font-weight: 700; }
.helpline-mark { color: var(--teal-ink); margin-right: 0.15em; }

/* ---- top bar ---------------------------------------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1240px; margin: 0 auto; padding: 8px var(--gutter);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--ink); text-decoration: none; font: 800 1.35rem/1 var(--font-head); letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 12px; height: 12px; background: var(--accent); border-radius: 3px; transform: rotate(45deg);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ink);
}
.topnav { display: flex; gap: 2px; }
/* QA M14: skip link, off screen until focused. */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 8px; background: var(--panel); color: var(--ink); border: 1.5px solid var(--ink); text-decoration: none; }
.skip-link:focus, .skip-link:focus-visible { top: 8px; }
/* QA M5: at 320 px the brand and links stay on one line. */
.brand, .navlink { white-space: nowrap; }
/* The long brand ("If I Were Born There") shrinks with the screen so brand + links + music fit one line. */
@media (max-width: 480px) {
  .brand { font-size: 1.05rem; gap: 8px; white-space: normal; line-height: 1.05; min-width: 0; flex: 0 1 auto; }
  .topbar-end { flex: none; }
}
@media (max-width: 360px) {
  .brand { font-size: 1rem; gap: 6px; }
  .navlink { font-size: 0.88rem; padding: 0.7em 0.35em; }
  .row2 .btn { font-size: 0.92rem; padding: 4px 0.4em; }
}
/* Phones: a long link ("Những cuộc đời", "Прожитые жизни") wraps onto two short lines instead of squeezing the brand,
   and when brand and links still do not fit side by side, the links and music move to a second row, on the right. */
@media (max-width: 420px) {
  .topbar { flex-wrap: wrap; row-gap: 0; }
  .brand { min-width: 6.4em; }
  .topbar-end { margin-left: auto; }
  .navlink { white-space: normal; text-align: center; line-height: 1.1; max-width: 6.2em; padding-block: 0.45em; }
}

/* ---- music controls (src/ui/sound.js): a mute toggle and a volume popover ------------------------------ */

.topbar-end { display: flex; align-items: center; gap: 2px; min-width: 0; }
.sound { position: relative; display: inline-flex; align-items: center; gap: 2px; flex: none; }
.sound-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted-ink);
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color 0.15s ease, background-color 0.15s ease;
}
.sound-btn:hover { color: var(--ink); background: rgba(255, 250, 241, 0.8); }
.sound-btn[aria-pressed="false"] { color: var(--accent-ink); }
.sound-btn .cross { display: none; }
.sound-btn[aria-pressed="true"] .cross { display: inline; }
.sound-btn[aria-pressed="true"] .waves { display: none; }
.sound-more[aria-expanded="true"] { color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.sound-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 248px; padding: 12px 14px 10px;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  text-align: left;
}
.sound-label { display: block; font: 700 0.75rem/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-ink); }
.sound-row { display: flex; align-items: center; gap: 10px; }
.sound-range { flex: 1; min-width: 0; min-height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.sound-val { min-width: 3.2em; text-align: right; color: var(--ink); font: 700 0.95rem/1 var(--font-body); font-variant-numeric: tabular-nums; }
.sound-state { color: var(--muted-ink); font-size: 0.85rem; }
/* The start screen has no top bar: the controls sit in its top corner. */
.start-top {
  position: relative; z-index: 2; /* above the hero photo's tape */
  display: flex; justify-content: flex-end; align-items: center; gap: 12px; max-width: 1240px; margin: 0 auto; padding: 8px var(--gutter) 0;
}
/* The language bar (src/ui/lang.js): every language in its own name, one row that scrolls sideways on a phone. */
.lang-bar {
  display: flex; gap: 2px; min-width: 0; margin-right: auto; overflow-x: auto; scrollbar-width: none;
  padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
}
.lang-bar::-webkit-scrollbar { display: none; }
.lang-bar a {
  flex: none; padding: 6px 11px; border-radius: 999px; color: var(--muted-ink); font-size: 14px; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
}
.lang-bar a:hover { color: var(--ink); background: var(--bg); }
.lang-bar a[aria-current="page"] { background: var(--ink); color: var(--panel); font-weight: 600; }
.lang-bar a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.start-top + .start { min-height: calc(100vh - 52px); min-height: calc(100dvh - 52px); padding-top: 8px; }
/* Stacked layout: room between the bar and the tape on the photo's top corners. */
@media (max-width: 979px) { .start-top + .start { padding-top: 28px; } }
/* Narrow phones: the top bar keeps the mute toggle; the volume (also on the start screen) yields its room. */
@media (max-width: 429px) {
  .topbar .sound-more { display: none; }
}

/* ---- pixel scenes in the notebook: a 4px ink frame -------------------------------------------------- */

.hero-frame, .scene-frame {
  position: relative; border: var(--frame); border-radius: var(--radius); background: var(--ink); overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ---- start ------------------------------------------------------------------------------------------ */

.start { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; row-gap: 40px; padding: 24px var(--gutter) 32px;
  overflow-x: clip; /* the photo's tape may reach past a 320 px screen's edge: cut it, never scroll sideways */ }
.start-inner { width: 100%; max-width: 600px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-frame { display: flex; flex-direction: column; align-items: center; padding: 0; overflow: visible; }
/* Two strips of paper tape hold the photo on the page, across its top corners. */
.hero-frame::before, .hero-frame::after {
  content: ""; position: absolute; z-index: 1; top: -12px; width: 78px; height: 24px;
  background: rgba(239, 224, 190, 0.86); border-left: 1px dashed rgba(122, 109, 98, 0.35); border-right: 1px dashed rgba(122, 109, 98, 0.35);
  box-shadow: 0 1px 3px rgba(42, 36, 32, 0.18); pointer-events: none;
}
.hero-frame::before { left: -22px; transform: rotate(-32deg); }
.hero-frame::after { right: -22px; transform: rotate(32deg); }
.hero-scene { display: block; border-radius: 8px 8px 0 0; }
.hero-frame.fade-in .hero-scene { animation: fadeIn 0.9s ease; }
@keyframes fadeIn { from { opacity: 0.15; } to { opacity: 1; } }
.hero-cap {
  align-self: stretch; padding: 8px 10px; background: var(--panel); text-align: center; border-top: var(--frame); border-radius: 0 0 8px 8px;
  color: var(--ink); font: 700 0.78rem/1 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase;
}
.title {
  margin-top: 26px; font: 800 clamp(3rem, 15vw, 5.4rem)/0.95 var(--font-head); letter-spacing: -0.025em;
  color: var(--ink);
}
.title::after { content: ""; display: block; width: 72px; height: 5px; margin: 16px auto 0; border-radius: 3px; background: var(--accent); }
.tagline { margin-top: 16px; max-width: 26em; font: italic 400 1.25rem/1.45 var(--font-head); color: var(--ink); }
.rate { margin-top: 12px; max-width: 30em; color: var(--muted-ink); font-size: 0.95rem; font-variant-numeric: tabular-nums; text-wrap: balance; }
/* The pulsing dot and the first word never part (an inline-block is a line-break opportunity on its own). */
.rate-lead { white-space: nowrap; }
.rate-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; vertical-align: 0.1em;
  background: var(--accent); box-shadow: 0 0 0 0 rgba(196, 85, 47, 0.6); animation: pulse 1s ease-out infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(196, 85, 47, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(196, 85, 47, 0); } }
.start-actions { margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.start-actions .btn-xl { min-width: min(100%, 320px); }
.continue .btn { flex-direction: column; gap: 4px; min-height: 64px; padding: 8px 1.4em; }
.auto-row { display: flex; flex-direction: column; align-items: center; gap: 0; }
.hint { color: var(--muted-ink); font-size: 0.85rem; }
.start-status { min-height: 1.4em; color: var(--down); font-size: 0.9rem; }
.start-links { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.data-note { margin-top: 22px; max-width: 30em; color: var(--muted-ink); font-size: 0.8rem; }
/* The short description of the game (also in index.html's static intro, for readers and crawlers without JS). */
.intro { margin-top: 22px; max-width: 32em; color: var(--ink); font-size: 0.95rem; text-wrap: pretty; }
/* The site's pages, small, at the foot of the start screen (and of the static intro). */
.foot-links { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 2px 14px; justify-content: center; font-size: 0.85rem; }
.foot-links a { display: inline-block; padding: 6px 0; color: var(--muted-ink); }
.foot-links a:hover { color: var(--ink); }
/* index.html before the app mounts (or with JS off): the same column, no hero scene. */
.start-static .start-inner { max-width: 600px; display: flex; }
.start-static .start-copy { align-items: center; text-align: center; }
.start-static .title { margin-top: 0; }
.start-static .title::after { margin-left: auto; margin-right: auto; }
.start-static .start-links { justify-content: center; }
.start-static .boot-error { margin: 18px auto 0; }
.start-copy { display: flex; flex-direction: column; align-items: center; width: 100%; }
@media (min-width: 900px) {
  .start-inner { max-width: 1120px; display: grid; grid-template-columns: auto minmax(0, 460px); gap: 56px; align-items: center; justify-content: center; text-align: left; }
  .start-copy { align-items: flex-start; }
  .title { margin-top: 0; }
  .title::after { margin-left: 0; }
  .start-actions { align-items: flex-start; }
  .auto-row { align-items: flex-start; flex-direction: row; gap: 10px; }
  .auto-row .hint { align-self: center; }
  .start-links { justify-content: flex-start; }
  .foot-links { justify-content: flex-start; }
  .start-static .foot-links { justify-content: center; }
}

/* ---- life ------------------------------------------------------------------------------------------- */

.life {
  max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter) 40px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px;
}
.stage { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.scene-frame { width: fit-content; max-width: 100%; padding: 0; }
.scene { display: block; transition: filter 2.4s ease; }
.scene-cap {
  position: absolute; left: 50%; top: 10px; transform: translate(-50%, -8px); max-width: calc(100% - 20px);
  padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 2px solid var(--ink);
  color: var(--ink); font: 700 0.8rem/1.1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity 0.4s ease, transform 0.4s ease; pointer-events: none;
}
.scene-cap::before, .scene-cap::after { content: "✦"; margin: 0 0.5em; font-size: 0.85em; color: var(--accent); }
.scene-frame.memory .scene-cap { opacity: 1; transform: translate(-50%, 0); }
.scene-frame.memory { box-shadow: var(--shadow-lg), 0 0 0 4px var(--gold); }
.year-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(42, 36, 32, 0.55); }
.year-progress span { display: block; height: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); }
.scene-frame.paused::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px;
  background:
    linear-gradient(var(--ink), var(--ink)) 8px 8px / 4px 12px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 16px 8px / 4px 12px no-repeat,
    var(--panel);
  box-shadow: 0 0 0 2px var(--ink);
}
.scene-frame.dead { box-shadow: var(--shadow); }
.scene-frame.dead .scene { filter: grayscale(1) sepia(0.25) brightness(0.62) contrast(0.92); }
.scene-frame.dead .year-progress { display: none; }

/* status: who, age and year, the 5 bars */
.status {
  width: 100%; max-width: 780px; display: grid; gap: 10px 16px;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who clock" "bars bars";
  padding: 12px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.who { grid-area: who; min-width: 0; }
.who-name { font: 600 1.2rem/1.25 var(--font-head); color: var(--ink); overflow-wrap: anywhere; }
.who-place { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.clock { grid-area: clock; text-align: right; }
.age { font: 700 0.72rem/1 var(--font-body); color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.age-num {
  display: inline-block; min-width: 1.4em; margin-left: 0.3em; font: 800 2.2rem/0.9 var(--font-body);
  color: var(--accent); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; text-transform: none;
}
.year { margin-top: 4px; font: 500 0.85rem/1.2 var(--font-body); color: var(--muted); font-variant-numeric: tabular-nums; }
.bars-box { grid-area: bars; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bars-title { font: 700 0.68rem/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.bar { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bar-label { font: 500 0.75rem/1.1 var(--font-body); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 7px; border-radius: 4px; background: var(--track); overflow: hidden; transition: box-shadow 0.3s ease; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; transition: width 0.6s ease; }
.bar-wealth .bar-fill { background: var(--stat-wealth); }
.bar-status .bar-fill { background: var(--stat-status); }
.bar-health .bar-fill { background: var(--stat-health); }
.bar-love .bar-fill { background: var(--stat-love); }
.bar-freedom .bar-fill { background: var(--stat-freedom); }
/* A bar a choice moved: a green or red ring for about a second (life.js adds none under reduced motion). */
.bar.flash-up .bar-track { animation: ringUp 1.1s ease; }
.bar.flash-down .bar-track { animation: ringDown 1.1s ease; }
@keyframes ringUp { 0%, 70% { box-shadow: 0 0 0 2px var(--up); } 100% { box-shadow: 0 0 0 2px transparent; } }
@keyframes ringDown { 0%, 70% { box-shadow: 0 0 0 2px var(--down); } 100% { box-shadow: 0 0 0 2px transparent; } }

/* clock controls */
.controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; }
.ctl {
  min-width: 48px; min-height: 44px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font: 700 1rem/1 var(--font-body); font-variant-numeric: tabular-nums; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ctl:hover { border-color: var(--ink); }
.ctl-play { min-width: 56px; display: inline-grid; place-items: center; color: var(--panel); background: var(--ink); border-color: var(--ink); }
.ctl-play:hover { background: #3d342e; }
.ctl-play.is-paused { background: var(--accent); color: var(--panel); border-color: var(--accent-ink); }
.icon { display: block; }
.speeds { display: inline-flex; border-radius: 11px; overflow: hidden; border: 1.5px solid var(--line-strong); background: var(--panel); }
.speeds .ctl { border: 0; border-radius: 0; min-width: 52px; }
.speeds .ctl + .ctl { border-left: 1.5px solid var(--line-strong); }
.ctl-speed[aria-pressed="true"] { background: var(--ink); color: var(--panel); }

/* the end of a life, under the faded scene */
.over {
  width: 100%; max-width: 780px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 18px 16px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise 0.9s ease both;
}
.over-years { font: 700 0.95rem/1 var(--font-body); letter-spacing: 0.14em; color: var(--muted); font-variant-numeric: tabular-nums; }
.over-line { font: italic 400 1.25rem/1.45 var(--font-head); color: var(--ink); }
.over .btn { margin-top: 6px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* the log: one notebook entry per year, newest on top */
.log { min-width: 0; }
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.year-block {
  display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 12px; padding: 11px 13px;
  border-radius: var(--radius); background: rgba(255, 250, 241, 0.6); border: 1px solid var(--line);
}
.year-block:first-child { background: var(--panel); box-shadow: var(--shadow); }
.year-block.enter { animation: rise 0.5s ease both; }
.yh { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-top: 2px; }
.yh-age { font: 700 0.9rem/1.1 var(--font-body); color: var(--accent-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.yh-year { font: 500 0.78rem/1 var(--font-body); color: var(--muted-ink); font-variant-numeric: tabular-nums; }
.lines { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.line { color: var(--ink); font-size: 0.95rem; line-height: 1.5; overflow-wrap: anywhere; }
.line-born { font: italic 400 1.08rem/1.5 var(--font-head); color: var(--ink); }
.line-choice { padding-left: 10px; border-left: 3px solid var(--accent); color: var(--ink); font-weight: 500; }
.line-death { font: italic 400 1.08rem/1.5 var(--font-head); color: var(--ink); }
.line .chips { margin-top: 5px; }
.line .chip { font-size: 0.72rem; padding: 2px 7px; }
/* A real-world note under its line (spec §5, style 1): a thin dashed rule, the globe in a light-teal circle, the
 * sentence, then "· Source" in muted text. No label word. */
.note {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 2px; padding-top: 8px;
  border-top: 1px dashed var(--line-strong); color: var(--note-ink); font-size: 0.84rem; line-height: 1.5;
}
.note-ic {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  background: var(--tealbg); color: var(--teal); font-size: 12px; line-height: 1;
}
.note-text { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note-src { color: var(--muted-ink); font-size: 0.92em; white-space: nowrap; }
.note-dialog { margin-top: 12px; font-size: 0.88rem; }

/* decision dialog */
.decision {
  width: min(560px, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 32px); overflow: auto;
  margin: auto; padding: 20px 20px 16px; border-radius: 16px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
}
.decision[open] { animation: pop 0.28s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.decision::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.dec-eyebrow { font: 700 0.78rem/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.dec-q { margin-top: 10px; font: 600 1.3rem/1.4 var(--font-head); color: var(--ink); }
.dec-options { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 50px; padding: 11px 13px; text-align: left;
  border-radius: 10px; border: 1.5px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer;
  font: 400 1rem/1.45 var(--font-body); transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.option:hover, .option:focus-visible { border-color: var(--accent); background: var(--chosen); }
.option:active { transform: translateY(1px); }
.option.chosen { border-color: var(--accent); background: var(--chosen); }
.option-key {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-top: -1px; border-radius: 7px;
  background: var(--paper-2); color: var(--ink); font: 700 0.85rem/1 var(--font-body); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.option:hover .option-key, .option:focus-visible .option-key, .option.chosen .option-key { background: var(--accent); color: var(--panel); box-shadow: none; }
.option:disabled { cursor: default; }
.option.dim { opacity: 0.5; }
.option.dim:hover { border-color: var(--line-strong); background: transparent; }
.option.dim:hover .option-key { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
/* The result view of a choice: what it led to, the chips (or "No change for now"), then Continue. */
.dec-res { margin-top: 14px; }
.dec-result { font-style: italic; color: var(--ink); }
.dec-result + .dec-result { margin-top: 6px; }
.decision .chips { display: flex; margin-top: 10px; }
.dec-nochange { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.dec-foot [data-action=continue] { margin-left: auto; min-width: 160px; }
.dec-foot { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dec-hint { color: var(--muted); font-size: 0.85rem; }
.helpline-dialog { margin-top: 14px; }

@media (min-width: 980px) {
  .life { grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); align-items: start; gap: 28px; padding-top: 8px; }
  .stage { position: sticky; top: 12px; }
  .log { max-height: calc(100vh - 92px); overflow-y: auto; padding: 4px 8px 8px 4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
}
@media (max-width: 979px) {
  .stage { position: sticky; top: 0; z-index: 2; padding: 6px 0 10px; margin: 0 calc(-1 * var(--gutter)); padding-inline: var(--gutter);
    background: linear-gradient(180deg, var(--bg) calc(100% - 10px), rgba(243, 235, 221, 0)); }
  .status { padding: 10px 12px; gap: 8px 12px; }
  .age-num { font-size: 1.9rem; }
  .life .topbar { padding-bottom: 0; }
}
@media (max-width: 979px) and (max-height: 700px) {
  .stage { position: static; }
}
@media (max-width: 420px) {
  .bars { gap: 6px; }
  /* A long stat name ("Gesundheit", "Liberdade") breaks onto a second line (hyphenated where the browser can)
     instead of being cut; every label keeps two lines' height so the meters stay in one row. */
  .bar-label { font-size: 0.7rem; white-space: normal; text-overflow: clip; overflow-wrap: anywhere; hyphens: auto;
    min-height: 2.2em; display: flex; align-items: flex-end; }
  .year-block { grid-template-columns: 50px minmax(0, 1fr); gap: 10px; padding: 9px 10px; }
  .controls { gap: 8px; }
  .ctl { min-width: 44px; padding: 0 8px; }
  .speeds .ctl { min-width: 46px; }
}

/* ---- ending ----------------------------------------------------------------------------------------- */

.ending { max-width: 980px; margin: 0 auto; padding: 8px var(--gutter) 56px; }
.ending-head { text-align: center; padding: 18px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ending-name { font: 800 clamp(2rem, 7vw, 2.9rem)/1.1 var(--font-head); letter-spacing: -0.015em; color: var(--ink); overflow-wrap: anywhere; }
.ending-name:focus { outline: none; }
.ending-meta { color: var(--muted-ink); font-variant-numeric: tabular-nums; }
.ending-died { margin-top: 2px; font: italic 400 1.2rem/1.35 var(--font-head); color: var(--accent-ink); }
.ending-head .helpline { max-width: 36em; text-align: left; }
.pick { margin: 26px 0 0; padding: 0; border: 0; min-width: 0; }
.pick legend { padding: 0; margin-bottom: 12px; display: flex; flex-direction: column; gap: 2px; }
.pick-title { font: 600 1.4rem/1.2 var(--font-head); color: var(--ink); }
.pick-hint { color: var(--muted-ink); font-size: 0.9rem; }
.moments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.moment {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 14px; cursor: pointer;
  background: var(--panel); border: 1.5px solid var(--line); box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.moment:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.moment.is-selected { border-color: var(--accent); background: var(--chosen); box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.moment:has(input:focus-visible) { box-shadow: var(--focus); }
.moment.is-selected::after {
  content: "✓"; position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: var(--panel); font: 800 0.85rem/1 var(--font-body); box-shadow: 0 0 0 2px var(--panel);
}
.moment-frame { display: block; border-radius: 8px; overflow: hidden; background: var(--ink); border: 3px solid var(--ink); }
.moment-scene { width: 100%; height: auto; aspect-ratio: 256 / 144; }
/* What happened, then the age on its own line (never "Moved / abroad · age 29" in a narrow tile). */
.moment-cap { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 2px 4px 4px; text-align: center; }
.cap-what { font: 500 0.88rem/1.3 var(--font-body); color: var(--ink); text-wrap: balance; }
.cap-what::first-letter { text-transform: uppercase; }
.cap-when { font: 400 0.8rem/1.3 var(--font-body); color: var(--muted-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.epitaphs { display: flex; flex-direction: column; gap: 10px; }
.epitaph {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px; cursor: pointer;
  background: var(--panel); border: 1.5px solid var(--line); transition: border-color 0.15s ease, background-color 0.15s ease;
}
.epitaph:hover { border-color: var(--line-strong); }
.epitaph.is-selected { border-color: var(--accent); background: var(--chosen); }
.epitaph:has(input:focus-visible) { box-shadow: var(--focus); }
.epitaph-mark { flex: none; width: 20px; height: 20px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--panel); }
.epitaph.is-selected .epitaph-mark { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 4px, var(--panel) 5px); }
.epitaph-text { font: italic 400 1.15rem/1.5 var(--font-head); color: var(--ink); }
.ending-cta { margin-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ending-status, .error { color: var(--down); min-height: 1.3em; }
@media (min-width: 760px) {
  .moments { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- card ------------------------------------------------------------------------------------------- */

.cardscreen {
  max-width: 1100px; margin: 0 auto; padding: 8px var(--gutter) 48px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; justify-items: center;
}
.card-wrap { width: 100%; max-width: 440px; }
.card-canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1620; border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.card-side { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; }
.card-title { font: 800 1.9rem/1.15 var(--font-head); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.card-title:focus, .gallery-title:focus, .notfound-title:focus { outline: none; }
.card-sub { color: var(--muted-ink); font-variant-numeric: tabular-nums; }
.card-actions { margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }
.card-actions .btn-primary { min-height: 56px; font-size: 1.25rem; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row2 .btn { padding: 4px 0.6em; font-size: 1rem; }
.card-note { min-height: 1.4em; color: var(--teal-ink); font-size: 0.9rem; font-weight: 500; }
.linkbox { display: flex; flex-direction: column; gap: 6px; }
.linkbox-label { color: var(--muted-ink); font-size: 0.9rem; }
.linkbox-input { width: 100%; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--panel); color: var(--ink); font: 400 0.9rem var(--font-body); }
.divider { height: 0; border-top: 1.5px dashed var(--line-strong); margin: 6px 0; }
.side-label { font: 700 0.75rem/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-ink); }
.card-next { display: flex; flex-direction: column; gap: 10px; }
.card-side > .navlink { align-self: flex-start; padding-left: 0; }
@media (min-width: 900px) {
  .cardscreen { grid-template-columns: minmax(0, auto) minmax(300px, 380px); justify-content: center; align-items: start; gap: 44px; padding-top: 16px; }
  .card-wrap { width: min(440px, calc((100vh - 110px) * 1080 / 1620)); min-width: 320px; }
  .card-side { position: sticky; top: 16px; padding-top: 12px; }
}

.notfound { min-height: 70vh; display: grid; place-items: center; }
.notfound-inner { max-width: 30rem; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 0 var(--gutter); }
.notfound-card {
  width: 120px; height: 180px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--panel); border: 3px dashed var(--line-strong); color: var(--line-strong); font: 800 4rem/1 var(--font-head);
}
.notfound-title { font: 800 1.7rem/1.25 var(--font-head); }
.notfound-sub { color: var(--muted-ink); }

/* ---- gallery ---------------------------------------------------------------------------------------- */

.gallery { max-width: 1240px; margin: 0 auto; padding: 8px var(--gutter) 56px; }
.gallery-head { padding: 14px 0 22px; display: flex; flex-direction: column; gap: 4px; }
.gallery-title { font: 800 clamp(2rem, 8vw, 2.6rem)/1.05 var(--font-head); letter-spacing: -0.015em; color: var(--ink); }
.gallery-count { color: var(--muted-ink); font-variant-numeric: tabular-nums; }
.gallery-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; }
.thumb-btn {
  width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  border-radius: 12px; transition: transform 0.15s ease;
}
.thumb-btn:hover { transform: translateY(-3px); }
.thumb {
  display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1620; border-radius: 10px;
  background: var(--panel); box-shadow: var(--shadow-lg);
}
.thumb-name { margin-top: 4px; font: 600 1rem/1.25 var(--font-head); color: var(--ink); overflow-wrap: anywhere; }
.thumb-meta { font: 500 0.85rem/1.2 var(--font-body); color: var(--muted-ink); font-variant-numeric: tabular-nums; }
.gallery-empty { margin-top: 10vh; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; color: var(--muted-ink); }

/* ---- tables on the static pages (src/ui/pages.css has the rest of their look) ------------------------ */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.table-wrap:focus-visible { box-shadow: var(--focus); }
/* QA M3: on a narrow screen the table scrolls sideways; a hint says so, and the edge fades to show there is more. */
.table-hint { display: none; margin-bottom: 6px; }
@media (max-width: 599px) {
  .table-hint { display: block; }
  .table-wrap { background: linear-gradient(to left, rgba(196, 85, 47, 0.16), transparent 28px) right / 28px 100% no-repeat, var(--panel); }
}

/* ---- reduced motion --------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .rate-dot { animation: none; }
}

/* ---- confirm dialog (ruling R41) -------------------------------------------------------------------- */

.confirm { width: min(460px, calc(100vw - 2 * var(--gutter))); }
.confirm .dec-q { margin-top: 0; }
.confirm-text { margin-top: 10px; color: var(--ink); }
.confirm-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.confirm-actions .btn { flex: 1 1 160px; }

/* ---- ad slots (src/ads/ads.js) ---------------------------------------------------------------------------------- */
/* Only when site.config.json turns ads on: the home slot after the start screen's <main> (below its full-height,
 * centred grid, so it never moves Be born when it appears or goes) and the content slot at the end of How to play and Data, under
 * their call to action. The box takes its final, fixed size as soon as the gate's config checks pass (no layout
 * shift when the ad arrives) but stays invisible until consent allows the one push; refused, the home slot is
 * removed (nothing follows it on the start screen) and the content slot stays as an invisible spacer. Sizes
 * follow AdSense's fixed-size ad unit CSS: 300×250, and 728×90 for the home slot from 768 px. */
.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.ad-slot--reserved { visibility: hidden; }
.ad-slot .ad-label { font: 600 0.68rem/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-ink); margin: 0; }
.ad-slot ins.adsbygoogle { display: inline-block; width: 300px; height: 250px; max-width: 100%; overflow: hidden; text-decoration: none; }
.ad-slot--home { padding: 0 var(--gutter) 40px; }
@media (min-width: 768px) {
  .ad-slot--home ins.adsbygoogle { width: 728px; height: 90px; }
}
/* The content slot is in the HTML at its final height (rule, padding, label, gap, 250 px) and invisible from the first
 * paint; it becomes visible only once pushed, and a refusal leaves it as an empty spacer of the same height, so the
 * footer below never moves (no layout shift). */
.ad-slot--content {
  margin-top: 120px; padding-top: 18px; border-top: 1.5px dashed var(--line-strong);
  height: calc(1.5px + 18px + 0.68rem * 1.2 + 6px + 250px); visibility: hidden;
}
.ad-slot--content[data-ad-state="pushed"] { visibility: visible; }
/* The Privacy page's Privacy choices control (its status line says when the consent message cannot load). A <button>
 * because it opens Google's consent message rather than going to a page, styled like the links around it. */
.ads-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.link-button {
  display: inline-block; min-height: 24px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-button:hover { color: var(--ink); }
.ads-choices-status { color: var(--muted-ink); font-size: 0.9rem; }

/* ---- Consent box and notice bar (src/consent/box.js) ------------------------------------------------------------ */
/* Only when site.config.json switches a tracker on. A notebook card: the paper panel, an ink rule, buttons of the same
 * style and size (Allow all / Only necessary / Choose; Opt out / OK: no button is pushed over another). Never a modal: no scrim, the game
 * stays usable. Phone: a sheet along the bottom (the page gets the sheet's height as bottom padding, so nothing ends
 * up hidden under it), except on the start screen, where it sits in the page under the start actions and never
 * covers Be born. From 900 px: a card in the bottom-right corner (bottom-left on the start screen, under the picture,
 * away from Be born in the right column). */
.consent {
  position: relative; z-index: 30; width: 100%; padding: 16px var(--gutter) 14px; text-align: left;
  background: var(--panel); color: var(--ink); border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 0.92rem; line-height: 1.5;
}
.consent-title { font: 600 1.12rem/1.25 var(--font-head); color: var(--ink); }
.consent-text { margin-top: 6px; }
.consent-current { margin-top: 8px; color: var(--muted-ink); font-size: 0.88rem; }
.consent-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.consent-actions .btn { width: 100%; }
.consent-google { margin-top: 10px; font-size: 0.88rem; }
.consent-google-status { display: block; color: var(--muted-ink); }
.consent-close { margin-top: 6px; }
/* Three buttons of exactly the same size on one row (a long label wraps inside its button rather than widening it);
 * under 360 px they stack, still equal, full width. */
.consent-actions--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.consent-actions--3 .btn { padding: 4px 6px; line-height: 1.15; text-wrap: balance; }
@media (max-width: 359px) { .consent-actions--3 { grid-template-columns: 1fr; } }
.consent-groups { margin-top: 12px; display: grid; gap: 10px; }
.consent-group { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; cursor: pointer; }
.consent-group input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--teal-ink); }
.consent-save { justify-self: start; }
.consent--bar { padding-top: 12px; padding-bottom: 12px; }
.consent--bar .consent-text { margin-top: 0; }
.consent--bar .consent-actions { margin-top: 10px; }
.consent-ads-only { margin-top: 8px; font-size: 0.88rem; }
.consent--float {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 70vh; max-height: 70dvh; overflow: auto;
  border-width: 1.5px 0 0; border-radius: 16px 16px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.consent--inline { margin: 20px 0 8px; max-width: 460px; box-shadow: var(--shadow); }
html.has-consent-sheet body { padding-bottom: var(--consent-h, 0px); }
@media (min-width: 900px) {
  .consent--float { left: auto; right: 20px; bottom: 20px; width: 400px; border-width: 1.5px; border-radius: var(--radius); padding: 18px 20px 16px; }
  /* The start screen's right column holds Be born: the card goes under the picture, on the left. */
  html[data-screen="start"] .consent--float { right: auto; left: 20px; }
  /* Every other screen and the content pages: a low band along the bottom, the text on the left and the buttons on the
   * right, and the page gets its height as bottom padding (has-consent-sheet), so the ending's and the card's action
   * column can always be scrolled clear of it. */
  html:not([data-screen="start"]) .consent--float {
    left: 0; right: 0; bottom: 0; width: auto; max-height: 50vh; border-width: 1.5px 0 0; border-radius: 16px 16px 0 0;
    padding: 14px max(24px, calc((100vw - 1120px) / 2));
    display: grid; grid-template-columns: minmax(0, 1fr) 380px; column-gap: 28px; align-items: center;
  }
  html:not([data-screen="start"]) .consent--float > * { grid-column: 1; }
  html:not([data-screen="start"]) .consent--float > .consent-actions { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .consent:not([hidden]) { animation: pop 0.24s ease both; }
}
/* Privacy choices (reopens the box): rendered only when a tracker is on, shown once src/consent/box.js is running. */
.privacy-choices { display: none; }
html[data-consent-choices="on"] .privacy-choices { display: inline-block; }
.foot-links .link-button { padding: 6px 0; color: var(--muted-ink); font-size: inherit; text-decoration: none; }
.foot-links .link-button:hover { color: var(--ink); }
