:root {
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ground: #F1ECE2;
  --panel: #FBF8F2;
  --well: #EAE4D7;
  --ink: #17140F;
  --ink2: #4A443A;
  --line: #D6CDBC;
  --mark: #A8300F;
  --ease: cubic-bezier(.2, .8, .1, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #12100D;
    --panel: #1B1814;
    --well: #24201B;
    --ink: #EFE9DD;
    --ink2: #B9B0A1;
    --line: #3A342C;
    --mark: #FF8A66;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--sans); }
body.story-open { overflow: hidden; }
a { color: inherit; }
code { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

.page { min-height: 100dvh; display: flex; flex-direction: column; max-width: 1360px; margin: 0 auto; padding: 0 16px; }
.mast { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0 8px; font: 600 13px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 22px; height: 22px; border-radius: 5px; background: linear-gradient(90deg, #F5E900 0 33%, #FF5B35 33% 66%, #0F3D2E 66%); box-shadow: inset 0 0 0 1.5px var(--ink); }
.mast-note { color: var(--ink2); text-align: right; display: none; }
@media (min-width: 640px) { .mast-note { display: inline; } }

.main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 18px 0 32px; }
@media (min-width: 980px) {
  .main { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 56px; align-items: start; padding-top: 26px; }
}

h1 { font: 800 clamp(44px, 12.4vw, 84px)/.9 var(--sans); letter-spacing: -.048em; margin: 0 0 22px; text-wrap: balance; }
h1 em { display: block; font: italic 400 1em/.96 var(--serif); letter-spacing: -.035em; color: var(--mark); margin-top: .06em; }
.lede { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.45; max-width: 34em; margin: 0 0 24px; color: var(--ink2); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; font: 650 16px/1 var(--sans); text-decoration: none; cursor: pointer; border: 2px solid var(--ink); transition: transform .18s var(--ease), background-color .18s; -webkit-tap-highlight-color: transparent; }
.btn-ink { background: var(--ink); color: var(--ground); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--well); }
.btn:active { transform: scale(.97); }
.btn-small { min-height: 44px; padding: 0 16px; font-size: 14px; background: var(--ink); color: var(--panel); flex: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (hover: hover) { .btn-ink:not([disabled]):hover { transform: translateY(-2px); } }

/* the deck: eight card backs, fanned */
.deck { list-style: none; margin: 34px 0 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.deck::-webkit-scrollbar { display: none; }
.deck li { flex: none; width: 82px; aspect-ratio: 9 / 16; border-radius: 10px; padding: 9px 8px; display: flex; flex-direction: column; justify-content: space-between; background: var(--c); color: var(--k); box-shadow: 0 1px 0 rgba(0,0,0,.08); animation: deal .7s var(--ease) both; animation-delay: calc(var(--i) * 55ms + 120ms); }
.dn { font: 700 11px/1 var(--mono); letter-spacing: .04em; }
.dw { font: 800 13.5px/1.02 var(--sans); letter-spacing: -.03em; }
.d1 { --c: #F5E900; --k: #121008; --i: 0; }
.d2 { --c: #0F3D2E; --k: #C8F7DC; --i: 1; } .d2 .dw { font: italic 500 18px/1 var(--serif); }
.d3 { --c: #FF5B35; --k: #1B0904; --i: 2; } .d3 .dw { text-transform: uppercase; font-size: 13px; }
.d4 { --c: #15120F; --k: #FFB01F; --i: 3; }
.d5 { --c: #FFB8CB; --k: #2A0A16; --i: 4; }
.d6 { --c: #F6F0E4; --k: #141210; --i: 5; } .d6 .dw { font: italic 500 18px/1 var(--serif); }
.d7 { --c: #00A67E; --k: #04150F; --i: 6; }
.d8 { --c: #26221E; --k: #C6FF3D; --i: 7; } .d8 .dw { font: italic 600 15px/1.05 var(--serif); }
@media (prefers-color-scheme: light) { .d6 { box-shadow: inset 0 0 0 1px var(--line); } }
@media (prefers-color-scheme: dark) { .d4, .d8 { box-shadow: inset 0 0 0 1px var(--line); } }
@keyframes deal { from { opacity: 0; transform: translateY(26px) rotate(-6deg); } }
@media (min-width: 980px) {
  .deck { overflow: visible; gap: 0; margin-top: 40px; padding: 18px 0 10px 26px; }
  .deck li { width: 90px; margin-right: -14px; transform: rotate(calc((var(--i) - 3.5) * 3.2deg)) translateY(calc(var(--lift, 0) * 1px)); transform-origin: 50% 120%; transition: transform .35s var(--ease); animation-name: deal-wide; }
  .deck li:hover { --lift: -16; }
  .dw { font-size: 15px; } .d2 .dw, .d6 .dw { font-size: 20px; } .d3 .dw { font-size: 13.5px; }
  @keyframes deal-wide { from { opacity: 0; transform: translateY(40px) rotate(0deg); } }
}

/* the panel */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px 18px 22px; box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 24px 48px -32px rgba(40,30,10,.35); }
@media (min-width: 640px) { .panel { padding: 28px 28px 26px; } }
.steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 22px; }
.steps h2 { display: flex; align-items: center; gap: 10px; font: 700 17px/1.25 var(--sans); letter-spacing: -.01em; margin: 0 0 10px; }
.steps h2 label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--panel); font: 700 13px/1 var(--mono); flex: none; }
.cmd { display: flex; gap: 10px; align-items: center; background: var(--well); border-radius: 14px; padding: 8px 8px 8px 14px; }
.cmd code { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; user-select: all; }
.cmd code span { white-space: nowrap; }
@media (max-width: 400px) { .cmd code { font-size: 12.5px; } }
.tip { font-size: 14px; color: var(--ink2); margin: 8px 2px 0; }
.tip code { background: var(--well); padding: 1px 5px; border-radius: 5px; }
textarea { display: block; width: 100%; height: 132px; resize: vertical; border: 2px solid var(--line); border-radius: 14px; background: var(--ground); color: var(--ink); font: 13px/1.5 var(--mono); padding: 12px 14px; transition: border-color .2s; }
textarea::placeholder { color: var(--ink2); opacity: 1; }
textarea:focus-visible { outline: none; border-color: var(--ink); }
textarea.drop { border-color: var(--mark); border-style: dashed; }
.status { margin: 8px 2px 0; font: 13.5px/1.45 var(--mono); color: var(--ink2); min-height: 1.45em; }
.status.good { color: var(--ink); }
.status b { font-weight: 700; }
.authors { display: flex; flex-wrap: wrap; gap: 8px; }
.author { position: relative; }
.author input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.author span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 2px solid var(--line); border-radius: 999px; font: 600 15px/1.2 var(--sans); max-width: 100%; }
.author small { font: 600 12px/1 var(--mono); color: var(--ink2); }
.author input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--panel); }
.author input:checked + span small { color: inherit; }
.author input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn-play { width: 100%; min-height: 58px; font-size: 18px; }
.privacy { font-size: 14px; line-height: 1.5; color: var(--ink2); margin: 16px 2px 0; }
.privacy strong { color: var(--ink); }

.foot { padding: 18px 0 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink2); }
.foot a { color: var(--ink); text-underline-offset: 3px; display: inline-block; padding: 12px 0; margin: -12px 0; }

/* ------- the story ------- */
.story { position: fixed; inset: 0; z-index: 10; background: #0D0B09; color: #F2ECDF; display: grid; place-items: center; overscroll-behavior: contain; }
.story[hidden] { display: none; }
.story::before { content: ""; position: absolute; inset: 0; background: var(--glow, #333); opacity: .2; transition: background-color .6s; pointer-events: none; }
.story-in { position: relative; display: grid; grid-template-columns: auto auto auto; grid-template-areas: "prev stage next" ". controls ." ". keys ."; align-items: center; justify-items: center; column-gap: 18px; }
.stage { grid-area: stage; position: relative; aspect-ratio: 9 / 16; height: min(calc(100dvh - 108px), 980px); border-radius: 18px; overflow: hidden; container-type: inline-size; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.side { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(242,236,223,.1); color: #F2ECDF; cursor: pointer; display: none; place-items: center; }
.side:hover { background: rgba(242,236,223,.2); }
.side svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.side-prev { grid-area: prev; } .side-next { grid-area: next; }
.side:disabled { visibility: hidden; }
@media (min-width: 760px) and (hover: hover) { .side { display: grid; } }
.controls { grid-area: controls; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 12px; width: 100%; }
.ctl { min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid rgba(242,236,223,.42); background: transparent; color: #F2ECDF; font: 600 15px/1 var(--sans); cursor: pointer; }
.ctl:hover { background: rgba(242,236,223,.12); }
.ctl-end { background: #F2ECDF; color: #14110E; border-color: #F2ECDF; }
.ctl-end:hover { background: #fff; }
.ctl[aria-pressed="true"] { background: rgba(242,236,223,.16); }
.story :focus-visible { outline: 3px solid #F2ECDF; outline-offset: 3px; }
.keys { grid-area: keys; margin: 8px 0 0; font: 12px/1.4 var(--mono); color: #CFC6B6; display: none; }
@media (min-width: 760px) and (hover: hover) { .keys { display: block; } }
@media (max-width: 759px) {
  .story { place-items: start center; }
  .story-in { grid-template-columns: 1fr; grid-template-areas: "stage" "controls"; width: 100%; }
  .stage { width: 100%; height: auto; max-height: calc(100dvh - 120px); max-width: calc((100dvh - 120px) * 9 / 16); border-radius: 0 0 16px 16px; }
  .controls { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .ctl { padding: 0 14px; }
}

.bars { position: absolute; z-index: 3; top: 2.6cqw; left: 4cqw; right: 4cqw; display: flex; gap: 1.2cqw; pointer-events: none; }
.bar { flex: 1; height: max(3px, .8cqw); border-radius: 9px; background: color-mix(in srgb, var(--ink, #fff) 26%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--ink, #fff); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.zone { position: absolute; z-index: 2; top: 0; bottom: 0; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.zone-prev { left: 0; width: 30%; } .zone-next { right: 0; width: 70%; }
.story .zone:focus-visible { outline: none; }
.stage:has(.zone:focus-visible) { outline: 3px solid #F2ECDF; outline-offset: 4px; }
.stage.is-paused .card.is-current .card-top span:last-child { visibility: hidden; }
.paused-note { position: absolute; z-index: 3; top: 6.6cqw; right: 7cqw; margin: -.6cqw -1.6cqw 0 0; padding: .6cqw 1.6cqw; border-radius: 99px; background: var(--ink); color: var(--bg); font: 600 3.3cqw/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; pointer-events: none; }

.cards { position: absolute; inset: 0; }
.card { position: absolute; inset: 0; background: var(--bg); color: var(--ink); visibility: hidden; overflow: hidden; }
.card.is-current, .card.is-leaving { visibility: visible; }
.card.is-current { z-index: 2; }
.card.is-leaving { z-index: 1; }
.card-top, .card-foot { position: absolute; left: 7cqw; right: 7cqw; display: flex; justify-content: space-between; gap: 3cqw; font: 600 3.3cqw/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.card-top { top: 6.6cqw; }
.card-foot { top: 165.6cqw; }
.card-foot .tag { padding: .4cqw 1.6cqw; margin: -.4cqw 0; border-radius: 99px; background: var(--ink); color: var(--bg); }
.card-text { position: absolute; left: 7cqw; right: 7cqw; top: 22cqw; }
.kicker { margin: 0; font: 700 4.2cqw/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.big { margin: 2.6cqw 0 0; font-size: calc(var(--fs) * 1cqw); line-height: .9; font-family: var(--sans); font-weight: 900; letter-spacing: -.045em; }
.big .ln { display: block; white-space: nowrap; }
.big.serif { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: -.03em; }
.big.caps { text-transform: uppercase; letter-spacing: -.035em; }
.big.name { font-family: var(--serif); font-style: italic; font-weight: 700; letter-spacing: -.025em; line-height: .98; }
.unit { margin: 1.6cqw 0 0; font: italic 400 8.6cqw/1.05 var(--serif); letter-spacing: -.02em; }
.unit.mono { font: 700 5.2cqw/1.2 var(--mono); font-style: normal; letter-spacing: .02em; }
.line { margin: 4cqw 0 0; font: 500 4.5cqw/1.3 var(--sans); max-width: 84cqw; }
.line + .line { margin-top: 1.6cqw; }
.fine { position: absolute; left: 7cqw; right: 9cqw; top: 153.6cqw; margin: 0; font: 3.1cqw/1.35 var(--mono); }
.vis { position: absolute; left: 7cqw; top: 109cqw; width: 86cqw; height: 42cqw; display: block; }
.receipts { list-style: none; margin: 4cqw 0 0; padding: 0; font: 500 4.3cqw/1.35 var(--sans); }
.receipts li { padding: 1.4cqw 0; border-top: .35cqw solid currentColor; }
.receipts li:last-child { border-bottom: .35cqw solid currentColor; }

/* motion between cards */
.card.is-current.fwd { animation: in-fwd .72s var(--ease) both; }
.card.is-current.back { animation: in-back .72s var(--ease) both; }
.card.is-leaving.fwd { animation: out-fwd .72s var(--ease) both; }
.card.is-leaving.back { animation: out-back .72s var(--ease) both; }
@keyframes in-fwd { from { clip-path: inset(0 0 0 100% round 18px); transform: translateX(14%) rotate(2deg); } to { clip-path: inset(0 0 0 0 round 0); transform: none; } }
@keyframes in-back { from { clip-path: inset(0 100% 0 0 round 18px); transform: translateX(-14%) rotate(-2deg); } to { clip-path: inset(0 0 0 0 round 0); transform: none; } }
@keyframes out-fwd { to { transform: translateX(-22%) scale(.9); filter: brightness(.6); } }
@keyframes out-back { to { transform: translateX(22%) scale(.9); filter: brightness(.6); } }

.card.is-current .kicker { animation: rise .7s var(--ease) .16s both; }
.card.is-current .big .ln { animation: var(--big-in, slam) .9s var(--ease) both; animation-delay: calc(.24s + var(--li, 0) * .09s); }
.card.is-current .unit { animation: rise .7s var(--ease) .42s both; }
.card.is-current .line, .card.is-current .receipts li { animation: rise .7s var(--ease) both; animation-delay: calc(.56s + var(--li, 0) * .08s); }
.card.is-current .card-foot, .card.is-current .fine { animation: fade .6s ease .7s both; }
@keyframes rise { from { opacity: 0; transform: translateY(5cqw); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slam { from { opacity: 0; transform: translateY(22%) scale(1.06); transform-origin: 0 100%; } }
@keyframes swing { from { opacity: 0; transform: translateX(-12%) skewX(-12deg); } }
@keyframes drop { from { opacity: 0; transform: translateY(-40%); } 60% { opacity: 1; transform: translateY(5%); } }
@keyframes stretch { from { opacity: 0; transform: scaleY(.2); transform-origin: 0 100%; } }
.card[data-id="busiest"] { --big-in: swing; }
.card[data-id="streak"], .card[data-id="verbs"] { --big-in: drop; }
.card[data-id="weekend"], .card[data-id="burst"] { --big-in: stretch; }

@media (prefers-reduced-motion: reduce) {
  .card.is-current.fwd, .card.is-current.back { animation: fade .25s ease both; }
  .card.is-leaving.fwd, .card.is-leaving.back { animation: none; visibility: hidden; }
  .card.is-current .kicker, .card.is-current .big .ln, .card.is-current .unit, .card.is-current .line, .card.is-current .fine, .card.is-current .receipts li, .card.is-current .card-foot { animation: none; }
  .deck li { animation: none; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
