:root {
  --ink: #eef3ff;
  --dim: #9fb1d4;
  --mute: #6c7fa6;
  --blue: #0a6cff;
  --blue2: #2b8bff;
  --glass: rgba(16, 32, 70, .55);
  --glass2: rgba(255, 255, 255, .06);
  --line: rgba(160, 195, 255, .16);
  --bronze: #d08a52;
  --silver: #c9d3e0;
  --gold: #f0c75e;
  --plat: #a9d4ff;
  --r: 16px;
  --cabar: 64px;
  /* motion: calm ease-out for travel, a soft spring for focus, a livelier pop for things that arrive */
  --out: cubic-bezier(.2, .8, .2, 1);
  --spring: linear(0, .062, .204, .376, .548, .699, .821, .913, .976, 1.016, 1.037, 1.045, 1.045, 1.04, 1.032, 1.024, 1.017, 1.011, 1.006, 1.002, 1, .999, .998, .998, .999, 1);
  --pop: linear(0, .069, .232, .435, .638, .815, .953, 1.047, 1.102, 1.125, 1.123, 1.106, 1.082, 1.056, 1.032, 1.012, .998, .989, .985, .984, .986, .988, .992, .995, .998, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* only the root gets the colour: an opaque body would paint over the fixed z-index:-1 background */
html { background: #020814; }
html, body { margin: 0; color: var(--ink); font: 400 15px/1.45 Inter, system-ui, -apple-system, Segoe UI, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; padding-bottom: calc(var(--cabar) + env(safe-area-inset-bottom) + 8px); }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* ---------- background: the selected game's art as soft colour fields, light waves, drifting motes ---------- */
.bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(120% 80% at 70% 0%, #0d3a8f 0%, #061a45 38%, #020814 75%); overflow: hidden; }
.bg-kb { position: absolute; inset: 0; animation: kb 46s ease-in-out infinite alternate; }
@keyframes kb { from { transform: none; } to { transform: scale(1.14) translate(3%, -2%) rotate(3deg); } }
.bg-l { position: absolute; left: 50%; top: 50%; width: max(150vw, 150vh); height: max(150vw, 150vh); translate: -50% -50%; opacity: 0; transition: opacity 1.6s var(--out); }
.bg-l.on { opacity: .5; }
.bg-wave { position: absolute; left: -20%; right: -20%; top: 38%; height: 70%; background:
  radial-gradient(60% 40% at 50% 50%, rgba(43,139,255,.2), transparent 70%),
  linear-gradient(180deg, transparent, rgba(2,8,20,.9) 70%);
  animation: wave 14s ease-in-out infinite alternate; }
@keyframes wave { from { transform: translateX(-4%) rotate(-2deg); } to { transform: translateX(4%) rotate(2deg); } }
.bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(130% 85% at 50% 10%, transparent 35%, rgba(2,8,20,.7) 90%), linear-gradient(180deg, rgba(2,8,20,.25), rgba(2,8,20,.15) 40%, rgba(2,8,20,.6)); }
.bg-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }

/* ---------- boot: light gathers into the four shapes, the name tracks in, then ✕ ---------- */
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(80% 60% at 50% 42%, #0a2a6e, #01040c 70%); overflow: hidden; }
.boot.off { display: none; }
.boot-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.boot-c { position: relative; display: grid; justify-items: center; gap: 22px; }
.boot-sweep { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 38%, rgba(170,210,255,.13) 50%, transparent 62%); transform: translateX(-80%); animation: sweep 3.4s var(--out) 1.9s infinite; pointer-events: none; }
@keyframes sweep { 0% { transform: translateX(-80%); } 55%, 100% { transform: translateX(80%); } }
.boot-shapes { width: min(66vw, 300px); height: auto; overflow: visible; filter: drop-shadow(0 0 6px rgba(120,180,255,.55)); }
.shapes-base .sh { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw .8s var(--out) 1.15s forwards; }
.shapes-base .sh:nth-child(2) { animation-delay: 1.25s; } .shapes-base .sh:nth-child(3) { animation-delay: 1.35s; } .shapes-base .sh:nth-child(4) { animation-delay: 1.45s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.boot-name { display: flex; font-weight: 300; font-size: 44px; letter-spacing: .28em; padding-left: .28em; line-height: 1.1; }
.boot-name span { display: inline-block; animation: track 1.1s var(--out) both; }
.boot-name span:nth-child(1) { --dx: -34px; animation-delay: 1.75s; } .boot-name span:nth-child(2) { --dx: -17px; animation-delay: 1.8s; }
.boot-name span:nth-child(3) { --dx: 0px; animation-delay: 1.85s; } .boot-name span:nth-child(4) { --dx: 17px; animation-delay: 1.9s; }
.boot-name span:nth-child(5) { --dx: 34px; animation-delay: 1.95s; }
@keyframes track { from { opacity: 0; transform: translateX(var(--dx)); } to { opacity: 1; transform: none; } }
.boot-x { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 2px solid rgba(200,225,255,.6); background: rgba(10,108,255,.15); display: grid; place-items: center; cursor: pointer; animation: xin .8s var(--pop) 2.25s both; -webkit-tap-highlight-color: transparent; }
.boot-x span { font-size: 34px; color: #b9d4ff; line-height: 1; }
.boot-x::before { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(160,205,255,.7); opacity: 0; animation: ring 2.4s var(--out) 3s infinite; }
.boot-x::after { content: ''; position: absolute; inset: -18px; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, rgba(43,139,255,.5), transparent); opacity: .35; animation: glowp 2.4s ease-in-out 3s infinite; }
.boot-x:focus-visible { outline: 2px solid #fff; outline-offset: 6px; }
@keyframes xin { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: none; } }
@keyframes ring { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes glowp { 50% { opacity: 1; } }
.boot-hint { color: var(--dim); letter-spacing: .14em; font-size: 13px; text-transform: uppercase; animation: fadein .6s 2.5s both, hint 2.4s ease-in-out 3.1s infinite; }
@keyframes fadein { from { opacity: 0; } }
@keyframes hint { 50% { opacity: .45; } }
.boot-ring { position: fixed; z-index: 51; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; border: 2px solid rgba(190,220,255,.9); pointer-events: none; animation: bring 1s var(--out) forwards; }
.boot-ring.b { animation-delay: .12s; opacity: 0; border-color: rgba(120,180,255,.7); animation-fill-mode: both; }
@keyframes bring { from { transform: scale(1); opacity: .9; } to { transform: scale(8); opacity: 0; } }
.boot-flash { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 45% at 50% 50%, rgba(170,210,255,.45), transparent 70%); animation: bflash .8s ease-out forwards; }
@keyframes bflash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: linear-gradient(180deg, rgba(2,8,20,.85), rgba(2,8,20,0)); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .14em; }
.glyphs { color: #9cc4ff; font-size: 12px; letter-spacing: .1em; }
.tabs { display: none; gap: 22px; margin-left: 18px; }
.tabs a { position: relative; text-decoration: none; color: var(--dim); font-size: 15px; padding: 10px 0; transition: color .3s; }
.tabs a.on { color: var(--ink); font-weight: 500; }
.tabs a.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 4px; height: 2px; border-radius: 2px; background: #fff; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.online { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.online .dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #39d98a; box-shadow: 0 0 8px #39d98a; }
.online .dot.ping::after { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid #39d98a; animation: ping 1s var(--out) forwards; }
@keyframes ping { from { transform: scale(1); opacity: .9; } to { transform: scale(3.4); opacity: 0; } }
.clock { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mute { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--glass2); cursor: pointer; transition: transform .35s var(--spring); }
.mute:active { transform: scale(.9); transition-duration: .08s; }
.mute .waves { transition: opacity .3s; }
.mute.off .waves { opacity: .15; }
.mute:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

main { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
main > * { min-width: 0; }

/* ---------- home: the row of games ---------- */
.home { padding-top: 4px; }
.mode { display: inline-block; font-size: 11px; letter-spacing: .14em; color: #ffd27a; background: rgba(255,190,70,.1); border: 1px solid rgba(255,190,70,.3); padding: 4px 10px; border-radius: 99px; margin-bottom: 4px; }
.mode.live { color: #7cf0b2; background: rgba(57,217,138,.1); border-color: rgba(57,217,138,.35); }
.row-wrap { margin: 0 -16px; }
/* Tiles are laid out by main.js: every tile is drawn at its focused size and scaled down when not focused,
   so focus is a scale + translate (no layout), and re-sorts glide instead of jumping. */
.row { --t: 72; --tp: 84; --ts: 104; --tps: 112; --gap: 10; --pad: 16; --rad: 18px;
  position: relative; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; padding: 12px 0 18px; }
.row::-webkit-scrollbar { display: none; }
.track { position: relative; height: calc(var(--tps) * 1px); }
.tile { position: absolute; left: 0; bottom: 0; z-index: 1; width: calc(var(--ts) * 1px); height: calc(var(--ts) * 1px); transform-origin: 0 100%; border: 0; padding: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: translate .62s var(--out), scale .6s var(--spring); }
.tile.pin { width: calc(var(--tps) * 1px); height: calc(var(--tps) * 1px); }
.tile.sel { z-index: 3; }
.tile .art { position: absolute; inset: 0; border-radius: var(--rad); overflow: hidden; background: #0b1f4a; transition: transform .35s var(--spring); }
.tile:active .art { transform: scale(.95); transition-duration: .08s; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 17px; background: linear-gradient(135deg, var(--a, #1b4fb8), var(--b, #0a1f4a)); }
.tile .gl { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 32%, rgba(255,255,255,.32) 50%, transparent 68%); transform: translateX(-130%); pointer-events: none; }
/* focus ring and the soft light under the focused tile */
.tile::before { content: ''; position: absolute; inset: -5px; z-index: 2; border-radius: calc(var(--rad) + 5px); border: 2.5px solid #fff; opacity: 0; transition: opacity .3s; pointer-events: none; }
.tile::after { content: ''; position: absolute; inset: 2px; z-index: -1; border-radius: var(--rad); box-shadow: 0 0 26px 3px rgba(110,175,255,.5), 0 14px 30px rgba(0,0,0,.6); opacity: 0; transition: opacity .45s; }
.tile.sel::before { opacity: 1; }
.tile.sel::after { opacity: 1; animation: tglow 3.2s ease-in-out .6s infinite; }
@keyframes tglow { 50% { opacity: .5; } }
.tile:focus-visible { outline: none; }
.tile:focus-visible::before { opacity: 1; border-color: #9cc4ff; }
.tile .tbar { position: absolute; left: 9px; right: 9px; bottom: 9px; z-index: 1; height: 5px; border-radius: 5px; background: rgba(0,0,0,.55); overflow: hidden; }
.tile .tbar i, .bar i { position: relative; display: block; height: 100%; width: 100%; overflow: hidden; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .9s var(--out); }
.tile .tbar i { background: #fff; }
.tile.sel .tbar i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(80,160,255,.85), transparent); animation: shim 1.9s ease-in-out infinite; }
@keyframes shim { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.tile .pl { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; padding: 3px 7px; border-radius: 7px; background: rgba(10,108,255,.88); }
.tile .stk { position: absolute; top: 7px; right: 7px; font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 5px; background: rgba(0,0,0,.6); color: #ffd27a; }
/* the "＋ Create" tile: a dashed empty slot that fills with console blue when it takes focus */
.tile.create .art { display: grid; place-items: center; align-content: center; gap: 4px; background: rgba(255,255,255,.08); border: 2px dashed rgba(200,225,255,.5); color: #dce9ff; transition: transform .35s var(--spring), background-color .45s, border-color .45s; }
.tile.create .plus { font-size: 40px; line-height: 1; font-weight: 300; }
.tile.create .cl { font-size: 15px; font-weight: 600; letter-spacing: .06em; }
.tile.create.sel .art { background: rgba(10,108,255,.32); border-style: solid; border-color: rgba(200,225,255,.75); }
.tile.create.sel .plus { animation: plusin .7s var(--pop); }
@keyframes plusin { from { transform: rotate(-90deg) scale(.6); opacity: .4; } }
/* a coin that just bonded: the bar fills, the ring flashes platinum, then the tile leaves */
.tile.installed::before { opacity: 1; border-color: var(--plat); animation: instring 1.3s var(--out); }
.tile.installed .tbar i { background: linear-gradient(90deg, var(--plat), #fff); }
.tile.installed .art::after { content: 'INSTALLED'; position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 2; font-size: 11px; font-weight: 700; letter-spacing: .12em; padding: 4px 8px; border-radius: 7px; background: rgba(169,212,255,.95); color: #02122e; animation: badge .6s var(--pop) .25s both; }
.tile.installed .art::before { content: ''; position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle, rgba(255,255,255,.85), rgba(169,212,255,.3) 60%, transparent); opacity: 0; animation: iflash .9s ease-out; }
@keyframes instring { 0% { transform: scale(1.12); opacity: 0; } 40% { opacity: 1; } 100% { transform: none; } }
@keyframes badge { from { opacity: 0; transform: scale(.6); } }
@keyframes iflash { 15% { opacity: 1; } 100% { opacity: 0; } }

/* sparks (fx.js) */
.sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 5; pointer-events: none; }
.sparks i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(169,212,255,.9); animation: spark .85s var(--out) both; }
.sparks.gold i { box-shadow: 0 0 6px 1px rgba(240,199,94,.9); }
@keyframes spark { from { transform: rotate(var(--a)) translateX(4px) scale(1.2); opacity: 1; } to { transform: rotate(var(--a)) translateX(var(--d)) scale(0); opacity: 0; } }

.hero { padding: 2px 0 4px; min-height: 236px; }
.hero-kicker { font-size: 11px; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; }
.hero-title { margin: 2px 0 2px; font-weight: 300; font-size: 34px; line-height: 1.1; letter-spacing: .01em; overflow-wrap: anywhere; }
.hero-sub { color: var(--dim); font-size: 14px; min-height: 20px; overflow-wrap: anywhere; }
.install { margin: 14px 0 14px; max-width: 520px; }
.install-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.install-top b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; transition: box-shadow .6s; }
.bar i { border-radius: 6px; background: linear-gradient(90deg, #5aa6ff, #fff); }
.hero:not(.done) .bar i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: shim 2.2s ease-in-out infinite; }
.hero.done .bar i { background: linear-gradient(90deg, var(--plat), #fff); }
.hero.done .bar { box-shadow: 0 0 14px rgba(169,212,255,.45); }
.install-meta { margin-top: 6px; font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.hero-btns { display: flex; gap: 10px; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 99px; text-decoration: none; font-weight: 600; font-size: 15px; border: 0; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: transform .4s var(--spring), box-shadow .3s, opacity .3s; }
.btn:active { transform: scale(.94); transition-duration: .08s; }
/* the focus ring a controller-driven UI draws around the button you're on */
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px #020814, 0 0 0 5px #fff, 0 0 24px rgba(120,180,255,.65); }
.btn.play { background: #fff; color: #02122e; overflow: hidden; isolation: isolate; }
.btn.play::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 38%, rgba(90,166,255,.35) 50%, transparent 62%); transform: translateX(-130%); animation: shine 6s ease-in-out 2.5s infinite; }
@keyframes shine { 0%, 72% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.btn.ghost { background: var(--glass2); border: 1px solid var(--line); color: var(--ink); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; pointer-events: none; }
.btn[aria-disabled="true"]::after { animation: none; }
@media (hover: hover) {
  .btn.play:hover { box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 8px 26px rgba(90,166,255,.35); }
  .btn.ghost:hover, .btn.copy:hover { background: rgba(255,255,255,.1); }
}

.ticker { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; padding: 8px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); overflow: hidden; }
.ticker-k { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: #02122e; background: #9cc4ff; padding: 2px 7px; border-radius: 5px; flex: 0 0 auto; }
.ticker-in { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-run { display: inline-flex; gap: 18px; white-space: nowrap; font-size: 13px; color: var(--dim); }
.ticker-run span b { color: var(--ink); font-weight: 600; }
.ticker-run span.just { animation: tkin .7s var(--out) both; }
.ticker-run span.just b { animation: flash 1.6s; }
@keyframes tkin { from { opacity: 0; } }
@keyframes flash { 0%, 30% { color: #9cc4ff; } 100% { color: var(--ink); } }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-width: 0; }
.card .k { font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.card .v { font-size: 24px; font-weight: 600; margin: 4px 0 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; transform-origin: 0 50%; }
.card .v.bump { animation: vbump .7s var(--pop); }
@keyframes vbump { 30% { transform: scale(1.12); color: #fff; text-shadow: 0 0 18px rgba(120,180,255,.8); } }
.card .s { font-size: 12px; color: var(--mute); }
.card.curve { grid-column: 1 / -1; background: linear-gradient(135deg, rgba(10,108,255,.28), rgba(16,32,70,.55)); }
.card.curve .v { font-size: 28px; }
.card.clocks { grid-column: 1 / -1; display: flex; gap: 12px; }
.clk { flex: 1; min-width: 0; }
.clk b { display: block; font-size: 17px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- panels ---------- */
.panel { margin: 14px 0; }
.panel-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.panel-h h2 { margin: 0; font-size: 18px; font-weight: 500; }
.panel-h span { font-size: 12px; color: var(--mute); }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.player { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); min-width: 0; overflow: hidden; }
.player.lead { border-color: rgba(240,199,94,.55); background: linear-gradient(135deg, rgba(240,199,94,.18), rgba(16,32,70,.55)); }
.player.lead::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 36%, rgba(255,226,150,.24) 50%, transparent 64%); transform: translateX(-120%); animation: lshine 5.5s ease-in-out 1s infinite; }
@keyframes lshine { 0%, 66% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.player.join { animation: join .75s var(--pop) both; }
@keyframes join { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.player.join::before { content: ''; position: absolute; left: 25px; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: radial-gradient(closest-side, rgba(90,166,255,.55), rgba(90,166,255,0)); animation: ripple 1.1s var(--out) .1s both; pointer-events: none; }
@keyframes ripple { from { transform: scale(.4); opacity: 1; } to { transform: scale(7); opacity: 0; } }
.av { position: relative; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: #fff; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.player.join .av { animation: avin .9s var(--pop) .1s both; }
@keyframes avin { from { transform: rotate(-90deg) scale(.4); } }
.av .crown { position: absolute; top: -8px; left: 50%; width: 16px; height: 11px; margin-left: -8px; color: var(--gold); filter: drop-shadow(0 0 4px rgba(240,199,94,.7)); }
.pn { min-width: 0; }
.pn b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn span { display: inline-block; font-size: 11px; color: var(--dim); transform-origin: 0 50%; }
.pn span.bump { animation: lvbump .7s var(--pop); }
@keyframes lvbump { 30% { transform: scale(1.18); color: #fff; } }
.player.lead .pn span { color: var(--gold); }
.empty { grid-column: 1 / -1; padding: 16px; border-radius: 14px; border: 1px dashed var(--line); color: var(--dim); font-size: 13px; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fi { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); min-width: 0; overflow: hidden; }
.fi .ti { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.06); }
.fi .tx { min-width: 0; flex: 1; }
.fi .tx b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi .tx span { display: block; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi .ago { font-size: 11px; color: var(--mute); flex: 0 0 auto; }
.fi.mine { border-color: rgba(10,108,255,.6); background: linear-gradient(135deg, rgba(10,108,255,.25), rgba(16,32,70,.55)); }
.fi.in { animation: fin .6s var(--out) both; }
.fi.in::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(120,180,255,.22), transparent 70%); animation: fglow 2.4s ease-out forwards; }
@keyframes fin { from { opacity: 0; transform: translateY(-8px); } }
@keyframes fglow { to { opacity: 0; } }
.fi.link { cursor: pointer; }

/* trophy icon */
.cup { width: 22px; height: 22px; }
.cup.bronze { color: var(--bronze); } .cup.silver { color: var(--silver); } .cup.gold { color: var(--gold); } .cup.platinum { color: var(--plat); }

/* ---------- toasts (top, like the console's notifications) ---------- */
.toasts { position: fixed; z-index: 40; top: max(62px, calc(env(safe-area-inset-top) + 56px)); left: 12px; right: 12px; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { --tc: var(--plat); position: relative; pointer-events: auto; width: min(420px, 100%); display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 16px; background: #0e1628; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 12px 40px rgba(0,0,0,.55); }
.toast.gold { --tc: var(--gold); border-color: rgba(240,199,94,.55); }
.toast.silver { --tc: var(--silver); }
.toast.bronze { --tc: var(--bronze); }
.toast.platinum { border-color: rgba(169,212,255,.5); box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 24px rgba(120,180,255,.18); }
.toast .ti { position: relative; flex: 0 0 auto; width: 40px; height: 40px; }
.toast .ic { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: rgba(255,255,255,.07); }
.toast .ic img { width: 100%; height: 100%; object-fit: cover; }
.toast .ic .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: linear-gradient(135deg, var(--a, #1b4fb8), var(--b, #0a1f4a)); }
.toast .glint { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.8) 50%, transparent 70%); transform: translateX(-140%); animation: glint .85s ease-in-out .4s; pointer-events: none; }
.toast.platinum .glint { animation: glint .85s ease-in-out .4s, glint .85s ease-in-out 1.8s; }
@keyframes glint { from { transform: translateX(-140%); } to { transform: translateX(140%); } }
.toast .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); overflow: visible; color: var(--tc); pointer-events: none; }
.toast .ring rect { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw 1s var(--out) .2s forwards; }
.toast.platinum .ti::before { content: ''; position: absolute; inset: -22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(169,212,255,.75), rgba(169,212,255,0)); opacity: 0; animation: bloom 1.1s var(--out) .15s; pointer-events: none; }
@keyframes bloom { 0% { opacity: 0; transform: scale(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.5); } }
.toast .tx { min-width: 0; }
.toast .tx b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .tx span { display: block; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .tl { position: absolute; left: 16px; right: 16px; bottom: 0; height: 2px; border-radius: 2px; background: var(--tc); opacity: .55; transform-origin: 0 50%; animation: tl var(--life, 5s) linear forwards; }
@keyframes tl { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* joins are a softer notification: no ring, no glint, quieter colours */
.toast.soft { padding: 9px 14px; background: #121e38; border-color: rgba(160,195,255,.16); }
.toast.soft .ic { border-radius: 50%; background: none; }
.toast.soft .tl { background: #9cc4ff; opacity: .3; }

/* ---------- State of Play overlay ---------- */
.sop { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: radial-gradient(90% 70% at 50% 30%, #0a3ca0, #01040c); padding: 20px 16px calc(var(--cabar) + 20px); overflow: hidden; }
.sop-bg { position: absolute; inset: 0; animation: kb 30s ease-in-out infinite alternate; }
.sop-bg canvas { position: absolute; left: 50%; top: 50%; width: max(150vw, 150vh); height: max(150vw, 150vh); translate: -50% -50%; opacity: 0; transition: opacity 1.4s var(--out); }
.sop-bg canvas.on { opacity: .6; }
.sop::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(90% 70% at 50% 45%, transparent 30%, rgba(1,4,12,.85)); }
.sop-streak { position: absolute; left: 0; width: 45%; height: 1px; z-index: 1; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(170,210,255,.95), transparent); animation: streak 1.5s var(--out) both; }
@keyframes streak { from { transform: translateX(-110%); opacity: 0; } 20% { opacity: 1; } to { transform: translateX(240%); opacity: 0; } }
.sop-in { position: relative; z-index: 2; width: min(720px, 100%); text-align: center; }
.sop-k { font-size: 13px; letter-spacing: .3em; color: #9cc4ff; margin-bottom: 16px; animation: fadeup .9s var(--out) .2s both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } }
.sop-stage { position: relative; min-height: 300px; display: grid; place-items: center; }
.sop-card { grid-area: 1 / 1; position: relative; }
.sop-card .art { position: relative; width: 150px; height: 150px; margin: 0 auto; border-radius: 22px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.12); background: #0b1f4a; }
.sop-card .art img { width: 100%; height: 100%; object-fit: cover; display: block; animation: kbimg var(--per, 12s) linear both; }
.sop-card .art .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 22px; background: linear-gradient(135deg, var(--a, #1b4fb8), var(--b, #0a1f4a)); }
@keyframes kbimg { from { transform: scale(1); } to { transform: scale(1.12); } }
.sop-card .rk { margin-top: 18px; font-size: 12px; letter-spacing: .2em; color: var(--dim); }
.sop-card h3 { margin: 4px 0; font-size: 34px; font-weight: 300; overflow-wrap: anywhere; }
.sop-card p { margin: 0; color: var(--dim); }
.sop-card .big { position: absolute; z-index: -1; left: 50%; top: -30px; translate: -50% 0; font-size: 210px; line-height: 1; font-weight: 200; color: rgba(160,200,255,.08); pointer-events: none; }
.sop-title h3 { font-size: 44px; font-weight: 200; letter-spacing: .06em; margin: 0 0 8px; }
.sop-title h3 span { display: inline-block; white-space: pre; animation: chin .9s var(--out) both; animation-delay: calc(var(--i) * 45ms + .35s); }
@keyframes chin { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }
.sop-title p { animation: fadeup .9s var(--out) 1s both; }
.sop-dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.sop-dots i { position: relative; width: 22px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.2); overflow: hidden; }
.sop-dots i b { position: absolute; inset: 0; background: #fff; transform-origin: 0 50%; transform: scaleX(0); }
.sop-dots i.done b { transform: none; }
.sop-dots i.on b { animation: dotfill var(--per, 10s) linear forwards; }
@keyframes dotfill { from { transform: scaleX(0); } to { transform: none; } }

/* ---------- CA bar ---------- */
.cabar { position: fixed; z-index: 46; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: rgba(2,8,20,.92); border-top: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.ca { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line); }
.ca-k { font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.ca code { font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.btn.copy { background: var(--glass2); border: 1px solid var(--line); padding: 0 16px; }
.btn.buy { padding: 0 20px; }

.foot { color: var(--mute); font-size: 12px; padding: 18px 0 8px; border-top: 1px solid var(--line); margin-top: 18px; }
.foot a { color: var(--dim); }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .tabs { display: flex; }
  main { display: grid; grid-template-columns: 1fr 340px; column-gap: 24px; padding: 0 28px; }
  .home, .cards { grid-column: 1; }
  #players { grid-column: 2; grid-row: 1 / span 2; margin-top: 44px; }
  #activity { grid-column: 1 / -1; }
  .foot { grid-column: 1 / -1; }
  .row-wrap { margin: 0 -8px; }
  .row { --t: 96; --tp: 110; --ts: 150; --tps: 160; --gap: 14; --pad: 8; --rad: 24px; padding: 14px 0 22px; }
  .tile .tbar { left: 12px; right: 12px; bottom: 12px; height: 6px; }
  .tile .pl { top: 10px; left: 10px; font-size: 13px; }
  .tile .stk { font-size: 12px; }
  .tile.create .plus { font-size: 56px; } .tile.create .cl { font-size: 19px; }
  .hero-title { font-size: 52px; }
  .hero { min-height: 270px; }
  .cards { grid-template-columns: 1.4fr 1fr 1fr; }
  .card.curve { grid-column: auto; }
  .card.clocks { grid-column: 1 / -1; }
  .players { grid-template-columns: 1fr 1fr; max-height: 620px; overflow: auto; }
  .feed { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .toasts { left: auto; right: 24px; justify-items: end; }
  .toast { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(14,22,40,.88); }
  .cabar { left: 50%; right: auto; bottom: 14px; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 18px; }
  body { padding-bottom: 96px; }
  .sop-card .art { width: 190px; height: 190px; border-radius: 28px; }
  .sop-card .big { font-size: 280px; top: -50px; }
}

/* ---------- pump.fun livestream (?stream=1): one fixed 16:9 screen ---------- */
body.stream { padding-bottom: 0; overflow: hidden; height: 100vh; }
body.stream .boot, body.stream .foot, body.stream .tabs, body.stream .mute { display: none; }
body.stream main { display: grid; grid-template-columns: 1fr 360px; grid-template-rows: auto 1fr; column-gap: 24px; max-width: none; height: calc(100vh - 70px - 74px); padding: 0 28px; }
body.stream .home { grid-column: 1; grid-row: 1; }
body.stream .cards { grid-column: 1; grid-row: 2; grid-template-columns: 1.4fr 1fr 1fr; align-content: start; }
body.stream .card.curve { grid-column: auto; }
body.stream #players { grid-column: 2; grid-row: 1 / span 2; margin: 0; overflow: hidden; }
body.stream .players { grid-template-columns: 1fr 1fr; }
body.stream #activity { display: none; }
body.stream .row-wrap { margin: 0 -8px; }
body.stream .row { --t: 96; --tp: 110; --ts: 150; --tps: 160; --gap: 14; --pad: 8; --rad: 24px; padding: 14px 0 22px; }
body.stream .tile .tbar { left: 12px; right: 12px; bottom: 12px; height: 6px; }
body.stream .tile .pl { top: 10px; left: 10px; font-size: 13px; }
body.stream .tile.create .plus { font-size: 56px; } body.stream .tile.create .cl { font-size: 19px; }
body.stream .hero-title { font-size: 52px; }
body.stream .toasts { left: auto; right: 24px; justify-items: end; }
body.stream .cabar { left: 50%; right: auto; bottom: 12px; transform: translateX(-50%); width: min(820px, calc(100% - 32px)); border-radius: 18px; border: 1px solid var(--line); }

/* lighter on phones and for reduced motion */
@media (max-width: 899px) {
  .card { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(12,26,60,.82); }
  .bg-wave { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .bg-fx, .boot-fx, .shapes-gl, .boot-sweep, .sop-streak, .sparks { display: none; }
}
