/* Murmuration. One object: the dusk sky over the ultraviolet cloud sea. Two materials: the sky (art + the live
   flock) for everything that moves, the ink plate (#0B0716, amber hairline on top) for everything you read or press.
   Layout system: container 1240, gutter 64 (24 phone), spacing 8/16/24/32/48/64/96. */
@font-face { font-family: "Bricolage"; src: url("/fonts/Bricolage-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Onest"; src: url("/fonts/Onest-var.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JB Mono"; src: url("/fonts/JetBrainsMono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --sky: #06040f;
  --ink: #0b0716;
  --plate: rgba(11, 7, 22, 0.92);
  --uv: #4b26f0;
  --violet: #7a3cff;
  --orange: #ff7a1a;
  --amber: #ffb13b;
  --star: #f3eee6;
  --text: #f3eeff;
  --soft: rgba(243, 238, 255, 0.78);
  --dim: rgba(243, 238, 255, 0.62);
  --line: rgba(243, 238, 255, 0.12);
  --gutter: 64px;
  --wrap: 1240px;
  --display: "Bricolage", "Onest", system-ui, sans-serif;
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JB Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--sky); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sky); color: var(--text); font: 400 18px/1.5 var(--sans); font-synthesis: none;
  font-variant-numeric: tabular-nums; overflow-x: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-weight: 500; letter-spacing: 0; }
b, strong { font-weight: 650; color: var(--text); }

/* ---------- top row ---------- */
.top { position: relative; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 32px; height: 88px; }
.mark { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.mark img { width: 40px; height: 40px; border-radius: 4px; }
.mark span { font: 800 22px/1 var(--display); letter-spacing: -0.01em; }
/* the pages: one segmented ink plate at the right, the open page filled amber (inversion, no underline) */
.nav { margin-left: auto; display: flex; padding: 4px; gap: 4px; background: var(--plate); border-top: 1px solid rgba(255, 177, 59, 0.55); border-radius: 4px; }
.nav a { padding: 10px 18px; text-decoration: none; font-weight: 600; font-size: 17px; color: var(--soft); border-radius: 3px; transition: background 140ms, color 140ms; }
.nav a:hover { color: var(--text); background: rgba(243, 238, 255, 0.08); }
.nav a[aria-current="page"] { color: #120a02; background: var(--amber); }
/* the one shared mode badge: plain words with a lamp, beside the mark */
.badge { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--soft); white-space: nowrap; }
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); flex: none; }
.badge.live::before { background: #7dffb0; box-shadow: 0 0 10px #7dffb0; }

/* ---------- the first screen ---------- */
.hero { position: relative; min-height: max(720px, 100svh); overflow: hidden; isolation: isolate; }
.hero .art { position: absolute; inset: 0; z-index: -2; background: var(--sky) url("/img/hero-wide.webp") center bottom / cover no-repeat; }
.hero canvas.sky { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; display: block; }
.hero .glow { position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; bottom: 38%; height: 0;
  background: linear-gradient(to top, rgba(255, 122, 26, 0.28), rgba(255, 122, 26, 0)); transition: height 900ms cubic-bezier(.2,.7,.2,1); }
.hero .top { position: absolute; top: 0; left: 0; right: 0; }
.lead { position: relative; padding-top: 120px; padding-bottom: 48px; max-width: calc(620px + var(--gutter)); }
.name { margin: 0; font: 800 clamp(56px, 9.4vw, 136px)/0.9 var(--display); letter-spacing: -0.035em; color: var(--text); }
.headline { margin: 20px 0 0; font: 800 clamp(30px, 3.4vw, 48px)/1.04 var(--display); letter-spacing: -0.02em; max-width: 15ch; }
.headline em { font-style: normal; color: var(--orange); }
.copy { margin: 20px 0 0; max-width: 34em; color: var(--soft); font-size: 18px; }
.actions { display: flex; gap: 16px; margin-top: 28px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 28px; border-radius: 4px;
  font: 700 18px/1 var(--sans); text-decoration: none; cursor: pointer; border: 0; transition: transform 140ms ease-out, background 140ms ease-out, box-shadow 140ms ease-out; }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn.primary { background: var(--amber); color: #120a02; box-shadow: 0 0 0 0 rgba(255, 177, 59, 0); }
.btn.primary:hover { background: #ffc261; box-shadow: 0 0 28px rgba(255, 177, 59, 0.35); }
.btn.ghost { background: rgba(6, 4, 15, 0.55); color: var(--text); box-shadow: inset 0 0 0 1.5px rgba(243, 238, 255, 0.85); }
.btn.ghost:hover { background: rgba(243, 238, 255, 0.1); }
.btn[aria-disabled="true"], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* the contract bar: the end of the eye path */
.cbar { display: flex; align-items: stretch; margin-top: 28px; background: var(--plate); border-top: 1px solid rgba(255, 177, 59, 0.6);
  border-radius: 4px; max-width: 700px; }
.cbar .ca { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 20px; }
.cbar .ca .label { font-size: 16px; font-weight: 600; color: var(--dim); white-space: nowrap; }
.cbar .addr { min-width: 0; background: none; border: 0; padding: 6px 4px; font-size: 16px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.cbar .addr.none { cursor: default; color: var(--soft); font-family: var(--sans); font-weight: 500; white-space: normal; overflow: visible; }
.cbar .addr.open { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: 4px; border: 0; background: rgba(243, 238, 255, 0.1); font-weight: 650; font-size: 16px; cursor: pointer; transition: background 140ms; }
.chip:hover:not(:disabled) { background: rgba(243, 238, 255, 0.18); }
.chip:disabled { opacity: 0.55; cursor: not-allowed; }
.marks { display: flex; flex: none; border-left: 1px solid var(--line); }
.markbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 106px; min-height: 84px; padding: 14px 8px;
  text-decoration: none; font-size: 16px; font-weight: 600; color: var(--soft); transition: background 140ms, transform 140ms; cursor: pointer; }
.markbtn img { width: 26px; height: 26px; object-fit: contain; flex: none; }
.markbtn + .markbtn { border-left: 1px solid var(--line); }
.markbtn:hover:not([aria-disabled="true"]) { background: rgba(255, 177, 59, 0.1); color: var(--text); }
.markbtn:active:not([aria-disabled="true"]) { transform: translateY(1px); }
.markbtn[aria-disabled="true"] { cursor: not-allowed; }
.markbtn[aria-disabled="true"] img { opacity: 0.45; }
.markbtn small { font-size: 16px; line-height: 1; white-space: nowrap; }
.hint { margin: 10px 0 0; font-size: 16px; color: var(--dim); min-height: 24px; }

/* the plate on the clouds: the numbers, or Find your bird in the same slot */
.board { position: absolute; right: max(var(--gutter), calc((100vw - var(--wrap)) / 2)); bottom: 48px; width: 484px; background: var(--plate); border-top: 1px solid rgba(255, 177, 59, 0.6);
  border-radius: 4px; padding: 20px 32px 18px; z-index: 3; }
.board .nums { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; }
.num .k { font-size: 16px; font-weight: 600; color: var(--dim); }
.num .v { font: 800 36px/1.05 var(--display); letter-spacing: -0.02em; margin-top: 4px; white-space: nowrap; }
.num .v small { font: 600 17px var(--sans); color: var(--soft); margin-left: 4px; letter-spacing: 0; }
.num.pot .v { color: var(--amber); }
.board hr { margin: 14px 0 0; border: 0; height: 1px; background: var(--line); }
.board .state { margin-top: 12px; font-size: 16px; color: var(--soft); display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.board .state .wlabel { font-size: 16px; font-weight: 600; color: var(--dim); }
.board .state .segs { width: 100%; }
.board .state .segs i { flex: 1; width: auto; }
.board .state b { color: var(--orange); }
.segs { display: flex; gap: 3px; flex: none; }
.segs i { width: 6px; height: 18px; background: rgba(243, 238, 255, 0.16); border-radius: 1px; }
.segs i.on { background: var(--orange); }
.board .src { margin: 10px 0 0; font-size: 16px; color: var(--dim); line-height: 1.4; }
.board .rtxt::before { display: none !important; }
.board.replaying .src { color: var(--soft); }
@media (min-width: 1181px) { .board.replaying .src { white-space: nowrap; } }
.board .row2 { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 6px; }
.linkbtn { background: none; border: 0; padding: 8px 0; color: var(--amber); font-weight: 650; font-size: 16px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.linkbtn:hover { color: #ffd08a; }
.find label { display: block; font-size: 16px; font-weight: 600; color: var(--soft); }
.find .field { display: flex; gap: 8px; margin-top: 10px; }
.find input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; background: rgba(243, 238, 255, 0.06); border: 1px solid rgba(243, 238, 255, 0.25);
  border-radius: 4px; color: var(--text); font: 500 16px var(--mono); }
.find input:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 3px rgba(255, 177, 59, 0.25); }
.find .out { margin-top: 14px; min-height: 120px; font-size: 16px; color: var(--soft); }
.find .out .big { font: 800 30px/1.1 var(--display); color: var(--text); margin-bottom: 6px; }
.find .out .big.amber { color: var(--amber); }
.find .formula { margin-top: 12px; font-size: 16px; color: var(--dim); }

/* ---------- sections below ---------- */
.sec { padding: 96px 0 0; }
.sec:last-of-type { padding-bottom: 96px; }
.sec h2 { margin: 0; font: 800 44px/1.02 var(--display); letter-spacing: -0.02em; }
.sec .sub { margin: 14px 0 0; max-width: 42em; color: var(--soft); }
.ledger { margin-top: 40px; width: 100%; border-collapse: collapse; font-size: 17px; }
.ledger th { text-align: left; font-size: 16px; font-weight: 600; color: var(--dim); padding: 12px 18px; white-space: nowrap; }
.ledger tr { border-bottom: 1px solid var(--line); }
.ledger td { padding: 14px 18px; vertical-align: middle; line-height: 1.4; }
.ledger td.r, .ledger th.r { text-align: right; }
.ledger { margin-left: -18px; width: calc(100% + 36px); }
.ledger .k { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.join { background: var(--amber); } .dot.leave, .dot.shed { background: var(--violet); } .dot.falcon { background: var(--text); box-shadow: 0 0 0 2px var(--orange); }
.dot.close, .dot.pay { background: var(--orange); } .dot.topup { background: #ffd08a; } .dot.grow { background: var(--amber); }
.sig { color: var(--soft); text-decoration: underline dotted rgba(243, 238, 255, 0.5); text-underline-offset: 4px; font-size: 16px; }
.sig:hover { color: var(--text); }
.more { margin-top: 32px; }
.addrbtn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--soft); font: 500 16px var(--mono); text-align: left; }
.addrbtn:hover { color: var(--text); }
.addrbtn.open { overflow-wrap: anywhere; }

/* inner pages: a band of the world on top */
.band { position: relative; min-height: 460px; display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.band .art { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; }
.band .art::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(6, 4, 15, 0.9) 0%, rgba(6, 4, 15, 0.82) 38%, rgba(6, 4, 15, 0.35) 62%, rgba(6, 4, 15, 0) 80%),
    linear-gradient(to bottom, rgba(6, 4, 15, 0.7) 0, rgba(6, 4, 15, 0) 110px, rgba(6, 4, 15, 0) 55%, var(--sky) 100%); }
@media (max-width: 760px) { .band .art::after { background: linear-gradient(to bottom, rgba(6, 4, 15, 0.75) 0, rgba(6, 4, 15, 0.82) 40%, var(--sky) 100%); } }
.band .top { position: absolute; top: 0; left: 0; right: 0; }
.band > .wrap { padding-top: 140px; padding-bottom: 40px; }
.band h1 { margin: 0; font: 800 clamp(52px, 7vw, 104px)/0.92 var(--display); letter-spacing: -0.03em; }
.band p { margin: 18px 0 0; max-width: 36em; color: var(--soft); }
.bigline { display: flex; flex-wrap: wrap; gap: 48px; margin-top: 40px; }
.bigline .num .v { font-size: 64px; }

/* the open window on the Dives page */
.window { margin-top: 40px; padding: 28px 32px; background: var(--plate); border-top: 1px solid rgba(255, 177, 59, 0.6); border-radius: 4px; }
.window h3 { margin: 0; font: 800 30px/1.1 var(--display); }
.window p { margin: 10px 0 0; color: var(--soft); }
.window .segs { margin-top: 18px; gap: 6px; }
.window .segs i { width: auto; flex: 1; height: 22px; }
.window .segs { width: 100%; }

/* How */
.steps { margin-top: 48px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 48px; counter-reset: s; }
.step { position: relative; padding-top: 24px; }
.step::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--line); }
.step .n { font: 800 64px/1 var(--display); color: var(--orange); letter-spacing: -0.03em; }
.step h3 { margin: 14px 0 0; font: 800 26px/1.1 var(--display); }
.step p { margin: 10px 0 0; color: var(--soft); }
.calc { margin-top: 48px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; padding: 32px; background: var(--plate); border-top: 1px solid rgba(255, 177, 59, 0.6); border-radius: 4px; }
.calc .f { display: grid; gap: 22px; }
.calc label { display: block; font-size: 16px; font-weight: 600; color: var(--soft); margin-bottom: 8px; }
.calc .rng { display: flex; align-items: center; gap: 16px; }
.calc input[type="range"] { flex: 1; accent-color: var(--amber); height: 32px; }
.calc .rv { min-width: 9.5em; text-align: right; font-weight: 650; }
.calc .res .v { font: 800 72px/1 var(--display); color: var(--amber); letter-spacing: -0.03em; }
.calc .res .k { font-size: 16px; font-weight: 600; color: var(--dim); }
.calc .res p { color: var(--soft); margin: 14px 0 0; }
.formula-box { margin-top: 20px; padding: 16px 18px; background: rgba(243, 238, 255, 0.05); border-radius: 4px; font-size: 16px; color: var(--soft); }
.formula-box b { color: var(--text); }
.facts { margin-top: 48px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.facts div { position: relative; padding: 18px 0; display: flex; justify-content: space-between; gap: 24px; }
.facts div::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line); }
.facts span { color: var(--soft); }
.facts b { text-align: right; }

