: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;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #020814; 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; }

/* ---------- background: selected game's art, blurred, over the console blue ---------- */
.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-art { position: absolute; inset: -10%; background-size: cover; background-position: center; filter: blur(28px) saturate(1.2); opacity: .32; transform: scale(1.05); transition: background-image .6s, opacity .6s; }
.bg-wave { position: absolute; left: -20%; right: -20%; top: 38%; height: 70%; background:
  radial-gradient(60% 40% at 50% 50%, rgba(43,139,255,.22), 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); } }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 22px; background: radial-gradient(80% 60% at 50% 40%, #0a2a6e, #01040c 70%); transition: opacity .7s, visibility .7s; }
.boot.off { opacity: 0; visibility: hidden; }
.boot-sweep { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(170,210,255,.16) 50%, transparent 65%); animation: sweep 3.2s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-70%); } to { transform: translateX(70%); } }
.boot-shapes .sh { opacity: 0; animation: pop .5s forwards; transform-box: fill-box; transform-origin: center; }
.boot-shapes .sh:nth-child(2) { animation-delay: .15s; } .boot-shapes .sh:nth-child(3) { animation-delay: .3s; } .boot-shapes .sh:nth-child(4) { animation-delay: .45s; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.8); } to { opacity: 1; transform: none; } }
.boot-name { font-weight: 300; font-size: 44px; letter-spacing: .28em; padding-left: .28em; }
.boot-x { 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: breathe 2s ease-in-out infinite; }
.boot-x span { font-size: 34px; color: #b9d4ff; line-height: 1; }
@keyframes breathe { 50% { box-shadow: 0 0 0 10px rgba(43,139,255,.12), 0 0 40px rgba(43,139,255,.45); } }
.boot-hint { color: var(--dim); letter-spacing: .14em; font-size: 13px; text-transform: uppercase; }

/* ---------- 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 { text-decoration: none; color: var(--dim); font-size: 15px; padding: 10px 0; }
.tabs a.on { color: var(--ink); font-weight: 500; }
.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 { width: 8px; height: 8px; border-radius: 50%; background: #39d98a; box-shadow: 0 0 8px #39d98a; }
.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; }
.mute.off .waves { opacity: .15; }

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: 10px; }
.mode.live { color: #7cf0b2; background: rgba(57,217,138,.1); border-color: rgba(57,217,138,.35); }
.row-wrap { margin: 0 -16px; }
.row { display: flex; gap: 10px; align-items: flex-end; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 8px 16px 12px; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.tile { position: relative; flex: 0 0 auto; width: 72px; height: 72px; border-radius: 14px; overflow: hidden; background: #0b1f4a; border: 0; padding: 0; cursor: pointer; scroll-snap-align: start; transition: width .25s, height .25s, box-shadow .25s, transform .25s; }
.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: 13px; background: linear-gradient(135deg, var(--a, #1b4fb8), var(--b, #0a1f4a)); }
.tile .tbar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 4px; background: rgba(0,0,0,.55); overflow: hidden; }
.tile .tbar i { display: block; height: 100%; background: #fff; border-radius: 4px; }
.tile.sel { width: 104px; height: 104px; box-shadow: 0 0 0 2px #fff, 0 10px 30px rgba(0,0,0,.5); }
.tile.pin { width: 84px; height: 84px; }
.tile.pin.sel { width: 112px; height: 112px; }
.tile.pin::after { content: 'PSPAD'; position: absolute; top: 6px; left: 6px; font-size: 9px; font-weight: 700; letter-spacing: .1em; padding: 2px 6px; border-radius: 6px; background: rgba(10,108,255,.85); }
.tile.new { animation: slidein .5s ease-out; }
.tile .stk { position: absolute; top: 5px; right: 5px; font-size: 8px; font-weight: 700; padding: 2px 4px; border-radius: 4px; background: rgba(0,0,0,.6); color: #ffd27a; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.hero { padding: 6px 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; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #5aa6ff, #fff); transition: width .8s ease; }
.hero.done .bar i { background: linear-gradient(90deg, var(--plat), #fff); }
.install-meta { margin-top: 6px; font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.hero-btns { display: flex; gap: 10px; }
.btn { 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; }
.btn.play { background: #fff; color: #02122e; }
.btn.play:active { transform: scale(.97); }
.btn.ghost { background: var(--glass2); border: 1px solid var(--line); color: var(--ink); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; pointer-events: none; }

.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); }
.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: flash 1.2s; }
@keyframes flash { 0% { color: #fff; } 100% { color: inherit; } }

/* ---------- 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; }
.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 { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); min-width: 0; }
.player.lead { border-color: rgba(240,199,94,.55); background: linear-gradient(135deg, rgba(240,199,94,.18), rgba(16,32,70,.55)); }
.player.join { animation: join .9s ease-out; }
@keyframes join { 0% { transform: scale(.6); opacity: 0; box-shadow: 0 0 0 0 rgba(43,139,255,.8); } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: none; box-shadow: 0 0 0 14px rgba(43,139,255,0); } }
.av { 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); }
.pn { min-width: 0; }
.pn b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn span { font-size: 11px; color: var(--dim); }
.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 { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); min-width: 0; }
.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: slidein .45s ease-out; }
.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 { pointer-events: auto; width: min(420px, 100%); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: rgba(14,22,40,.92); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 12px 40px rgba(0,0,0,.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: tin .45s cubic-bezier(.2,.9,.3,1.2); }
.toast.out { animation: tout .35s forwards; }
.toast .ti { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.07); overflow: hidden; }
.toast .ti img { width: 100%; height: 100%; object-fit: cover; }
.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.platinum { border-color: rgba(169,212,255,.5); }
.toast.gold { border-color: rgba(240,199,94,.55); }
@keyframes tin { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes tout { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- 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); }
.sop-in { width: min(720px, 100%); text-align: center; }
.sop-k { font-size: 13px; letter-spacing: .3em; color: #9cc4ff; margin-bottom: 16px; }
.sop-stage { min-height: 300px; display: grid; place-items: center; }
.sop-card { animation: sopin .8s cubic-bezier(.2,.9,.3,1); }
.sop-card img, .sop-card .fallback { width: 150px; height: 150px; border-radius: 22px; object-fit: cover; box-shadow: 0 20px 60px rgba(0,0,0,.6); display: grid; place-items: center; margin: 0 auto; font-weight: 700; font-size: 22px; background: linear-gradient(135deg, var(--a, #1b4fb8), var(--b, #0a1f4a)); }
.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-title h3 { font-size: 44px; font-weight: 200; letter-spacing: .06em; margin: 0 0 8px; }
.sop-dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.sop-dots i { width: 22px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.2); }
.sop-dots i.on { background: #fff; }
@keyframes sopin { from { opacity: 0; transform: scale(.92) translateY(10px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- CA bar ---------- */
.cabar { position: fixed; z-index: 30; 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; }
  .row { padding: 10px 2px 14px; gap: 14px; }
  .tile { width: 96px; height: 96px; border-radius: 18px; }
  .tile.pin { width: 110px; height: 110px; }
  .tile.sel { width: 150px; height: 150px; }
  .tile.pin.sel { width: 160px; height: 160px; }
  .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; }
  .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; }
}

/* ---------- 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 .tile { width: 96px; height: 96px; } body.stream .tile.sel { width: 150px; height: 150px; }
body.stream .tile.pin { width: 110px; height: 110px; } body.stream .tile.pin.sel { width: 160px; height: 160px; }
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) {
  .bg-art { filter: blur(18px); }
  .card { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(12,26,60,.82); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-wave, .boot-sweep, .boot-x { animation: none; }
}
