/* Verso base styles. Every color is a theme token from /css/theme.css (generated from server/themes.js).
   Site pages (landing, lobby, demo, leaderboard, dialogs) use the cartoon look of art-source/v3/mock-*.png, calmed
   down for the calm site backgrounds: soft cream panels with a slate outline and a soft "ledge" shadow, rounded
   buttons (terracotta Play, muted blue Connect), selected chips in ink. The match screen uses the same look (sky page, cream HUD stickers, the scene in an
   ink-outlined card); only the scenes' SVG drawings keep the graphite scene tokens (--bg, --surface-*, --text).
   --player and --opponent mark the two sides; variants are derived here with color-mix(). */
:root {
  --player-hover: color-mix(in srgb, var(--player) 82%, var(--text));
  --player-press: color-mix(in srgb, var(--player) 78%, var(--bg));
  --player-glow: color-mix(in srgb, var(--player) 38%, transparent);
  --player-soft: color-mix(in srgb, var(--player) 14%, transparent);
  --opponent-glow: color-mix(in srgb, var(--opponent) 38%, transparent);
  --opponent-soft: color-mix(in srgb, var(--opponent) 14%, transparent);
  --money-glow: color-mix(in srgb, var(--money) 36%, transparent);
  --money-soft: color-mix(in srgb, var(--money) 12%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 14%, transparent);
  --primary-hover: color-mix(in srgb, var(--primary-bg) 88%, var(--text));
  --primary-press: color-mix(in srgb, var(--primary-bg) 86%, var(--bg));
  --focus: var(--ui-player);
  --highlight: inset 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent);
  --lift: 0 10px 30px color-mix(in srgb, var(--shadow) 40%, transparent);
  --backdrop: color-mix(in srgb, var(--bg) 72%, transparent);
  --line-strong: color-mix(in srgb, var(--line) 60%, var(--text-2));
  --panel: color-mix(in srgb, var(--surface-1) 92%, transparent);
  --panel-2: color-mix(in srgb, var(--surface-2) 70%, var(--surface-1));
  --hair: 1px solid var(--line);
  /* the cartoon UI, calm: slate outlines (--edge), soft translucent ledges (--ledge-c), selected chips in ink */
  --edge: var(--ui-line);
  --ledge-c: color-mix(in srgb, var(--ui-line) 42%, transparent);
  --ink-line: 2px solid var(--edge);
  --ink-soft: color-mix(in srgb, var(--ui-line) 26%, transparent);
  --ledge: 0 4px 0 var(--ledge-c);
  --ledge-sm: 0 2.5px 0 var(--ledge-c);
  --float: 0 12px 28px color-mix(in srgb, var(--ui-ink) 13%, transparent);
  --pick-bg: var(--ui-ink);                 /* a selected tab / chip / stake: ink fill, cream text */
  --pick-fg: var(--ui-cream);
  --accent-soft: color-mix(in srgb, var(--ui-sun) 38%, var(--ui-cream));   /* demo chips, hover tints */
  --cream-glass: color-mix(in srgb, var(--ui-cream) 94%, transparent);
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --gap: 24px;
  --bar-in: 60px;           /* the top bar itself */
  --bar-h: 76px;            /* the room it takes, margins included (the match view fits under it) */
  --font-display: 'Fredoka', 'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html, body { margin: 0; }
body {
  background: var(--ui-sky);
  color: var(--ui-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body[data-view="match"] { background: var(--ui-sky); color: var(--ui-ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.asset-missing { display: none !important; }  /* an optional image (cover, icon) that isn't published yet */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.1; font-weight: 700; }
::selection { background: color-mix(in srgb, var(--ui-sun) 60%, transparent); }
img { max-width: 100%; }

/* ---------- page background ----------
   The dark arcade (round 9): the look's page color with a soft glow from the top (no illustrated site art). */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(120% 70% at 50% -10%, var(--ui-sky-2), var(--ui-sky) 70%);
}

/* ---------- shared pieces: panels, stickers, buttons ---------- */
.card-panel {
  background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); border-radius: var(--r-lg);
  box-shadow: var(--ledge), var(--float);
}
/* a title or line of text sitting on the page art: a cream sticker so it keeps AA contrast on every background */
.sticker {
  display: inline-flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%;
  padding: 6px 20px 8px; border-radius: 999px; background: var(--ui-cream); color: var(--ui-ink);
  border: var(--ink-line); box-shadow: var(--ledge-sm);
}
.sticker img { width: 34px; height: 34px; margin-left: -6px; }



.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: var(--ink-line); border-radius: 999px; padding: 10px 20px; line-height: 1.15;
  font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: .005em;
  background: var(--ui-cream); color: var(--ui-ink); box-shadow: var(--ledge-sm);
  transition: transform .08s ease, box-shadow .08s ease, background .15s, filter .15s;
}
.btn img { width: 22px; height: 22px; flex-shrink: 0; margin-left: -4px; object-fit: contain; }
/* UI icons: Lucide (public/js/icons.js, VersoIcons; stroke 2, currentColor). A [data-icon] holder is filled at startup. */
.vi { display: block; flex: none; width: 1.2em; height: 1.2em; overflow: visible; pointer-events: none; }
span[data-icon] { display: inline-flex; flex: none; align-items: center; justify-content: center; }
.btn > [data-icon], .btn > .vi { margin-left: -4px; }
.btn > [data-icon] .vi, .btn > .vi { width: 20px; height: 20px; }
.link-btn [data-icon] { margin-left: 4px; vertical-align: -3px; }
.link-btn .vi { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ledge-c); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ledge-c); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-play, .btn-primary { background: var(--ui-play); color: var(--ui-on-play); }
.btn-play:hover:not(:disabled), .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ui-play) 90%, var(--ui-cream)); }
.btn-blue { background: var(--ui-player); color: var(--ui-on-play); }
.btn-blue:hover:not(:disabled) { background: color-mix(in srgb, var(--ui-player) 90%, var(--ui-cream)); }
.btn-gold { background: var(--ui-sun); color: var(--ui-ink); }
.btn-gold:hover:not(:disabled) { background: color-mix(in srgb, var(--ui-sun) 85%, var(--ui-cream)); }
.btn-ghost { background: var(--ui-cream); color: var(--ui-ink); }
.btn-ghost:hover:not(:disabled) { background: var(--ui-cream-2); }
.btn-danger { background: var(--ui-cream); color: var(--ui-opponent); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 15px; }
.btn-sm img { width: 18px; height: 18px; }
.btn-big { padding: 14px 26px; font-size: 20px; box-shadow: var(--ledge); }
.btn-big:hover:not(:disabled) { box-shadow: 0 6px 0 var(--ledge-c); }
.btn-big img { width: 26px; height: 26px; }
/* the red play icon sits on a cream disc on the red buttons */
.btn.dim { filter: saturate(.55); }