.end { padding: 96px 0; }
.end .cbar { margin-top: 24px; }

/* ---------- 404 ---------- */
.lost { min-height: 100svh; display: flex; align-items: center; position: relative; isolation: isolate; }
.lost .art { position: absolute; inset: 0; z-index: -1; background: var(--sky) url("/img/notfound.webp") center / cover no-repeat; }
.lost h1 { margin: 0; font: 800 clamp(56px, 9vw, 128px)/0.9 var(--display); letter-spacing: -0.03em; }
.lost p { margin: 20px 0 32px; color: var(--soft); max-width: 30em; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); opacity: 0; z-index: 50; padding: 14px 22px; background: var(--ink);
  border-top: 1px solid var(--amber); border-radius: 4px; font-weight: 600; font-size: 16px; transition: opacity 160ms ease-out, transform 160ms ease-out; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }


/* ---------- effects layer (js/fx.js): sprites, sparks, drops ---------- */
.fxlayer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.sp { position: absolute; display: block; background-repeat: no-repeat; pointer-events: none; }
.sp-bird { background-image: url("/img/starlings.webp"); background-size: 400% 100%; animation: flap 0.36s steps(4) infinite; }
.sp-falcon { background-image: url("/img/falcon.webp"); background-size: 300% 100%; background-position-x: 0%; }
@keyframes flap { from { background-position-x: 0%; } to { background-position-x: 133.333%; } }
.spark { position: fixed; width: 7px; height: 7px; border-radius: 50%; background: #ffd08a; box-shadow: 0 0 10px 2px rgba(255, 177, 59, 0.8); }
.drop { position: fixed; width: 12px; height: 16px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 40% 35%, #ffd08a, #ff7a1a 70%); box-shadow: 0 0 14px rgba(255, 122, 26, 0.8); }
canvas.ambient { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hero canvas.ambient { z-index: -1; }
.band canvas.bandsky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.band > .wrap { position: relative; z-index: 1; }

/* ---------- replay marking ---------- */
.board.replaying::before { content: "Replay"; position: absolute; top: -15px; left: 28px; padding: 3px 12px; border-radius: 3px; background: var(--orange); color: #120a02; font-weight: 700; font-size: 16px; line-height: 1.5; }
.board.replaying { border-top-color: var(--orange); }
.band .rbar[hidden] { display: none; }
.band .rbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 28px; padding: 12px 20px; background: var(--plate); border-radius: 4px; border-left: 3px solid rgba(243, 238, 255, 0.25); font-size: 16px; color: var(--soft); max-width: 760px; }
.band .rbar.on { border-left-color: var(--orange); }
.rbar.on .rtxt::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 8px var(--orange); vertical-align: middle; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.band.replaying .bigline .k::after { content: " · replay"; color: var(--orange); }

/* ---------- the flight log ---------- */
.ledger tr.hit td { animation: hit 1.1s ease-out; }
@keyframes hit { 0% { background: rgba(255, 122, 26, 0.45); } 100% { background: transparent; } }
.dot.landed { animation: land 0.6s ease-out; }
@keyframes land { 0% { transform: scale(1); } 40% { transform: scale(1.9); box-shadow: 0 0 12px var(--amber); } 100% { transform: scale(1); } }
.dot.emptied { animation: empty 0.8s ease-out; }
@keyframes empty { 0% { transform: scale(1.6); } 100% { transform: scale(1); opacity: 0.55; } }
.expand { margin-left: 12px; padding: 8px 16px; border: 0; border-radius: 4px; background: rgba(243, 238, 255, 0.08); color: var(--soft); font: 600 16px var(--sans); cursor: pointer; }
.expand:hover { background: rgba(243, 238, 255, 0.16); color: var(--text); }
.expand::after { content: " ▾"; }
.expand[aria-expanded="true"]::after { content: " ▴"; }
.ledger tr.detail td { background: rgba(243, 238, 255, 0.04); color: var(--soft); font-size: 16px; line-height: 1.8; }
.ledger tr.dive { cursor: pointer; }
.ledger tr.dive:hover td, .ledger tr.dive:focus td { background: rgba(255, 177, 59, 0.06); }
.ledger tr.dive:focus { outline: none; }
.ledger tr.dive:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

/* ---------- Dives: the open dive ---------- */
.window .whead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.window .held { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.window .held .lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.window .held.dim .lamp { animation: lampdim 0.9s ease-out; }
@keyframes lampdim { 0% { background: var(--violet); box-shadow: none; transform: scale(0.6); } 100% { background: var(--amber); } }
.window .cells { position: relative; display: flex; gap: 6px; margin-top: 44px; }
.window .cells i { flex: 1; height: 24px; border-radius: 2px; background: rgba(243, 238, 255, 0.16); transition: background 200ms; }
.window .cells i.on { background: var(--orange); }
.window .cells i.pop { animation: pop 0.6s ease-out; }
@keyframes pop { 0% { background: #fff1d6; transform: scaleY(1.5); box-shadow: 0 0 14px #ffb13b; } 100% { transform: scaleY(1); } }
.window .cells.gold i.on { animation: gold 1.4s ease-out; }
.window .cells.gold i:not(.on) { animation: goldoff 1.4s ease-out; }
@keyframes goldoff { 0%, 30% { background: rgba(255, 177, 59, 0.35); } 100% { background: rgba(243, 238, 255, 0.16); } }
@keyframes gold { 0%, 30% { background: #ffd08a; box-shadow: 0 0 16px rgba(255, 177, 59, 0.9); } 100% { background: var(--orange); } }
.window .orbit { position: absolute; left: 0; right: 0; top: -40px; height: 32px; pointer-events: none; }
.window .orbit .sp-falcon { position: absolute; top: 0; width: 34px; height: 34px; background-position-x: 0%; animation: patrol 9s ease-in-out infinite alternate; }
@keyframes patrol { 0% { left: 0; transform: scaleX(1) translateY(0); } 25% { transform: scaleX(1) translateY(-6px); } 50% { transform: scaleX(1) translateY(2px); } 100% { left: calc(100% - 34px); transform: scaleX(1) translateY(0); } }
.window:not(.open) .orbit { display: none; }
.window .last { min-height: 28px; margin-top: 14px; color: var(--soft); }
.window .gain { color: var(--amber); }

/* ---------- Payouts ---------- */
.hpulse { position: absolute; right: 0; bottom: 18%; width: 62%; height: 120px; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 60% 70%, rgba(255, 177, 59, 0.55), rgba(255, 122, 26, 0.18) 45%, rgba(255, 122, 26, 0) 70%); animation: hpulse 5.5s ease-in-out infinite; mix-blend-mode: screen; }
@keyframes hpulse { 0%, 100% { opacity: 0.45; transform: scaleX(0.96); } 50% { opacity: 1; transform: scaleX(1.04); } }
.ledger td.bar { position: relative; }
.ledger td.bar .fill { position: absolute; right: 18px; top: 50%; height: 6px; margin-top: 12px; width: calc((100% - 36px) * var(--w) / 100); background: linear-gradient(90deg, rgba(255, 177, 59, 0.15), rgba(255, 177, 59, 0.7)); border-radius: 3px; transition: width 700ms cubic-bezier(.2,.7,.2,1); }
.ledger td.bar.sent .fill { background: linear-gradient(90deg, rgba(255, 122, 26, 0.2), rgba(255, 122, 26, 0.85)); }
.ledger tr.grow td.bar .fill { width: 0; transition: none; }
.ledger td.bar .num { position: relative; }
.bigline .v.up { color: var(--amber); }
.tip { position: absolute; z-index: 70; max-width: 300px; padding: 12px 16px; background: var(--ink); border-top: 1px solid var(--amber); border-radius: 4px; color: var(--soft); font-size: 16px; line-height: 1.5; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); pointer-events: none; }
.tip b { color: var(--text); }

/* ---------- How: the scenes ---------- */
.step .scene { position: relative; height: 110px; margin-bottom: 14px; overflow: hidden; border-radius: 4px;
  background: linear-gradient(to top, rgba(255, 122, 26, 0.75) 0%, rgba(255, 122, 26, 0.28) 38%, rgba(75, 38, 240, 0.12) 75%, rgba(6, 4, 15, 0) 100%); }
.step .scene .sp { width: 22px; height: 22px; }
.step:not(.played) .scene * { animation-play-state: paused !important; }
.step.still .scene * { animation: none !important; }
/* 1: a bird lands in the flock */
.s1a { left: 38%; top: 46%; } .s1b { left: 52%; top: 36%; } .s1c { left: 60%; top: 58%; } .s1d { left: 46%; top: 66%; }
.s1in { left: 46%; top: 50%; transform: translate(-260%, -260%); opacity: 0; }
.played .s1in { animation: flap 0.36s steps(4) infinite, s1in 1.4s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes s1in { to { transform: translate(0, 0); opacity: 1; } }
/* 2: the falcon dives, the flock splits */
.s2a { left: 30%; top: 40%; } .s2b { left: 42%; top: 55%; } .s2c { left: 52%; top: 38%; } .s2d { left: 62%; top: 58%; } .s2e { left: 70%; top: 44%; }
.s2f { width: 44px !important; height: 44px !important; left: 44%; top: -50px; background-position-x: 50%; }
.played .s2f { animation: s2f 1.2s cubic-bezier(.55,0,.95,.5) forwards; }
@keyframes s2f { to { top: 130px; } }
.played .s2a, .played .s2b { animation: flap 0.36s steps(4) infinite, s2l 1.2s 0.4s ease-out forwards; }
.played .s2c, .played .s2d, .played .s2e { animation: flap 0.36s steps(4) infinite, s2r 1.2s 0.4s ease-out forwards; }
@keyframes s2l { to { transform: translateX(-26px); } }
@keyframes s2r { to { transform: translateX(26px); } }
/* 3: 25 cells fill */
.s3 { position: absolute; left: 0; right: 0; top: 44px; display: flex; gap: 4px; }
.s3 b { flex: 1; height: 20px; border-radius: 2px; background: rgba(243, 238, 255, 0.16); }
.played .s3 b { animation: s3 0.25s calc(var(--i) * 70ms) forwards; }
@keyframes s3 { to { background: var(--orange); } }
/* 4: the pot splits into shares */
.orb { position: absolute; left: 50%; top: 10px; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe3b0, #ffb13b 45%, rgba(255, 122, 26, 0) 72%); }
.played .orb { animation: orb 1.6s ease-out forwards; }
@keyframes orb { 60% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(0.5); opacity: 0.3; } }
.s4p { position: absolute; left: 50%; top: 24px; width: 7px; height: 7px; border-radius: 50%; background: #ffd08a; box-shadow: 0 0 8px rgba(255, 177, 59, 0.9); opacity: 0; }
.played .s4p { animation: s4p 1s calc(0.5s + var(--i) * 0.08s) ease-out forwards; }
@keyframes s4p { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(calc((var(--i) - 2) * 52px), 56px); } }
.s4b { top: 72px; } .s4b0 { left: calc(50% - 115px); } .s4b1 { left: calc(50% - 63px); } .s4b2 { left: calc(50% - 11px); } .s4b3 { left: calc(50% + 41px); } .s4b4 { left: calc(50% + 93px); }
/* 5: a drop falls into a wallet */
.s5drop { position: absolute; left: 50%; top: -20px; width: 10px; height: 14px; margin-left: -5px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 40% 35%, #ffd08a, #ff7a1a 70%); }
.played .s5drop { animation: s5 1s cubic-bezier(.55,0,1,.45) forwards; }
@keyframes s5 { 90% { top: 66px; opacity: 1; } 100% { top: 70px; opacity: 0; } }
.s5b { left: calc(50% - 11px); top: 74px; }
.s5tag { position: absolute; left: calc(50% + 22px); top: 64px; padding: 8px 16px; border-radius: 3px; background: var(--ink); font-size: 16px; color: var(--text); opacity: 0; }
.played .s5tag { animation: fadein 0.4s 1s forwards; }
@keyframes fadein { to { opacity: 1; } }
/* 6: who is never paid dims */
.s6f { width: 40px !important; height: 40px !important; left: 6%; top: 34px; }
.chip6 { position: absolute; top: 34px; padding: 8px 16px; border-radius: 4px; background: var(--ink); font-size: 16px; color: var(--text); }
.c6a { left: 28%; } .c6b { left: 62%; }
.s6b { left: 86%; top: 42px; }
.played .s6f, .played .chip6 { animation: dim6 1.2s 0.3s ease-out forwards; }
@keyframes dim6 { to { opacity: 0.22; filter: grayscale(1); } }
.played .s6b { animation: flap 0.36s steps(4) infinite, lit6 1.2s 0.3s ease-out forwards; }
@keyframes lit6 { to { filter: drop-shadow(0 0 6px #ffb13b); } }

/* the calculator's flock */
.mini { position: relative; margin-top: 18px; }
.mini canvas { display: block; width: 100%; height: 150px; border-radius: 4px; background: linear-gradient(to top, rgba(255, 122, 26, 0.55), rgba(255, 122, 26, 0.1) 55%, rgba(6, 4, 15, 0)); }
.owedtag { position: absolute; right: 0; top: 0; padding: 8px 16px; border-radius: 4px; background: rgba(122, 60, 255, 0.25); color: var(--text); font-size: 16px; font-weight: 600; }

/* ---------- widths ---------- */
@media (max-width: 1180px) {
  .board { width: 470px; }
  .num .v { font-size: 32px; }
}
@media (max-width: 1023px) {
  :root { --gutter: 40px; }
  .ledger { margin-left: 0; width: 100%; }
  .ledger th, .ledger td { padding: 14px 10px; white-space: normal; overflow-wrap: anywhere; }
  .ledger .k { white-space: normal; }
  .calc { grid-template-columns: minmax(0, 1fr); }
  .hero { min-height: 0; }
  .lead { max-width: none; padding-bottom: 360px; }
  .board { left: var(--gutter); right: var(--gutter); width: auto; bottom: 32px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .calc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  :root { --gutter: 24px; }
  body { padding-bottom: 72px; }
  .top .wrap { height: 72px; gap: 16px; }
  .top .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; justify-content: space-between; gap: 4px; background: var(--ink); border-radius: 0; border-top: 1px solid rgba(255, 177, 59, 0.5); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .nav a { flex: 1; text-align: center; padding: 14px 4px; font-size: 16px; }
  .nav a { position: relative; }
  .nav a[aria-current="page"] { background: none; color: var(--amber); }
  .nav a[aria-current="page"]::before { content: ""; position: absolute; left: 20%; right: 20%; top: -6px; height: 3px; background: var(--amber); border-radius: 0 0 2px 2px; }
  .badge { padding: 8px 0; }
  .hero .art { background: linear-gradient(to bottom, var(--sky) 0, var(--sky) calc(var(--bgy, 120px) + 4px), rgba(6, 4, 15, 0) calc(var(--bgy, 120px) + 90px)) no-repeat,
    var(--sky) url("/img/hero-tall.webp") center var(--bgy, 120px) / 100% auto no-repeat; }
  .lead { padding-top: 84px; padding-bottom: 0; }
  .headline { margin-top: 14px; }
  .copy { margin-top: 14px; font-size: 17px; }
  .flockroom { height: 176px; }
  .cbar { margin-top: 16px; }
  .actions { margin-top: 0; }
  .actions .btn { flex: 1 1 0; padding: 0 16px; }
  .cbar { flex-wrap: wrap; }
  .cbar .ca { flex-basis: 100%; }
  .marks { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .markbtn { flex: 1; width: auto; min-height: 76px; padding: 14px 8px; }
  .markbtn[data-link=pump] { flex: 1.5; }
  .board { position: relative; left: auto; right: auto; bottom: auto; margin: 24px var(--gutter) 0; padding: 24px 28px; }
  .num .v { font-size: 28px; }
  .hero { padding-bottom: 24px; }
  .sec { padding-top: 72px; }
  .sec h2 { font-size: 34px; }
  .ledger { font-size: 16px; margin-left: 0; width: 100%; table-layout: fixed; }
  .ledger th, .ledger td { padding: 14px 16px; white-space: normal; overflow-wrap: anywhere; }
  .ledger .k { white-space: normal; }
  .ledger th:first-child, .ledger td:first-child { width: 40%; }
  .ledger .hide-s { display: none; }
  .steps { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .calc { padding: 24px 32px; }
  .calc .res .v { font-size: 36px; }
  .calc .rng { flex-wrap: wrap; gap: 4px 16px; }
  .calc input[type="range"] { flex-basis: 100%; }
  .calc .rv { min-width: 0; text-align: left; }
  .band { min-height: 380px; }
  .bigline { gap: 28px; }
  .bigline .num .v { font-size: 44px; }
  .window { padding: 24px 32px; }
  .window h3 { font-size: 26px; }
}
@media (min-width: 761px) { .flockroom { display: none; } }
@media (max-width: 900px) { .band canvas.bandsky { display: none; } }
@media (max-width: 380px) {
  .badge span { display: none; }
  .actions .btn { flex-basis: 100%; }
  .flockroom { height: 150px; }
  .board .nums { grid-template-columns: 1fr 1fr; }
  .board .nums .num.pot { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
