/* Cerevision Play
   A console home screen for the web. Dark only: the art is the light.
   Shapes: cards 22px, controls 14px, chips are pills. One accent (signal red),
   gold means Pro and nothing else. Motion is eased, never springy. */

:root {
  --ink-0: #0b0c12;
  --ink-1: #12141c;
  --ink-2: #1a1d28;
  --ink-3: #262a39;
  --glass: rgba(16, 18, 27, 0.62);
  --text: #f3f4f8;
  --text-2: #b9bdcc;
  --text-3: #80869b;
  --accent: #ff3358;
  --accent-deep: #d81f45;
  --gold: #f6c453;
  --ok: #4ade80;
  --game: #7c5cff;

  --r-card: 22px;
  --r-ctl: 14px;
  --bar-h: 72px;
  --hints-h: 52px;
  --pad: clamp(16px, 3.2vw, 48px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 160ms;
  --t-med: 320ms;
  --t-slow: 700ms;
  --ui: 1;

  --f-display: 'Unbounded', 'Rubik', system-ui, sans-serif;
  --f-ui: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
:root[data-size='s'] { --ui: 0.92; }
:root[data-size='l'] { --ui: 1.1; }

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--ui)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--ink-0); color: var(--text);
  font-family: var(--f-ui); line-height: 1.45; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.ph, .ph-bold, .ph-fill { line-height: 1; }
:focus { outline: none; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- backdrop */

.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--ink-0); }
.bd-layer {
  position: absolute; inset: -2%; opacity: 0; transition: opacity var(--t-slow) var(--ease);
  background-size: cover; background-position: center;
}
.bd-layer.on { opacity: 1; }
.bd-layer .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Games with no key art yet: their colour as a lit field, the icon huge and soft. */
.bd-layer .field {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 80% at 78% 40%, color-mix(in oklab, var(--c) 70%, transparent), transparent 70%),
    radial-gradient(50% 60% at 10% 100%, color-mix(in oklab, var(--c) 30%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in oklab, var(--c) 22%, var(--ink-0)), var(--ink-0));
}
.bd-layer .field img {
  position: absolute; right: 6%; top: 50%; width: min(46vw, 640px); aspect-ratio: 1; object-fit: contain;
  transform: translateY(-55%) rotate(-8deg); border-radius: 22%;
  filter: saturate(1.1); opacity: 0.8;
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent); mask-image: radial-gradient(closest-side, #000 62%, transparent);
  box-shadow: 0 60px 140px -20px color-mix(in oklab, var(--c) 60%, black);
}
.bd-layer .field img.mark { border-radius: 0; box-shadow: none; filter: drop-shadow(0 40px 80px rgba(0,0,0,.5)); opacity: 1; -webkit-mask-image: none; mask-image: none; }
.bd-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11,12,18,.92) 0%, rgba(11,12,18,.55) 38%, rgba(11,12,18,0) 62%),
    linear-gradient(0deg, rgba(11,12,18,.96) 0%, rgba(11,12,18,.2) 34%, rgba(11,12,18,0) 50%),
    linear-gradient(180deg, rgba(11,12,18,.7) 0%, rgba(11,12,18,0) 18%);
}
:root[data-bg='calm'] .bd-layer { filter: blur(28px) saturate(0.9); }
:root[data-bg='off'] .bd-layer { display: none; }
body[data-view]:not([data-view='home']):not([data-view='game']) .bd-layer { filter: blur(36px) brightness(0.55); }
body[data-view]:not([data-view='home']):not([data-view='game']) .bd-scrim { background: rgba(11,12,18,.55); }

/* ---------------------------------------------------------------- top bar */

.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--bar-h);
  display: flex; align-items: center; gap: 28px; padding: 0 var(--pad);
  padding-top: env(safe-area-inset-top);
}
.brand { display: flex; align-items: center; gap: 12px; border-radius: 14px; flex: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 18px;
  box-shadow: 0 10px 24px -8px rgba(255, 51, 88, .7);
}
.brand-word { font-family: var(--f-display); font-weight: 600; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.brand-word b { font-weight: 800; }

.tabs { display: flex; gap: 6px; }
.tabs a {
  position: relative; padding: 10px 14px; border-radius: 12px; color: var(--text-2);
  font-weight: 600; font-size: 16px; transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tabs a:hover { color: var(--text); background: rgba(255,255,255,.06); }
.tabs a[aria-current='page'] { color: var(--text); }
.tabs a[aria-current='page']::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; border-radius: 3px; background: var(--accent);
}
.dot-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; vertical-align: 2px;
}