.rules-link {
  background: none; border: 0; padding: 0; color: var(--ui-ink-2); font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.rules-link:hover { color: var(--ui-ink); }
.name-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-decoration-color: var(--ink-soft); text-underline-offset: 3px; }
.name-link:hover { text-decoration-color: currentColor; }
.note { font-size: 14px; color: var(--ui-ink-2); margin: 10px 0 0; }
.note.err { font-size: 14px; color: var(--ui-opponent); font-weight: 700; margin-top: 10px; }
.note.err:empty { display: none; }
.warn { font-size: 14px; color: var(--ui-money); font-weight: 700; margin: 0 0 12px; }
.empty { color: var(--ui-ink-2); font-size: 15px; }

/* round icon buttons (wallet, preview options, sound, help) */
.round-btn, .sound-btn, .help-btn {
  width: 42px; height: 42px; flex-shrink: 0; padding: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--ui-cream); border: var(--ink-line); box-shadow: var(--ledge-sm); color: var(--ui-ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.round-btn img, .sound-btn img, .help-btn img { width: 28px; height: 28px; object-fit: contain; pointer-events: none; }
.round-btn .vi { width: 22px; height: 22px; }
.round-btn:hover, .sound-btn:hover, .help-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ledge-c); }
.round-btn:active, .sound-btn:active, .help-btn:active, .round-btn[aria-expanded="true"], .sound-btn[aria-expanded="true"] { transform: translateY(2px); box-shadow: 0 1px 0 var(--ledge-c); }

/* ---------- top bar: a floating cream bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; min-height: var(--bar-in);
  margin: 10px clamp(8px, 2vw, 24px) 6px; padding: 7px 10px 7px 14px;
  position: sticky; top: 8px; z-index: 20;
  background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); border-radius: 999px; box-shadow: var(--ledge-sm), var(--float);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; flex-shrink: 0; }
/* the logo (public/js/logo.js): one picture, the mascots over the VERSO wordmark, sized by height; in the dark theme a
   thin light edge keeps its dark outline readable on the dark page */
.brand-logo, .foot-brand, .hero-logo { display: block; line-height: 0; }
.brand-logo { height: 52px; margin: -7px 0; }
.brand-logo svg, .foot-brand svg, .hero-logo svg { height: 100%; width: auto; display: block; overflow: visible; }
.verso-logo { display: block; height: 100%; width: auto; max-width: none; user-select: none; -webkit-user-drag: none; }
:root[data-theme="dark"] .verso-logo { filter: drop-shadow(0 0 0.6px color-mix(in srgb, var(--ui-ink) 70%, transparent)) drop-shadow(0 0 0.6px color-mix(in srgb, var(--ui-ink) 45%, transparent)); }
.topbar .spacer { flex: 1; }

/* Games | Demo | Leaderboard */
.main-nav {
  display: flex; gap: 4px; padding: 4px; margin-left: 10px; border-radius: 999px; background: var(--ui-cream-2);
  border: 2px solid var(--edge); flex-shrink: 0;
}
.main-nav button {
  border: 0; background: transparent; color: var(--ui-ink); border-radius: 999px; padding: 6px 16px;
  font: 600 17px/1.15 var(--font-display); white-space: nowrap;
}
.main-nav button:hover { background: color-mix(in srgb, var(--ui-cream) 70%, transparent); }
.main-nav button[aria-current="page"] { background: var(--pick-bg); color: var(--pick-fg); }

/* balance pills: real SOL (wallet) and Demo SOL (play money) */
.wallet-chip {
  display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; flex-shrink: 0;
  background: var(--ui-cream); border: var(--ink-line); border-radius: 999px; box-shadow: var(--ledge-sm);
  padding: 3px 14px 3px 4px; line-height: 1.15; color: var(--ui-ink);
}
/* the token logo (monkey + cat + VERSO, public/js/logo.js) scaled down; the amount centered next to it */
.wallet-chip .tok-logo { grid-row: span 2; display: block; height: 30px; line-height: 0; align-self: center; }
.wallet-chip .tok-logo svg { height: 100%; width: auto; display: block; overflow: visible; }
.wallet-chip .amt, .wallet-chip .sub { text-align: center; justify-self: center; }
.wallet-chip:hover { background: var(--ui-cream-2); }
.wallet-chip .amt { font-family: var(--font-display); font-weight: 700; font-size: 18px; white-space: nowrap; }
.wallet-chip .sub { font-size: 12px; color: var(--ui-ink-2); white-space: nowrap; font-weight: 700; }
.wallet-chip .sub:empty { display: none; }

/* avatar: the mascot head in a disc ringed with a side color */
.avatar {
  --size: 38px; --side-ring: var(--ui-player);
  width: var(--size); height: var(--size); flex-shrink: 0; border-radius: 50%; padding: 0; display: inline-grid; place-items: center;
  background: color-mix(in srgb, var(--side-ring) 16%, var(--ui-cream)); border: 2.5px solid var(--side-ring); color: var(--ui-ink);
  font: 700 calc(var(--size) * .44) / 1 var(--font-display);
}
.me-avatar { box-shadow: var(--ledge-sm); }
/* mascot avatars: the head from the rig (public/js/mascots/rig.js avatarSvg), clipped to the disc */
.avatar.mascot-avatar { overflow: hidden; }
.avatar.mascot-avatar > svg { width: 118%; height: 118%; margin-top: 12%; }
.avatar.mascot-avatar[data-side="opp"] { --side-ring: var(--ui-opponent); }
.avatar.neutral { --side-ring: var(--ui-ink-2); }





