/* Degen Protocol design system. Server-rendered pages, no
   inline styles (the Content-Security-Policy forbids them). Two faces:
   public (green baize, brass; dark first, with a light theme) and admin
   (red baize, gold; dark only). */

/* ---------- fonts ---------- */
/* Self-hosted latin subsets of @fontsource 5.3.0 (SIL OFL 1.1; licences in
   /static/fonts/). Text shows in the fallback stack until a face loads. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }

/* ---------- tokens ---------- */
:root {
  --hl-k: #e5b567; --hl-s: #9fd59a; --hl-n: #f0a07a; --hl-b: #c99ae6; --hl-c: #7d978b; --hl-f: #7cc3e6; --hl-p: #9fb5aa;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem; --fs-sm: 0.875rem; --fs-md: 1rem; --fs-lg: 1.25rem; --fs-xl: 1.75rem; --fs-2xl: 2.5rem;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;
  --gap: 1rem;
  --ease: cubic-bezier(.2, .8, .2, 1); --t-fast: 120ms; --t-med: 240ms; --t-slow: 480ms;

  /* Public, dark (the default). */
  --bg: #07130e; --bg-2: #0b1c15; --surface: #10261d; --surface-2: #163226; --line: #23443a;
  --baize-base: #113a2b;
  --baize: radial-gradient(120% 140% at 50% 0%, #1d5c43 0%, #113a2b 55%, #0a2219 100%);
  --rail: #3b2a17;
  --ink: #e8f1ec; --muted: #9db5a8; --link: #e3bf7d;
  --accent: #d9b16c; --accent-ink: #1a1408;
  --glow: 0 0 0 1px rgba(217, 177, 108, .35), 0 10px 40px -10px rgba(217, 177, 108, .35);
  --topbar: rgba(7, 19, 14, .9);
  /* Status colours: one meaning each, on both faces. */
  --live: #34d399; --live-bg: rgba(52, 211, 153, .12);
  --wait: #fbbf24; --wait-bg: rgba(251, 191, 36, .12);
  --done: #a9b6c6; --done-bg: rgba(148, 163, 184, .14);
  --lose: #fb8f8f; --lose-bg: rgba(248, 113, 113, .14);
  --win: #4ade80; --win-bg: rgba(74, 222, 128, .14);
  --info: #7cb4fb; --info-bg: rgba(96, 165, 250, .14);
  --gold: #e8c15a; --silver: #c3ccd6; --bronze: #d99a6c;
  color-scheme: dark;
}
/* Public, light: from the system scheme unless a theme was chosen. */
@media (prefers-color-scheme: light) {
  :root.face-public:not([data-theme="dark"]) {
    --bg: #f4f1e8; --bg-2: #ece7da; --surface: #fffdf7; --surface-2: #f3eee2; --line: #d9d1be;
    --baize-base: #1d5c43;
    --rail: #6b4a26;
    --ink: #14201a; --muted: #4f5d55; --link: #7a5410;
    --accent: #c99a45; --accent-ink: #1a1408;
    --glow: 0 0 0 1px rgba(160, 120, 40, .35), 0 10px 30px -12px rgba(60, 40, 10, .35);
    --topbar: rgba(244, 241, 232, .92);
    --live: #08643f; --live-bg: rgba(16, 140, 90, .12);
    --wait: #8a5a00; --wait-bg: rgba(200, 140, 0, .14);
    --done: #4b5563; --done-bg: rgba(100, 116, 139, .14);
    --lose: #b42323; --lose-bg: rgba(220, 38, 38, .1);
    --win: #0f6630; --win-bg: rgba(22, 163, 74, .12);
    --info: #1d5fbf; --info-bg: rgba(37, 99, 235, .1);
    --gold: #8a5f12; --silver: #56616c; --bronze: #87502a;
    --hl-k: #8a5a00; --hl-s: #1f6b2a; --hl-n: #a6481b; --hl-b: #6d3fa6; --hl-c: #55635b; --hl-f: #1d5fbf; --hl-p: #4f5d55;
    color-scheme: light;
  }
}
:root.face-public[data-theme="light"] {
  --bg: #f4f1e8; --bg-2: #ece7da; --surface: #fffdf7; --surface-2: #f3eee2; --line: #d9d1be;
  --baize-base: #1d5c43;
  --rail: #6b4a26;
  --ink: #14201a; --muted: #4f5d55; --link: #7a5410;
  --accent: #c99a45; --accent-ink: #1a1408;
  --glow: 0 0 0 1px rgba(160, 120, 40, .35), 0 10px 30px -12px rgba(60, 40, 10, .35);
  --topbar: rgba(244, 241, 232, .92);
  --live: #08643f; --live-bg: rgba(16, 140, 90, .12);
  --wait: #8a5a00; --wait-bg: rgba(200, 140, 0, .14);
  --done: #4b5563; --done-bg: rgba(100, 116, 139, .14);
  --lose: #b42323; --lose-bg: rgba(220, 38, 38, .1);
  --win: #0f6630; --win-bg: rgba(22, 163, 74, .12);
  --info: #1d5fbf; --info-bg: rgba(37, 99, 235, .1);
  --gold: #8a5f12; --silver: #56616c; --bronze: #87502a;
  --hl-k: #8a5a00; --hl-s: #1f6b2a; --hl-n: #a6481b; --hl-b: #6d3fa6; --hl-c: #55635b; --hl-f: #1d5fbf; --hl-p: #4f5d55;
  color-scheme: light;
}
/* Admin: red baize, gold. Dark only. */
:root.face-admin {
  --bg: #12080a; --bg-2: #1a0b0e; --surface: #241014; --surface-2: #30161b; --line: #4a2228;
  --baize-base: #4e1019;
  --baize: radial-gradient(120% 140% at 50% 0%, #7a1d2a 0%, #4e1019 55%, #2a080d 100%);
  --rail: #2a1a0c;
  --ink: #f6ece6; --muted: #cdb0aa; --link: #f1d78e;
  --accent: #e8c15a; --accent-ink: #1f1604;
  --glow: 0 0 0 1px rgba(232, 193, 90, .4), 0 10px 40px -10px rgba(232, 193, 90, .35);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-md)/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 0; }
h3 { font-weight: 600; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: 1.05rem; }
p { margin: .5rem 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: var(--font-mono); font-size: .88em; overflow-wrap: anywhere; }
pre { font-family: var(--font-mono); font-size: var(--fs-sm); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem; overflow-x: auto; margin: .75rem 0; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; top: .5rem; z-index: 20; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; border-radius: var(--r-pill); }
.skip:focus { left: .5rem; }
.muted { color: var(--muted); }

/* ---------- public shell ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem; padding: .7rem 2rem;
  background: var(--topbar); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .6rem; font: 700 1.2rem var(--font-display); color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; gap: .25rem; flex: 1; min-width: 0; }
.nav a { color: var(--muted); padding: .45rem .85rem; border-radius: var(--r-pill); font-weight: 500; font-size: var(--fs-sm); white-space: nowrap;
  transition: background-color var(--t-fast), color var(--t-fast); }
.nav a:hover { text-decoration: none; color: var(--ink); background: var(--surface); }
.nav a.active { color: var(--accent-ink); background: var(--accent); }
.theme-switch { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 500 var(--fs-sm) var(--font-ui); cursor: pointer; transition: border-color var(--t-fast); }
.theme-switch:hover { border-color: var(--accent); }
.theme-icon { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: inset -4px -2px 0 0 var(--surface); transition: box-shadow var(--t-med) var(--ease); }
.theme-switch[data-current="light"] .theme-icon { box-shadow: inset 0 0 0 3px var(--surface); }
.page { max-width: 1240px; margin: 0 auto; padding: 2rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head .lead { color: var(--muted); margin: .35rem 0 0; overflow-wrap: anywhere; }
footer.site { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--muted); font-size: var(--fs-sm); padding: 2.5rem 1rem; border-top: 1px solid var(--line); margin-top: 2rem; }
footer.site img { border-radius: 5px; }
footer.site a { color: var(--muted); margin-left: .75rem; }
footer.site a:hover { color: var(--ink); }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem 1.4rem; margin: 0 0 1.25rem; }
.panel > h2 { margin-bottom: .75rem; }
.panel > h3 { margin: 1.25rem 0 .5rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.grid { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.baize { background-color: var(--baize-base); background-image: var(--baize); color: #f1f6f2; border: 1px solid var(--line); border-radius: var(--r-lg); }
.empty { color: var(--muted); padding: 1rem; border: 1px dashed var(--line); border-radius: var(--r-md); text-align: center; margin: .5rem 0; }
.note { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- pills and figures ---------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-xs); font-weight: 600; padding: .2rem .6rem; border-radius: var(--r-pill); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--live-bg); color: var(--live); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.done { background: var(--done-bg); color: var(--done); }
.pill.lose { background: var(--lose-bg); color: var(--lose); }
.pill.win { background: var(--win-bg); color: var(--win); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem 1rem; }
.stat .k { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font: 700 var(--fs-xl) var(--font-display); }
.stat .d { margin-top: .15rem; font-size: var(--fs-xs); color: var(--muted); }
.stat .d:empty { display: none; }
#stats h3 { margin: 1.25rem 0 .4rem; font-size: var(--fs-sm); }
#stats .stat .v { font-size: var(--fs-lg); }
/* Inside a panel, figures sit on the panel itself: no box within a box. */
.panel .stats { gap: 0; row-gap: .75rem; }
.panel .stat { background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: .1rem 1rem; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--win); }
.neg { color: var(--lose); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0; }
.panel > .table-wrap { margin: 0 -.25rem; }
.table-wrap th, .table-wrap td { white-space: nowrap; }
.table-wrap td code { overflow-wrap: normal; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; padding: .55rem .75rem; border-bottom: 1px solid var(--line); }
td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background-color var(--t-fast); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }

