:root {
  --ink: #2a2633; --red: #d22b2b; --cream: #fffaf0; --accent: #e4572e;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #fdf0d5; }
body { margin: 0; font-family: var(--font); color: var(--ink); overscroll-behavior-y: none; }
#stage { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100lvh; display: block; touch-action: pan-y; }
#spacer { width: 1px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#hud { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; pointer-events: none; z-index: 3; }
.brand { font-family: var(--round); font-weight: 900; font-size: 15px; letter-spacing: .02em; color: var(--red); }
.readout { margin-top: 4px; font-size: 14px; }
.readout .lbl { opacity: .7; font-weight: 600; }
.readout strong { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; margin-left: 4px; }
.alt { margin-top: 44px; font-size: 13px; font-weight: 700; opacity: .75; min-height: 1em; }

#track { position: fixed; right: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; z-index: 3; }
#track .dot { width: 14px; height: 14px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
#track .dot::after { content: ""; position: absolute; left: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: rgba(42,38,51,.3); transition: transform .2s, background .2s; }
#track .dot:hover::after, #track .dot:focus-visible::after { background: var(--ink); transform: scale(1.4); }
#track .dot.on::after { background: var(--red); transform: scale(1.7); }
#track .dot:focus-visible { outline: 2px solid var(--ink); border-radius: 50%; }

#intro { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 4; pointer-events: none; }
.intro-card { pointer-events: auto; max-width: 560px; text-align: center; background: rgba(255,250,240,.94); border-radius: 28px; padding: 30px 30px 24px; box-shadow: 0 18px 50px rgba(80,50,10,.18), 0 0 0 3px #fff inset; }
.kicker { margin: 0; text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; color: var(--accent); }
h1 { font-family: var(--round); font-size: clamp(42px, 9vw, 76px); line-height: .95; margin: 8px 0 12px; font-weight: 900; letter-spacing: -.02em; }
h1 span { color: var(--red); }
.lede { font-size: 17px; line-height: 1.45; margin: 0 auto 18px; max-width: 34em; }
.small { font-size: 13px; opacity: .75; margin: 12px 0 0; }
.btn { font: 800 16px var(--font); color: #fff; background: var(--red); border: 0; border-radius: 999px; padding: 13px 22px; cursor: pointer; box-shadow: 0 4px 0 #8f1a1d; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 #8f1a1d; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8f1a1d; }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 4px 0 #c9c2b4; }
.small-btn { padding: 8px 14px; font-size: 14px; }

#hint { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4; font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#hint span { width: 22px; height: 34px; border: 2.5px solid var(--ink); border-radius: 12px; position: relative; }
#hint span::after { content: ""; position: absolute; left: 50%; top: 6px; width: 4px; height: 7px; margin-left: -2px; border-radius: 2px; background: var(--ink); animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(10px); opacity: 0; } 100% { opacity: 0; } }

#card { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(560px, calc(100% - 28px)); background: #fff; border-radius: 22px; padding: 16px 20px 18px; box-shadow: 0 12px 34px rgba(30,30,60,.18); z-index: 3; opacity: 0; visibility: hidden; will-change: opacity; }
.card-top { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--accent); font-variant-numeric: tabular-nums; }
#card h2 { font-family: var(--round); margin: 2px 0 2px; font-size: 24px; line-height: 1.1; font-weight: 900; }
#card-size { margin: 0 0 6px; font-weight: 800; color: var(--red); font-size: 15px; }
#card-text { margin: 0; font-size: 15.5px; line-height: 1.45; }
#card.swap > * { animation: pop .35s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#outro { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 16px; padding-bottom: max(18px, env(safe-area-inset-bottom)); z-index: 4; opacity: 0; visibility: hidden; pointer-events: none; }
.outro-card { pointer-events: auto; max-width: 620px; background: rgba(255,250,240,.97); border-radius: 26px; padding: 22px 24px 18px; text-align: center; box-shadow: 0 18px 50px rgba(20,40,80,.25); }
.outro-card h2 { font-family: var(--round); font-size: clamp(26px, 5vw, 36px); margin: 0 0 8px; font-weight: 900; }
.outro-card p { margin: 0 0 14px; line-height: 1.45; font-size: 16px; }
.outro-card .row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.outro-card a { color: var(--red); font-weight: 700; }

dialog#sources { width: min(760px, calc(100% - 24px)); max-height: 86vh; border: 0; border-radius: 22px; padding: 18px 22px 22px; color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog#sources::backdrop { background: rgba(20,20,40,.45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-head h2 { margin: 0; font-family: var(--round); font-weight: 900; }
#src-list { padding-left: 1.3em; font-size: 14px; line-height: 1.5; }
#src-list li { margin-bottom: 8px; }
#src-list a { color: #1f5f99; }
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; font-weight: 800; }

body[data-phase="intro"] #card { visibility: hidden; }

@media (max-width: 699px) {
  #track { display: none; }
  .readout strong { font-size: 19px; }
  .alt { margin-top: 36px; font-size: 12px; }
  #card { padding: 12px 16px 14px; border-radius: 18px; }
  #card h2 { font-size: 20px; }
  #card-text { font-size: 14.5px; }
  .intro-card { padding: 24px 20px 20px; }
  .lede { font-size: 16px; }
  .outro-card { padding: 18px 16px 14px; }
  .outro-card p { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