body[data-view="match"] .timer-ring .track { stroke: var(--edge); stroke-width: 2; }

/* ---------- lobby and demo: games in the middle, the stake in a rail at the edge ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 22px; }



.stakes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stakes button {
  display: grid; justify-items: center; gap: 0; padding: 7px 2px 6px; border-radius: 14px; line-height: 1.15;
  border: 2px solid var(--edge); background: var(--ui-cream); color: var(--ui-ink); box-shadow: 0 2px 0 var(--ledge-c);
  transition: transform .08s, background .15s;
}
.stakes button:hover { background: var(--ui-cream-2); }
.stakes button:active { transform: translateY(2px); box-shadow: none; }
.stakes button b { font-family: var(--font-display); font-weight: 700; font-size: 19px; white-space: nowrap; }
.stakes button small { font-size: 11px; color: var(--ui-ink-2); white-space: nowrap; font-weight: 700; }
.stakes button small.wait.on { color: var(--ui-win); }
.stakes button[aria-pressed="true"] { background: var(--pick-bg); color: var(--pick-fg); }
.stakes button[aria-pressed="true"] small, .stakes button[aria-pressed="true"] small.wait.on { color: var(--pick-fg); }
/* the stake: "0.1 SOL", "≈ 1.8M $VERSO" under it, one "Win ≈ …" line (the fee is a note at the bottom of the page) */
.stake-sum { display: grid; gap: 1px; border-top: 2px dashed var(--ink-soft); padding-top: 10px; margin: 14px 0 12px; min-width: 0; }
/* .ss-* (the stake summary) live in arcade.css: one centered block */
.fee-note {
  display: block; width: fit-content; max-width: 100%; margin: 26px auto 0; padding: 3px 12px; border-radius: 12px;
  background: var(--cream-glass); color: var(--ui-ink-2); font-size: 13px; font-weight: 700; border: 1.5px solid var(--ink-soft);
}
.fee-note:empty { display: none; }
.summary { border-top: 2px dashed var(--ink-soft); padding-top: 10px; margin: 14px 0 12px; font-size: 15px; }
.summary .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 0; color: var(--ui-ink-2); font-weight: 700; }
.summary .row b { color: var(--ui-ink); }
.summary .row.big span { color: var(--ui-ink); font-size: 17px; }
.summary .row.big b { color: var(--ui-win); font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1; }
.summary small { color: var(--ui-ink-2); font-weight: 400; }
.summary.flat { border-top: 0; padding-top: 0; margin-top: 0; }
.demo-balance {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 12px; padding: 8px 8px 8px 6px;
  border-radius: 14px; background: var(--accent-soft); border: 2px solid var(--edge);
}
.demo-balance .tok-logo { display: block; height: 24px; line-height: 0; flex: none; }
.demo-balance .tok-logo svg { height: 100%; width: auto; display: block; overflow: visible; }
.demo-balance b { display: block; font: 700 19px/1.1 var(--font-display); }
.demo-balance small { display: block; font-size: 11px; font-weight: 700; color: var(--ui-ink-2); }

.history { list-style: none; margin: 0; padding: 4px 18px; }
.history li {
  display: grid; grid-template-columns: 76px 1.3fr 1fr auto 90px; align-items: center; gap: 14px;
  padding: 11px 0; border-bottom: 2px dashed var(--ink-soft); font-size: 15px;
}
.history li:last-child { border-bottom: 0; }
.history li.empty { display: block; }
.history .pill { border-radius: 999px; text-align: center; padding: 2px 0; font: 600 14px/1.3 var(--font-display); color: var(--ui-ink); border: 2px solid var(--edge); background: var(--ui-cream-2); }
.history .pill.res-win { background: var(--ui-win); color: var(--ui-on-play); }
.history .pill.res-loss { background: var(--ui-opponent); color: var(--ui-on-play); }
.history .h-game { font-weight: 700; }
.history .h-opp, .history .h-delta, .history .h-time { color: var(--ui-ink-2); }

.history .h-time { text-align: right; white-space: nowrap; }
.history.compact { padding: 0; background: none; border: 0; box-shadow: none; }

/* ---------- queue ---------- */
.queue-overlay {
  position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--ui-ink) 45%, transparent);
  display: grid; place-items: center; padding: 16px;
}
.queue-box { text-align: center; width: min(560px, 100%); padding: 22px clamp(18px, 5vw, 48px) 26px; }
.queue-box h2 { font-size: clamp(26px, 3.4vw, 34px); }
.queue-box .timer { font-family: var(--font-display); font-size: 54px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.queue-box p { color: var(--ui-ink-2); font-size: 17px; margin: 0 0 18px; font-weight: 700; }
/* the stake confirmation of a real match (Phantom) */
.stake-box .st-amt { font: 700 clamp(26px, 4vw, 34px)/1.15 var(--font-display); color: var(--ui-money); margin: 6px 0 2px; }
.stake-box .st-fee { font-size: 14px; margin: 0 0 8px; }
.stake-box .st-timer { font: 700 40px/1.1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--ui-ink); }
.stake-box .st-timer.low { color: var(--ui-opponent); }
.st-who { list-style: none; padding: 0; margin: 10px 0 12px; display: grid; gap: 6px; }
.st-who li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--ui-cream-2); border: 2px solid var(--ui-line); font-weight: 700; color: var(--ui-ink-2); }
.st-who li b { color: var(--ui-ink); }
.st-who li[data-st="paid"] { border-color: var(--ui-win); }
.st-who li[data-st="paid"] b { color: var(--ui-win); }
.stake-box .row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stake-box .err:empty { display: none; }
.result-tx { margin: 4px 0 0; font-size: 14px; font-weight: 700; color: var(--ui-ink-2); }
.result-tx a { color: var(--ui-player); }
.h-amt.win { color: var(--ui-win); } .h-amt.loss { color: var(--ui-opponent); }
.h-tx { color: var(--ui-player); font-size: 12px; }
.queue-box p b { color: var(--ui-money); }
.q-scene { width: 100%; aspect-ratio: 16 / 9; margin-bottom: 14px; border-radius: var(--r-md); overflow: hidden; border: 2.5px solid var(--edge); background: var(--ui-sky); }