/* ---------- lists ---------- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.tile { display: flex; align-items: center; gap: .9rem; padding: .75rem 1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  transition: border-color var(--t-fast), transform var(--t-fast) var(--ease); }
.arrived > .tile { animation: enter var(--t-slow) var(--ease) both; border-color: var(--accent); }
a.tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.tile .what { flex: 1; min-width: 0; }
.tile .what b { display: block; font-weight: 600; }
.tile .what span { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
/* Inside a panel, tiles are rows of a list, not boxes. */
.panel .tiles { gap: 0; }
.panel .tile { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .7rem .25rem; }
.panel .tiles li:last-child .tile { border-bottom: 0; }
.panel a.tile:hover { transform: none; background: var(--surface-2); }
dl { margin: .5rem 0; }
dl dt { font-weight: 600; margin-top: .9rem; color: var(--muted); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; }
dl dd { margin: .25rem 0 0; }
ol.steps { padding-left: 1.4rem; }
ol.steps li { margin: .4rem 0; }
ol.hashes { padding-left: 1.5rem; margin: .25rem 0; font-size: var(--fs-sm); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.1rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 var(--fs-sm) var(--font-ui); cursor: pointer; transition: transform var(--t-fast) var(--ease), box-shadow var(--t-med), border-color var(--t-fast); }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--glow); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.baize .btn:not(.primary) { background: rgba(0, 0, 0, .35); color: #f1f6f2; border-color: rgba(255, 255, 255, .18); }

/* ---------- home ---------- */
.hero { position: relative; overflow: hidden; padding: 2.5rem; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2rem; align-items: center; margin-bottom: 1rem; }
.hero::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 6px); pointer-events: none; }
.hero h1 { font-size: var(--fs-2xl); line-height: 1.08; }
.hero p { color: #c9dbd1; max-width: 40ch; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; position: relative; z-index: 1; }
.hero .stats { position: relative; z-index: 1; }
.hero .stat { background: rgba(0, 0, 0, .3); border-color: rgba(255, 255, 255, .1); }
.hero .stat .k { color: #c9dbd1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; background: currentColor; }
.dot.live { background: #34d399; animation: pulse-live 1.6s infinite; }
.dot.wait { background: #fbbf24; }
.dot.done { background: #a9b6c6; }
@keyframes pulse-live { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }
.bump { animation: bump var(--t-slow) var(--ease); }
@keyframes bump { 30% { transform: scale(1.18); color: var(--accent); } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2.25rem 0 1rem; }
.section-head a { font-size: var(--fs-sm); }
.game { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med), border-color var(--t-med); }
.game:hover { transform: translateY(-3px); box-shadow: var(--glow); border-color: var(--accent); }
.game-art { height: 132px; background-color: var(--baize-base); background-image: var(--baize); display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.game-art svg { width: 160px; height: 90px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); transition: transform var(--t-med) var(--ease); }
.game:hover .game-art svg { transform: scale(1.06) rotate(-1deg); }
.game-body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.game-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.live-n { font-size: var(--fs-xs); font-weight: 600; color: var(--live); background: var(--live-bg); padding: .2rem .6rem; border-radius: var(--r-pill); white-space: nowrap; }
.live-n:empty, .preset .n:empty { display: none; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.presets { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.preset { font-size: var(--fs-xs); padding: .3rem .7rem; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.preset .n { color: var(--wait); font-weight: 600; margin-left: .4rem; }
.game .more { margin-top: auto; font-size: var(--fs-sm); font-weight: 600; }
.game { position: relative; }
.game h3 a.stretch { color: inherit; text-decoration: none; }
.game h3 a.stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.game h3 a.stretch:focus-visible { outline: none; }
.game:has(a.stretch:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.game a.more, .game .preset a, .game .leaders a { position: relative; z-index: 2; }

.home-lists { align-items: start; }
.home-lists .tiles + .tiles { margin-top: .5rem; }
.tiles:empty { display: none; }
.tile .side { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.tile .side .mono { color: var(--ink); }

/* ---------- live table (match page) ---------- */
.live-view { background: var(--bg-2); border: 1px solid var(--line); padding: .75rem; border-radius: var(--r-md); overflow-x: auto; min-height: 3rem; font-size: var(--fs-sm); margin: 0; }
.live-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
/* Replays and live tables keep a table's proportions on wide screens. */
#live, #replay { max-width: 78rem; }
/* Full screen: the table fills the screen's height too. */
.replay:fullscreen { max-width: none; height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; padding: 1.25rem 2rem; border-radius: 0; background: var(--bg); }
.replay:fullscreen .live-grid { flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(0, 3fr) minmax(16rem, 1fr); align-items: stretch; }
.replay:fullscreen .table-box { height: 100%; min-height: 0; }
.replay:fullscreen .table-box .table-baize { height: 100%; box-sizing: border-box; font-size: 1.2rem; }
.replay:fullscreen .feed-box { display: flex; flex-direction: column; min-height: 0; }
.replay:fullscreen .feed { max-height: none; flex: 1; }
.replay:fullscreen .player { flex: none; }
.panel-head [data-fullscreen] { margin-left: auto; }
.table-baize { position: relative; border-radius: 140px / 110px; background-color: var(--baize-base); background-image: var(--baize); border: 10px solid var(--rail);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .55), 0 24px 50px -24px rgba(0, 0, 0, .7); padding: 1.5rem 2rem; min-height: 340px;
  display: grid; grid-template-rows: auto 1fr auto; gap: 1rem; align-items: center; color: #f1f6f2; }
.table-baize.idle { place-items: center; text-align: center; color: #c9dbd1; }
.rail { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.center { display: grid; place-items: center; text-align: center; gap: .4rem; }
.pot, .bid, .round { display: grid; justify-items: center; gap: .35rem; }
.center .note, .table-baize .note { color: #c9dbd1; }
.seat { display: inline-flex; align-items: center; gap: .7rem; padding: .5rem .9rem .5rem .5rem; border-radius: var(--r-pill); background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(255, 255, 255, .1); transition: box-shadow var(--t-med), opacity var(--t-med), transform var(--t-med) var(--ease); }
.seat .who { display: flex; flex-direction: column; line-height: 1.2; }
.seat .who b { font-weight: 600; }
.seat .state { font-size: var(--fs-xs); color: #e3bf7d; }
.seat .id { font: 400 .68rem var(--font-mono); color: #c9dbd1; }
.seat.to-act { box-shadow: 0 0 0 2px #fbbf24, 0 0 28px rgba(251, 191, 36, .35); transform: translateY(-2px); }
.seat.ready { box-shadow: 0 0 0 2px #34d399; }
.seat.out { opacity: .45; }
.seat.lost { animation: shake var(--t-slow) var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.ring { --p: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(#fbbf24 calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0); display: none; }
.seat.timed .ring { display: grid; }
.seat:not(.timed) { padding-left: .9rem; }
.seat.urgent .ring { background: conic-gradient(#f87171 calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0); }
.ring-v { width: 27px; height: 27px; border-radius: 50%; background: #0a2219; display: grid; place-items: center; font: 600 .62rem var(--font-mono); color: #f1f6f2; }
.card { width: 34px; height: 48px; border-radius: 5px; display: grid; place-items: center; font: 700 1.05rem var(--font-display); box-shadow: 0 4px 10px rgba(0, 0, 0, .4); }
.card.face { background: #fbf7ee; color: #14201a; }
.card.face.red { color: #b4232f; }
.card.back { background: repeating-linear-gradient(45deg, #8a1f2b 0 5px, #a3293a 5px 10px); box-shadow: inset 0 0 0 2px #fbf7ee, 0 4px 10px rgba(0, 0, 0, .4); }
.card.flip { animation: flip var(--t-slow) var(--ease); }
@keyframes flip { from { transform: rotateY(90deg); } }
.pot .chips { display: flex; justify-content: center; gap: 3px; min-height: 22px; }
.pot .chips i { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle, #d9b16c 42%, #8a6a2c 43% 58%, #d9b16c 59%); box-shadow: 0 3px 6px rgba(0, 0, 0, .4); animation: enter var(--t-med) var(--ease) both; }
.pot b { font: 700 var(--fs-lg) var(--font-display); }
.die { width: 22px; height: 22px; border-radius: 5px; background: #fbf7ee; display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 3px; box-shadow: 0 2px 5px rgba(0, 0, 0, .35); vertical-align: middle; }
.die i { width: 4px; height: 4px; border-radius: 50%; background: #14201a; place-self: center; }
.die .p1 { grid-area: 1 / 1; } .die .p3 { grid-area: 1 / 3; } .die .p4 { grid-area: 2 / 1; } .die .p5 { grid-area: 2 / 2; }
.die .p6 { grid-area: 2 / 3; } .die .p7 { grid-area: 3 / 1; } .die .p9 { grid-area: 3 / 3; }
.die.hidden { width: 14px; height: 14px; padding: 0; background: #3b2a17; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.die.big { width: 40px; height: 40px; padding: 6px; border-radius: 8px; }
.die.big i { width: 7px; height: 7px; }
.die.match { box-shadow: 0 0 0 2px #fbbf24; }
.cup { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 54px; }
.bid .k, .reveal .k { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: #c9dbd1; }
.bid-line { display: flex; align-items: center; gap: .5rem; }
.bid-line .qty { font: 700 var(--fs-xl) var(--font-display); }
.reveal { margin-top: .6rem; padding: .6rem .8rem; border-radius: var(--r-md); background: rgba(0, 0, 0, .3); display: grid; gap: .4rem; }
.reveal-rows { display: grid; gap: .3rem; }
.reveal-row { display: flex; align-items: center; gap: .3rem; font-size: var(--fs-xs); }
.reveal-row .who { width: 3.5rem; text-align: left; color: #c9dbd1; }
.reveal-row.loser .who { color: #fca5a5; font-weight: 600; }
.score { display: inline-flex; gap: 4px; }
.score i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #e3bf7d; }
.score i.won { background: #e3bf7d; }
.round .hands { display: flex; align-items: center; gap: 1rem; padding: .25rem .5rem; }
.hand { display: grid; justify-items: center; gap: .2rem; opacity: .7; transition: transform var(--t-med) var(--ease); }
.hand svg { width: 56px; height: 46px; }
.hand.won { opacity: 1; transform: scale(1.12); }
.round .vs { font: 700 var(--fs-sm) var(--font-display); color: #c9dbd1; }
.round .standing { font: 700 var(--fs-md) var(--font-display); }
.feed-box h3 { margin-bottom: .5rem; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; max-height: 360px; overflow-y: auto; font-size: var(--fs-sm); }
.feed li { display: flex; gap: .6rem; align-items: baseline; padding: .45rem .7rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid transparent; }
.feed li .seq { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); min-width: 2rem; }
.feed li.arrived:first-child { animation: enter var(--t-slow) var(--ease) both; border-color: var(--accent); }
/* ---------- replay player ---------- */
.player { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; margin-top: 1rem; padding: .7rem .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast) var(--ease); }
.iconbtn:hover { border-color: var(--accent); transform: translateY(-1px); }
.iconbtn.play { background: var(--accent); color: var(--accent-ink); border-color: transparent; width: 42px; height: 42px; }
.iconbtn span { display: block; }
.i-play { width: 0; height: 0; border-left: 11px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.playing .i-play { width: 11px; height: 13px; border: 0; margin: 0; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
.i-next, .i-back { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.i-next { border-left: 8px solid currentColor; margin-left: 2px; }
.i-back { border-right: 8px solid currentColor; margin-right: 2px; }
.i-first, .i-last { width: 10px; height: 12px; }
.i-first { border-left: 2px solid currentColor; background: linear-gradient(to left top, transparent 50%, currentColor 50%) right top / 8px 6px no-repeat, linear-gradient(to left bottom, transparent 50%, currentColor 50%) right bottom / 8px 6px no-repeat; }
.i-last { border-right: 2px solid currentColor; background: linear-gradient(to right top, transparent 50%, currentColor 50%) left top / 8px 6px no-repeat, linear-gradient(to right bottom, transparent 50%, currentColor 50%) left bottom / 8px 6px no-repeat; }
.scrub { --fill: 100%; flex: 1 1 10rem; min-width: 8rem; height: 6px; appearance: none; -webkit-appearance: none; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) var(--fill), var(--line) var(--fill)); }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
.scrub::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--accent); }
.player .pos { color: var(--muted); min-width: 3.5rem; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.seg a { color: var(--muted); padding: .3rem .7rem; border-radius: var(--r-pill); font: 600 var(--fs-xs) var(--font-ui); text-decoration: none; }
.seg a[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: .3rem .7rem; border-radius: var(--r-pill); font: 600 var(--fs-xs) var(--font-ui); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.view-pick { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: var(--fs-sm); }
select { font: 500 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .35rem .5rem; }
.seat.viewer { box-shadow: 0 0 0 2px #7cb4fb; }
.die.small { width: 14px; height: 14px; padding: 2px; border-radius: 3px; }
.die.small i { width: 2.5px; height: 2.5px; }
details.raw { margin-top: 1rem; }
details.raw summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); }
details.raw pre { margin-top: .5rem; }


/* ---------- admin console ---------- */
.console { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.console.bare { display: block; }
.console.bare .page { max-width: 30rem; margin: 0 auto; padding-top: 14vh; }
.console.bare .page-head { text-align: center; }
.console.bare .gate { margin-top: 0; }
.sidebar { background: linear-gradient(180deg, #1f0b0f, #12080a); background-color: #1a0b0e; border-right: 1px solid var(--line); padding: 1.1rem .8rem;
  display: flex; flex-direction: column; gap: 1.4rem; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 .5rem; }
.sidenav { display: grid; gap: 1.1rem; }
.navgroup h2 { margin: 0 .6rem .35rem; color: var(--muted); font: 600 .7rem var(--font-ui); letter-spacing: .14em; text-transform: uppercase; }
.navgroup a { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: var(--r-sm); color: var(--ink); font-size: var(--fs-sm); font-weight: 500;
  transition: background-color var(--t-fast); }
.navgroup a:hover { text-decoration: none; background: var(--surface); }
.navgroup a.active { background-color: var(--surface); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.face-admin .page { max-width: none; margin: 0; padding: 1.75rem 2.25rem; }
.gate { max-width: 34rem; margin: 3rem auto; text-align: center; padding: 2.5rem 2rem; }
.gate .seal { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background-color: var(--baize-base); background-image: var(--baize); box-shadow: inset 0 0 0 2px var(--accent), var(--glow); display: grid; place-items: center; }
.gate .seal img { width: 36px; height: 36px; border-radius: 8px; }
.gate h2 { font-size: var(--fs-xl); margin-bottom: .5rem; }
.gate p { color: var(--muted); }

/* ---------- leaderboards and players ---------- */
.lead-note { color: var(--muted); max-width: 70ch; margin: -.5rem 0 1.5rem; }
.h3 { font-size: 1.05rem; }
.board-nav { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; margin-bottom: 1rem; }
.seg-links { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.seg-links a { padding: .35rem .85rem; border-radius: var(--r-pill); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; transition: background-color var(--t-fast), color var(--t-fast); }
.seg-links a:hover { text-decoration: none; color: var(--ink); background: var(--surface-2); }
.seg-links a.active, .seg-links a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.game .seg-links { align-self: flex-start; margin-top: auto; }
.rank { font: 700 var(--fs-md) var(--font-display); color: var(--muted); }
.rank.gold { color: var(--gold); }
.rank.silver { color: var(--silver); }
.rank.bronze { color: var(--bronze); }
.leaders { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; }
.leaders li { display: flex; align-items: center; gap: .6rem; font-size: var(--fs-sm); }
.leaders li a, .leaders li code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaders .rank { width: 1.25rem; }
table.board td { white-space: nowrap; }
.ci { display: inline-flex; align-items: center; gap: .6rem; }
.ci-bar { width: 120px; height: 12px; flex: none; }
.ci-bar .track { fill: var(--line); }
.ci-bar .band { fill: var(--done); opacity: .75; }
.ci-bar .band.pos { fill: var(--win); }
.ci-bar .band.neg { fill: var(--lose); }
.ci-bar .zero { fill: var(--muted); }
.ci-bar .mean { fill: var(--ink); }
th .scale { text-transform: none; letter-spacing: 0; font-weight: 400; }
button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
button.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
th[aria-sort] button.sort { color: var(--ink); }
th[aria-sort="ascending"] button.sort::after { content: "▲"; font-size: .6rem; color: var(--accent); }
th[aria-sort="descending"] button.sort::after { content: "▼"; font-size: .6rem; color: var(--accent); }
.player-stats { margin-bottom: 1.25rem; }

/* ---------- account and sign-in ---------- */
.btn.small { padding: .35rem .8rem; font-size: var(--fs-xs); }
.btn.gold { background: linear-gradient(180deg, #f1d78e, #e0b54a); background-color: #e8c15a; color: #1f1604; border-color: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.account-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: var(--fs-sm); }
.account-chip:hover { text-decoration: none; border-color: var(--accent); }
.wallet-status { flex-basis: 100%; margin: 0; text-align: right; color: var(--muted); font-size: var(--fs-sm); }
/* In the top bar: a notice floating under it, never moving the bar. */
.topbar > .wallet-status { position: absolute; top: calc(100% + .6rem); right: 1rem; flex-basis: auto; max-width: min(30rem, calc(100vw - 2rem)); padding: .75rem 1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--accent); color: var(--ink); text-align: left; box-shadow: 0 10px 30px rgba(0,0,0,.35); cursor: pointer; }
.gate .wallet-status, .gate [data-wallet-status] { text-align: center; }
.wallet-menu { position: fixed; z-index: 40; display: grid; gap: .25rem; padding: .4rem; min-width: 14rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .6); }
.wallet-menu button { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: 500 var(--fs-sm) var(--font-ui); cursor: pointer; text-align: left; }
.wallet-menu button:hover, .wallet-menu button:focus-visible { background: var(--surface-2); }
.wallet-menu img { width: 22px; height: 22px; border-radius: 5px; }
.key-reveal { margin: .75rem 0; padding: 1rem; border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--surface-2); }
.key-reveal pre { overflow-wrap: anywhere; white-space: pre-wrap; }
.key-reveal .btn { margin-right: .5rem; }
.btn.danger { border-color: var(--lose); color: var(--lose); background: transparent; }
dl.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem 1.5rem; margin: 0; }
dl.facts dt { margin-top: 0; }
dl.facts dd { overflow-wrap: anywhere; }
.who-admin { margin-top: auto; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .7rem; border-radius: var(--r-md); background: var(--surface); font-size: var(--fs-sm); }
.who-admin .av { width: 30px; height: 30px; border-radius: 50%; flex: none; background-color: var(--baize-base); background-image: var(--baize); box-shadow: inset 0 0 0 1px var(--accent); }
.who-admin div { display: grid; min-width: 0; }
.who-admin div span { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- developers ---------- */
ol.steps.cards { list-style: none; padding: 0; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; }
ol.steps.cards li { counter-increment: step; margin: 0; padding: .9rem 1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: .3rem; align-content: start; }
ol.steps.cards li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 700 var(--fs-sm) var(--font-display); }
ol.steps.cards li span { color: var(--muted); font-size: var(--fs-sm); }
.copy-wrap { position: relative; }
.copy-wrap pre { padding-right: 5.5rem; }
button.copy { position: absolute; top: .5rem; right: .5rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-pill); padding: .25rem .7rem; font: 600 var(--fs-xs) var(--font-ui); cursor: pointer; }
button.copy:hover { border-color: var(--accent); }
.offscreen { position: fixed; left: -9999px; top: 0; }
.route-search { min-width: min(18rem, 100%); font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: .45rem .9rem; }
.route-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.method { font: 700 var(--fs-xs) var(--font-mono); padding: .15rem .5rem; border-radius: var(--r-sm); letter-spacing: .04em; }
.method.get { background: var(--live-bg); color: var(--live); }
.method.post { background: var(--wait-bg); color: var(--wait); }
.method.delete { background: var(--lose-bg); color: var(--lose); }
.try { margin-top: .6rem; }
.try-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.try-form label { color: var(--muted); font: 400 var(--fs-xs) var(--font-mono); display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; }
.try-form input { font: 400 var(--fs-sm) var(--font-mono); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .3rem .5rem; min-width: 0; flex: 0 1 auto; }
.try-form .btn { padding: .35rem .9rem; }
.try-out, .try-curl { max-height: 22rem; overflow: auto; margin: .5rem 0 0; }
.try-panel { padding: .9rem 0 0; border-top: 1px solid var(--line); }
.try-title { flex-basis: 100%; margin: 0; font: 600 var(--fs-sm) var(--font-ui); color: var(--ink); }
.try-body { flex-basis: 100%; font: 400 var(--fs-sm) var(--font-mono); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .5rem .6rem; resize: vertical; min-width: 0; }
.try-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex-basis: 100%; }
.try-form .confirm { flex-basis: 100%; font: 500 var(--fs-sm) var(--font-ui); color: var(--lose); }
.api-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.api-nav { display: flex; flex-direction: column; gap: .15rem; font-size: var(--fs-sm); }
.api-nav .route-search { margin-bottom: .6rem; }
.api-nav .nav-group { margin: .5rem 0 .1rem; font-weight: 600; }
.api-nav .op-link { display: flex; align-items: center; gap: .45rem; padding: .25rem .4rem; border-radius: var(--r-sm); color: var(--ink); min-width: 0; }
.api-nav .op-link .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
.api-nav .op-link:hover { background: var(--surface-2); }
.api-nav .method { min-width: 4.4rem; text-align: center; flex: none; }
.api-main { min-width: 0; }
.route-group { scroll-margin-top: 5rem; }
.route-group h2 { margin: 2rem 0 .8rem; }
.op { scroll-margin-top: 5rem; padding: 1.1rem 1.2rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 1rem; }
.op > p { margin: .5rem 0 0; max-width: 80ch; }
.op .meta { color: var(--muted); font-size: var(--fs-sm); }
.op-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.op-head .path { font-size: var(--fs-md); font-weight: 600; overflow-wrap: anywhere; }
.op-anchor { color: var(--muted); margin-left: auto; text-decoration: none; }
/* An operation reads top to bottom: its tables at full width, then the
   example request and response side by side. */
.op-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; margin-top: .5rem; }
.op-docs, .op-examples { min-width: 0; }
.op-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 0 1.5rem; align-items: start; }
.op-examples > div { min-width: 0; }
.op .table-wrap { margin: 0; }
.op .table-wrap td.wrap { min-width: 10rem; }
.op h4 { margin: 1rem 0 .4rem; font-size: var(--fs-sm); display: flex; align-items: center; gap: .5rem; }
.op pre.json { max-height: 24rem; overflow: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.op .req { color: var(--lose); font-size: var(--fs-xs); }
.op .req:empty { display: none; }
.authorize { margin-top: 1rem; padding: 1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.authorize h3 { margin: 0 0 .4rem; }
@media (min-width: 1100px) {
  .api-layout { grid-template-columns: 18rem minmax(0, 1fr); }
  .api-nav { position: sticky; top: calc(4.5rem + env(safe-area-inset-top, 0px)); align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; padding-right: .5rem; }
}
@media (max-width: 1099px) { .api-nav .op-link { display: none; } .api-nav { flex-direction: row; flex-wrap: wrap; gap: .25rem 1rem; } .api-nav .route-search { flex-basis: 100%; } }

/* ---------- admin console pages ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.kpi { position: relative; overflow: hidden; border-radius: var(--r-md); padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), transparent); }
.kpi .k { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; }
.kpi .v { font: 700 1.6rem var(--font-display); margin-top: .2rem; }
.kpi .d { color: var(--muted); font-size: var(--fs-xs); }
.admin-panels { align-items: start; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.alert-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-size: var(--fs-sm); }
.tabs { margin-bottom: 1rem; }
/* Tab rows and filters on a page always stand clear of what follows. */
.page > .seg-links, .page > nav.seg-links { margin: 0 .5rem 1.25rem 0; }
.page > .lead-note { margin-bottom: 1.5rem; }
.tabs .count { font: 600 .7rem var(--font-mono); margin-left: .25rem; opacity: .8; }
table.settings td.changed { color: var(--muted); font-size: var(--fs-xs); white-space: normal; min-width: 12rem; max-width: 22rem; }
form.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
form.search input { flex: 1; max-width: 32rem; font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: .5rem .9rem; }
ul.legs { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
ul.legs li { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--fs-xs); }
table.ledger td { white-space: nowrap; }
.check-result { margin-top: .75rem; }
.check-lines { margin: .5rem 0 0; padding-left: 1.2rem; font-size: var(--fs-sm); }
.act { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; align-items: center; }
.reason { display: inline-flex; gap: .4rem; align-items: center; }
.reason input { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .35rem .5rem; min-width: 12rem; }

/* ---------- verify in the browser ---------- */
.browser-check { margin: 1rem 0; padding: 1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.browser-check .panel-head { margin-bottom: .5rem; }
.browser-check .panel-head h3 { flex: 1; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.check { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem .75rem; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); transition: border-color var(--t-med); }
.check .st { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.check.run .st { border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.check.ok .st { background: var(--win-bg); color: var(--win); animation: pop var(--t-med) var(--ease); }
.check.bad { border-color: var(--lose); }
.check.bad .st { background: var(--lose-bg); color: var(--lose); animation: pop var(--t-med) var(--ease); }
.check .name { display: block; font-size: var(--fs-sm); font-weight: 500; }
.check .hash { display: block; color: var(--muted); font: 400 var(--fs-xs) var(--font-mono); overflow-wrap: anywhere; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.4); } }

/* ---------- motion and small screens ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 1100px) {
  .face-admin .cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; gap: .75rem; }
  .topbar .brand { margin-right: auto; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 1.5rem; }
  .hero h1 { font-size: var(--fs-xl); }
  .topbar { padding: .6rem 1rem; }
  .page { padding: 1.25rem 1rem; }
  .cols-2, .cols-3, .live-grid { grid-template-columns: minmax(0, 1fr); }
  .table-baize { border-radius: 48px; padding: 1rem; border-width: 6px; }
  .panel { padding: 1rem; }
}

/* ---------- hold'em match view ---------- */
.chart { margin: 1rem 0 0; }
.chart svg { width: 100%; height: auto; display: block; }
.winnings .band { fill: var(--accent); opacity: .14; }
.winnings .zero { stroke: var(--line); stroke-width: 1; }
.winnings polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
.winnings .won { stroke: var(--accent); }
.winnings .ev { stroke: var(--info); stroke-dasharray: 5 4; }
.winnings .axis { fill: var(--muted); font: 400 11px var(--font-ui); }
svg.winnings { max-height: 22rem; }
.chart figcaption { color: var(--muted); font-size: var(--fs-sm); margin-top: .5rem; }
.key { display: inline-block; width: 1.1rem; height: .25rem; border-radius: 2px; vertical-align: middle; margin-right: .2rem; }
.key.won { background: var(--accent); }
.key.ev { background: var(--info); }
.key.won2 { background: var(--win); }
.winnings .won2 { stroke: var(--win); }
.key.band { background: var(--accent); opacity: .3; height: .7rem; }
table.hands td { vertical-align: top; }
table.hands td.cards { white-space: nowrap; }
table.hands td.cards .pcard + .pcard { margin-left: .2rem; }
.pcard { font: 600 var(--fs-sm) var(--font-mono); margin-right: .2rem; color: var(--ink); }
.pcard.s-h, .pcard.s-d { color: var(--lose); }
table.hands .betting { font-size: var(--fs-sm); color: var(--muted); min-width: 14rem; width: 45%; white-space: normal; }
table.hands .ev { display: block; font-size: var(--fs-xs); color: var(--info); }
.pages { margin-top: .75rem; }
/* Hold'em hands: paging, a highlighted hand, the replay player. */
.hand-paging { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 1rem; }
.hand-paging .pages { margin: 0; }
.hand-paging .edge { color: var(--muted); }
.hand-jump { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); }
.hand-jump input { width: 6rem; font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .3rem .45rem; }
table.hands tr.hl td { background: var(--surface-2); }
.hand-player { margin: 0 0 1rem; padding: 1rem; border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--surface-2); }
.hp-table { display: grid; grid-template-columns: 1fr minmax(0, 1.4fr) 1fr; gap: 1rem; align-items: center; padding: 1rem; border-radius: var(--r-lg); background-color: var(--baize-base); background-image: var(--baize); }
.hp-seat { padding: .6rem .8rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); display: grid; gap: .35rem; }
.hp-seat.acting { border-color: var(--accent); }
.hp-name { display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.hp-cards { display: flex; flex-wrap: wrap; gap: .25rem; }
.hp-cards .pcard { margin: 0; padding: .2rem .35rem; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); }
.pcard.back { display: inline-block; min-width: 1.6rem; height: 1.5rem; background: var(--surface); }
.hp-board { display: grid; justify-items: center; gap: .5rem; }
.hp-stack { font-size: var(--fs-sm); color: var(--muted); }
.hp-pot { font-size: var(--fs-sm); color: #f4f1e6; background: rgba(0, 0, 0, .45); padding: .15rem .6rem; border-radius: 999px; }
.hp-caption { margin: .75rem 0 .5rem; font-weight: 500; }
.hp-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
@media (max-width: 640px) { .hp-table { grid-template-columns: 1fr; } }

/* ---------- admin presets ---------- */
table.preset-table .rules { white-space: normal; min-width: 14rem; color: var(--muted); font-size: var(--fs-sm); }
.preset-new { margin-top: .75rem; }

/* Status page */
.status-overall p { margin: 0; display: flex; align-items: center; gap: .25rem; }
.status-overall b { font-size: var(--fs-lg, 1.15rem); }
.status-overall .note { margin-top: .35rem; }
.status-overall.win { border-color: #34d39966; } .status-overall.win .dot { background: #34d399; }
.status-overall.wait { border-color: #fbbf2466; } .status-overall.wait .dot { background: #fbbf24; }
.status-overall.lose { border-color: #f8717166; } .status-overall.lose .dot { background: #f87171; }
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.status-list .what { display: grid; gap: .15rem; min-width: 0; }
.status-list .what .note:empty { display: none; }
.incident { padding: 1rem 0; border-top: 1px solid var(--line); }
.incident:first-of-type { border-top: 0; padding-top: 0; }
.incident-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.incident-head h3 { margin: 0; }
.incident-updates { list-style: none; margin: .75rem 0 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); display: grid; gap: .75rem; }
.incident-updates time { color: var(--muted); font-size: var(--fs-sm); }
.incident-updates p { margin: .3rem 0 0; overflow-wrap: anywhere; }
.flag-actions { display: flex; gap: .5rem; }

/* ---------- scrollbars ---------- */
/* Every scrollbar in the design's colours: a thin track, a rounded thumb,
   the accent on hover. Tokens, so both themes and both faces follow. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: var(--r-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
html { scrollbar-color: color-mix(in srgb, var(--muted) 45%, var(--bg)) var(--bg); }

/* ---------- forms: fieldsets, choices, fields, actions ---------- */
.standing p, .standing li { overflow-wrap: anywhere; }
.restrict > summary { cursor: pointer; width: fit-content; font-size: var(--fs-sm); font-weight: 600; color: var(--lose); padding: .35rem .8rem; border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--lose) 55%, transparent); list-style: none; }
.restrict > summary::-webkit-details-marker { display: none; }
.restrict[open] > summary { margin-bottom: .25rem; }
.field .note { font-weight: 400; }
.choice { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: var(--fs-sm); }
.choice input[type=radio] { accent-color: var(--accent); }
.field { display: grid; gap: .35rem; font-size: var(--fs-sm); color: var(--ink); font-weight: 500; }
.field textarea, .choice select { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .5rem .65rem; }
.field textarea { resize: vertical; min-height: 3.2rem; }
.field textarea:focus, .choice select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.form-actions .note { margin: 0; flex: 1 1 18rem; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.note-list li { padding: .7rem .9rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.note-list p { margin: .35rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; gap: .75rem; align-items: baseline; font-size: var(--fs-sm); }
.note-meta .when { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* A filter bar: labelled fields in a row, wrapping, the button aligned. */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; padding: .9rem 1.1rem; margin: 0 0 1.25rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.filters .field { min-width: 0; flex: 0 1 14rem; }
.filters select, .filters input { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .45rem .6rem; width: 100%; min-width: 0; }
.filters input { font-family: var(--font-mono); }
.filters select:focus, .filters input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filters .btn { margin-bottom: 1px; }
/* Hold'em table: the board, the dealer button, the hand's winner. */
.holdem-board { display: flex; gap: .35rem; justify-content: center; margin-bottom: .4rem; }
.card.slot { opacity: .25; }
span.cards { display: inline-flex; gap: .25rem; }
.dealer { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 var(--fs-xs) var(--font-ui); margin-left: .35rem; }
.seat.winner { box-shadow: 0 0 0 2px var(--accent), var(--glow); }
.seat.winner::after { content: "Won"; font: 700 var(--fs-xs) var(--font-ui); color: var(--accent); margin-left: .4rem; }
.last-hand { color: var(--accent); }
.queue-group + .queue-group { margin-top: 1rem; }
.queue-group h4 { margin: .5rem 0 .35rem; display: flex; gap: .6rem; align-items: baseline; }
.row-moderate { display: inline-flex; gap: .4rem; align-items: center; }
.row-moderate input { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .3rem .5rem; width: 12rem; max-width: 40vw; }
/* A user by display name reads as a name; by id, as an id. */
a.user.named { font-weight: 600; }
.field input { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .45rem .6rem; min-width: 0; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Grouped filters: a label per group, its choices beside it. */
.filter-groups { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; margin: 0 0 1.25rem; padding: .9rem 1.1rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.filter-group { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.filter-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- form system: one look for every form ---------- */
.form { display: grid; gap: 1.1rem; padding: 1.1rem 1.25rem 1.2rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); max-width: 60rem; }
.form > h3, .form > .form-title { margin: 0; font-size: var(--fs-md); }
/* Inside a panel a form is part of it: no frame of its own. */
.panel .form { padding: 0; background: none; border: 0; border-radius: 0; margin-top: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr)); gap: 1rem 1.25rem; align-items: start; }
.form fieldset.group { border: 0; border-top: 1px solid var(--line); margin: 0; padding: .9rem 0 0; min-width: 0; }
.form fieldset.group:first-of-type { border-top: 0; padding-top: 0; }
.form fieldset.group > legend { float: left; width: 100%; padding: 0; margin: 0 0 .7rem; font: 600 var(--fs-xs) var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.form fieldset.group > legend + * { clear: both; }
.fld { display: grid; gap: .35rem; min-width: 0; align-content: start; }
.fld.wide { grid-column: 1 / -1; }
.fld-label { font: 500 var(--fs-sm) var(--font-ui); color: var(--ink); }
.fld-hint { margin: 0; font-size: var(--fs-xs); line-height: 1.45; color: var(--muted); }
.fld-error { margin: 0; font-size: var(--fs-xs); font-weight: 500; color: var(--lose); }
.fld input[type=text], .fld select, .fld textarea, .input-group {
  font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); min-width: 0; max-width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.fld input[type=text], .fld select, .fld textarea { padding: .5rem .65rem; }
.fld input.mono { font-family: var(--font-mono); }
.fld textarea { resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.fld select { padding-right: 1.8rem; }
.fld input[type=text]:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.fld.invalid input[type=text], .fld.invalid select, .fld.invalid textarea, .fld.invalid .input-group { border-color: var(--lose); }
.input-group { display: flex; align-items: stretch; overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.fld .input-group input[type=text] { flex: 1 1 auto; width: 100%; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-variant-numeric: tabular-nums; }
.fld .input-group input[type=text]:focus { box-shadow: none; }
.input-group .suffix { display: flex; align-items: center; padding: 0 .7rem; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); background: var(--surface); border-left: 1px solid var(--line); white-space: nowrap; }
.fld .input-group select { border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--surface); flex: 0 0 auto; font-weight: 600; font-size: var(--fs-xs); }
.fld .input-group select:focus { box-shadow: none; }
.fld :disabled { opacity: .55; cursor: not-allowed; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; width: fit-content; min-height: 2.25rem; font-size: var(--fs-sm); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 2.6rem; height: 1.5rem; border-radius: var(--r-pill); background: var(--bg-2); border: 1px solid var(--line); transition: background var(--t-fast) var(--ease); flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.5rem - 6px); height: calc(1.5rem - 6px); border-radius: 50%; background: var(--muted); transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.switch input:checked + .track { background: color-mix(in srgb, var(--live) 30%, var(--bg-2)); border-color: var(--live); }
.switch input:checked + .track::after { transform: translateX(1.1rem); background: var(--live); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .55; }
.form .form-actions { padding-top: .2rem; }
@media (prefers-reduced-motion: reduce) { .switch .track, .switch .track::after, .input-group, .fld input { transition: none; } }
.choices { display: grid; gap: .55rem; margin-bottom: .9rem; }
.choices.row { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: 0; }
/* A form opened in a table row spans what is visible of the table, not
   the table's full width, and stays in view while the table scrolls. */
.table-wrap { container-type: inline-size; }
tr.edit-row > td, tr.preset-edit-row > td { white-space: normal; padding: .5rem 0 1rem; }
tr.edit-row .form, tr.preset-edit-row .form { position: sticky; left: 0; box-sizing: border-box; width: min(100cqi, 60rem); }
.form + .form, .panel > .form { margin-top: 1rem; }
.note-form { margin-bottom: 1rem; }
.name-form { margin-bottom: 1rem; max-width: 36rem; }
.referrer-form { margin-top: 1rem; max-width: 24rem; }
.copy-inline { margin-left: .5rem; vertical-align: middle; }
.facts code[data-copy-text] { overflow-wrap: anywhere; }
.invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-left: 3px solid var(--accent); }
.invite h2 { margin: 0 0 .25rem; }
.invite p { margin: 0; max-width: 46rem; }
.inline-select { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .3rem .45rem; }
.form fieldset.group > .fld-hint, .form fieldset.group > .note { margin: 0 0 .9rem; }

/* ---------- help bubbles: a "?" with a designed tooltip ---------- */
.help { position: relative; display: inline-flex; vertical-align: middle; margin-left: .3rem; }
.help-btn { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; padding: 0; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--muted) 60%, transparent); background: transparent; color: var(--muted); font: 700 .68rem/1 var(--font-ui); cursor: help; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.help-btn:hover, .help.open .help-btn { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Fixed, so a scrolling table never clips it; forms.js places it next to
   its button (above, or below when there is no room) inside the window. */
.help-tip { display: none; position: fixed; z-index: 60; left: var(--tip-x, 0px); top: var(--tip-y, 0px); width: max-content; max-width: min(19rem, calc(100vw - 2rem)); padding: .6rem .75rem; border-radius: var(--r-md); background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .55); font: 400 var(--fs-xs)/1.5 var(--font-ui); text-align: left; text-transform: none; letter-spacing: normal; white-space: normal; pointer-events: none; }
.help-tip::after { content: ""; position: absolute; top: 100%; left: var(--tip-arrow, 50%); margin-left: -6px; border: 6px solid transparent; border-top-color: var(--surface); }
.help-tip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--surface); }
.help:hover .help-tip, .help-btn:focus-visible + .help-tip, .help.open .help-tip { display: block; }
th .help, .fld-label .help, dt .help { margin-left: .25rem; }
/* API reference field tables. */
table.fields td.kind, table.fields .kind, .ev-field .kind { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
table.fields .rules { display: block; margin-top: .2rem; color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.ev-field { display: block; margin-bottom: .3rem; }
.resp-fields { margin: .75rem 0; }
.resp-fields > summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); width: fit-content; }
.next-ops { margin: .25rem 0 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: var(--fs-sm); }
.next-ops .method { font: 600 var(--fs-xs) var(--font-mono); color: var(--muted); }
/* Admin search. */
.side-search { margin: .25rem 0 .75rem; }
.side-search input { width: 100%; box-sizing: border-box; font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: .45rem .8rem; }
.side-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
form.search-wide { flex-wrap: wrap; }
form.search-wide select { font: 400 var(--fs-sm) var(--font-ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: .45rem .8rem; }
.search-group .filter-group { margin-bottom: .6rem; }
.search-note, .search-lag { margin: .5rem 0 1rem; }
.search-pages:empty { display: none; }
/* Charts: SVG drawn on the server, coloured here. */
svg.spark { width: 100%; max-width: 9rem; height: 2rem; display: block; margin-top: .4rem; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark-area { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: none; }
/* Bar charts: a fixed-height plot; the scale and labels are HTML. */
.bar-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 9rem auto; column-gap: .5rem; margin: .5rem 0 0; }
.bar-chart .y-axis { grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: var(--fs-xs); color: var(--muted); line-height: 1; margin: -.3rem 0; }
svg.bars { grid-row: 1; grid-column: 2; width: 100%; height: 100%; display: block; overflow: visible; }
.bar-chart .x-axis { grid-row: 2; grid-column: 2; display: flex; font-size: var(--fs-xs); color: var(--muted); margin-top: .3rem; }
.bar-chart .x-axis span { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-axis .w2 { flex-grow: 2; } .x-axis .w3 { flex-grow: 3; } .x-axis .w4 { flex-grow: 4; } .x-axis .w5 { flex-grow: 5; } .x-axis .w6 { flex-grow: 6; }
.x-axis .w7 { flex-grow: 7; } .x-axis .w8 { flex-grow: 8; } .x-axis .w9 { flex-grow: 9; } .x-axis .w10 { flex-grow: 10; } .x-axis .w11 { flex-grow: 11; } .x-axis .w12 { flex-grow: 12; }
svg.bars .grid { stroke: var(--line); stroke-width: 1; }
svg.bars .s1 { fill: var(--accent); }
svg.bars .s2 { fill: var(--info); }
svg.bars .hit { fill: transparent; }
svg.bars .bar:hover .s1, svg.bars .bar:hover .s2 { opacity: .8; }
.legend { margin: .35rem 0 0; font-size: var(--fs-xs); color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.legend .key { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-left: .5rem; }
.legend .key.s1 { background: var(--accent); }
.legend .key.s2 { background: var(--info); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.charts .panel h2 { font-size: var(--fs-md); margin-bottom: .5rem; }
.charts.single { grid-template-columns: 1fr; }
.charts > .panel { margin: 0; }
/* A game's presets: one block each, rules as a grid of labels and values. */
.preset-list { display: grid; gap: 0; }
.preset-item { padding: 1rem 0; border-top: 1px solid var(--line); display: grid; gap: .6rem; }
.preset-item:first-child { border-top: 0; padding-top: .25rem; }
.preset-item header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.preset-item header h3 { margin: 0; }
.preset-money, .rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem 1.5rem; margin: 0; }
.preset-money { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.preset-money dt, .rule-grid dt { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.preset-money dd, .rule-grid dd { margin: .1rem 0 0; }
.rule-grid { padding-left: .8rem; border-left: 2px solid var(--line); }
.preset-item .join { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
/* The console's user page: who first, then money and matches beside one
   column of controls that reads as a single panel. */
.identity .pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.identity .links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: .75rem 0 0; font-size: var(--fs-sm); }
.user-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 1200px) { .user-grid { grid-template-columns: minmax(0, 3fr) minmax(20rem, 2fr); } }
.user-main { display: grid; gap: 1rem; min-width: 0; }
.user-side > .panel { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 1rem 0 0; margin: 1rem 0 0; border-top: 1px solid var(--line); }
.user-side > .panel:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.user-side > .panel h2 { font-size: var(--fs-md); }
.user-side > .panel > .table-wrap { margin: 0; }
details.manage { margin-top: .9rem; }
details.manage > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent); }
.user-main > .panel, .user-grid > .user-side { margin: 0; }
.user-side .empty { border: 0; padding: 0; text-align: left; background: none; }
/* Cohesive pages: inside a panel nothing gets a frame of its own;
   sections are set apart by rules and spacing. */
.panel .empty { border: 0; padding: .25rem 0; text-align: left; background: none; }
.panel ol.steps.cards { gap: 0 1.5rem; }
.panel ol.steps.cards li { background: none; border: 0; border-radius: 0; border-top: 2px solid var(--line); padding: .75rem 0 0; }
.panel .authorize, .panel .browser-check { background: none; border: 0; border-radius: 0; border-top: 1px solid var(--line); padding: 1rem 0 0; }
.panel .status-list li, .panel .note-list li { background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); padding-left: 0; padding-right: 0; }
.panel .status-list li:last-child, .panel .note-list li:last-child { border-bottom: 0; }
.panel .feed li { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.panel .hand-player { background: none; border: 0; border-left: 3px solid var(--accent); border-radius: 0; padding: .25rem 0 .25rem 1rem; }

/* Syntax highlighting (highlight.js): keys and keywords, strings,
   numbers, literals, comments, functions and commands. */
.hl .hl-k { color: var(--hl-k); }
.hl .hl-s { color: var(--hl-s); }
.hl .hl-n { color: var(--hl-n); }
.hl .hl-b { color: var(--hl-b); }
.hl .hl-c { color: var(--hl-c); font-style: italic; }
.hl .hl-f, .hl .hl-o { color: var(--hl-f); }
.hl .hl-v { color: var(--hl-b); }
.hl .hl-p { color: var(--hl-p); }
pre.prose { white-space: pre-wrap; }
.copy-wrap pre { padding-right: 5.5rem; }

/* The FAQ: questions that open in place. */
.faq { max-width: 52rem; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { cursor: pointer; padding: 1rem 0; font: 600 var(--fs-md) var(--font-ui); list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::after { content: "+"; color: var(--accent); font-weight: 700; }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 0 1rem; color: var(--ink); }
.faq-answer p { margin: 0 0 .6rem; }
.faq-admin { list-style: none; margin: 0; padding: 0; }
.faq-admin > li { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.faq-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.faq-head .faq-controls { margin-left: auto; display: inline-flex; gap: .35rem; }
.faq-head details.manage { flex-basis: 100%; margin-top: .25rem; }

/* ---------- progress: avatars, levels, badges, form ---------- */
.avatar { flex: none; border-radius: var(--r-md); box-shadow: 0 6px 24px -8px rgba(0,0,0,.6); }
.level-badge { position: relative; width: 5.5rem; height: 5.5rem; flex: none; }
.level-badge .lvl-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.level-badge circle { fill: none; stroke-width: 3.2; }
.level-badge .ring-bg { stroke: var(--line); }
.level-badge .ring-fg { stroke: var(--accent); stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(217,177,108,.55)); animation: ring-in var(--t-slow) var(--ease) both; }
@keyframes ring-in { from { stroke-dasharray: 0 100; } }
.level-badge .lv { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.level-badge .lv small { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.level-badge .lv b { font-family: var(--font-display); font-size: var(--fs-xl); }
.xp { flex: 1; min-width: 12rem; }
.xp-row { display: flex; justify-content: space-between; gap: .5rem; font-size: var(--fs-sm); font-weight: 600; }
svg.bar { display: block; width: 100%; height: .5rem; margin: .4rem 0; }
.bar-bg { fill: var(--surface-2); }
.bar-fg { fill: var(--accent); filter: drop-shadow(0 0 2px rgba(217,177,108,.6)); }
.small { font-size: var(--fs-xs); }
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .6rem; }
.badge-tile { position: relative; display: grid; gap: .15rem; padding: .7rem .75rem; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg-2); }
.badge-tile .glyph { font-size: 1.4rem; line-height: 1; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; margin-bottom: .25rem; }
.badge-tile b { font-size: var(--fs-sm); }
.badge-tile .about { font-size: var(--fs-xs); color: var(--muted); }
.badge-tile.earned { border-color: rgba(217,177,108,.55); background: linear-gradient(160deg, rgba(217,177,108,.16), transparent 60%), var(--bg-2); }
.badge-tile.earned .glyph { background: radial-gradient(circle at 35% 30%, #ffe7a8, var(--accent) 60%, #8a6420); color: var(--accent-ink); box-shadow: 0 0 14px rgba(217,177,108,.45); }
.badge-tile.locked .glyph { background: var(--surface-2); color: var(--muted); }
.badge-tile.locked b { color: var(--muted); }
.badge-tile svg.bar { height: .3rem; margin: .35rem 0 0; }
.form-strip { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; }
.form-strip li { width: 1.35rem; height: 1.35rem; border-radius: 4px; display: grid; place-items: center; font-size: .68rem; font-weight: 700; }
.form-strip .win { background: var(--win-bg); color: var(--win); box-shadow: inset 0 0 0 1px var(--win); }
.form-strip .loss { background: var(--lose-bg); color: var(--lose); }
.form-strip .draw { background: var(--done-bg); color: var(--done); }
.calendar { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, .8rem); gap: 3px; overflow-x: auto; padding-bottom: .2rem; }
.calendar i { width: .8rem; height: .8rem; border-radius: 3px; background: var(--surface-2); }
.calendar i.future { background: transparent; }
.calendar .t1 { background: color-mix(in srgb, var(--live) 35%, var(--surface-2)); }
.calendar .t2 { background: color-mix(in srgb, var(--live) 65%, var(--surface-2)); }
.calendar .t3 { background: var(--live); box-shadow: 0 0 6px var(--live); }
.tag { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: .1rem .55rem; border-radius: var(--r-pill); margin-left: .4rem; vertical-align: middle; }
.tag.house { background: var(--info-bg); color: var(--info); }
.tag.hot { background: var(--lose-bg); color: var(--lose); }
.live-now { display: inline-flex; align-items: center; gap: .45rem; margin-top: .4rem; padding: .25rem .7rem; border-radius: var(--r-pill); background: var(--live-bg); color: var(--live); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; }
.pulse { width: .55rem; height: .55rem; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 70% { box-shadow: 0 0 0 .5rem rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
@media (prefers-reduced-motion: reduce) { .pulse, .level-badge .ring-fg { animation: none; } }

/* ---------- player profile ---------- */
.profile-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.75rem; border-radius: var(--r-lg); background: var(--baize); border: 1px solid var(--line); position: relative; overflow: hidden; }
.profile-hero::after { content: ""; position: absolute; inset: auto 0 -60% 40%; height: 120%; background: radial-gradient(closest-side, rgba(217,177,108,.18), transparent); pointer-events: none; }
.profile-hero .who { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.profile-hero h1 { margin: 0; font-family: var(--font-display); font-size: var(--fs-2xl); line-height: 1.05; overflow-wrap: anywhere; }
.profile-hero .id-line { margin: .3rem 0 .1rem; }
.profile-hero .id-line code { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.profile-hero .progress { display: flex; align-items: center; gap: 1rem; flex: 1 1 18rem; max-width: 26rem; position: relative; z-index: 1; }
/* The degen is dark in both themes: its text is light in both. */
.profile-hero { color: #eef6f1; }
.profile-hero .muted, .profile-hero .id-line code, .profile-hero .xp .muted, .profile-hero .level-badge .lv small { color: #b9d0c3; }
.profile-hero .ring-bg { stroke: rgba(255,255,255,.14); }
.profile-hero .bar-bg { fill: rgba(0,0,0,.3); }
.profile-hero .live-now { background: rgba(0,0,0,.35); color: #6ee7b7; }
.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0; margin: 1.25rem 0; padding: 0; border-block: 1px solid var(--line); }
.statline > div { padding: .9rem 1rem; border-right: 1px solid var(--line); }
.statline > div:last-child { border-right: 0; }
.statline dt { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.statline dd { margin: .2rem 0 0; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; }
.statline dd small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.statline .form-cell dd { font-size: var(--fs-md); margin-top: .45rem; }
.profile-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 2rem; margin-bottom: 1.5rem; }
@media (max-width: 860px) { .profile-cols { grid-template-columns: 1fr; } }
.profile-cols h2, .boards h2, .timeline h2 { font-family: var(--font-display); font-size: var(--fs-lg); margin: 0 0 .8rem; }
.profile-cols h2 .muted { font-size: var(--fs-sm); font-weight: 500; }
.board-list, .results { list-style: none; margin: 0 0 1.75rem; padding: 0; }
.board-list a { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .7rem .4rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; transition: background var(--t-fast); }
.board-list a:hover, .results li:hover { background: var(--bg-2); }
.board-list .rank { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; text-align: center; }
.board-list .gold .rank { color: var(--gold); text-shadow: 0 0 12px rgba(232,193,90,.5); }
.board-list .silver .rank { color: var(--silver); }
.board-list .bronze .rank { color: var(--bronze); }
.board-list .unranked .rank { color: var(--muted); }
.board-list .what, .results .what { display: grid; min-width: 0; }
.board-list .what .muted, .results .what .muted { font-size: var(--fs-sm); }
.results li { display: grid; grid-template-columns: 1rem minmax(0, 1fr) minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .6rem .4rem; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
.results a.what, .results a.side { color: inherit; text-decoration: none; }
.results a.what:hover b { color: var(--link); }
.results .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--done); }
.results .win .dot { background: var(--win); box-shadow: 0 0 8px var(--win); }
.results .loss .dot { background: var(--lose); }
.results .vs { font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.results .side { display: grid; justify-items: end; font-size: var(--fs-sm); }
.results .when { color: var(--muted); font-size: var(--fs-xs); }
@media (max-width: 640px) { .results li { grid-template-columns: 1rem minmax(0, 1fr) auto; } .results .vs { display: none; } }

/* ---------- ticker ---------- */
.ticker { position: relative; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, var(--bg-2), var(--surface) 50%, var(--bg-2)); font-size: var(--fs-sm); }
.ticker::-webkit-scrollbar { display: none; }
.ticker-track { display: inline-flex; gap: 2.25rem; padding: .45rem 1.25rem; white-space: nowrap; width: max-content; }
.ticker-copy { display: inline-flex; gap: 2.25rem; }
.ticker.running { overflow-x: hidden; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker.running .ticker-track { animation: ticker var(--ticker-dur, 60s) linear infinite; }
.ticker.running:hover .ticker-track, .ticker.running:focus-within .ticker-track { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(calc(-50% - 1.125rem)); } }
.tick { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; }
a.tick:hover { color: var(--link); }
.tick-k { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: .12rem .45rem; border-radius: var(--r-sm); }
.tick.live .tick-k { background: var(--live-bg); color: var(--live); }
.tick.live .tick-k::before { content: ""; display: inline-block; width: .4rem; height: .4rem; border-radius: 50%; background: var(--live); margin-right: .35rem; vertical-align: .05rem; animation: pulse 1.6s infinite; }
.tick.win .tick-k { background: rgba(217,177,108,.16); color: var(--accent); }
.tick.wait .tick-k { background: var(--wait-bg); color: var(--wait); }
.tick.info .tick-k { background: var(--info-bg); color: var(--info); }
@media (prefers-reduced-motion: reduce) { .ticker.running .ticker-track { animation: none; } .ticker.running { overflow-x: auto; } .tick.live .tick-k::before { animation: none; } }

/* ---------- home: featured match, counters, the board ---------- */
.home-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
@media (max-width: 900px) { .home-hero { grid-template-columns: 1fr; } }
.kicker { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6ee7b7 !important; margin: 0 0 .6rem; }
.featured { position: relative; z-index: 1; display: grid; gap: .5rem; padding: 1rem; border-radius: var(--r-lg); background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 20px 50px -20px rgba(0,0,0,.7); }
.featured-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.featured-link { color: #f1d9a6; font-weight: 600; font-size: var(--fs-sm); text-decoration: none; }
.featured-link:hover { text-decoration: underline; }
.featured-title { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; color: #eef6f1; }
.featured-title b { font-family: var(--font-display); font-size: var(--fs-lg); }
.featured-title .muted { color: #b9d0c3; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.featured-table .table-baize { min-height: 15rem; border-width: 7px; }
.featured.ended .featured-table { opacity: .55; transition: opacity var(--t-med); }
.home-counts { margin-top: 0; }
.home-counts dt { display: flex; align-items: center; gap: .45rem; }
.home-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; margin-top: 2rem; align-items: start; }
@media (max-width: 980px) { .home-board { grid-template-columns: 1fr; } }
.home-board .section-head h2 { display: flex; align-items: center; gap: .5rem; }
.tiles.rows { gap: 0; }
.tiles.rows .tile { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .65rem .2rem; box-shadow: none; }
.tiles.rows a.tile:hover { background: var(--bg-2); transform: none; }
.tiles.rows + .tiles.rows { margin-top: 0; }

/* ---------- podium ---------- */
.podium { list-style: none; margin: 1.25rem 0 1.5rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: .75rem; max-width: 46rem; margin-inline: auto; }
.podium .step { display: grid; justify-items: center; gap: .3rem; text-align: center; min-width: 0; }
.podium .gold { order: 2; }
.podium .silver { order: 1; }
.podium .bronze { order: 3; }
.podium .medal { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--accent-ink); }
.podium .gold .medal { background: radial-gradient(circle at 35% 30%, #fff1c2, var(--gold) 60%, #8a6420); box-shadow: 0 0 18px rgba(232,193,90,.6); font-size: 1.2rem; }
.podium .silver .medal { background: radial-gradient(circle at 35% 30%, #fff, #c3ccd6 60%, #6b7480); }
.podium .bronze .medal { background: radial-gradient(circle at 35% 30%, #ffd9bb, #d99a6c 60%, #7a4a26); }
.podium .who { font-weight: 600; max-width: 100%; overflow-wrap: anywhere; }
.podium .fig { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; }
.podium .block { width: 100%; border-radius: var(--r-md) var(--r-md) 0 0; background: linear-gradient(180deg, var(--surface-2), var(--bg-2)); border: 1px solid var(--line); border-bottom: 0; margin-top: .3rem; }
.podium .gold .block { height: 5.5rem; background: linear-gradient(180deg, rgba(232,193,90,.25), var(--bg-2)); border-color: rgba(232,193,90,.5); }
.podium .silver .block { height: 3.75rem; }
.podium .bronze .block { height: 2.5rem; }
.podium .gold .avatar { width: 72px; height: 72px; box-shadow: 0 0 0 3px var(--gold), 0 10px 30px -8px rgba(232,193,90,.6); }

/* ---------- game page ---------- */
.game-hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); color: #eef6f1; }
.game-hero h1 { margin: 0 0 .5rem; }
.game-hero .lead { color: #c9dbd1; max-width: 60ch; }
.game-hero dl.facts dt { color: #b9d0c3; }
.game-hero-art { display: grid; place-items: center; position: relative; z-index: 1; }
.game-hero-art svg { width: 100%; max-width: 22rem; height: auto; filter: drop-shadow(0 20px 30px rgba(0,0,0,.45)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-1deg); } }
@media (prefers-reduced-motion: reduce) { .game-hero-art svg { animation: none; } }
@media (max-width: 760px) { .game-hero { grid-template-columns: 1fr; } .game-hero-art { order: -1; } .game-hero-art svg { max-width: 14rem; } }
.game-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 2.5rem; align-items: start; margin-top: 1rem; }
@media (max-width: 960px) { .game-cols { grid-template-columns: 1fr; } }
.game-main h2, .game-side h2, .dev-band h2 { font-family: var(--font-display); }
.game-side { position: sticky; top: 4.5rem; display: grid; gap: 1.75rem; }
@media (max-width: 960px) { .game-side { position: static; } }
.steps:not(.cards) { counter-reset: step; list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: .9rem; }
.steps:not(.cards) li { counter-increment: step; position: relative; padding-left: 3rem; max-width: 70ch; }
.steps:not(.cards) li::before { content: counter(step); position: absolute; left: 0; top: -.1rem; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: var(--accent-ink); background: radial-gradient(circle at 35% 30%, #ffe7a8, var(--accent) 65%); }
.dev-band { margin: 2.5rem calc(50% - 50vw) 0; padding: 2.5rem max(1.25rem, calc(50vw - 37rem)); background: var(--bg-2); border-block: 1px solid var(--line); }
.dev-band-head { max-width: 70ch; margin-bottom: 1.5rem; }
.dev-band .kicker { color: var(--accent) !important; }
.dev-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .dev-grid { grid-template-columns: 1fr; } }

/* ---------- account ---------- */
.account-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; color: #eef6f1; padding: 1.75rem; }
.account-hero .who { display: flex; align-items: center; gap: 1.1rem; min-width: 0; position: relative; z-index: 1; }
.account-hero h1 { margin: 0; font-family: var(--font-display); font-size: var(--fs-2xl); overflow-wrap: anywhere; }
.account-hero .id-line { margin: .25rem 0; }
.account-hero .id-line code, .account-hero .muted, .account-hero .level-badge .lv small, .account-hero .xp .muted { color: #b9d0c3; overflow-wrap: anywhere; }
.account-hero a { color: #f1d9a6; }
.account-hero .kicker { margin: 0 0 .2rem; }
.account-hero .progress { display: flex; align-items: center; gap: 1rem; flex: 1 1 18rem; max-width: 26rem; position: relative; z-index: 1; }
.account-hero .ring-bg { stroke: rgba(255,255,255,.14); }
.account-hero .bar-bg { fill: rgba(0,0,0,.3); }
.wallet { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0; margin: 1.25rem 0 1.5rem; border-block: 1px solid var(--line); }
.purse { display: grid; gap: .15rem; padding: 1rem 1.1rem; border-right: 1px solid var(--line); }
.purse .k { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.purse b { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: 1.1; }
.purse-actions { padding: 1rem 1.1rem; display: grid; align-content: center; gap: .3rem; }
.purse-actions .note { margin: 0; }
.account-cols { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
@media (max-width: 860px) { .account-cols { grid-template-columns: 1fr; gap: 1rem; } }
.side-menu { position: sticky; top: 4.5rem; display: grid; gap: .15rem; }
.side-menu a { padding: .45rem .75rem; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.side-menu a:hover { color: var(--ink); background: var(--bg-2); border-left-color: var(--accent); }

.account-main > section, .account-main > div { margin-bottom: 2.25rem; scroll-margin-top: 5rem; }
.account-main h2 { font-family: var(--font-display); font-size: var(--fs-lg); }
.account-main h2 .muted { font-size: var(--fs-sm); font-weight: 500; }
.account-main .panel { background: none; border: 0; box-shadow: none; padding: 0; }
.account-main .form { margin: .9rem 0 1.25rem; }
#badges .form-strip { margin: 0 0 1rem; }

/* ---------- match page ---------- */
.match-hero { display: grid; grid-template-columns: 1fr; gap: 1.5rem; color: #eef6f1; }
.mh-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; position: relative; z-index: 1; }
.mh-top h1 { margin: 0 0 .4rem; }
.mh-top .muted { color: #b9d0c3; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.mh-top code { color: #b9d0c3; overflow-wrap: anywhere; }
.mh-top .actions { margin: 0; }
.faceoff { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem 3rem; position: relative; z-index: 1; }
.faceoff li { position: relative; display: grid; justify-items: center; gap: .3rem; min-width: 9rem; padding: 1.1rem 1rem .9rem; border-radius: var(--r-lg); background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.08); }
.faceoff li + li::before { content: "vs"; position: absolute; left: -1.5rem; top: 50%; transform: translate(-50%, -50%); font-family: var(--font-display); font-weight: 700; color: #b9d0c3; font-size: var(--fs-sm); }
.faceoff .who { font-weight: 600; max-width: 12rem; overflow-wrap: anywhere; }
.faceoff .who a { color: #f1d9a6; }
.faceoff .muted { color: #b9d0c3; }
.faceoff b { font-family: var(--font-display); font-size: var(--fs-xl); }
.faceoff b.pos { color: #6ee7b7; }
.faceoff b.neg { color: #fca5a5; }
.faceoff .crown { visibility: hidden; position: absolute; top: -.9rem; font-size: 1.4rem; color: var(--gold); text-shadow: 0 0 12px rgba(232,193,90,.7); }
.faceoff .top { border-color: rgba(232,193,90,.6); background: linear-gradient(180deg, rgba(232,193,90,.18), rgba(0,0,0,.25)); box-shadow: 0 0 30px -8px rgba(232,193,90,.5); }
.faceoff .top .crown { visibility: visible; }
.faceoff .out .avatar { filter: grayscale(.6) brightness(.8); }
.proof-band { margin: 2.5rem calc(50% - 50vw) 2rem; padding: 2.5rem max(1.25rem, calc(50vw - 37rem)); background: var(--bg-2); border-block: 1px solid var(--line); }
.proof-band .kicker { color: var(--live) !important; }
.proof-band h2 { font-family: var(--font-display); }
.moves-list summary { cursor: pointer; list-style: none; }
.moves-list summary h2 { display: inline; }
.moves-list summary::after { content: " ▾"; color: var(--muted); }

/* ---------- FAQ ---------- */
.faq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .faq-layout { grid-template-columns: 1fr; } }
.faq-search input { width: 100%; padding: .8rem 1.1rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; margin-bottom: 1rem; }
.faq-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.faq-side { position: sticky; top: 4.5rem; display: grid; gap: .9rem; }
.help-card { padding: 1rem 1.1rem; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 var(--r-md) var(--r-md) 0; }
.help-card p { margin: 0; }
.help-card .kicker { color: var(--accent) !important; margin-bottom: .3rem; }

/* ---------- status ---------- */
.status-hero { display: block; padding: 2rem 2.5rem; color: #eef6f1; }
.status-hero .muted { color: #b9d0c3; margin: .4rem 0 0; position: relative; z-index: 1; }
.status-big { margin: 0; display: flex; align-items: center; gap: .9rem; position: relative; z-index: 1; }
.status-big b { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: 1.1; }
.beacon { flex: none; width: .9rem; height: .9rem; border-radius: 50%; background: var(--done); }
.status-big .beacon { width: 1.3rem; height: 1.3rem; }
.win > .beacon, .win .status-big .beacon, .status-hero.win .beacon { background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 1.8s infinite; }
.wait > .beacon, .status-hero.wait .beacon { background: #fbbf24; }
.lose > .beacon, .status-hero.lose .beacon { background: #f87171; }
.status-components, .status-incidents { margin-top: 2rem; }
.status-components h2, .status-incidents h2 { font-family: var(--font-display); }
.status-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0; border-block: 1px solid var(--line); }
.status-grid li { display: flex; align-items: flex-start; gap: .75rem; padding: 1rem; border-right: 1px solid var(--line); }
.status-grid li:last-child { border-right: 0; }
.status-grid .beacon { margin-top: .35rem; }
.status-grid .what { flex: 1; display: grid; gap: .15rem; min-width: 0; }
.status-hero p { max-width: none; }

/* ---------- console overview ---------- */
.attention { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 2rem; align-items: start; color: #f6ece6; }
@media (max-width: 1000px) { .attention { grid-template-columns: 1fr; } }
.attention h2 { font-family: var(--font-display); font-size: var(--fs-xl); margin: .2rem 0 .6rem; }
.attention .muted { color: #e2c9c3; }
.attention .kicker { color: #fca5a5 !important; }
.attention.calm .kicker { color: #6ee7b7 !important; }
.attention.calm .pulse { background: #34d399; }
.attention.alarm .pulse, .attention.busy .pulse { background: #f87171; animation-name: pulse-red; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(248,113,113,.6); } 70% { box-shadow: 0 0 0 .5rem rgba(248,113,113,0); } 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); } }
.attention.alarm { box-shadow: 0 0 0 1px rgba(248,113,113,.45), 0 20px 60px -25px rgba(248,113,113,.5); }
.att-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; position: relative; z-index: 1; }
@media (max-width: 640px) { .att-lists { grid-template-columns: 1fr; } }
.att-lists h3 { margin: 0; font-size: var(--fs-md); }
.att-lists a { color: var(--link); }
.att-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .4rem; }
.att-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .7rem; border-radius: var(--r-sm); background: rgba(0,0,0,.28); }
.att-list li b { margin-left: auto; }
.kpi-strip > div { display: grid; gap: .15rem; align-content: start; }
.kpi-strip svg { margin-top: .3rem; }
.trend-wall { margin-top: 1rem; }
.trend-wall h2, .actions-log h2 { font-family: var(--font-display); }
.trend-wall .charts { gap: 0; border-top: 1px solid var(--line); }
.trend-wall .panel { background: none; border: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.trend-wall .panel::before { display: none; }
.actions-log { margin-top: 2rem; }

/* ---------- open sections ---------- */
/* Sections are not boxed: a rule and space set them apart, so a page reads
   as one piece. Only stages and notices keep a box. */
.panel { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 1.5rem 0 .75rem; box-shadow: none; }
.panel.replay, .panel#live, .panel.gate, .panel.invite, .panel.hold-notice, .panel.status-overall { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem 1.4rem; }
.panel > h2:first-child, .panel > .panel-head:first-child h2 { font-family: var(--font-display); }
.panel > .table-wrap { margin: 0; }
.tick.win .tick-k { color: var(--gold); }
/* Bands sit in the page's width (no full bleed: nothing may overflow). */
.dev-band, .proof-band { margin: 2.5rem 0 2rem; padding: 2rem clamp(1rem, 3vw, 2.5rem); border: 1px solid var(--line); border-radius: var(--r-lg); }
@media (max-width: 900px) { .dev-grid { grid-template-columns: minmax(0, 1fr); } }
.dev-band .kicker { color: var(--link) !important; }
/* The degen is dark in both themes: status pills on it keep their dark colours. */
.hero .pill.done { color: #d7dee6; background: rgba(255,255,255,.12); }
.hero .pill.live { color: #6ee7b7; background: rgba(52,211,153,.16); }
.hero .pill.wait { color: #fcd34d; background: rgba(251,191,36,.16); }
.hero .pill.lose { color: #fca5a5; background: rgba(248,113,113,.16); }
.hero .pill.win { color: #86efac; background: rgba(74,222,128,.16); }
.hero .pill.info { color: #93c5fd; background: rgba(96,165,250,.16); }
.att-lists > div { min-width: 0; }
.att-list li > * { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .att-lists { grid-template-columns: minmax(0, 1fr); } }
.hero .pill { background: rgba(0,0,0,.32); }
.hero .pill.done { color: #f1f5f9; background: rgba(0,0,0,.32); }
.hero .pill.live { color: #a7f3d0; background: rgba(0,0,0,.32); }
.hero .pill.wait { color: #fde68a; background: rgba(0,0,0,.32); }
.hero .pill.lose { color: #fecaca; background: rgba(0,0,0,.32); }
.profile-hero { background-color: var(--baize-base); }
.profile-hero .who { flex-wrap: wrap; }
.profile-hero .who > div { min-width: 0; }
.form-strip { flex-wrap: wrap; }
.help-card .kicker { color: var(--link) !important; }
.profile-hero .tag.hot { color: #fecaca; background: rgba(0,0,0,.32); }
.profile-hero .tag.house { color: #bfdbfe; background: rgba(0,0,0,.32); }
.badge-tile .prog { font-size: var(--fs-xs); color: var(--muted); }
.badge-tile.special.earned { border-color: rgba(167,139,250,.6); background: linear-gradient(160deg, rgba(167,139,250,.18), transparent 60%), var(--bg-2); }
.badge-tile.special.earned .glyph { background: radial-gradient(circle at 35% 30%, #ede9fe, #a78bfa 60%, #5b21b6); color: #1e1035; box-shadow: 0 0 14px rgba(167,139,250,.5); }
.badge-admin { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0; }
.badge-admin > li { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.badge-head { display: flex; align-items: flex-start; gap: .8rem; }
.badge-head .glyph { width: 2.2rem; height: 2.2rem; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; background: var(--surface-2); color: var(--accent); }
.badge-head .what { flex: 1; display: grid; gap: .1rem; min-width: 0; }
.awards { margin: .6rem 0 0 3rem; }
.awards h4 { margin: 0 0 .3rem; font-size: var(--fs-sm); }
.award-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .3rem; }
.award-list li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.more-badges { margin-top: .75rem; }
.more-badges summary { cursor: pointer; color: var(--link); font-weight: 600; margin-bottom: .6rem; }
.mini-form { display: inline-flex; gap: 2px; }
.mini-form i { font-style: normal; font-size: .62rem; font-weight: 700; width: 1rem; height: 1rem; display: grid; place-items: center; border-radius: 3px; }
.mini-form .win { background: var(--win-bg); color: var(--win); }
.mini-form .loss { background: var(--lose-bg); color: var(--lose); }
.mini-form .draw { background: var(--done-bg); color: var(--done); }
.waited { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- phones and tablets ---------- */
/* The console's sidebar: its body is part of it on wide screens; below
   1024px it is a drawer under a top bar. The sidebar scrolls when the
   window is shorter than the navigation. */
.side-body { display: contents; }
.menu-btn, .menu-search { display: none; }
.sidebar { overflow-y: auto; }
/* Prose in tables wraps; codes and figures stay on one line. */
.table-wrap td.wrap, .table-wrap td.rules, .table-wrap td.changed, .table-wrap td.betting, .table-wrap td.detail { white-space: normal; }
/* Times beside text never shrink into pieces. */
.feed .when, .note-meta .when, .tile .side, .feed li .seq, .award-list .when, time { white-space: nowrap; }
.feed li > :not(.seq):not(.when) { min-width: 0; overflow-wrap: anywhere; }
/* Tab rows and pill groups: one row that scrolls sideways, never a capsule
   that breaks into lines. */
.seg-links { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-links::-webkit-scrollbar { display: none; }
.seg-links a { white-space: nowrap; flex: none; }
.seg-links:not(:has(a)) { display: none; }
.filter-groups > *, .filter-group { min-width: 0; max-width: 100%; }
.filter-group .seg-links { min-width: 0; }
/* The ticker fades out at both edges, whether it runs or not. */
.ticker { mask-image: linear-gradient(90deg, transparent, #000 1.25rem, #000 calc(100% - 1.25rem), transparent); }
/* Short pages keep the footer at the bottom of the window. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > .page, body > .console { flex: 1 0 auto; width: 100%; }
/* A checkbox stays beside its label. */
.choice { flex-wrap: nowrap; align-items: flex-start; }
.choice > input[type=checkbox], .choice > input[type=radio] { flex: none; margin-top: .2rem; }
.panel-head h2, .panel-head h3, .incident-head h3 { min-width: 0; }

@media (max-width: 1024px) {
  .console { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; overflow: visible; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: .5rem;
    padding: .55rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0; margin-right: auto; min-width: 0; font-size: 1.05rem; }
  .sidebar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar .brand img { width: 28px; height: 28px; }
  .menu-btn, .menu-search { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 40px; border-radius: var(--r-pill); border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); font: 600 var(--fs-sm) var(--font-ui); cursor: pointer; }
  .menu-btn { padding: 0 1rem; }
  .menu-search { width: 40px; font-size: 1.15rem; text-decoration: none; }
  .menu-search:hover { text-decoration: none; border-color: var(--accent); }
  .menu-icon { width: 14px; height: 10px; border-block: 2px solid currentColor; position: relative; }
  .menu-icon::after { content: ""; position: absolute; left: 0; right: 0; top: 2px; border-top: 2px solid currentColor; }
  .menu-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
  .side-body { display: none; }
  .side-body.open { display: flex; flex-direction: column; gap: 1.1rem; position: fixed; inset: 3.6rem 0 0 0; z-index: 29; overflow-y: auto; overscroll-behavior: contain;
    padding: 1rem 1rem 2rem; background: #160a0c; border-top: 1px solid var(--line); }
  .side-body.open .sidenav { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1rem 1.5rem; }
  .side-body.open .navgroup { display: block; }
  .side-body.open .navgroup h2 { margin: 0 .6rem .35rem; }
  .side-body.open .navgroup a { min-height: 44px; }
  .side-body.open .side-search { margin: 0; }
  .side-body.open .side-search input { min-height: 44px; }
  .side-body.open .who-admin { margin-top: 0; flex-basis: auto; }
  .menu-open, .menu-open body { overflow: hidden; }
  .face-admin .page { padding: 1.25rem 1.25rem 2rem; }
  dl.facts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
  .filters .field { flex: 1 1 11rem; }
  /* Wide tables at tablet width: a shadow says there is more to the side. */
  .table-wrap { background:
      linear-gradient(90deg, var(--bg) 30%, transparent) left / 2rem 100% no-repeat local,
      linear-gradient(270deg, var(--bg) 30%, transparent) right / 2rem 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .45), transparent) left / .9rem 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .45), transparent) right / .9rem 100% no-repeat scroll; }
  .home-board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; }
  .home-board > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  /* Public header: one compact row (brand, theme, account), the sections
     on a scrolling row under it; it does not follow the page down. */
  .topbar { position: relative; flex-wrap: wrap; gap: .5rem .5rem; padding: .55rem 1rem .4rem; }
  .topbar .brand { font-size: 1.05rem; margin-right: auto; }
  .topbar .brand img { width: 28px; height: 28px; }
  .sidebar .brand { font-size: .95rem; gap: .45rem; }
  .theme-switch { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .theme-switch .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .topbar [data-sign-out] { display: none; }
  .account-chip { min-height: 40px; max-width: 9.5rem; }
  .account-chip .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar [data-sign-in] { min-height: 40px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem .15rem; gap: .15rem;
    mask-image: linear-gradient(90deg, transparent, #000 1rem, #000 calc(100% - 1rem), transparent); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { min-height: 40px; display: inline-flex; align-items: center; }
  .ticker-track { padding: .4rem 1rem; }
  footer.site { flex-wrap: wrap; text-align: center; padding: 1.75rem 1rem; }
  .section-head { margin: 1.75rem 0 .75rem; }
  .home-board { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; margin-top: 1.25rem; }
  .home-board > :last-child:nth-child(odd) { grid-column: auto; }
  .hero .actions .btn { flex: 1 1 auto; justify-content: center; }
  .featured-table .table-baize { min-height: 11rem; }
  .table-baize.idle { min-height: 9rem; }
  /* Figures: two or three to a row, rules between rows, no stray dividers. */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel .stat, .hero .stat { border-left: 0; padding: .5rem .25rem; }
  .stats .stat .v { font-size: var(--fs-lg); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { padding: .75rem .8rem; }
  .kpi .v { font-size: 1.25rem; }
  .statline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statline > div { border-right: 0; border-bottom: 1px solid var(--line); padding: .7rem .5rem; }
  .statline > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .statline > div:nth-last-child(-n+2):nth-child(odd), .statline > div:last-child { border-bottom: 0; }
  .statline dd { font-size: var(--fs-lg); }
  .status-grid li, .purse { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-grid li:last-child, .purse:last-of-type { border-bottom: 0; }
  dl.facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
  dl.facts > div:has(code), dl.facts dd:has(> code) { grid-column: 1 / -1; }
  /* Filters: each field full width, the button under them. */
  .filters { padding: .8rem; gap: .6rem; }
  .filters .field { flex: 1 1 100%; }
  .filters .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
  form.search { flex-wrap: wrap; }
  form.search input { max-width: none; flex: 1 1 12rem; min-height: 44px; }
  /* Code: the copy button above the code, not on it. */
  .copy-wrap pre { padding-right: 1rem; padding-top: 2.6rem; }
  pre { font-size: .78rem; padding: .8rem; }
  /* Chart labels: every other one, so they can be read. */
  .bar-chart .x-axis span:nth-child(even) { visibility: hidden; }
  .bar-chart { grid-template-rows: 7.5rem auto; }
  /* Account and profile. */
  .side-menu { position: sticky; top: 0; z-index: 5; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: .5rem 0; background: var(--bg); min-width: 0; }
  .side-menu::-webkit-scrollbar { display: none; }
  .side-menu a { flex: none; white-space: nowrap; }
  .account-hero, .profile-hero { padding: 1.25rem; }
  .account-hero h1, .profile-hero h1 { font-size: clamp(1.4rem, 7vw, var(--fs-2xl)); }
  .purse b { font-size: var(--fs-xl); }
  .name-form, .referrer-form { max-width: none; }
  /* Game pages: the art small beside nothing, facts two to a row. */
  .game-hero-art svg { max-width: 8.5rem; }
  .preset-money, .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 1rem; }
  /* Match result: the two cards side by side, vs between them. */
  .faceoff { flex-direction: row; flex-wrap: nowrap; align-items: stretch; gap: 1.75rem; }
  .faceoff li { flex: 1 1 0; min-width: 0; padding: .9rem .5rem .7rem; }
  .faceoff li + li::before { left: -.875rem; top: 50%; }
  .faceoff .avatar { width: 56px; height: 56px; }
  .faceoff b { font-size: var(--fs-lg); }
  .browser-check .panel-head { flex-wrap: wrap; }
  .browser-check .panel-head h3 { flex: 1 1 100%; overflow-wrap: anywhere; }
  .live-grid { gap: 1rem; }
  .feed { max-height: 18rem; }
  /* Badges in the console: no indent on a phone. */
  .awards { margin-left: 0; }
  .status-big b { font-size: var(--fs-xl); }
  .status-big { align-items: flex-start; }
  .status-big .beacon { margin-top: .35rem; }
}

/* Touch-sized controls on phones and on any touch screen. */
@media (max-width: 760px), (pointer: coarse) {
  .btn.small { min-height: 40px; padding: .45rem .95rem; font-size: var(--fs-sm); }
  .seg a, .seg button { min-height: 36px; display: inline-flex; align-items: center; padding: .3rem .8rem; }
  .seg-links a { min-height: 36px; display: inline-flex; align-items: center; }
  button.copy { min-height: 32px; padding: .3rem .85rem; }
  .help-btn { width: 1.6rem; height: 1.6rem; font-size: .78rem; }
  input[type=checkbox], input[type=radio] { width: 1.2rem; height: 1.2rem; }
  details > summary { min-height: 40px; display: flex; align-items: center; }
  .moves-list summary { display: block; }
  .faq-item summary { min-height: 0; }
  .iconbtn { width: 42px; height: 42px; }
  .form-strip li { width: 1.5rem; height: 1.5rem; }
}

/* Phones: a table's rows become labelled blocks (labels from the header,
   `ui.labelCells`). It is the table's own width that decides (the
   wrapper is a size container): a narrow column on a wide screen stacks
   too, and wide tables stack sooner. */
@container (max-width: 40rem) {
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td, .table-wrap tbody th { display: block; width: auto; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .table-wrap tbody tr:last-child { border-bottom: 0; }
  .table-wrap tbody tr:hover td { background: none; }
  .table-wrap td, .table-wrap tbody th, .table-wrap table.board td, .table-wrap table.ledger td, .table-wrap table.hands td { position: relative; border: 0; padding: .2rem 0 .2rem 40%; min-height: 1.6rem; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .table-wrap td.r { text-align: left; }
  .table-wrap td::before { content: attr(data-label); position: absolute; left: 0; top: .25rem; width: 37%; color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
  .table-wrap td:not([data-label]) { padding-left: 0; }
  .table-wrap td:first-child, .table-wrap tbody th:first-child { padding-left: 0; font-weight: 600; font-size: var(--fs-md); margin-bottom: .2rem; }
  .table-wrap td:first-child::before { display: none; }
  .table-wrap td:empty { display: none; }
  .table-wrap td.changed, .table-wrap td.wrap, .table-wrap td.rules { min-width: 0; max-width: none; }
  .table-wrap td:not([data-label]):has(.btn, button, form, .act, input, select) { padding-top: .5rem; }
  .table-wrap td .act, .table-wrap td .row-moderate, .table-wrap td .reason { justify-content: flex-start; flex-wrap: wrap; }
  .table-wrap td .reason input, .table-wrap td .row-moderate input { min-width: 0; width: auto; max-width: none; flex: 1 1 10rem; }
  .table-wrap td code { overflow-wrap: anywhere; }
  .table-wrap td.cards { white-space: normal; }
  .table-wrap tr.edit-row > td, .table-wrap tr.preset-edit-row > td { padding: .5rem 0; }
  .table-wrap tr.edit-row .form, .table-wrap tr.preset-edit-row .form { position: static; width: auto; }
  .table-wrap .ci-bar { width: 90px; }
  .table-wrap .op td.wrap { min-width: 0; }
  .table-wrap table.hands .betting { min-width: 0; width: auto; }
}
@container (max-width: 56rem) {
  table:is(.settings, .preset-table, .hands, .ledger), table:is(.settings, .preset-table, .hands, .ledger) > tbody, table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr, table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td { display: block; width: auto; }
  table:is(.settings, .preset-table, .hands, .ledger) > thead { display: none; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr:last-child { border-bottom: 0; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td { position: relative; border: 0; padding: .2rem 0 .2rem 40%; min-height: 1.6rem; white-space: normal; overflow-wrap: anywhere; text-align: left; background: none; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td::before { content: attr(data-label); position: absolute; left: 0; top: .25rem; width: 37%; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td:not([data-label]) { padding-left: 0; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td:first-child { padding-left: 0; font-weight: 600; font-size: var(--fs-md); margin-bottom: .2rem; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td:first-child::before { display: none; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td:empty { display: none; }
  table:is(.settings, .preset-table, .hands, .ledger) > tbody > tr > td { min-width: 0; max-width: none; }
}
@media (max-width: 640px) { .table-wrap { overflow-x: visible; background: none; } }

@media (max-width: 860px) {
  .side-menu { position: static; display: flex; gap: .3rem; }
  .side-menu a { border: 1px solid var(--line); border-radius: var(--r-pill); padding: .3rem .8rem; }
}
@media (max-width: 760px) {
  .side-menu { position: sticky; top: 0; }
  .side-menu a { min-height: 40px; display: inline-flex; align-items: center; }
  /* Three short figures stay on one row. */
  .statline.home-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .statline.home-counts > div { border-bottom: 0; border-right: 1px solid var(--line); padding: .7rem .6rem; }
  .statline.home-counts > div:last-child { border-right: 0; }
  .statline.home-counts dt { font-size: .62rem; letter-spacing: .05em; }
}
@container (max-width: 40rem) {
  /* Leaderboards: rank and player share the row's title line. */
  table.board td:first-child { display: inline-block; padding: 0 .5rem 0 0; margin: 0; }
  table.board td:nth-child(2) { display: inline-block; padding: 0; font-weight: 600; margin-bottom: .3rem; }
  table.board td:nth-child(2)::before { display: none; }
}

@media (max-width: 760px) {
  /* API reference: an operation is its head and summary until opened. */
  .op { padding: .9rem 1rem; }
  .op:not(.open):not(:target) > :not(.op-head):not(:nth-child(2)) { display: none; }
  .op-head[role=button] { cursor: pointer; }
  .op-head[role=button]::after { content: "▾"; color: var(--muted); transition: transform var(--t-fast); }
  .op.open > .op-head::after, .op:target > .op-head::after { transform: rotate(180deg); }
  .op-head .op-anchor { margin-left: auto; min-width: 32px; text-align: center; }
  .op > p:nth-child(2) { margin-top: .4rem; }
  .try-form label { display: grid; width: 100%; }
  .try-form input { width: 100%; }
  .api-nav { gap: .25rem .75rem; }
  ol.steps.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
}