.bar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.clock { font-family: var(--f-display); font-weight: 600; font-size: 15px; color: var(--text-2); margin-right: 8px; font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px;
  color: var(--text-2); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.pro-pill {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  font-family: var(--f-display); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold); background: rgba(246,196,83,.1); box-shadow: inset 0 0 0 1.5px rgba(246,196,83,.55);
  transition: background var(--t-fast) var(--ease);
}
.pro-pill:hover { background: rgba(246,196,83,.18); }
.pro-pill.is-pro { color: #1a1406; background: var(--gold); box-shadow: none; }

.me-pill {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 4px 16px 4px 4px; border-radius: 999px;
  background: rgba(255,255,255,.07); transition: background var(--t-fast) var(--ease);
}
.me-pill:hover { background: rgba(255,255,255,.12); }
.me-pill .who-name { font-weight: 700; font-size: 15px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-pill .who-lvl { font-size: 12px; color: var(--text-3); font-weight: 600; }
.me-pill .meta { display: flex; flex-direction: column; line-height: 1.15; }
.signin-btn {
  height: 44px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 15px;
  background: #fff; color: var(--ink-0); transition: transform var(--t-fast) var(--ease);
}
.signin-btn:active { transform: scale(.97); }

/* Avatar: a squircle with the player's colour and initials, ringed by level progress. */
.ava {
  --s: 40px; position: relative; flex: none; width: var(--s); height: var(--s); border-radius: 32%;
  display: grid; place-items: center; background: var(--c, #3b82f6); color: #0b0c12;
  font-family: var(--f-display); font-weight: 800; font-size: calc(var(--s) * .36); letter-spacing: -.02em;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.35);
}
.ava.pro::after {
  content: ''; position: absolute; inset: -4px; border-radius: 36%; box-shadow: 0 0 0 2.5px var(--gold);
}
.ava .online { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ink-1); }

/* ---------------------------------------------------------------- views */

#view {
  position: relative; z-index: 1; min-height: 100dvh;
  padding: calc(var(--bar-h) + env(safe-area-inset-top)) var(--pad) calc(var(--hints-h) + 12px);
}
.view-enter { animation: viewIn var(--t-med) var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.h-display { font-family: var(--f-display); font-weight: 800; letter-spacing: -.02em; line-height: 1.02; margin: 0; }
.h-page { font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -.02em; margin: 24px 0 24px; line-height: 1.05; }
.h-sec { font-family: var(--f-display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; margin: 0 0 14px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 24px;
  border-radius: var(--r-ctl); font-weight: 700; font-size: 16px; white-space: nowrap;
  background: rgba(255,255,255,.1); color: var(--text);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:hover { background: rgba(255,255,255,.16); }
.btn:active { transform: scale(.98); }
.btn i { font-size: 20px; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn-sm i { font-size: 16px; }
.btn-white { background: #fff; color: var(--ink-0); }
.btn-white:hover { background: #e9eaf0; }
.btn-danger { background: rgba(255,51,88,.14); color: #ff8aa0; }
.btn-danger:hover { background: rgba(255,51,88,.24); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* The one big button on a screen. Slanted end, like a launch key. */
.btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; white-space: nowrap; transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  position: relative; height: 68px; padding: 0 44px 0 34px; border-radius: 16px;
  background: var(--accent); color: #fff; font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 18px 40px -14px rgba(255,51,88,.75), inset 0 -4px 0 rgba(0,0,0,.18);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.btn-play:hover { background: #ff4a6b; }
.btn-play:active { transform: scale(.98); }
.btn-play i { font-size: 24px; }
.btn-play:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ink-0), 0 0 0 6px #fff, 0 18px 40px -14px rgba(255,51,88,.75); clip-path: none; border-radius: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-2); background: rgba(255,255,255,.08);
}
.chip i { font-size: 15px; }
.chip.new { color: #fff; background: var(--accent); }
.chip.gold { color: #1a1406; background: var(--gold); }
button.chip { transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); height: 38px; padding: 0 16px; font-size: 14px; }
button.chip:hover { background: rgba(255,255,255,.14); color: var(--text); }
button.chip[aria-pressed='true'] { background: #fff; color: var(--ink-0); }

/* ---------------------------------------------------------------- home */

.home {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: 1fr auto;
  gap: 24px 40px; min-height: calc(100dvh - var(--bar-h) - var(--hints-h) - 12px);
}
.hero { grid-column: 1; grid-row: 1; align-self: end; max-width: 640px; padding-bottom: 8px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.hero-chips .chip:not(.new) { color: var(--text); background: rgba(11,12,18,.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.hero-title { font-size: clamp(44px, 6.4vw, 92px); text-wrap: balance; }
.hero-he { font-family: var(--f-ui); font-weight: 800; font-size: clamp(18px, 1.8vw, 24px); color: var(--text-2); margin-top: 10px; direction: rtl; text-align: left; unicode-bidi: plaintext; }
.hero-tag { font-size: clamp(17px, 1.5vw, 20px); color: var(--text); opacity: .92; margin: 16px 0 0; max-width: 34ch; text-wrap: pretty; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin: 18px 0 28px; color: var(--text-2); font-size: 15px; font-weight: 500; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta i { font-size: 18px; color: var(--text-3); }
.hero-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hero-swap { animation: heroSwap var(--t-med) var(--ease) both; }
@keyframes heroSwap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.side { grid-column: 2; grid-row: 1; align-self: end; display: flex; flex-direction: column; gap: 14px; }
.panel {
  border-radius: var(--r-card); padding: 18px; background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 24px 60px -30px rgba(0,0,0,.8);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head .h-sec { margin: 0; font-size: 15px; }
.panel-head a { font-size: 13px; color: var(--text-2); font-weight: 600; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
.panel-head a:hover { color: var(--text); }
@supports not (backdrop-filter: blur(1px)) { .panel { background: rgba(18,20,28,.94); } }

/* Leaderboard rows (shared by home, game sheet, boards) */
.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: grid; grid-template-columns: 28px 36px minmax(0,1fr) auto; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 12px;
}
.row .ava { --s: 36px; }
.row .rank { font-family: var(--f-display); font-weight: 800; font-size: 14px; color: var(--text-3); text-align: center; }
.row:nth-child(1) .rank { color: var(--gold); }
.row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .nm small { display: block; color: var(--text-3); font-size: 12px; font-weight: 500; }
.row .val { font-family: var(--f-display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.row.me { background: rgba(255,51,88,.14); }
.row .vf { color: var(--ok); font-size: 14px; margin-left: 4px; vertical-align: -1px; }
.empty { display: flex; gap: 14px; align-items: flex-start; padding: 6px 4px 4px; color: var(--text-2); font-size: 14px; }
.empty i { font-size: 28px; color: var(--text-3); flex: none; margin-top: 2px; }
.empty b { color: var(--text); display: block; font-size: 15px; margin-bottom: 2px; }

.mini-me { display: flex; align-items: center; gap: 14px; }
.mini-me .ava { --s: 52px; }
.xpbar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 8px; }
.xpbar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* The rail: the console row of games. */
.rail-wrap { grid-column: 1 / -1; grid-row: 2; position: relative; }
.rail {
  display: flex; gap: 18px; padding: 18px 6px 40px; margin: 0 -6px; overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none; scroll-padding: 0 6px;
}
.rail::-webkit-scrollbar { display: none; }
.tile {
  --s: 128px; position: relative; flex: none; width: var(--s); scroll-snap-align: start;
  border-radius: 30px; text-align: left;
}
.tile .face {
  display: block; position: relative; width: var(--s); height: var(--s); border-radius: 30px; overflow: hidden; background: var(--c, var(--ink-2));
  box-shadow: 0 18px 30px -18px rgba(0,0,0,.9);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), filter var(--t-med) var(--ease);
  filter: brightness(.82) saturate(.9);
}
.tile .face img { width: 100%; height: 100%; object-fit: cover; }
.tile .label {
  display: block; position: absolute; left: 0; top: calc(var(--s) + 12px); width: max-content; max-width: 220px;
  font-weight: 700; font-size: 15px; opacity: 0; transform: translateY(-4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tile .badge { position: absolute; top: 10px; right: 10px; z-index: 1; height: 22px; padding: 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .04em; border-radius: 999px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.tile:hover .face { filter: none; }
.tile.focus .face, .tile:focus-visible .face {
  filter: none; transform: scale(1.08);
  box-shadow: 0 0 0 4px var(--ink-0), 0 0 0 7px #fff, 0 26px 50px -18px rgba(0,0,0,.95);
}
.tile.focus .label, .tile:focus-visible .label { opacity: 1; transform: none; }
.tile:focus-visible { outline: none; }
.tile.more .face { display: grid; place-items: center; background: rgba(255,255,255,.08); filter: none; font-size: 36px; color: var(--text-2); }

/* ---------------------------------------------------------------- hints */

.hints {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--hints-h);
  display: flex; align-items: center; gap: 22px; padding: 0 var(--pad) env(safe-area-inset-bottom);
  font-size: 14px; font-weight: 600; color: var(--text-2);
  background: linear-gradient(0deg, rgba(11,12,18,.9), rgba(11,12,18,0));
}
.hints span { display: inline-flex; align-items: center; gap: 8px; }
.key {
  display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 7px; border-radius: 7px;
  background: rgba(255,255,255,.12); box-shadow: inset 0 -2px 0 rgba(0,0,0,.35); color: var(--text);
  font-size: 12px; font-weight: 700; font-family: var(--f-ui);
}
.key.pad { border-radius: 50%; min-width: 26px; padding: 0; }
.hints .pad-on { margin-left: auto; color: var(--ok); }

/* ---------------------------------------------------------------- library */

.lib-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.cover {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 3 / 4; padding: 18px;
  border-radius: var(--r-card); overflow: hidden; isolation: isolate; background: var(--ink-2); text-align: left;
  box-shadow: 0 24px 40px -26px rgba(0,0,0,.9);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.cover .bg { position: absolute; inset: 0; z-index: -2; }
.cover .bg img.art { width: 100%; height: 100%; object-fit: cover; }
.cover .bg.field { background: radial-gradient(90% 70% at 50% 30%, color-mix(in oklab, var(--c) 75%, transparent), transparent 75%), linear-gradient(180deg, color-mix(in oklab, var(--c) 35%, var(--ink-1)), var(--ink-1)); }
.cover .bg.field img { position: absolute; left: 50%; top: 36%; width: 58%; transform: translate(-50%, -50%); border-radius: 24%; box-shadow: 0 30px 60px -20px rgba(0,0,0,.7); }
.cover .bg.field img.mark { border-radius: 0; box-shadow: none; width: 72%; }
.cover::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(11,12,18,.95) 0%, rgba(11,12,18,.5) 32%, rgba(11,12,18,0) 56%); }
.cover h3 { font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.1; }
.cover p { margin: 0; font-size: 14px; color: var(--text-2); }
.cover .tags { position: absolute; top: 14px; left: 14px; display: flex; gap: 6px; }
.cover:hover, .cover:focus-visible { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--ink-0), 0 0 0 6px #fff, 0 30px 50px -24px rgba(0,0,0,.95); outline: none; }

/* ---------------------------------------------------------------- game sheet */

.sheet-back {
  position: fixed; inset: 0; z-index: 40; background: rgba(6,7,11,.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeIn var(--t-med) var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; z-index: 41; left: 50%; top: 50%; width: min(1080px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  transform: translate(-50%, -50%); border-radius: 28px; overflow: auto; background: var(--ink-1);
  box-shadow: 0 40px 120px -20px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.06);
  animation: sheetIn var(--t-med) var(--ease) both;
}
@keyframes sheetIn { from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
.sheet.narrow { width: min(460px, calc(100vw - 32px)); }
.sheet-close { position: absolute; top: 16px; right: 16px; z-index: 3; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: rgba(11,12,18,.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sheet-close:hover { background: rgba(11,12,18,.8); }

.gs-hero { position: relative; height: 340px; overflow: hidden; }
.gs-hero .bg { position: absolute; inset: 0; }
.gs-hero .bg img.art { width: 100%; height: 100%; object-fit: cover; }
.gs-hero .bg.field { background: radial-gradient(70% 90% at 75% 40%, color-mix(in oklab, var(--c) 70%, transparent), transparent 70%), linear-gradient(180deg, color-mix(in oklab, var(--c) 30%, var(--ink-1)), var(--ink-1)); }
.gs-hero .bg.field img { position: absolute; right: 8%; top: 46%; width: 240px; transform: translateY(-50%) rotate(-6deg); border-radius: 24%; box-shadow: 0 40px 80px -20px rgba(0,0,0,.7); }
.gs-hero .bg.field img.mark { border-radius: 0; box-shadow: none; width: 300px; }
.gs-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, var(--ink-1) 0%, rgba(18,20,28,.4) 45%, rgba(18,20,28,0) 70%); }
.gs-head { position: absolute; left: 36px; right: 36px; bottom: 24px; z-index: 1; display: flex; align-items: flex-end; gap: 20px; }
.gs-icon { width: 92px; height: 92px; border-radius: 26px; overflow: hidden; flex: none; box-shadow: 0 20px 40px -14px rgba(0,0,0,.9); }
.gs-icon img { width: 100%; height: 100%; object-fit: cover; }
.gs-head h2 { font-size: clamp(32px, 4vw, 52px); }
.gs-head .he { font-weight: 800; color: var(--text-2); font-size: 18px; margin-top: 6px; }
.gs-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 36px; padding: 12px 36px 36px; }
.gs-about { font-size: 17px; color: var(--text); line-height: 1.6; margin: 0 0 22px; max-width: 58ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 26px 0 0; }
.fact { padding: 14px 16px; border-radius: 16px; background: var(--ink-2); }
.fact dt { font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
.fact dd { margin: 0; font-weight: 600; font-size: 15px; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--ink-2); gap: 2px; }
.seg button { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--text-2); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg button[aria-pressed='true'] { background: var(--ink-3); color: var(--text); }
.board-box { background: var(--ink-2); border-radius: var(--r-card); padding: 16px; }
.board-box .panel-head { margin-bottom: 10px; }

/* ---------------------------------------------------------------- boards page */

.boards { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; }
.blist { display: flex; flex-direction: column; gap: 4px; }
.blist button { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; text-align: left; font-weight: 600; transition: background var(--t-fast) var(--ease); }
.blist button img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.blist button:hover { background: rgba(255,255,255,.06); }
.blist button[aria-pressed='true'] { background: rgba(255,255,255,.1); }
.bmain { border-radius: var(--r-card); background: rgba(18,20,28,.8); padding: 24px; min-height: 420px; }
.bmain .top3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0 18px; }
.podium { border-radius: 18px; background: var(--ink-2); padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.podium .ava { --s: 56px; }
.podium .pl { font-family: var(--f-display); font-weight: 800; font-size: 13px; color: var(--text-3); }
.podium.p1 .pl { color: var(--gold); }
.podium .nm { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .val { font-family: var(--f-display); font-weight: 800; font-size: 20px; }

/* ---------------------------------------------------------------- friends / me / settings */

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.card { border-radius: var(--r-card); background: rgba(18,20,28,.86); padding: 24px; box-shadow: 0 24px 60px -34px rgba(0,0,0,.9); }
.code-big { font-family: var(--f-display); font-weight: 800; font-size: clamp(34px, 4vw, 48px); letter-spacing: .06em; margin: 6px 0 18px; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.input {
  height: 52px; padding: 0 16px; border-radius: var(--r-ctl); border: 0; background: var(--ink-2); color: var(--text);
  font-size: 17px; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; background: var(--ink-3); box-shadow: inset 0 0 0 2px #fff; }
.input.code { font-family: var(--f-display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.err { color: #ff8aa0; font-size: 14px; font-weight: 500; min-height: 0; }
.inline { display: flex; gap: 10px; }
.inline .input { flex: 1; min-width: 0; }
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 16px; background: rgba(255,255,255,.04); }
.prow .ava { --s: 46px; }
.prow .info { flex: 1; min-width: 0; }
.prow .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .info small { color: var(--text-3); font-size: 13px; font-weight: 500; }
.prow .acts { display: flex; gap: 8px; }

.player-card {
  position: relative; border-radius: 28px; padding: 28px; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in oklab, var(--c) 40%, var(--ink-1)), var(--ink-1) 70%);
  box-shadow: 0 30px 70px -40px rgba(0,0,0,.95);
}
.player-card.pro { background: linear-gradient(135deg, #3d2f0d, #17140b 60%, var(--ink-1)); box-shadow: inset 0 0 0 1.5px rgba(246,196,83,.5), 0 30px 70px -40px rgba(0,0,0,.95); }
.player-card .top { display: flex; align-items: center; gap: 20px; }
.player-card .ava { --s: 96px; }
.player-card h2 { font-size: clamp(26px, 3vw, 36px); }
.player-card .lvl { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-weight: 600; color: var(--text-2); font-size: 14px; }
.player-card .xpbar { height: 8px; flex: 1; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.stat { border-radius: 16px; background: rgba(0,0,0,.25); padding: 14px; }
.stat b { display: block; font-family: var(--f-display); font-weight: 800; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 14px; background: var(--c); box-shadow: inset 0 -5px 10px rgba(0,0,0,.2); transition: transform var(--t-fast) var(--ease); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--ink-1), 0 0 0 5.5px #fff; }
.swatch:active { transform: scale(.94); }

.set-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 26px; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 14px 4px; }
.set-row + .set-row { border-top: 1px solid rgba(255,255,255,.06); }
.set-row .lbl { flex: 1; min-width: 0; }
.set-row .lbl b { display: block; font-weight: 600; }
.set-row .lbl small { color: var(--text-3); font-size: 13px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--ink-3); flex: none; transition: background var(--t-fast) var(--ease); }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform var(--t-fast) var(--ease); }
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(20px); }

/* ---------------------------------------------------------------- pro */

.pro-hero { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 40px; align-items: center; margin-top: 12px; }
.pro-gem { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; font-size: 42px; color: #1a1406; background: linear-gradient(160deg, #ffe08a, var(--gold) 50%, #c9932a); box-shadow: 0 24px 50px -18px rgba(246,196,83,.6); margin-bottom: 24px; }
.perks { display: grid; gap: 12px; margin-top: 28px; }
.perk { display: flex; gap: 14px; align-items: flex-start; }
.perk i { font-size: 24px; color: var(--gold); flex: none; margin-top: 2px; }
.perk b { display: block; font-size: 16px; }
.perk span { color: var(--text-2); font-size: 14px; }
.plans { display: grid; gap: 12px; }
.plan { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 18px; background: var(--ink-2); text-align: left; transition: box-shadow var(--t-fast) var(--ease); }
.plan[aria-pressed='true'] { box-shadow: inset 0 0 0 2px var(--gold); }
.plan .pn { flex: 1; font-weight: 700; }
.plan .pn small { display: block; color: var(--text-3); font-weight: 500; font-size: 13px; }
.plan .pp { font-family: var(--f-display); font-weight: 800; font-size: 22px; }
.note { font-size: 13px; color: var(--text-3); margin-top: 14px; }

/* ---------------------------------------------------------------- launch */

.launch {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; text-align: center;
  background: radial-gradient(60% 60% at 50% 45%, color-mix(in oklab, var(--c) 45%, var(--ink-0)), var(--ink-0) 75%);
  animation: fadeIn 260ms var(--ease) both;
}
.launch .li { width: 132px; height: 132px; border-radius: 34px; overflow: hidden; margin: 0 auto 26px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); animation: liIn 600ms var(--ease) both; }
.launch .li img { width: 100%; height: 100%; object-fit: cover; }
@keyframes liIn { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.launch h2 { font-size: 34px; }
.launch p { color: var(--text-2); margin: 10px 0 26px; }
.launch .prog { width: 220px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); margin: 0 auto; overflow: hidden; }
.launch .prog i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left; animation: prog 900ms var(--ease) both; }
@keyframes prog { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------------------------------------------------------------- standalone game page (/g/:slug) */

body[data-view='game'] .bar .tabs, body[data-view='game'] .bar .clock, body[data-view='game'] .dock, body[data-view='game'] #pro-pill { display: none; }
.solo { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; min-height: calc(100dvh - var(--bar-h) - var(--hints-h)); align-items: end; padding-bottom: 24px; }
.solo .hero { max-width: 660px; }
.solo-icon { width: 84px; height: 84px; border-radius: 24px; overflow: hidden; margin-bottom: 22px; box-shadow: 0 20px 40px -14px rgba(0,0,0,.9); }
.solo-icon img { width: 100%; height: 100%; object-fit: cover; }
.more-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-weight: 600; color: var(--text-2); border-radius: 8px; }
.more-link:hover { color: var(--text); }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--hints-h) + 18px); z-index: 70; transform: translate(-50%, 20px); opacity: 0;
  padding: 14px 20px; border-radius: 16px; background: #fff; color: var(--ink-0); font-weight: 600; font-size: 15px;
  box-shadow: 0 20px 50px -16px rgba(0,0,0,.8); pointer-events: none;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- skeleton */

.sk { border-radius: 10px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.1), rgba(255,255,255,.05)); background-size: 200% 100%; animation: sk 1.4s linear infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-row { height: 44px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- dock (phones) */

.dock { display: none; }

@media (max-width: 1180px) {
  .home { grid-template-columns: minmax(0, 1fr) 320px; gap: 20px 28px; }
  .clock { display: none; }
  .gs-body { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --bar-h: 64px; --hints-h: 0px; }
  .tabs, .hints, .brand-word, .bar .icon-btn, .me-pill .meta { display: none; }
  .me-pill { padding: 4px; background: none; }
  .bar { gap: 12px; background: linear-gradient(180deg, rgba(11,12,18,.85), rgba(11,12,18,0)); }
  .brand-mark { width: 38px; height: 38px; }
  #view { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  .dock {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
    height: 64px; border-radius: 22px; background: rgba(18,20,28,.86);
    -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 20px 40px -16px rgba(0,0,0,.9);
  }
  .dock a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text-3); }
  .dock a i { font-size: 22px; }
  .dock a[aria-current='page'] { color: var(--text); }
  .dock a[aria-current='page'] i { color: var(--accent); }

  .home { display: flex; flex-direction: column; gap: 0; min-height: 0; }
  .hero { order: 1; padding-top: 34vh; max-width: none; }
  .hero-title { font-size: clamp(38px, 11vw, 56px); }
  .hero-meta { margin: 14px 0 20px; gap: 14px; font-size: 14px; }
  .hero-actions .btn-play { flex: 1; }
  .rail-wrap { order: 2; margin: 18px calc(var(--pad) * -1) 0; }
  .rail { padding: 14px var(--pad) 36px; margin: 0; scroll-padding: 0 var(--pad); gap: 14px; }
  .tile { --s: 92px; }
  .tile .face { border-radius: 24px; }
  .side { order: 3; }
  .bd-layer { bottom: auto; height: 62vh; }
  .bd-layer .field img { width: 62vw; right: -6vw; top: 30%; }
  .bd-scrim { background: linear-gradient(0deg, var(--ink-0) 38%, rgba(11,12,18,.4) 62%, rgba(11,12,18,.15) 80%, rgba(11,12,18,.7) 100%); }

  .two, .boards, .pro-hero, .solo, .gs-body { grid-template-columns: 1fr; }
  .blist { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
  .blist button { flex: none; }
  .blist button span { display: none; }
  .bmain { padding: 16px; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cover { padding: 14px; }
  .cover h3 { font-size: 17px; }
  .cover p { display: none; }
  .gs-hero { height: 260px; }
  .gs-head { left: 20px; right: 20px; }
  .gs-icon { width: 72px; height: 72px; border-radius: 20px; }
  .gs-body { padding: 8px 20px 24px; gap: 24px; }
  .sheet { top: auto; bottom: 0; left: 0; width: 100%; max-height: 92dvh; transform: none; border-radius: 28px 28px 0 0; animation: sheetUp var(--t-med) var(--ease) both; }
  .sheet.narrow { width: 100%; }
  .solo .hero { padding-top: 30vh; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat b { font-size: 20px; }
  .player-card .ava { --s: 72px; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
:root[data-motion='reduce'] *, :root[data-motion='reduce'] *::before, :root[data-motion='reduce'] *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