/* ---------- dialogs ---------- */
/* Every dialog: a header (title + Close ✕) that never scrolls away, a body that scrolls inside the window, and an
   optional footer that keeps the main buttons in view. */
dialog {
  color: var(--ui-ink); padding: 0; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: hidden;
  background: var(--ui-cream); border: var(--ink-line); border-radius: var(--r-lg); box-shadow: var(--ledge), var(--float);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: color-mix(in srgb, var(--ui-ink) 50%, transparent); }
dialog h2 { font-size: 28px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
dialog h2 img { width: 34px; height: 34px; }
dialog h2 > [data-icon] { margin-right: 10px; color: var(--ui-money); }
dialog h2 .vi { width: 28px; height: 28px; }
.modal-head {
  flex: none; position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; min-height: 64px;
  padding: 10px 12px 10px 22px; background: var(--ui-cream); border-bottom: 2px dashed var(--ink-soft);
}
.modal-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 26px; overflow-wrap: anywhere; }
.modal-x {
  flex: none; margin-left: auto; width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); box-shadow: var(--ledge-sm);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.modal-x svg { width: 22px; height: 22px; pointer-events: none; }
.modal-x:hover { background: var(--ui-cream-2); transform: translateY(-1px); box-shadow: 0 4px 0 var(--ledge-c); }
.modal-x:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ledge-c); }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 22px 22px; }
.modal-foot {
  flex: none; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 22px 16px;
  background: var(--ui-cream); border-top: 2px dashed var(--ink-soft);
}
dialog .modal-foot.row-btns { margin-top: 0; }
dialog ol, dialog ul { padding-left: 22px; color: var(--ui-ink-2); }
dialog li { margin-bottom: 6px; }
dialog .row-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
dialog label { display: block; font-size: 14px; font-weight: 700; color: var(--ui-ink-2); margin: 12px 0 4px; }
dialog input, .claim-row input {
  width: 100%; background: var(--ui-cream-2); color: var(--ui-ink); border: 2px solid var(--edge); border-radius: var(--r-sm); padding: 10px 12px;
}
dialog input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.rules-cover { position: relative; aspect-ratio: 16 / 9; margin: 0 0 12px; border-radius: var(--r-md); overflow: hidden; border: 2.5px solid var(--edge); }
.w-head, #dlgProfile h3 { font-size: 18px; margin: 20px 0 8px; }
.addr { word-break: break-all; background: var(--ui-cream-2); border: 2px solid var(--edge); padding: 10px; border-radius: var(--r-sm); font-size: 14px; color: var(--ui-ink); }
.claim-row { display: flex; gap: 8px; align-items: center; }
.claim-row input { flex: 1; min-width: 0; }
.claim-row .btn { padding: 8px 16px; }
.w-head:first-of-type { margin-top: 16px; }
/* "Your character" in Wallet & settings: the head, what you wear, Customize */
.w-char { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.w-char .avatar { --size: 44px; }
.w-char-txt { flex: 1 1 160px; min-width: 0; font-size: 14px; font-weight: 700; color: var(--ui-ink-2); line-height: 1.3; }
.w-char-txt b { display: block; color: var(--ui-ink); font: 700 17px/1.2 var(--font-display); }
.w-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.w-account .btn-sm { padding: 6px 12px; font-size: 14px; }
/* Your profile: the character row, the nickname and the theme in one block */
#dlgWallet .w-char + .w-acct, #dlgWallet .w-theme { margin-top: 12px; }
.w-balance .summary { margin-top: 4px; }
dialog .summary .row.big b { color: var(--ui-ink); }

/* result: the result card (server/images.js resultCard, 1200x630) IS the result; the buttons under it.
   The text version (#resFallback) shows only while the picture is missing. Fits without scrolling at 360x640. */
#dlgResult { width: min(660px, calc(100vw - 24px), calc((100dvh - 210px) * 1200 / 630 + 40px)); min-width: min(320px, calc(100vw - 24px)); overflow: visible; }
#dlgResult .modal-body { text-align: center; padding-top: 4px; }
#dlgResult .modal-head { background: transparent; }
.result-head { flex: 1; }
.result-card { position: relative; width: 100%; aspect-ratio: 1200 / 630; border-radius: var(--r-sm); overflow: hidden; border: 2px solid var(--ui-line); background: var(--ui-cream-2); }
.result-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.result-card img:not([src]), .result-card.failed img { visibility: hidden; }
.result-fallback { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px; }
.result-card.failed .result-fallback { display: flex; }
.result-title { font-size: clamp(34px, 6vw, 60px) !important; font-weight: 700; letter-spacing: -.02em; margin: 0 !important; line-height: 1.05; justify-content: center; }
.result-title.loss { color: var(--ui-opponent); }
.result-amt { font-family: var(--font-display); font-size: clamp(22px, 4vw, 32px); font-weight: 700; line-height: 1.2; color: var(--ui-win); }
#dlgResult.res-loss .result-amt { color: var(--ui-opponent); }
.result-amt.small { font-size: 18px; line-height: 1.5; color: var(--ui-ink-2) !important; }
.result-amt:empty { display: none; }
#dlgResult .row-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; }
#dlgResult .row-btns .hidden { display: none; }
#dlgResult .btn { padding: 11px 10px; font-size: 18px; }
#dlgResult .share-wrap { position: relative; display: grid; }
/* the fee-free reward bubble over the Share button (a real win, not claimed today): a speech bubble pointing at it */
.share-tip { position: absolute; bottom: calc(100% + 14px); left: 50%; z-index: 3; width: max-content; max-width: min(260px, 80vw);
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 10px 14px; border-radius: 14px; text-align: left;
  background: var(--ui-money); color: var(--ui-on-play); font-weight: 700; font-size: 15px; line-height: 1.3;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ui-sky) 55%, transparent); transform: translateX(-50%); transform-origin: 50% 100%;
  animation: share-tip-in .32s cubic-bezier(.2, 1.4, .4, 1) both; }
