/* 3C Arena — shared styles. Dark is the base theme; light exists only behind the toggle. */

:root {
  --bg: #070d16;
  --surface: #0e1827;
  --surface-2: #142236;
  --line: #1d2c42;
  --ink: #f2f5f9;
  --ink-soft: #8d9db2;
  --accent: #e9b44c;
  --accent-hi: #f6cd77;
  --on-accent: #1a1204;
  --link: #6db3ff;
  --cloth-far: #061427;
  --cloth-near: #0f3f78;
  --hero-fade: 7, 13, 22;
  --red: #e2604f;
  --coin: #e9b44c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 12px;
  --wrap: 1160px;

  --display: "Montserrat", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --script: "Dancing Script", "Snell Roundhand", cursive;
}

:root[data-theme="light"] {
  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #e9eff8;
  --line: #d7e0ed;
  --ink: #0c1a2d;
  --ink-soft: #5a6a80;
  --accent: #1668dc;
  --accent-hi: #0f55ba;
  --on-accent: #ffffff;
  --link: #1668dc;
  --cloth-far: #a9cbf3;
  --cloth-near: #3f86d9;
  --hero-fade: 242, 245, 250;
  --red: #c4402f;
  --coin: #a9761a;
  --shadow: 0 8px 24px rgba(12, 26, 45, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
/* An element that sets its own display (a .btn is inline-flex) would otherwise ignore the hidden attribute. */
[hidden] { display: none !important; }
a { color: var(--link); }

h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.1; text-wrap: balance; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.section { padding-block: 34px 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; }
.section-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: .95rem; }
.more { color: var(--link); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.more:hover { text-decoration: underline; }

/* ---------- header ---------- */

.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: rgba(var(--hero-fade), .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font: 800 1.2rem/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand svg { width: 34px; height: 30px; flex: none; }
.brand i { color: var(--accent); font-style: normal; }
/* The 3C Arena logo, without its "Billiards Redefined" line: at header size that line is a smear. Gold and
   silver on the dark header; the light one gets a soft shade under it, or the silver ARENA fades into the white. */
.brand-logo { display: block; height: 36px; width: auto; }
:root[data-theme="light"] .brand-logo { filter: drop-shadow(0 1px 1.2px rgba(12, 26, 45, .45)); }
@media (max-width: 560px) { .brand-logo { height: 30px; } }
.nav { display: flex; gap: 26px; margin-inline: auto; }
.nav a { color: var(--ink-soft); text-decoration: none; font: 600 .88rem/1 var(--display); padding-block: 8px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.head-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); cursor: pointer; font-size: .95rem; line-height: 1;
}
.theme-toggle:hover { color: var(--ink); }
/* Light / Dark / System, per the v2 design handoff. The button keeps its place in the header and
   app.js upgrades it in place into a menu, so every page gets the control without new markup. */
.theme-wrap { position: relative; display: inline-flex; }
.theme-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 178px; padding: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow);
  display: grid; gap: 2px;
}
.theme-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink);
  font: 600 .86rem/1 var(--display); text-align: left; cursor: pointer;
}
.theme-menu button:hover { background: var(--surface-2); }
.theme-menu button[aria-checked="true"] { color: var(--accent); }
.theme-menu .tick { margin-left: auto; visibility: hidden; }
.theme-menu button[aria-checked="true"] .tick { visibility: visible; }
/* Wallet balance, shown beside the profile chip once GET /v1/me confirms the session. */
.coin-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font: 700 .82rem/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums;
}
.coin-chip img { width: 16px; height: 16px; flex: none; display: block; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang a, .lang span { padding: 11px 12px; font: 700 .72rem/1 var(--display); color: var(--ink-soft); text-decoration: none; }
.lang a:hover { color: var(--ink); }
.lang [aria-current="true"] { background: var(--surface-2); color: var(--ink); }
/* A signed-in visitor sees this instead of the Sign In button (.head-actions script swaps them). */
.profile-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font: 700 .82rem/1 var(--display); color: var(--ink); text-decoration: none;
}
.profile-chip:hover { border-color: var(--accent); }
.profile-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--surface-2); color: var(--ink-soft); display: grid; place-items: center;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 560px) { .head-actions .btn, .head-actions .profile-chip, .head-actions .coin-chip { display: none; } }
@media (max-width: 800px) {
  .nav { order: 3; width: 100%; margin: 0; gap: 20px; overflow-x: auto; padding-bottom: 6px; }
  .nav a { white-space: nowrap; }
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 8px; border: 1px solid transparent;
  font: 700 .92rem/1 var(--display); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
/* The browser game is for computers (a mouse that can hover); phones and tablets are sent to the app. */
.for-desktop { display: none; }
@media (hover: hover) and (pointer: fine) {
  .for-desktop { display: inline-flex; }
  .for-touch { display: none; }
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-ghost { background: rgba(var(--hero-fade), .55); border-color: var(--ink-soft); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-small { padding: 9px 16px; font-size: .82rem; }
.btn-outline { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- hero ---------- */

.hero {
  --hero-fade: 7, 13, 22; --ink: #f2f5f9; --ink-soft: #a9b6c7; --accent: #e9b44c; --accent-hi: #f6cd77; --on-accent: #1a1204;
  color: var(--ink); background: #05080e;
  position: relative; overflow: hidden; min-height: clamp(380px, 46vw, 470px); display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 72% 50%; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(var(--hero-fade), .96) 0%, rgba(var(--hero-fade), .82) 30%, rgba(var(--hero-fade), 0) 62%);
}
.hero .wrap { position: relative; z-index: 2; padding-block: 44px; }
.eyebrow { font: 600 .74rem/1 var(--display); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
.hero h1 { font-size: clamp(3rem, 8.4vw, 5.6rem); font-weight: 800; letter-spacing: -.01em; margin-top: 14px; }
.hero h1 span { color: var(--accent); }
.hero .tagline { font: 800 clamp(.95rem, 2vw, 1.25rem)/1.2 var(--display); letter-spacing: .02em; text-transform: uppercase; margin: 10px 0 0; }
.hero .sub { color: var(--ink-soft); margin: 10px 0 0; font-size: 1.02rem; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.flourish {
  position: absolute; z-index: 2; right: clamp(16px, 5vw, 70px); bottom: 34px; transform: rotate(-9deg);
  font: 700 clamp(1.4rem, 2.6vw, 2.1rem)/1.05 var(--script); color: var(--ink); text-align: center; opacity: .92;
}
.flourish i { display: block; height: 3px; width: 70%; margin: 8px auto 0; border-radius: 3px; background: var(--accent); }
@media (max-width: 720px) {
  .hero { flex-direction: column; align-items: stretch; min-height: 0; }
  .hero .wrap { order: 1; padding-block: 30px 6px; }
  .hero picture { order: 2; display: block; }
  .hero-art { position: relative; inset: auto; flex: none; height: 230px; display: block; object-position: 74% 60%; }
  .hero::after { background: linear-gradient(180deg, rgb(var(--hero-fade)) 0, rgb(var(--hero-fade)) calc(100% - 232px), rgba(var(--hero-fade), 0) calc(100% - 150px)); }
  .flourish { display: none; }
}

/* ---------- live figures ---------- */

.figures { background: var(--surface); border-bottom: 1px solid var(--line); }
.figures .wrap { display: grid; grid-template-columns: repeat(4, 1fr); }
.figure { display: flex; align-items: center; gap: 14px; padding: 20px 10px; }
.figure + .figure { border-left: 1px solid var(--line); padding-left: 26px; }
.figure svg { width: 34px; height: 34px; flex: none; color: var(--ink-soft); }
.figure b { display: block; font: 800 1.35rem/1.1 var(--display); }
.figure span { color: var(--ink-soft); font-size: .8rem; line-height: 1.3; text-wrap: balance; }
@media (max-width: 760px) {
  .figures .wrap { grid-template-columns: repeat(2, 1fr); }
  .figure + .figure { border-left: 0; padding-left: 10px; }
  .figure { padding-block: 14px; }
}

/* ---------- mode cards ---------- */

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 980px) { .modes { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .modes { grid-template-columns: 1fr; } }
.mode {
  position: relative; overflow: hidden; min-height: 150px; border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  color: #fff; text-decoration: none; border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(5, 12, 24, .88) 0%, rgba(5, 12, 24, .45) 48%, rgba(5, 12, 24, 0) 78%),
    linear-gradient(0deg, rgba(5, 12, 24, .55) 0%, rgba(5, 12, 24, 0) 55%),
    var(--img) 88% center / cover no-repeat, #0c2748;
  transition: transform .15s ease, border-color .15s ease;
}
.mode:hover { transform: translateY(-2px); border-color: var(--accent); }
.mode svg.icon { position: absolute; top: 16px; left: 18px; width: 30px; height: 30px; }
.mode h3 { color: #fff; }
.mode small { color: rgba(255, 255, 255, .72); font-size: .82rem; }
.mode .go {
  position: absolute; right: 14px; bottom: 14px; width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center; background: rgba(4, 12, 24, .7); border: 1px solid rgba(255, 255, 255, .25); font-size: .9rem;
}

/* ---------- panels ---------- */

.duo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 900px) { .duo { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; padding: 16px 18px 12px; }
.panel-body { padding: 0 18px 16px; }
.queue-status { color: var(--ink-soft); font-size: .82rem; margin: -6px 0 12px; }

.tabs { display: flex; gap: 6px; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft); cursor: pointer;
  font: 600 .74rem/1 var(--display); padding: 7px 11px; border-radius: 999px; white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

table.board { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.board th { text-align: left; color: var(--ink-soft); font: 600 .7rem/1 var(--display); letter-spacing: .08em; padding: 8px 0; }
table.board td { padding: 9px 0; border-top: 1px solid var(--line); }
table.board td.rank { width: 44px; }
table.board td.score { text-align: right; font: 700 .93rem/1 var(--display); font-variant-numeric: tabular-nums; }
.medal { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; font: 700 .74rem/1 var(--display); color: var(--ink-soft); }
.medal.m1 { background: #e9b44c; color: #1a1204; }
.medal.m2 { background: #b8c2cf; color: #10202f; }
.medal.m3 { background: #c98a4f; color: #1d0f03; }
.empty { color: var(--ink-soft); font-size: .92rem; padding: 14px 0; }

/* ---------- mini calculator ---------- */

.mini { display: grid; grid-template-columns: 1fr auto; gap: 18px 22px; align-items: center; }
.mini .sliders { display: grid; gap: 14px; }
.slider label { display: flex; justify-content: space-between; font: 600 .8rem/1 var(--display); color: var(--ink-soft); margin-bottom: 8px; }
.slider label b { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.aim { text-align: center; min-width: 110px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); }
.aim span { display: block; font: 600 .68rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.aim b { display: block; font: 800 2.5rem/1.1 var(--display); color: var(--accent); }
.aim em { font: 500 .78rem/1 var(--body); font-style: normal; color: var(--ink-soft); }
@media (max-width: 480px) { .mini { grid-template-columns: 1fr; } }

/* ---------- balls (avatars, seat markers) ---------- */

.ball-ivory { background: radial-gradient(circle at 34% 28%, #fff 0, #f3eee0 30%, #b9b29f 72%, #6d6757 100%); }
.ball-yellow { background: radial-gradient(circle at 34% 28%, #fff3b8 0, #f0bb3d 38%, #aa761b 78%, #5b3e0d 100%); }
.ball-red { background: radial-gradient(circle at 34% 28%, #ffb0a2 0, #dc4533 38%, #8d2014 78%, #4b0f08 100%); }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { color: var(--accent); text-decoration: underline; }

/* ---------- home: signed-in dashboard (real data only — assets/app.js) ---------- */

#dashboard .section-head .pill { background: var(--surface-2); color: var(--accent); margin-right: 6px; }
#dashboard .section-head #dash-rating { color: var(--ink-soft); font-size: .95rem; }

.badge.streak { background: var(--surface-2); color: var(--accent); }
.claimed-note { color: var(--accent); font-weight: 700; font-size: .88rem; margin: 0 0 10px; }
.mission-list { list-style: none; margin: 0; padding: 0; }
.mission-row { display: grid; gap: 6px; padding: 12px 2px; border-top: 1px solid var(--line); }
.mission-row:first-child { border-top: 0; padding-top: 0; }
.mission-text { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .92rem; }
.mission-title { font-weight: 700; }
.mission-frac { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.mission-reward { color: var(--ink-soft); font-size: .8rem; }
.mission-row.done .mission-reward { color: var(--accent); font-weight: 700; }

/* ---------- home: three panels, and the recent matches list ---------- */

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1000px) { .trio { grid-template-columns: repeat(2, 1fr); } .trio > :last-child { grid-column: 1 / -1; } }
@media (max-width: 640px) { .trio { grid-template-columns: 1fr; } }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { border-top: 1px solid var(--line); }
.recent li:first-child { border-top: 0; }
.recent a { display: grid; grid-template-columns: 1fr auto 1fr; gap: 2px 10px; align-items: center; padding: 10px 0; color: inherit; text-decoration: none; font-size: .93rem; }
.recent a:hover .who { text-decoration: underline; }
.recent .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent a > :nth-child(3) { text-align: right; }
.recent .who.won { color: var(--accent); font-weight: 700; }
.recent b { font: 800 1rem/1 var(--display); }
.recent time { grid-column: 1 / -1; color: var(--ink-soft); font-size: .78rem; text-align: center; }
.recent .empty { color: var(--ink-soft); font-size: .92rem; padding: 14px 0; }

/* ---------- player profile ---------- */

#profile .empty, #replay .empty, #tournament .empty { padding: 70px 0; text-align: center; color: var(--ink-soft); }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding-block: 34px 18px; }
.profile-head .btn { margin-left: auto; flex-shrink: 0; }
.profile-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; overflow-wrap: anywhere; }
.profile-head .meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 8px 0 0; color: var(--ink-soft); font-size: .92rem; }
.pill { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); font: 700 .78rem/1 var(--display); padding: 7px 11px; border-radius: 999px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; flex: none; box-shadow: 0 8px 14px rgba(0, 0, 0, .4); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 800px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font: 800 1.7rem/1.1 var(--display); }
.tile span { color: var(--ink-soft); font-size: .8rem; }
.tile.accent b { color: var(--accent); }
.recent-title { margin: 32px 0 10px; font-size: 1.2rem; }

/* ---------- tournament bracket ---------- */

.enter-row { margin: 0 0 24px; }
.bracket { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 14px; margin-bottom: 20px; }
.b-round { flex: 0 0 220px; display: grid; gap: 14px; align-content: start; }
.b-round h3 { font: 700 .78rem/1 var(--display); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.b-match { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; display: grid; }
.b-seat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; font-size: .92rem; overflow-wrap: anywhere; }
.b-seat + .b-seat { border-top: 1px solid var(--line); }
.b-seat.winner { font-weight: 700; color: var(--accent); }
.b-seat .bye { color: var(--ink-soft); font-style: italic; }
.b-seat .you { color: var(--ink-soft); font-size: .74rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; flex: none; }

#dash-tournament-meta { color: var(--ink-soft); font-size: .92rem; margin: 0 0 12px; }
.match-list { list-style: none; margin: 0 0 30px; padding: 0; }
.match-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 2px; border-top: 1px solid var(--line); }
.match-row.empty { color: var(--ink-soft); }
.badge { font: 700 .74rem/1 var(--display); padding: 7px 11px; border-radius: 999px; min-width: 58px; text-align: center; }
.badge.won { background: var(--accent); color: var(--on-accent); }
.badge.lost { border: 1px solid var(--line); color: var(--ink-soft); }
.match-row .opp { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; }
.match-row .score { font: 800 1.05rem/1 var(--display); }
.delta { font: 700 .86rem/1 var(--display); }
.delta.up { color: var(--accent); }
.delta.down { color: var(--red); }
.match-row .when { color: var(--ink-soft); font-size: .82rem; }
.match-row .when.online { color: var(--accent); font-weight: 700; }
.watch { margin-left: auto; font: 700 .8rem/1 var(--display); color: var(--accent); text-decoration: none; border: 1px solid var(--accent); padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.watch:hover { background: var(--accent); color: var(--on-accent); }
/* Your own profile: this week's missions, and the history with its Matches / Past seasons tabs. */
.recent-title .badge.streak { margin-left: 10px; vertical-align: middle; }
.mission { padding: 12px 2px; border-top: 1px solid var(--line); }
.mission-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mission-top span { color: var(--ink-soft); font-size: .85rem; font-variant-numeric: tabular-nums; flex: none; }
.mission progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; margin-top: 8px; border: 0; border-radius: 999px; background: var(--surface-2); }
.mission progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.mission progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.mission progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.history-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 32px; }
.history-head .recent-title { margin: 0; }
.history-head + .match-list, .history-head ~ .match-list { margin-top: 12px; }

/* ---------- match replay ---------- */

.scorebar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; padding-block: 26px 16px; }
.player { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; }
.player.right { flex-direction: row-reverse; text-align: right; }
.player.turn { background: var(--surface); border-color: var(--line); }
.player .info { display: flex; flex-direction: column; min-width: 0; }
.player .name { font: 700 1.02rem/1.25 var(--display); color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .name:hover { color: var(--accent); }
.player .rating { color: var(--ink-soft); font-size: .8rem; }
.player .score { font: 800 2.4rem/1 var(--display); margin-left: auto; }
.player.right .score { margin-left: 0; margin-right: auto; }
.player.won .score { color: var(--accent); }
.dot { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: 0 3px 6px rgba(0, 0, 0, .4); }
.dot.small { width: 12px; height: 12px; box-shadow: none; }
.mid { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-soft); font-size: .8rem; text-align: center; }
@media (max-width: 700px) {
  .scorebar { grid-template-columns: 1fr 1fr; }
  .mid { grid-column: 1 / -1; order: 3; flex-direction: row; gap: 4px 14px; flex-wrap: wrap; justify-content: center; }
  .player { padding: 8px; gap: 8px; }
  .player .rating { display: none; }   /* the name needs the width more; ratings are on the profile */
  .player > .dot { display: none; }
  .player .name { font-size: .92rem; }
  .player .score { font-size: 1.9rem; }
}
.replay-body { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: start; padding-bottom: 20px; }
@media (max-width: 900px) { .replay-body { grid-template-columns: 1fr; } }
.stage canvas { display: block; width: 100%; border-radius: 14px; box-shadow: var(--shadow); background: #0d3a70; }
.caption { margin: 12px 2px 0; font-size: .92rem; color: var(--ink-soft); min-height: 2.9em; }
.caption b { color: var(--ink); }
.caption .good { color: var(--accent); font-weight: 700; }
.caption .bad { color: var(--red); font-weight: 600; }
.caption .check { font-size: .84rem; }
.caption .check.ok { color: var(--accent); }
.caption .check.warn { color: var(--red); }
.controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ctl { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.ctl:hover { border-color: var(--ink-soft); }
.ctl svg { width: 20px; height: 20px; }
.ctl.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); width: 54px; }
.ctl.text { width: auto; padding: 0 14px; font: 700 .8rem/1 var(--display); }
.scrub { flex: 1 1 140px; min-width: 120px; accent-color: var(--accent); }
.shot-list { list-style: none; margin: 0; padding: 0; max-height: 580px; overflow: auto; position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
@media (max-width: 900px) { .shot-list { max-height: 300px; } }
.shot-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 500 .86rem/1 var(--body); cursor: pointer; text-align: left; }
.shot-item:hover { background: var(--surface-2); }
.shot-item[aria-current] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.shot-item .n { width: 36px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.shot-item .res.good { color: var(--accent); font-weight: 800; }
.shot-item .res.bad { color: var(--red); }
.shot-item .cush { color: var(--ink-soft); margin-left: auto; font-size: .78rem; }

/* ---------- improve banner ---------- */

.improve {
  position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px;
  padding: 24px clamp(18px, 3vw, 30px); color: #fff;
  background:
    linear-gradient(90deg, rgba(5, 12, 24, .92) 0%, rgba(5, 12, 24, .55) 38%, rgba(5, 12, 24, .1) 58%, rgba(5, 12, 24, .78) 100%),
    url(img/banner-improve.jpg) 100% 42% / 132% auto no-repeat, #0a1f3c;
}
.improve h2 { color: #fff; text-transform: uppercase; font-size: 1.15rem; letter-spacing: .02em; }
.improve p { margin: 4px 0 14px; color: #8fc1ff; font-size: .95rem; }
.improve .links { display: flex; gap: clamp(14px, 3vw, 34px); position: relative; z-index: 1; }
.improve .links a { display: grid; justify-items: center; gap: 8px; color: #fff; text-decoration: none; font: 600 .8rem/1 var(--display); padding-inline: 10px; }
.improve .links a + a { border-left: 1px solid rgba(255, 255, 255, .18); padding-left: clamp(14px, 3vw, 34px); }
.improve .links svg { width: 34px; height: 34px; }
.improve .links a:hover { color: var(--accent); }
.improve .btn-outline { border-color: #e9b44c; color: #e9b44c; }
.improve .btn-outline:hover { background: #e9b44c; color: #1a1204; }

/* ---------- get the game / beta signup ---------- */

.get {
  display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 22px clamp(18px, 3vw, 30px);
}
.get p { margin: 3px 0 0; color: var(--ink-soft); font-size: .93rem; }
.get-copy { flex: 1 1 220px; }
/* Google's badge, its own artwork at a size its brand rules allow; the line under it is their trademark notice. */
.get-store { display: inline-block; margin: 14px 0 8px; border-radius: 10px; }
.get-store img { display: block; height: 56px; width: auto; }
.get-store:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.beta-lede { margin: 0; font-weight: 600; color: var(--ink); }
.beta { flex: 1 1 380px; max-width: 520px; display: grid; gap: 12px; }
.platforms { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block; font: 600 .78rem/1 var(--display); padding: 9px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-soft); transition: background .12s ease, color .12s ease;
}
.chip:hover span { border-color: var(--ink-soft); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.beta-row { display: flex; gap: 10px; }
.beta-row input[type="email"] {
  flex: 1 1 auto; min-width: 0; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: 400 1rem/1.2 var(--body);
}
.beta-row input[type="email"]::placeholder { color: var(--ink-soft); opacity: .7; }
.beta-row input[type="email"]:focus { border-color: var(--accent); outline: none; }
.beta-row .btn { flex: none; }
/* Honeypot: off-screen rather than display:none, which some scripts skip. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.beta-msg { min-height: 1.3em; margin: 0; font-weight: 600; font-size: .92rem; }
.beta-msg.ok { color: var(--accent); }
.beta-msg.err { color: var(--red); }
.get .beta-fine { margin: 0; font-size: .8rem; color: var(--ink-soft); }
.beta-fine a { color: var(--ink-soft); }
.beta.done .platforms, .beta.done .beta-row { display: none; }
.beta.done .beta-msg { font-size: 1.05rem; }
@media (max-width: 520px) { .beta-row { flex-direction: column; } }

/* ---------- learn page ---------- */

.page-head { padding-block: 34px 6px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; }
.page-head .formula { font: 700 1.05rem/1 var(--display); color: var(--accent); margin: 10px 0 0; }
.calc { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
@media (max-width: 880px) { .calc { grid-template-columns: 1fr; } }
.calc .panel { padding: 18px; }
.calc .sliders { display: grid; gap: 20px; }
.result { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.result span { font: 600 .7rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.result b { font: 800 3rem/1 var(--display); color: var(--accent); }
.result em { font-style: normal; color: var(--ink-soft); font-size: .92rem; font-variant-numeric: tabular-nums; }
.warn { color: var(--red); font-size: .88rem; margin: 10px 0 0; }
.caption { color: var(--ink-soft); font-size: .82rem; margin: 10px 2px 0; }
.systems { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .systems { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .systems { grid-template-columns: 1fr; } }
.systems li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.systems b { font: 700 .92rem/1.2 var(--display); display: block; }
.systems code { font: 500 .82rem/1.3 var(--body); color: var(--ink-soft); display: block; margin-top: 4px; }
.systems a { display: block; color: inherit; text-decoration: none; }
.systems li:has(a:hover) { border-color: var(--accent); }

/* ---------- changelog ---------- */

.log { list-style: none; margin: 26px 0 0; padding: 0; }
.log li { display: grid; grid-template-columns: 150px 1fr; gap: 4px 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.log time { font: 600 .82rem/1.7 var(--display); color: var(--ink-soft); }
.prose .log h3 { margin: 0 0 4px; }   /* beats .prose h3's top margin */
.log p { margin: 0; color: var(--ink-soft); }
@media (max-width: 560px) { .log li { grid-template-columns: 1fr; } }

/* ---------- prose pages (legal, support) ---------- */

.prose { max-width: 70ch; padding-block: 34px 10px; }
.prose h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); font-weight: 800; margin-top: 8px; }
.prose h3 { margin-top: 26px; }
.prose ul { padding-left: 20px; }
.prose li { margin: 6px 0; }
.prose .lede, .prose .updated { color: var(--ink-soft); }
.prose .updated { font-size: .9rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .93rem; }
.prose th, .prose td { text-align: left; padding: 10px; border: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose .eyebrow { color: var(--accent); }

/* ---------- footer ---------- */

.site-foot { border-top: 1px solid var(--line); margin-top: 40px; background: var(--surface); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding-block: 20px; }
.site-foot .copy { color: var(--ink-soft); font-size: .84rem; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-left: auto; }
.site-foot nav a { color: var(--ink-soft); text-decoration: none; font-size: .84rem; }
.site-foot nav a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