.share-tip::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: var(--ui-money); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.share-tip.hidden { display: none; }
.share-tip-x { flex: none; width: 24px; height: 24px; margin: -2px -2px 0 0; padding: 4px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.share-tip-x:hover { background: color-mix(in srgb, var(--ui-on-play) 14%, transparent); }
.share-tip-x svg { width: 100%; height: 100%; }
@keyframes share-tip-in { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.85); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .share-tip { animation: share-tip-fade .2s ease both; } @keyframes share-tip-fade { from { opacity: 0; } to { opacity: 1; } } }
#dlgResult .res-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
#dlgResult .res-row:has(> :not(.hidden)) { min-height: 1px; }
#dlgResult .res-row:not(:has(> :not(.hidden))) { display: none; }
#dlgResult .claim { flex: 1; min-width: 0; text-align: left; }
#dlgResult .claim .claim-row input { min-width: 0; }
.result-tx { flex: none; margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ui-player); text-decoration: underline; text-underline-offset: 2px; }
#dlgResult #claimMsg { margin: 6px 0 0; text-align: left; }
@media (max-width: 560px) { #dlgResult .modal-body { padding: 2px 8px 8px; } #dlgResult .result-card { border-width: 1px; } }   /* phones: the card as wide as it gets */
#claimMsg:empty { display: none; }
/* the light / dark toggle (top bar and Wallet & settings; public/js/theme.js VersoTheme): a small switch with the sun
   on the left (light) and the moon on the right (dark); the knob sits on the active one */
.theme-toggle { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: space-between; width: 58px; height: 32px;
  padding: 0 7px; border-radius: 999px; border: 2px solid var(--ui-line); background: var(--ui-cream-2); color: var(--ui-ink-2); cursor: pointer; }
.theme-toggle :is(.tt-sun, .tt-moon) { position: relative; z-index: 1; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .tt-knob { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--ui-money); transition: transform .18s ease; }
.theme-toggle[aria-checked="true"] .tt-knob { transform: translateX(26px); background: var(--ui-player); }
.theme-toggle[aria-checked="false"] .tt-sun, .theme-toggle[aria-checked="true"] .tt-moon { color: var(--ui-on-play); }
.theme-toggle:hover { border-color: var(--ui-frame-hi); }
.theme-toggle:focus-visible { outline: 2px solid var(--ui-player); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .theme-toggle .tt-knob { transition: none; } }
.w-theme { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ui-ink); }
#claimMsg { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 10px;
  background: var(--ui-cream); color: var(--ui-ink); padding: 9px 12px 9px 16px; border-radius: 999px; font-weight: 700; font-size: 15px;
  border: var(--ink-line); box-shadow: var(--ledge-sm), var(--float); max-width: calc(100vw - 24px); width: max-content;
}
.toast.err::before { background: var(--ui-play); }
.toast .btn { flex-shrink: 0; }

/* ---------- team badge (leaderboard rows) ---------- */
.team-badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; border: 1.5px solid var(--ink-soft);
  background: var(--ui-cream-2); color: var(--ui-ink-2); font: 700 12px/1.3 var(--font-body); vertical-align: middle; white-space: nowrap;
}

/* ---------- character creator (#dlgCustomize): species toggle, the live character, arrows at the slot heights ---------- */
.customizer { width: min(580px, calc(100vw - 24px)); }
.customizer .modal-body { display: grid; gap: 12px; padding-top: 14px; }
.species-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px;
  background: var(--ui-cream-2); border: 2px solid var(--edge);
}
.species-toggle button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; border: 0; background: transparent;
  border-radius: 999px; padding: 3px 14px 3px 3px; color: var(--ui-ink); font: 600 19px/1.1 var(--font-display);
}
.species-toggle button:hover { background: color-mix(in srgb, var(--ui-cream) 70%, transparent); }
.species-toggle button[aria-checked="true"] { background: var(--pick-bg); color: var(--pick-fg); }
.species-toggle .avatar { --size: 36px; }
.cust-stage, .prof-stage {
  position: relative; overflow: hidden; border-radius: var(--r-md); border: 2.5px solid var(--edge);
  background: linear-gradient(to bottom, var(--ui-sky) 0 86%, var(--ui-grass) 86%);
}
.cust-stage { height: clamp(250px, calc(100dvh - 370px), 430px); isolation: isolate; }
/* the customizer preview's backdrop (round 33): the RPS meadow (its small copy cust-backdrop.webp, round 37), softly blurred, desaturated and veiled in the panel
   color, so the character stays the focus (the veil follows the theme: cream in light, espresso in dark) */
.cust-stage::before {
  content: ''; position: absolute; inset: -16px; z-index: -1; pointer-events: none;
  background: linear-gradient(color-mix(in srgb, var(--ui-cream) 38%, transparent), color-mix(in srgb, var(--ui-cream) 38%, transparent)),
    url('/assets/cust-backdrop.webp') 50% 72% / cover no-repeat;
  filter: blur(6px) saturate(.6);
}
:root[data-theme="dark"] .cust-stage::before {
  background: linear-gradient(color-mix(in srgb, var(--ui-cream) 58%, transparent), color-mix(in srgb, var(--ui-cream) 58%, transparent)),
    url('/assets/cust-backdrop.webp') 50% 72% / cover no-repeat;
  filter: blur(6px) saturate(.5) brightness(.8);
}
.cust-rig, .prof-rig { position: absolute; inset: 4px 0 0; }
.cust-rig svg, .prof-rig svg { width: 100%; height: 100%; display: block; overflow: visible; }
.cust-slots { position: absolute; inset: 0; pointer-events: none; }
/* one side of a slot: the arrow centered on the slot's height (--y, set by app.js from the rig), its caption under it */
.cust-side {
  position: absolute; top: var(--y, 50%); width: clamp(70px, 24%, 128px); display: flex; flex-direction: column; align-items: center; gap: 3px;
  transform: translateY(-21px); pointer-events: none; transition: top .25s ease;
}
/* the shoes sit at the bottom edge: their caption goes above the arrow */
.cust-side[data-row="feet"] { transform: translateY(calc(-100% + 21px)); }
.cust-side[data-row="feet"] .cust-cap { order: -1; }
.cust-side.l { left: max(4px, calc(50% - 205px)); }
.cust-side.r { right: max(4px, calc(50% - 205px)); }
.cust-side.l { align-items: flex-start; }
.cust-side.r { align-items: flex-end; }   /* a long name grows inward, never off the stage */
.cust-arrow {
  width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border-radius: 50%; pointer-events: auto;
  background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); box-shadow: var(--ledge-sm);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.cust-arrow svg { width: 24px; height: 24px; pointer-events: none; }
.cust-arrow:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 4px 0 var(--ledge-c); }
.cust-arrow:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ledge-c); }
.cust-cap {
  padding: 1px 8px 2px; border-radius: 10px; text-align: center; line-height: 1.2; white-space: nowrap; pointer-events: none;
  background: var(--cream-glass); border: 1.5px solid var(--ink-soft); color: var(--ui-ink); font: 600 13px/1.2 var(--font-display);
}
.cust-cap.slot { font: 700 11px/1.3 var(--font-body); color: var(--ui-ink-2); text-transform: uppercase; letter-spacing: .06em; }
.cust-cap.bump { animation: cap-bump .3s ease; }
@keyframes cap-bump { 40% { transform: scale(1.08); } }
.cust-name label { margin: 0 0 4px; }
.cust-name .acct { margin: 0; font-size: 15px; font-weight: 700; color: var(--ui-ink-2); }
.cust-name .acct b { color: var(--ui-ink); font-family: var(--font-display); font-size: 18px; }
.cust-name .note { margin-top: 4px; font-size: 13px; }
.cust-name .nick-row { display: flex; gap: 8px; align-items: center; }
.cust-name .nick-row input { flex: 1; min-width: 0; margin: 0; }
.customizer #custErr { margin: 0; }
.customizer .modal-foot .btn { min-width: 170px; }

/* ---------- profile: name + key stats, their character big next to their most played games, the rest below ---------- */
.profile-dialog { width: min(640px, calc(100vw - 24px)); }
.profile-dialog .modal-head h2 { flex-wrap: wrap; gap: 4px 6px; }
.profile-dialog .modal-body { padding-top: 12px; }
.profile-dialog h3 { font-size: 18px; margin: 20px 0 8px; }
.profile-name { display: flex; align-items: center; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat-grid div { display: grid; justify-items: center; align-content: center; padding: 8px 4px; border-radius: var(--r-sm); background: var(--ui-cream-2); border: 2px solid var(--edge); }
.stat-grid b { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1; }
.stat-grid span { font-size: 12px; color: var(--ui-ink-2); text-align: center; font-weight: 700; line-height: 1.2; }
.prof-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; align-items: stretch; }
.prof-stage { height: 250px; }
#profCustomize { flex: none; white-space: nowrap; }
.prof-top { display: grid; align-content: start; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--ui-cream-2); border: 2px solid var(--edge); }
.prof-top h3 { margin: 0 !important; font-size: 17px; }
.prof-top .empty { font-size: 14px; margin: 0; }
.top-game { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: baseline; }
.top-game b { font: 600 16px/1.2 var(--font-display); min-width: 0; }
.top-game span { font-size: 13px; font-weight: 700; color: var(--ui-ink-2); white-space: nowrap; }
.top-game i { grid-column: 1 / -1; height: 8px; border-radius: 4px; border: 1px solid var(--ink-soft); background: linear-gradient(90deg, var(--ui-player) var(--w), var(--ui-cream) var(--w)); }
.history.compact li { grid-template-columns: 60px 1fr auto; font-size: 14px; }
.history.compact .h-opp { grid-column: 2; }
dialog .summary .row { color: var(--ui-ink-2); }
dialog .summary .row span { flex-shrink: 0; }
dialog .summary .row b { min-width: 0; text-align: right; }   /* a long value wraps instead of running into its label */
.dist { display: grid; gap: 6px; margin: 6px 0 10px; }
.dist-row { display: grid; grid-template-columns: 70px 1fr 42px; align-items: center; gap: 8px; font-size: 14px; }
.dist-row i { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--ui-opponent) var(--w), var(--ui-cream-2) var(--w)); border: 1px solid var(--ink-soft); }
.dist-row b { text-align: right; }
.summary.tells { margin-bottom: 4px; }

/* ---------- match additions (the Scout sheet and the rules card are styled in game-ui.css) ---------- */
.scout-btn {
  border: 2px solid var(--edge); background: var(--ui-cream); border-radius: 999px; padding: 2px 10px; font: 600 12px/1.3 var(--font-display);
  color: var(--ui-opponent); white-space: nowrap; box-shadow: 0 2px 0 var(--ledge-c);
}
.scout-btn:hover, .scout-btn[aria-expanded="true"] { background: var(--ui-opponent); color: var(--ui-on-play); }
/* the sheets' title + Close stay at the top while their content scrolls */
.scout-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -14px -16px 8px; padding: 8px 10px 8px 16px;
  position: sticky; top: -14px; z-index: 2; background: var(--ui-cream); border-bottom: 2px dashed var(--ink-soft);
}
.modal-x.sm { width: 34px; height: 34px; }
.modal-x.sm svg { width: 18px; height: 18px; }
.scout-head h3 { font-size: 18px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .pot-extra, .pot-tok { display: none; }

  .history li { grid-template-columns: 70px 1fr auto; }
  .history .h-opp, .history .h-time { display: none; }
  .main-nav button { padding: 6px 12px; font-size: 16px; }
  .wallet-chip .sub { display: none; }
  .wallet-chip { grid-template-columns: auto auto; }
  .wallet-chip .tok-logo { grid-row: auto; }
}
@media (max-width: 860px) {
  :root { --bar-in: 50px; --bar-h: 66px; }
  .topbar { flex-wrap: wrap; gap: 6px 8px; margin: 6px 8px 4px; padding: 5px 6px 5px 10px; border-radius: 26px; top: 6px; }
  .brand { gap: 6px; }
  .brand-logo { height: 50px; margin: -6px 0; }
  /* the nav takes its own row under the bar's buttons */
  .main-nav { order: 10; flex-basis: 100%; margin: 0 0 2px; justify-content: stretch; }
  .main-nav button { flex: 1; padding: 5px 6px; font-size: 16px; }
  .round-btn, .sound-btn, .help-btn { width: 36px; height: 36px; }
  .round-btn img, .sound-btn img, .help-btn img { width: 24px; height: 24px; }
  .wallet-chip { padding: 2px 10px 2px 3px; column-gap: 5px; }
  .wallet-chip .tok-logo { height: 24px; }
  .wallet-chip .amt { font-size: 15px; }
  .avatar.me-avatar { --size: 34px; }
  .btn-sm { padding: 5px 11px; font-size: 14px; }

  /* landing on phones: the picture on top, the pitch in a card under it */
  .hero { flex-direction: column; align-items: stretch; justify-content: flex-end; min-height: 0; padding: 12px 12px 16px; }




  .hero h1 { font-size: clamp(36px, 11vw, 52px); margin-bottom: 10px; }
  .hero .sub { font-size: 16px; }
  .hero .actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 16px; }
  .hero .actions .btn { padding: 12px 14px; font-size: 19px; }
  .trust { font-size: 13px; margin-top: 12px; }
  .strip, .how { padding: 18px 12px 12px; }


  .site-foot { padding: 14px 16px; margin: 16px 12px 24px; }
  .landing .site-foot { width: auto; }
  .foot-note { margin-left: 0; }

  /* cards on phones: cover on the left, name + hook + Play on the right (art-source/v3/mock-mobile.png) */
  .card-grid { gap: 20px; }










  /* the stake chips on phones: one scrolling row */
  .stakes { display: flex; gap: 6px; overflow-x: auto; position: relative; padding: 2px 2px 5px; scrollbar-width: none; }
  .stakes::-webkit-scrollbar { display: none; }
  .stakes button { flex-shrink: 0; padding: 3px 11px 4px; border-radius: 999px; }
  .stakes button b { font-size: 16px; }
  .stakes button small { font-size: 10px; }

  .ss-main { font-size: 26px; }
  .ss-win b { font-size: 16px; }
  .warn { grid-column: 1 / -1; margin: 0; }
  .demo-balance { margin: 0; padding: 5px 6px; }
  .demo-balance img { width: 26px; height: 26px; }
  .demo-balance b { font-size: 17px; }




  .board { padding: 10px 10px 40px; }
  .board-card { padding: 10px 8px 12px; }
  .b-row { grid-template-columns: 26px 28px 34px minmax(0, 1fr) 46px; gap: 7px; padding: 8px 4px; }
  .b-row .avatar { --size: 34px; }
  .b-row .place { font-size: 15px; }
  .b-row .b-matches { display: none; }
  .b-rate { font-size: 17px; }
  .rank-badge.big { width: 24px; height: 32px; }
  .rank-badge.big b { font-size: 13px; }
  .rank-space { width: 24px; }
  .b-name b { font-size: 15px; }
  .b-name .team-badge { font-size: 11px; padding: 0 7px; }

  dialog { padding: 18px 16px; }
  dialog h2 { font-size: 24px; }
  .modal-head { min-height: 56px; padding: 8px 10px 8px 16px; }
  .modal-head h2 { font-size: 22px; }
  .modal-x { width: 38px; height: 38px; }
  .modal-body { padding: 14px 16px 18px; }
  .modal-foot { padding: 10px 16px 12px; }
  .customizer .modal-body { gap: 10px; padding-top: 12px; }
  .species-toggle button { font-size: 17px; }
  .species-toggle .avatar { --size: 30px; }
  .cust-stage { height: clamp(220px, calc(100dvh - 345px), 400px); }
  .cust-side { width: 72px; }
  .cust-arrow { width: 40px; height: 40px; }
  .cust-cap { font-size: 11.5px; padding: 1px 5px 2px; }
  .cust-cap.slot { font-size: 10px; }
  .customizer .modal-foot .btn { flex: 1; }
  .stat-grid { gap: 6px; }
  .stat-grid div { padding: 6px 2px; }
  .stat-grid b { font-size: 21px; }
  .stat-grid span { font-size: 11px; }
  .prof-hero { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 8px; margin-top: 8px; }
  .prof-stage { height: 200px; }
  .prof-top { padding: 8px 10px; gap: 6px; }
  .prof-top h3 { font-size: 15px; }
  .top-game b { font-size: 14px; }
  .top-game span { font-size: 12px; }
  .history { padding: 2px 12px; }
  .history li { grid-template-columns: 60px 1fr auto; gap: 10px; }
  .history .h-opp { display: block; grid-column: 2; grid-row: 2; font-size: 13px; }
  .history .h-time { display: block; grid-column: 3; grid-row: 2; font-size: 13px; }
  .history .h-game { min-width: 0; }
  .history .pill { grid-row: span 2; }

  .history.compact { padding: 0; }
  #dlgResult .btn { padding: 11px 6px; font-size: 17px; }

  .pot-extra { display: none; }

  .scout-btn { padding: 2px 7px; font-size: 11px; }
}
/* short phones: the controls and hint must fit without scrolling */
@media (max-width: 860px) and (max-height: 760px) {
  :root { --bar-h: 60px; --bar-in: 46px; }
  .topbar { padding-top: 3px; padding-bottom: 3px; }

  .hero h1 { font-size: 34px; }
  .hero .sub { font-size: 15px; }
}
@media (max-width: 400px) {
  /* one row of buttons on a 360 px phone (+ the nav row under it) */
  .topbar { gap: 5px 3px; padding-left: 8px; padding-right: 6px; margin-inline: 6px; }
  .wallet-chip { padding-right: 8px; }
  .brand:has(~ .wallet-chip:not(.hidden)) .brand-logo { height: 46px; margin: -5px 0; }
  .avatar.me-avatar { --size: 32px; }
  .modal-head h2 { font-size: 20px; }
  #dlgResult .btn { font-size: 16px; white-space: nowrap; }



}
/* very narrow bars: a slightly smaller logo, and no room for the admin-only online chip */
@media (max-width: 380px) {
  .brand .brand-logo, .brand:has(~ .wallet-chip:not(.hidden)) .brand-logo { height: 40px; margin: -3px 0; }
}
/* ---------- challenge a friend: the dialog (#dlgChallenge) and the card a friend sees (#dlgChallengeCard) ---------- */
.ch-open { margin-top: 10px; }
[data-challenge] { position: relative; }
[data-challenge][data-news]:not([data-news=""])::after {
  content: attr(data-news); position: absolute; top: -7px; right: -5px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; font: 700 13px/1 var(--font-display); background: var(--ui-play); color: var(--ui-on-play); border: 2px solid var(--edge);
}
.ch-h { margin: 14px 0 0; font: 600 18px/1.2 var(--font-display); color: var(--ui-ink); }
#chForm .ch-h:first-of-type { margin-top: 0; }
.ch-for { margin-top: 0; font-weight: 700; color: var(--ui-ink); }
/* the game picker: small cover cards, picked = lit frame + check, not picked = dimmed (the card designs: arcade.css) */
.ch-ghead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ch-games { margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.ch-gpick { position: relative; display: grid; gap: 6px; padding: 6px 6px 8px; border-radius: 14px; text-align: left; cursor: pointer;
  background: var(--ui-cream-2); color: var(--ui-ink); border: 2px solid var(--ui-line); transition: border-color .15s, opacity .15s, transform .15s; }
.ch-gpick b { font: 600 15px/1.15 var(--font-display); padding: 0 2px; }
.ch-gcover { display: block; aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; background: var(--ui-cream); }
.ch-gcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-gcheck { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ui-player); border: 2px solid var(--ui-cream); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.ch-gcheck svg { width: 16px; height: 16px; fill: none; stroke: var(--ui-cream); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-gpick[aria-pressed="true"] { border-color: var(--ui-player); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-player) 28%, transparent); }
.ch-gpick[aria-pressed="true"] .ch-gcheck { opacity: 1; transform: none; }
.ch-gpick[aria-pressed="false"] { opacity: .55; }
.ch-gpick[aria-pressed="false"] .ch-gcover { filter: grayscale(.7); }
.ch-gpick:hover { border-color: color-mix(in srgb, var(--ui-player) 60%, var(--ui-line)); }
.ch-gpick:focus-visible { outline: 3px solid var(--ui-player); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ch-gpick, .ch-gcheck { transition: none; } }
.ch-latest { margin: 0 0 16px; padding: 10px 12px 12px; border-radius: 14px; background: var(--ui-cream-2); border: 2px solid var(--ui-line); }
.ch-latest .ch-h { margin: 0 0 8px; font-size: 16px; }
.ch-stakes { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 8px; }
.ch-stakes button:disabled { opacity: .5; cursor: not-allowed; }
.ch-sum { margin: 10px 0 0; }
.ch-sum .ss-main { font-size: 28px; }
.ch-as { margin-top: 12px; }
.ch-ready { margin: 0 0 10px; color: var(--ui-ink); font-size: 16px; }
.ch-link { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.ch-link input { flex: 1; min-width: 0; margin: 0; font: 600 15px/1.2 var(--font-body); }
.ch-share { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-share a { text-decoration: none; }
.ch-item { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 0 !important;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--ui-cream-2); border: 2px solid var(--edge); }
.ch-item .pill { border-radius: 999px; text-align: center; padding: 2px 0; font: 600 13px/1.3 var(--font-display); color: var(--ui-ink); border: 2px solid var(--edge); background: var(--ui-cream); }
.ch-item.st-accepted .pill { background: var(--ui-win); color: var(--ui-on-play); }
.ch-item.st-cancelled, .ch-item.st-expired, .ch-item.st-started { opacity: .7; }
.ch-what { display: grid; min-width: 0; }
.ch-what b { font: 600 16px/1.2 var(--font-display); color: var(--ui-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-what small { font-size: 13px; font-weight: 700; color: var(--ui-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ch-acts .rules-link { margin: 0; }
#dlgChallenge .modal-foot, #dlgChallengeCard .modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
#dlgChallengeCard .modal-foot .rules-link { margin-right: auto; }
.cc-hero { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: 14px; align-items: center; }
.cc-stage { height: 230px; border-radius: var(--r-md); background: var(--ui-cream-2); border: 2px solid var(--edge); overflow: hidden; }
.cc-rig, .cc-rig svg { width: 100%; height: 100%; display: block; }
.cc-kicker { margin: 0; font-size: 13px; font-weight: 700; color: var(--ui-ink-2); text-transform: uppercase; letter-spacing: .04em; }
.cc-name { margin: 0 0 8px; font: 700 28px/1.1 var(--font-display); color: var(--ui-ink); overflow-wrap: anywhere; }
.cc-games { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-game { display: grid; gap: 3px; width: 96px; }
.cc-game b { font: 600 14px/1.15 var(--font-display); color: var(--ui-ink); }
.cc-cover { display: block; width: 96px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 2px solid var(--edge); background: var(--ui-cream-2); }
.cc-pick { margin-top: 6px; font-size: 13px; }
.cc-msg { margin: 14px 0 0; color: var(--ui-ink); font-size: 16px; }
.cc-wait { display: flex; gap: 10px; align-items: center; }
.cc-spin { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink-soft); border-top-color: var(--ui-play); animation: ccSpin 0.9s linear infinite; }
@keyframes ccSpin { to { transform: rotate(360deg); } }
.cc-me { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 14px; padding: 10px; border-radius: var(--r-sm); background: var(--ui-cream-2); border: 2px solid var(--edge); }
.cc-me label { margin-top: 0; }
.cc-me input { margin: 0; }
.cc-me-head .avatar { width: 46px; height: 46px; }
.prof-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
@media (max-width: 560px) {
  .ch-stakes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-item { grid-template-columns: 78px minmax(0, 1fr); }
  .ch-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .cc-hero { grid-template-columns: minmax(0, 38%) minmax(0, 1fr); gap: 10px; }
  .cc-stage { height: 180px; }
  .cc-name { font-size: 22px; }
  .cc-game, .cc-cover { width: 76px; }
  .cc-me { grid-template-columns: auto minmax(0, 1fr); }
  .cc-me .btn { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .game-card:hover, .btn:hover:not(:disabled), .round-btn:hover { transform: none; }
}
