/* Quantrena
   Dark: black, a red grid that wakes up under the cursor, one big serif promise.
   Light: warm white, a black grid, black text. Red stays the colour of heat in both:
   rank, urgency, and you. Every colour below comes from the tokens in :root. */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0809;
  --ink: #f6f2f1;
  --ink-soft: #ecdfdc;
  --ash: #aca4a3;
  --smoke: #878080;
  --red: #ff3b3b;
  --red-ink: #ff5252;
  --red-deep: #d71f2b;
  --red-top: #ff4a4a;
  --red-glow: rgba(255, 48, 48, 0.5);
  --red-soft: rgba(255, 59, 59, 0.1);
  --red-edge: rgba(255, 90, 90, 0.45);
  --mint: #5fe3a1;
  --mint-soft: rgba(95, 227, 161, 0.1);
  --mint-edge: rgba(95, 227, 161, 0.35);
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.1);
  --edge: rgba(255, 255, 255, 0.08);
  --edge-2: rgba(255, 255, 255, 0.16);
  --edge-3: rgba(255, 255, 255, 0.32);
  --card: linear-gradient(180deg, #161112, #0e0b0c);
  --card-shadow: none;
  --glass: rgba(12, 9, 10, 0.6);
  --glass-2: rgba(13, 10, 11, 0.85);
  --menu: rgba(16, 12, 13, 0.97);
  --well: rgba(0, 0, 0, 0.42);
  --inset: rgba(0, 0, 0, 0.35);
  --shadow: rgba(0, 0, 0, 0.9);
  --backdrop: rgba(6, 4, 5, 0.62);
  --focus: #ffffff;
  --key-bg: linear-gradient(180deg, rgba(36, 27, 29, 0.95), rgba(20, 15, 16, 0.95));
  --key-edge: rgba(255, 255, 255, 0.07);
  --key-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 14px -8px rgba(0, 0, 0, 0.9);
  --key-op: #ffd6d0;
  --grid-line: rgba(255, 59, 59, 0.075);
  --grid-lit: rgba(255, 88, 88, 0.9);
  --grid-dot: rgba(255, 170, 170, 1);
  --glow: rgba(255, 40, 40, 0.17);
  --top-glow: rgba(255, 45, 45, 0.17);
  --side-glow: rgba(255, 45, 45, 0.06);
  --headline: linear-gradient(90deg, #ff3b3b 0%, #ffb0a6 30%, #fff3ef 50%, #ffb0a6 70%, #ff3b3b 100%);
  --date-grad: linear-gradient(180deg, #ffffff 30%, #ffc2ba 100%);
  --silver: linear-gradient(180deg, #ffffff, #b9b1b0);
  --bronze: rgba(246, 242, 241, 0.6);
  --pip: rgba(255, 255, 255, 0.14);
  --dot: rgba(255, 255, 255, 0.08);
  --dot-future: rgba(255, 255, 255, 0.035);
  --trail: rgba(255, 59, 59, 0.24);
  --hero-card: radial-gradient(90% 120% at 50% 0%, rgba(255, 50, 50, 0.18), transparent 70%);
  --pod1-bg: radial-gradient(130% 75% at 50% 0%, rgba(255, 55, 55, 0.32), transparent 62%), linear-gradient(180deg, rgba(255, 60, 60, 0.07), rgba(255, 255, 255, 0.01));
  --pod1-shadow: inset 0 1px 0 rgba(255, 150, 150, 0.3), 0 40px 110px -36px rgba(255, 40, 40, 0.75);
  --pod-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012) 70%);
  --orb-core: rgba(22, 15, 16, 0.92);
  --bot-bg: linear-gradient(140deg, #3a3132, #1a1415);
  --ring: #141011; /* the card surface, used to ring chart dots */
  --stick: #d9b07a; /* matchsticks */
  --fig-gap: #120e0f; /* the thin gap between the squares of a shape */
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4f2;
  --ink: #161213;
  --ink-soft: #2a2223;
  --ash: #5c5455;
  --smoke: #716969;
  --red: #e0222e;
  --red-ink: #c8121e;
  --red-deep: #b30f19;
  --red-top: #ef3340;
  --red-glow: rgba(224, 34, 46, 0.3);
  --red-soft: rgba(224, 34, 46, 0.08);
  --red-edge: rgba(224, 34, 46, 0.4);
  --mint: #0b8a50;
  --mint-soft: rgba(11, 138, 80, 0.09);
  --mint-edge: rgba(11, 138, 80, 0.35);
  --surface: rgba(22, 18, 19, 0.03);
  --surface-2: rgba(22, 18, 19, 0.055);
  --surface-3: rgba(22, 18, 19, 0.09);
  --edge: rgba(22, 18, 19, 0.1);
  --edge-2: rgba(22, 18, 19, 0.18);
  --edge-3: rgba(22, 18, 19, 0.34);
  --card: linear-gradient(180deg, #ffffff, #fdfcfb);
  --card-shadow: 0 1px 2px rgba(40, 20, 20, 0.04), 0 14px 34px -18px rgba(60, 20, 20, 0.18);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-2: rgba(255, 255, 255, 0.88);
  --menu: rgba(255, 255, 255, 0.98);
  --well: rgba(22, 18, 19, 0.035);
  --inset: rgba(22, 18, 19, 0.045);
  --shadow: rgba(60, 25, 25, 0.22);
  --backdrop: rgba(30, 22, 22, 0.28);
  --focus: #161213;
  --key-bg: linear-gradient(180deg, #ffffff, #f3f0ee);
  --key-edge: rgba(22, 18, 19, 0.12);
  --key-shadow: inset 0 -1px 0 rgba(22, 18, 19, 0.06), 0 4px 10px -6px rgba(40, 20, 20, 0.25);
  --key-op: #b30f19;
  --grid-line: rgba(0, 0, 0, 0.07);
  --grid-lit: rgba(0, 0, 0, 0.5);
  --grid-dot: rgba(0, 0, 0, 0.72);
  --glow: rgba(224, 34, 46, 0.07);
  --top-glow: rgba(224, 34, 46, 0.07);
  --side-glow: rgba(224, 34, 46, 0.03);
  --headline: linear-gradient(90deg, #e0222e 0%, #8e1219 30%, #161213 50%, #8e1219 70%, #e0222e 100%);
  --date-grad: linear-gradient(180deg, #161213 35%, #8e1219 100%);
  --silver: linear-gradient(180deg, #3a3334, #8f8687);
  --bronze: rgba(22, 18, 19, 0.5);
  --pip: rgba(22, 18, 19, 0.14);
  --dot: rgba(22, 18, 19, 0.1);
  --dot-future: rgba(22, 18, 19, 0.045);
  --trail: rgba(224, 34, 46, 0.13);
  --hero-card: radial-gradient(90% 120% at 50% 0%, rgba(224, 34, 46, 0.08), transparent 70%);
  --pod1-bg: radial-gradient(130% 75% at 50% 0%, rgba(224, 34, 46, 0.13), transparent 62%), #ffffff;
  --pod1-shadow: 0 30px 70px -36px rgba(224, 34, 46, 0.55);
  --pod-bg: linear-gradient(180deg, #ffffff, #fbfaf9);
  --orb-core: #ffffff;
  --bot-bg: linear-gradient(140deg, #efeae8, #ddd5d3);
  --ring: #ffffff;
  --stick: #b9874b;
  --fig-gap: #ffffff;
}

:root {
  --f-ui: "Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-display: "Gloock", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-italic: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --f-num: "Geist Mono Variable", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1120px;
  --cell: 60px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-padding-top: 100px; /* keeps scrolled-to content clear of the sticky timer */ }
html.theming, html.theming *, html.theming *::before, html.theming *::after { transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease, stroke 0.35s ease !important; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }

/* The interface is not a document: clicking a label, a number or a heading never shows a text cursor or starts a
   selection. Typing fields stay normal, and so do the texts people may want to copy (solutions, the legal pages). */
body { -webkit-user-select: none; user-select: none; cursor: default; -webkit-tap-highlight-color: transparent; }
input, textarea, select, .solution, .legal, .rc-table, .mod-reports, .b-solution { -webkit-user-select: text; user-select: text; }
input, textarea { cursor: text; }
summary, label, select, input[type="radio"], input[type="range"] { cursor: pointer; }
img, svg { -webkit-user-drag: none; }
[hidden] { display: none !important; } /* component display rules must never beat the hidden attribute */
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---------- Background: the grid ---------- */

.bg {
  --mx: 50%;
  --my: 22%;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 50% -6%, var(--top-glow), transparent 70%),
    radial-gradient(600px 460px at 0% 0%, var(--side-glow), transparent 70%),
    var(--bg);
}
.bg-grid {
  --line: var(--grid-line);
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  background-position: center top;
  -webkit-mask-image: radial-gradient(140% 100% at 50% 0%, #000 40%, rgba(0, 0, 0, 0.35) 100%);
  mask-image: radial-gradient(140% 100% at 50% 0%, #000 40%, rgba(0, 0, 0, 0.35) 100%);
}
/* The same grid, stronger, revealed only around the pointer. Grid intersections glow too. */
.bg-lit {
  --line: var(--grid-lit);
  background-image:
    radial-gradient(circle at 0.5px 0.5px, var(--grid-dot) 0 1.7px, transparent 2.8px),
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  -webkit-mask-image: radial-gradient(circle 290px at var(--mx) var(--my), #000 0%, rgba(0, 0, 0, 0.55) 36%, transparent 72%);
  mask-image: radial-gradient(circle 290px at var(--mx) var(--my), #000 0%, rgba(0, 0, 0, 0.55) 36%, transparent 72%);
  opacity: 0.5;
  transition: opacity 0.5s ease;
}
.bg-glow {
  position: absolute;
  left: 0;
  top: 0;
  width: 760px;
  height: 760px;
  margin: -380px 0 0 -380px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 62%);
  transform: translate3d(50vw, 22vh, 0);
  opacity: 0.8;
  transition: opacity 0.5s ease;
  will-change: transform;
}
@media (hover: hover) and (pointer: fine) {
  .bg-lit, .bg-glow { opacity: 0; }
  .bg.is-lit .bg-lit, .bg.is-lit .bg-glow { opacity: 1; }
}

.top, main, .foot { position: relative; z-index: 1; }

/* ---------- Header and wordmark ---------- */

.top {
  z-index: 3;
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 20px var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* The wordmark is the headline serif (Gloock), drawn as paths (#wm in index.html) so it looks the same everywhere.
   One stroke carries the heat: the tail of the Q. It glows when you point at it. */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.wordmark { display: inline-flex; align-items: center; padding: 8px 2px 6px; color: var(--ink); text-decoration: none; }
.wm { display: block; height: 30px; width: auto; aspect-ratio: 4934 / 939; overflow: visible; }
.wm-ink { fill: currentColor; }
.wm-tail { fill: var(--red); filter: var(--tail-glow, none); }
:root[data-theme="dark"] :is(.wm, .dlg-mark) { --tail-glow: url(#wm-glow-soft); }
:root .wordmark:is(:hover, :focus-visible) .wm { --tail-glow: url(#wm-glow); }

.top-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--edge-2);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.pill:hover { border-color: var(--edge-3); background: var(--surface-2); }
.pill:disabled { opacity: 0.5; cursor: default; }
.pill-small { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.pill.is-armed { border-color: var(--red); color: var(--red-ink); }
.pill-nav { color: var(--ash); padding: 0 16px 0 14px; }
.pill-nav:hover, .pill-nav[aria-current="page"] { color: var(--ink); }
.pill-nav[aria-current="page"] { border-color: var(--red-edge); }
.pill-nav svg, .pill-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.pill-nav .streak-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--red); font-family: var(--f-num); font-weight: 700; font-size: 0.9rem; }
.pill-nav .streak-badge svg { width: 12px; height: 14px; fill: currentColor; stroke: none; filter: drop-shadow(0 0 6px var(--red-glow)); }
.pill-nav.has-streak .ico-cal { display: none; }
.pill-icon { width: 44px; padding: 0; color: var(--ash); }
.pill-icon:hover { color: var(--ink); }
.theme-toggle svg { width: 19px; height: 19px; transition: transform 0.5s var(--ease); }
.theme-toggle:hover .ico-sun { transform: rotate(45deg); }
.theme-toggle:hover .ico-moon { transform: rotate(-18deg); }
.theme-toggle .ico-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ico-sun { display: none; }
:root[data-theme="light"] .theme-toggle .ico-moon { display: block; fill: currentColor; stroke: none; }
.pill-mono { font-family: var(--f-num); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; padding: 0 22px; }
.pill-red {
  border-color: transparent;
  background: linear-gradient(180deg, var(--red-top), var(--red-deep));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 30px -10px var(--red-glow);
}
.pill-red:hover { border-color: transparent; background: linear-gradient(180deg, var(--red-top), var(--red)); }
body[data-route="home"] .top .play, body[data-route="play"] .top .play, body[data-route="training"] .top .play, body[data-route="battle"] .top .play { display: none; }

.account { display: flex; align-items: center; }
.acct { position: relative; }
.acct > summary { list-style: none; }
.acct > summary::-webkit-details-marker { display: none; }
.acct-pill { padding: 0 16px 0 6px; }
.acct-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  min-width: 230px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--edge);
  background: var(--menu);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -20px var(--shadow);
  display: grid;
  gap: 2px;
}
.acct-meta { padding: 8px 14px 10px; color: var(--ash); font-size: 0.85rem; }
.acct-menu a, .acct-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--surface-2); }

/* ---------- Profile pictures: small squares ---------- */

.av {
  --s: 40px;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--s);
  height: var(--s);
  border-radius: calc(var(--s) * 0.26);
  overflow: hidden;
  color: #fff;
  font-family: var(--f-display);
  font-size: calc(var(--s) * 0.5);
  line-height: 1;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 16px -10px var(--shadow);
  user-select: none;
}
.av img, .av canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.av-letter { transform: translateY(0.04em); }
.av .katex { font-size: calc(var(--s) * 0.46); text-transform: none; }
.av-sm { --s: 32px; }
.av-md { --s: 44px; }
.av-lg { --s: 52px; }
.av-xl { --s: 116px; }
.av-c0 { background: linear-gradient(140deg, #ff6a5c, #a3121f); }
.av-c1 { background: linear-gradient(140deg, #ff8a4c, #b0301b); }
.av-c2 { background: linear-gradient(140deg, #f2577d, #8a1240); }
.av-c3 { background: linear-gradient(140deg, #c55cf0, #5b1d86); }
.av-c4 { background: linear-gradient(140deg, #d4485b, #5c1220); }
.av-c5 { background: linear-gradient(140deg, #e8735a, #7c2414); }
.av.is-bot { background: var(--bot-bg); color: var(--red); box-shadow: inset 0 0 0 1px var(--edge-2); }
.av.is-photo, .av:has(> img) { background: var(--surface-3); }

/* ---------- Buttons ---------- */

.btn-compete {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 62px;
  padding: 0 44px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.12rem;
  background: linear-gradient(180deg, var(--red-top) 0%, var(--red-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 0 0 1px var(--red-edge),
    0 18px 50px -14px var(--red-glow),
    0 0 90px -20px var(--red-glow);
  transition: transform 0.2s var(--ease), filter 0.2s;
}
.btn-compete svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-compete::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.3) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.8s var(--ease);
}
.btn-compete:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-compete:hover::after { transform: translateX(120%); }
.btn-compete:active { transform: none; }
.btn-compete:disabled { opacity: 0.6; cursor: default; }
.btn-compete.small { height: 52px; padding: 0 30px; font-size: 1rem; }

.btn-submit {
  height: 54px;
  padding: 0 28px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(180deg, var(--red-top), var(--red-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 30px -12px var(--red-glow);
}
.btn-submit:hover:not(:disabled) { filter: brightness(1.07); }
.btn-submit:disabled { opacity: 0.6; cursor: default; }

.btn-ghost {
  height: 54px;
  padding: 0 22px;
  border: 1px solid var(--edge-2);
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}
.btn-ghost:hover { background: var(--surface-2); }

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--glass);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { border-color: var(--edge-2); background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn svg, .nav-arrow svg, .crumb svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 72px;
  outline: none;
}

.h-lead {
  display: block;
  font-family: var(--f-italic);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.45rem, 3.2vw, 2.45rem);
  line-height: 1.1;
  color: var(--ink-soft);
}

.label-mono { font-family: var(--f-num); font-size: 0.74rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--smoke); }

/* cards share one surface so the grid never shows through them */
.stage, .summary, .claim, .streak-hero, .year, .form-card, .plan, .setup, .royale, .topic, .mode-card, .b-lobby, .b-standings li, .rv-item { box-shadow: var(--card-shadow); }

/* ---------- Home: hero ---------- */

.hero { text-align: center; padding-top: clamp(32px, 7vh, 84px); }
.headline { font-weight: 400; }
.h-main {
  display: block;
  width: fit-content;
  margin: 0.14em auto 0;
  padding: 0 0.04em 0.1em;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(3.1rem, min(9vw, 14vh), 6.75rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
  background: var(--headline);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-cta { margin-top: clamp(26px, 4vh, 40px); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 28px; color: var(--ash); font-size: 0.95rem; }
.hero-stats .num { color: var(--ink); font-weight: 600; }
.stat { display: inline-flex; align-items: center; gap: 0.4em; }
.stat-me { color: var(--ink); }
.stat-me .num { color: var(--red); font-weight: 700; }
.live-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--red); animation: ping 1.8s var(--ease) infinite; }
@keyframes ping {
  0% { transform: scale(1); opacity: 0.7; }
  80%, 100% { transform: scale(2.8); opacity: 0; }
}

/* ---------- Home: leaderboard ---------- */

.lb { margin-top: clamp(36px, 6vh, 64px); }
.lb-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 18px; }

.seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.seg button {
  position: relative;
  z-index: 1;
  height: 40px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ash);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.25s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: #fff; }
.seg-thumb {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--red-top), var(--red-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 24px -6px var(--red-glow);
  transition: transform 0.35s var(--ease);
}
.seg[data-active="monthly"] .seg-thumb { transform: translateX(100%); }

.period { display: flex; align-items: center; gap: 10px; color: var(--ash); font-size: 0.95rem; }
.period-pill { display: inline-flex; align-items: center; gap: 12px; height: 34px; padding: 0 16px; border-radius: 999px; background: var(--surface-2); }
.period-label { font-weight: 500; color: var(--ink); white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--red); }

/* Podium */
.podium {
  max-width: 960px;
  margin: 30px auto 0;
  display: grid;
  grid-template-columns: 1fr 1.14fr 1fr;
  align-items: end;
  gap: 18px;
}
.pod {
  position: relative;
  overflow: hidden;
  min-width: 0;
  text-align: center;
  padding: 26px 16px 24px;
  border-radius: 28px;
  border: 1px solid var(--edge);
  background: var(--pod-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: var(--card-shadow);
}
.pod-1 {
  order: 2;
  padding-top: 34px;
  padding-bottom: 32px;
  border-color: var(--red-edge);
  background: var(--pod1-bg);
  box-shadow: var(--pod1-shadow);
}
.pod-2 { order: 1; }
.pod-3 { order: 3; }
.pod-rank { font-family: var(--f-display); font-weight: 400; font-size: 5.25rem; line-height: 0.95; }
.pod-1 .pod-rank {
  font-size: 7rem;
  background: linear-gradient(180deg, #ff8a80 0%, #ff3b3b 45%, #b8101d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 28px var(--red-glow));
}
.pod-2 .pod-rank { background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pod-3 .pod-rank { color: transparent; -webkit-text-stroke: 1.5px var(--bronze); }
.pod-who { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.pod-id { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.pod-name { max-width: 100%; font-weight: 700; font-size: 1.08rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod-score { margin-top: 10px; display: flex; justify-content: center; align-items: baseline; gap: 6px; }
.pod-score .num { font-weight: 700; font-size: 2.1rem; letter-spacing: -0.03em; }
.pod-1 .pod-score .num { font-size: 2.7rem; }
.pod-unit { color: var(--smoke); font-size: 0.85rem; font-weight: 500; }
.pod-meta { margin-top: 10px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 14px; color: var(--ash); font-size: 0.88rem; }
.pod.is-empty {
  background: var(--surface);
  border-style: dashed;
  border-color: var(--edge-2);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.pod.is-empty .pod-rank { background: none; filter: none; color: transparent; -webkit-text-stroke: 1.5px var(--edge-3); }
.pod.is-empty.pod-1 { border-color: var(--red-edge); }
.pod.is-empty.pod-1 .pod-rank { -webkit-text-stroke-color: var(--red-edge); }
.pod.is-empty .pod-name { margin-top: 12px; color: var(--ash); font-weight: 600; }
.pod-open { margin-top: 8px; font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--smoke); }
.pod.is-me { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red), 0 30px 80px -30px var(--red-glow); }
.you-tag {
  display: inline-block;
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
}
.pod > .you-tag { position: absolute; top: 14px; right: 14px; }

.pips { display: inline-flex; gap: 4px; }
.pips i { width: 9px; height: 9px; border-radius: 2px; background: var(--pip); }
.pips i.on { background: var(--red); box-shadow: 0 0 10px -1px var(--red-glow); }

/* LinkedIn link, under a name */
.li-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--edge-2);
  color: var(--ash);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.li-chip svg { width: 9px; height: 9px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.li-chip:hover { color: var(--ink); border-color: var(--edge-3); background: var(--surface-2); }

/* Ranks 4 and below: each row is its own score bar */
.ranks { max-width: 960px; margin: 16px auto 0; display: grid; gap: 8px; }
.row {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 92px;
  grid-template-areas: "rank who meta pts";
  align-items: center;
  gap: 4px 18px;
  padding: 12px 22px;
  border-radius: 18px;
  background: var(--surface);
  transition: background-color 0.2s;
}
:root[data-theme="light"] .row { background: rgba(255, 255, 255, 0.78); box-shadow: inset 0 0 0 1px var(--edge); }
/* a heat trail: its length is the score relative to the leader, and it fades out instead of ending in an edge */
.row::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: linear-gradient(90deg, var(--trail), transparent);
  transition: width 1.1s var(--ease);
}
.row:hover { background: var(--surface-2); }
.row-rank { grid-area: rank; color: var(--smoke); font-weight: 600; font-size: 1.15rem; }
.row-who { grid-area: who; min-width: 0; display: flex; align-items: center; gap: 12px; }
.row-id { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.row-name-line { max-width: 100%; min-width: 0; display: flex; align-items: center; gap: 8px; }
.row-name { min-width: 0; font-weight: 650; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { grid-area: meta; display: flex; align-items: center; gap: 14px; color: var(--ash); font-size: 0.9rem; }
.row-pts { grid-area: pts; text-align: right; font-weight: 700; font-size: 1.22rem; }
.row.is-me { background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-edge); }
.row.is-me .row-rank, .row.is-me .row-name { color: var(--red-ink); }
.row-gap { text-align: center; color: var(--smoke); letter-spacing: 0.3em; }

.lb-foot { margin-top: 18px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px 18px; color: var(--ash); font-size: 0.92rem; }
.lb-foot .num { color: var(--ink); font-weight: 600; }

.claim {
  max-width: 960px;
  margin: 44px auto 0;
  padding: 44px 24px 40px;
  border-radius: 28px;
  border: 1px solid var(--edge);
  text-align: center;
  background: radial-gradient(80% 120% at 50% 100%, var(--red-soft), transparent 70%), var(--card);
}
.claim-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.6rem, 3.6vw, 2.4rem); line-height: 1.1; text-wrap: balance; }
.claim-sub { margin-top: 10px; color: var(--ash); }
.claim .btn-compete { margin-top: 26px; }

/* ---------- Page heads ---------- */

.page-head { text-align: center; padding-top: clamp(24px, 6vh, 64px); }
.page-head .h-lead { font-size: clamp(1.3rem, 2.6vw, 1.8rem); margin-bottom: 4px; }
.page-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -0.02em; text-wrap: balance; }
.page-sub { margin: 14px auto 0; max-width: 38rem; color: var(--ash); text-wrap: pretty; }

/* ---------- Play: intro ---------- */

.intro { text-align: center; padding-top: clamp(20px, 5vh, 56px); }
.intro-date {
  display: block;
  width: fit-content;
  margin: 0.08em auto 0;
  padding-bottom: 0.08em;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.9rem, min(8.5vw, 13vh), 6.25rem);
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
  background: var(--date-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.quote { max-width: 40rem; margin: clamp(22px, 4vh, 34px) auto 0; }
.quote blockquote { font-family: var(--f-italic); font-style: italic; font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.35; color: var(--ink-soft); text-wrap: balance; }
.quote figcaption { margin-top: 12px; font-family: var(--f-num); font-size: 0.74rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--red); }

.orbs { max-width: 900px; margin: clamp(30px, 5vh, 48px) auto 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.orb-item { display: flex; flex-direction: column; align-items: center; }
.orb {
  --heat: 0.3;
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  color: var(--ink);
  border: 1px solid rgba(255, 100, 100, calc(0.12 + var(--heat) * 0.45));
  background: radial-gradient(circle at 50% 30%, rgba(255, 70, 70, calc(var(--heat) * 0.55)), var(--orb-core) 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 calc(var(--heat) * 70px) calc(var(--heat) * -6px) rgba(255, 40, 40, calc(var(--heat) * 0.75));
}
:root[data-theme="light"] .orb {
  border-color: rgba(224, 34, 46, calc(0.14 + var(--heat) * 0.5));
  background: radial-gradient(circle at 50% 30%, rgba(224, 34, 46, calc(var(--heat) * 0.3)), var(--orb-core) 72%);
  box-shadow: 0 10px calc(var(--heat) * 50px) calc(var(--heat) * -10px) rgba(224, 34, 46, calc(var(--heat) * 0.55));
}
.orb-sym .katex { font-size: 2.1rem; }
.orb-tier { margin-top: 14px; font-family: var(--f-display); font-size: 1.3rem; line-height: 1.1; }
.orb-pts { margin-top: 4px; color: var(--ash); font-size: 0.9rem; }
.orb-pts .num { color: var(--ink); font-weight: 700; }
.intro-cta { margin-top: clamp(30px, 5vh, 48px); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.intro-cta .pill { height: 62px; padding: 0 28px; font-size: 1rem; }
.intro-rules { margin: 16px auto 0; max-width: 32rem; color: var(--smoke); font-size: 0.95rem; }

/* ---------- Rules dialog ---------- */

dialog.rules { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; }
.rules-inner { padding: 32px 30px 28px; }
.rules-inner h2 { font-family: var(--f-display); font-weight: 400; font-size: 2.4rem; line-height: 1; }
.rules-lede { margin-top: 10px; color: var(--ash); }
.rules-list { margin-top: 22px; display: grid; gap: 16px; }
.rules-list li { display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; }
.rules-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--red-soft); color: var(--red); }
.rules-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rules-list h3 { font-size: 1rem; font-weight: 700; }
.rules-list p { margin-top: 2px; color: var(--ash); font-size: 0.95rem; line-height: 1.55; }
.points-table { margin-top: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.points-table div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 0.88rem; }
.points-table .num { font-weight: 700; color: var(--ink); }
.rules-example { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--inset); color: var(--ash); font-size: 0.88rem; }
.rules-example .num { color: var(--ink); }
.rules-inner .btn-submit { width: 100%; margin-top: 26px; }

/* ---------- Play: the round ---------- */

.hud {
  position: sticky;
  top: 12px;
  z-index: 5;
  max-width: 860px;
  margin: 8px auto 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 8px 24px 8px 8px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--glass-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px -24px var(--shadow);
}
.hud-timer { display: flex; align-items: center; gap: 12px; }
.ring { width: 48px; height: 48px; transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke-width: 3.5; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--red); stroke-linecap: round; transition: stroke-dashoffset 0.3s linear; filter: drop-shadow(0 0 4px var(--red-glow)); }
.hud.is-done .ring-fg { stroke: var(--mint); filter: none; }
.hud-time { font-weight: 700; font-size: 1.45rem; letter-spacing: -0.02em; }
.hud-time.low { color: var(--red); }
.hud-label { color: var(--ash); font-size: 0.88rem; }
.hud-dots { display: flex; justify-content: center; gap: 2px; }
.pdot { position: relative; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.pdot::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--edge-3); transition: transform 0.2s var(--ease), background-color 0.2s; }
.pdot.is-solved::before { background: var(--mint); box-shadow: 0 0 10px var(--mint-edge); }
.pdot.is-locked::before { background: transparent; box-shadow: inset 0 0 0 2px var(--red); }
.pdot.is-current::before { transform: scale(1.35); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ink); }
.pdot:hover::before { transform: scale(1.25); }
.hud-score { display: flex; align-items: baseline; gap: 6px; }
.hud-score .num { font-weight: 700; font-size: 1.45rem; }
.hud-of { color: var(--smoke); font-family: var(--f-num); font-size: 0.9rem; }

.stage {
  max-width: 860px;
  margin: 18px auto 0;
  padding: 24px 28px 30px;
  border-radius: 30px;
  border: 1px solid var(--edge);
  background: var(--card);
}
.stage.is-solved { border-color: var(--mint-edge); }
.stage.is-locked { border-color: var(--red-edge); }
.stage-head { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 12px; text-align: center; }
.nav-arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--edge-2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.nav-arrow svg { width: 18px; height: 18px; }
.nav-arrow:hover:not(:disabled) { border-color: var(--edge-3); background: var(--surface-2); }
.nav-arrow:disabled { opacity: 0.2; cursor: default; }
.stage-tier { margin-top: 2px; font-family: var(--f-display); font-weight: 400; font-size: clamp(2.1rem, 5vw, 3rem); line-height: 1.05; }
.stage-worth { margin-top: 6px; color: var(--ash); font-size: 0.95rem; }
.stage-worth .num { color: var(--ink); font-weight: 700; }
.chip { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.chip-good { color: var(--mint); background: var(--mint-soft); }
.chip-bad { color: var(--red-ink); background: var(--red-soft); }
.chip-dim { color: var(--ash); background: var(--surface-2); }
.stage .chip { margin-top: 10px; }
.fresh .chip { animation: pop 0.45s var(--ease); }
@keyframes pop { from { transform: scale(1.35); opacity: 0; } }

.briefing { max-width: 640px; margin: 24px auto 0; padding: 16px 20px; border-radius: 18px; border: 1px solid var(--red-edge); background: var(--red-soft); text-align: left; }
.briefing .label-mono { color: var(--red); }
.briefing p:last-child { margin-top: 6px; color: var(--ink-soft); line-height: 1.6; }

.statement { overflow-x: auto; overflow-y: hidden; }
.stage .statement { max-width: 660px; margin: 24px auto 0; text-align: center; font-size: 1.28rem; line-height: 1.7; text-wrap: pretty; }
.statement .katex { font-size: 1.08em; }
.statement .katex-display { margin: 0.8em 0; }
.stage .statement.big { margin-top: 18px; font-size: clamp(2.2rem, 6vw, 3.2rem); line-height: 1.3; }

.answer { max-width: 560px; margin: 26px auto 0; }
.answer-box {
  border-radius: 20px;
  border: 1px solid var(--edge-2);
  background: var(--well);
  padding: 12px 16px 6px;
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.answer-box:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.answer-box.shake { animation: shake 0.4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.answer-preview { min-height: 64px; display: flex; align-items: center; justify-content: center; overflow-x: auto; overflow-y: hidden; font-size: 1.55rem; }
.answer-preview .katex { font-size: 1.15em; }
.answer-preview.is-empty { font-family: var(--f-italic); font-style: italic; font-size: 1.35rem; color: var(--smoke); }
.answer-preview.is-unreadable { color: var(--smoke); font-size: 1rem; }
.answer-raw {
  display: block;
  width: 100%;
  height: 30px;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: var(--f-num);
  font-size: 0.92rem;
  color: var(--ash);
  caret-color: var(--red);
  outline: none;
}
.answer-raw::placeholder { color: var(--smoke); opacity: 0.6; }
.answer-meta { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; color: var(--smoke); font-size: 0.86rem; text-align: center; }
.attempts { display: inline-flex; align-items: center; gap: 8px; color: var(--ash); font-weight: 500; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.dots i.spent { background: transparent; box-shadow: inset 0 0 0 2px var(--red); }
.feedback { margin-top: 10px; text-align: center; font-weight: 600; }
.feedback:empty { display: none; }
.feedback.bad { color: var(--red-ink); }

.keypad {
  position: relative;
  max-width: 560px;
  margin: 18px auto 0;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid var(--edge);
  background: var(--surface);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.key {
  display: grid;
  place-items: center;
  height: 58px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--key-edge);
  background: var(--key-bg);
  box-shadow: var(--key-shadow);
  color: var(--ink);
  font-family: var(--f-display);
  font-size: 1.35rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.08s, border-color 0.15s, background-color 0.15s;
}
.key:hover { border-color: var(--edge-3); }
.key:active { transform: translateY(1px) scale(0.97); }
.key .katex { font-size: 1.34rem; }
.key.op { font-family: var(--f-ui); font-weight: 400; font-size: 1.65rem; color: var(--key-op); }
.key.txt { font-family: var(--f-ui); font-weight: 600; font-size: 0.95rem; }
.key.del { color: var(--red); }
.key.del svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.key.move svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.key.check {
  grid-column: span 2;
  border-color: transparent;
  background: linear-gradient(180deg, var(--red-top), var(--red-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 14px 34px -12px var(--red-glow);
  color: #fff;
  font-family: var(--f-ui);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.key.check:disabled { opacity: 0.6; cursor: default; }
.key[aria-expanded="true"] { border-color: var(--red-edge); }
.fx {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 8px);
  z-index: 4;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--edge-2);
  background: var(--menu);
  box-shadow: 0 24px 60px -20px var(--shadow);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.fx .key { height: 50px; }

.result { max-width: 560px; margin: 26px auto 0; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.result p { color: var(--ash); }

/* summary at the end of the round */
.summary {
  max-width: 860px;
  margin: 18px auto 0;
  padding: 34px 24px 32px;
  border-radius: 30px;
  border: 1px solid var(--edge);
  text-align: center;
  background: var(--hero-card), var(--card);
}
.summary .h-lead { font-size: 1.7rem; }
.summary-score { margin-top: 4px; display: flex; justify-content: center; align-items: baseline; gap: 8px; }
.summary-score .num { font-size: clamp(3.5rem, 9vw, 5.5rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.summary-of { font-family: var(--f-num); color: var(--smoke); font-size: 1.3rem; }
.summary-rank { margin-top: 6px; min-height: 1.5em; color: var(--ash); }
.summary-list { margin: 20px auto 0; max-width: 640px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.sum-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface-2); font-size: 0.88rem; cursor: pointer; }
.sum-chip:hover { border-color: var(--edge-2); }
.sum-chip .r { font-family: var(--f-num); font-weight: 700; }
.sum-chip.is-solved .r { color: var(--mint); }
.sum-chip.is-locked .r, .sum-chip.is-open .r { color: var(--smoke); }
.summary .btn-compete { margin-top: 24px; }
.summary-next { margin-top: 14px; color: var(--smoke); font-size: 0.9rem; }
.summary-next .num { color: var(--ash); }
.summary-actions { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.summary-actions .btn-compete { margin-top: 0; }
.summary-actions .pill { height: 52px; padding: 0 22px; }

/* ---------- Archive ---------- */

.streak-hero {
  max-width: 860px;
  margin: 32px auto 0;
  padding: 28px 30px;
  border-radius: 30px;
  border: 1px solid var(--edge);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px 36px;
  background: radial-gradient(60% 140% at 0% 50%, var(--red-soft), transparent 70%), var(--card);
}
.streak-big { display: flex; align-items: center; gap: 14px; }
.streak-big svg { width: 38px; height: 46px; fill: var(--red); filter: drop-shadow(0 0 14px var(--red-glow)); }
.streak-big .n {
  font-family: var(--f-display);
  font-size: clamp(4.2rem, 10vw, 6.5rem);
  line-height: 0.9;
  background: linear-gradient(180deg, #ff8a80 0%, #ff3b3b 50%, #b8101d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.streak-cap { margin-top: 6px; color: var(--ash); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi { padding: 14px 16px; border-radius: 16px; background: var(--surface); }
:root[data-theme="light"] .kpi { background: var(--surface-2); }
.kpi dt { color: var(--ash); font-size: 0.82rem; }
.kpi dd { margin-top: 2px; font-family: var(--f-num); font-weight: 700; font-size: 1.45rem; }

.year { max-width: 860px; margin: 18px auto 0; padding: 26px 28px 24px; border-radius: 30px; border: 1px solid var(--edge); background: var(--card); }
.year-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.year-head h2 { min-width: 4ch; text-align: center; font-family: var(--f-display); font-weight: 400; font-size: 2.1rem; line-height: 1; }
.year-count { margin-left: auto; color: var(--ash); font-size: 0.92rem; }
.year-count .num { color: var(--ink); font-weight: 700; }
.months { margin-top: 20px; display: grid; gap: 7px; }
.month { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px; }
.month-name { font-family: var(--f-num); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--smoke); }
.mdots { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 5px; }
.yd { aspect-ratio: 1; border-radius: 50%; background: var(--dot); }
.yd.future { background: var(--dot-future); }
.yd.played { background: rgba(255, 59, 59, var(--o, 1)); box-shadow: 0 0 calc(var(--g, 0) * 12px) rgba(255, 59, 59, 0.85); }
:root[data-theme="light"] .yd.played { background: rgba(224, 34, 46, var(--o, 1)); box-shadow: 0 0 calc(var(--g, 0) * 8px) rgba(224, 34, 46, 0.45); }
.yd.zero { background: transparent; box-shadow: inset 0 0 0 1.5px var(--red-edge); }
.yd.today { outline: 2px solid var(--ink); outline-offset: 2px; }
.legend { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; color: var(--smoke); font-size: 0.8rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .yd { width: 10px; }

.hist { max-width: 860px; margin: 18px auto 0; display: grid; gap: 8px; }
.hist-title { max-width: 860px; margin: 40px auto 0; font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; }
.hist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 22px;
  padding: 18px 22px;
  border-radius: 18px;
  background: var(--surface);
  text-decoration: none;
  transition: background-color 0.2s;
}
:root[data-theme="light"] .hist-row { background: rgba(255, 255, 255, 0.78); box-shadow: inset 0 0 0 1px var(--edge); }
.hist-row:hover { background: var(--surface-2); }
.hist-day { font-weight: 650; }
.hist-note { display: block; color: var(--ash); font-size: 0.88rem; font-weight: 400; }
.hist-pts { min-width: 4ch; text-align: right; font-weight: 700; font-size: 1.25rem; }

/* ---------- Review ---------- */

.review { max-width: 860px; margin: 28px auto 0; display: grid; gap: 16px; }
.review .stage { margin: 0; }
.answer-line { margin-top: 18px; display: inline-flex; align-items: baseline; gap: 10px; padding: 8px 16px; border-radius: 999px; background: var(--surface-2); color: var(--ash); font-size: 0.9rem; }
.answer-line .num, .answer-line .ans-tex { color: var(--ink); font-weight: 700; font-size: 1.1rem; }
.solution { max-width: 640px; margin: 14px auto 0; padding: 16px 18px; border-radius: 16px; background: var(--inset); color: var(--ash); line-height: 1.65; text-align: left; overflow-x: auto; }
.topic-tag { display: inline-block; margin-top: 8px; font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--smoke); }
.backlink { display: flex; width: fit-content; margin: 30px auto 0; }
.empty-note { margin-top: 28px; text-align: center; color: var(--ash); }
.prompt { margin-top: 28px; text-align: center; }
.prompt p { margin-bottom: 20px; color: var(--ash); }

/* ---------- Profile ---------- */

.form-card { max-width: 640px; margin: 30px auto 0; padding: 28px 28px 26px; border-radius: 28px; border: 1px solid var(--edge); background: var(--card); }
.form-card + .form-card { margin-top: 16px; }
.form-card h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.9rem; line-height: 1.1; }
.form-card > p { margin-top: 8px; color: var(--ash); }
.field { margin-top: 20px; display: grid; gap: 8px; }
.field label { color: var(--ash); font-size: 0.88rem; font-weight: 600; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field-row input { flex: 1 1 15rem; min-width: 0; height: 54px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--edge-2); background: var(--well); font-size: 1rem; }
.field-row input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.form-msg { min-height: 1.4em; margin-top: 10px; font-weight: 600; }
.form-msg.good { color: var(--mint); }
.form-msg.bad { color: var(--red-ink); }
.li-preview { max-width: 640px; margin: 18px auto 0; }
.li-preview .label-mono { margin-bottom: 8px; text-align: center; }
.li-preview .row { pointer-events: none; }
.pic-row { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.pic-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pic-side { flex: 1 1 14rem; display: grid; gap: 10px; }
.pic-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pic-note { color: var(--smoke); font-size: 0.85rem; }
.zoom { display: flex; align-items: center; gap: 10px; color: var(--ash); font-size: 0.85rem; font-weight: 600; order: 2; }
.zoom input { width: 120px; accent-color: var(--red); }

/* ---------- Membership ---------- */

.plans { max-width: 900px; margin: 34px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; padding: 30px 28px 28px; border-radius: 30px; border: 1px solid var(--edge); background: var(--card); }
.plan-pro {
  border-color: var(--red-edge);
  background: radial-gradient(120% 70% at 50% 0%, var(--red-soft), transparent 62%), var(--card);
  box-shadow: 0 40px 110px -40px var(--red-glow);
}
.plan-tag { position: absolute; top: 20px; right: 20px; padding: 4px 12px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.75rem; font-weight: 700; }
.plan h2 { font-family: var(--f-display); font-weight: 400; font-size: 2.3rem; line-height: 1; }
.plan-price { margin-top: 8px; color: var(--ash); }
.plan ul { margin: 24px 0 28px; display: grid; gap: 12px; }
.plan li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; color: var(--ink-soft); line-height: 1.45; }
.plan li::before { content: ""; width: 8px; height: 8px; margin-top: 7px; border-radius: 2px; background: var(--edge-3); }
.plan-pro li::before { background: var(--red); box-shadow: 0 0 10px -1px var(--red-glow); }
.plan-foot { margin-top: auto; }
.plan-foot .btn-compete { width: 100%; }
.plan-note { color: var(--smoke); font-size: 0.9rem; text-align: center; }
.plan-done { color: var(--mint); font-weight: 600; text-align: center; }
.plans-small { max-width: 640px; margin: 22px auto 0; color: var(--smoke); font-size: 0.88rem; text-align: center; }

/* ---------- Training ---------- */

.royale {
  max-width: 960px;
  margin: 34px auto 0;
  padding: 30px 32px;
  border-radius: 30px;
  border: 1px solid var(--red-edge);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px 32px;
  background: radial-gradient(70% 140% at 100% 50%, var(--red-soft), transparent 70%), var(--card);
  box-shadow: 0 34px 90px -44px var(--red-glow);
}
.royale-tag { display: inline-flex; align-items: center; gap: 9px; font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--red); }
.royale h2 { margin-top: 8px; font-family: var(--f-display); font-weight: 400; font-size: clamp(2.2rem, 4.6vw, 3.1rem); line-height: 1; }
.royale-lede { margin-top: 10px; max-width: 34rem; color: var(--ink-soft); }
.royale-meta { margin-top: 10px; color: var(--ash); font-size: 0.9rem; }
.royale-meta .num { color: var(--ink); font-weight: 700; }
.topics-title { max-width: 960px; margin: 40px auto 0; font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; }
.topics { max-width: 960px; margin: 14px auto 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.topic {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 6px;
  padding: 20px 20px 18px;
  border-radius: 22px;
  border: 1px solid var(--edge);
  background: var(--card);
  text-decoration: none;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.topic:hover { transform: translateY(-2px); border-color: var(--red-edge); }
.topic-sym { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 8px; border-radius: 14px; background: var(--red-soft); color: var(--red); }
.topic-sym .katex { font-size: 1.45rem; }
.topic-sym.big { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; }
.topic-sym.big .katex { font-size: 2.3rem; }
.topic-name { font-family: var(--f-display); font-size: 1.45rem; line-height: 1.1; }
.topic-blurb { color: var(--ash); font-size: 0.9rem; line-height: 1.45; }
.topic-best { margin-top: 8px; color: var(--smoke); font-size: 0.82rem; }
.topic-best .num { color: var(--red); font-weight: 700; }
.topic.is-mixed .topic-sym { background: var(--surface-3); color: var(--ink); }
.train-totals { margin-top: 18px; text-align: center; color: var(--smoke); font-size: 0.9rem; }

.crumb { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--ash); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.crumb:hover { color: var(--ink); }
.setup-head { text-align: center; padding-top: clamp(8px, 3vh, 28px); }
.setup {
  max-width: 640px;
  margin: 28px auto 0;
  padding: 26px 28px 30px;
  border-radius: 30px;
  border: 1px solid var(--edge);
  background: var(--card);
  display: grid;
  gap: 22px;
}
.setup-row { display: grid; gap: 10px; }
.setup-label { font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--smoke); }
.setup .btn-compete { justify-self: center; margin-top: 6px; }
.chooser { display: flex; flex-wrap: wrap; gap: 8px; }
.chooser button {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--edge-2);
  background: var(--surface);
  color: var(--ash);
  font-weight: 600;
  cursor: pointer;
}
.chooser button:hover { color: var(--ink); border-color: var(--edge-3); }
.chooser button[aria-checked="true"] { color: #fff; border-color: transparent; background: linear-gradient(180deg, var(--red-top), var(--red-deep)); box-shadow: 0 8px 22px -10px var(--red-glow); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--edge-2);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.mode-card:hover { border-color: var(--edge-3); }
.mode-card[aria-checked="true"] { border-color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.mode-title { font-weight: 700; font-size: 1.05rem; }
.mode-text { color: var(--ash); font-size: 0.88rem; line-height: 1.45; }

.train-hud { grid-template-columns: auto 1fr auto; padding-right: 26px; }
.hud-mode { padding: 0 14px; height: 48px; display: inline-flex; align-items: center; font-family: var(--f-num); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ash); }
.hud-topic { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; font-weight: 600; text-align: center; }
.hud-level { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ash); font-size: 0.8rem; }
#tscore.bump { animation: bump 0.4s var(--ease); color: var(--mint); }
@keyframes bump { 30% { transform: scale(1.35); } }
.train-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.train-actions { display: flex; gap: 8px; }
.train-card .statement { margin-top: 18px; }
.train-result { max-width: 660px; margin: 22px auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.train-result .answer-line { margin-top: 12px; }
.train-result .btn-compete { margin-top: 20px; }
.train-summary .train-best { margin-top: 8px; min-height: 1.4em; color: var(--ash); font-weight: 600; }
.train-best.is-new { color: var(--red-ink); }
.rv-wrap { max-width: 860px; margin: 0 auto; }
.rv-help { margin-top: 6px; color: var(--smoke); font-size: 0.9rem; }
.rv { margin-top: 14px; display: grid; gap: 8px; }
.rv-item { border-radius: 18px; border: 1px solid var(--edge); background: var(--card); overflow: hidden; }
.rv-item summary { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; }
.rv-item summary::-webkit-details-marker { display: none; }
.rv-n { color: var(--smoke); font-weight: 600; }
.rv-q { min-width: 0; overflow-x: auto; overflow-y: hidden; line-height: 1.6; }
.rv-res { font-weight: 700; font-size: 0.85rem; }
.rv-item.is-ok .rv-res { color: var(--mint); }
.rv-item.is-miss .rv-res { color: var(--red-ink); }
.rv-body { padding: 0 18px 18px 66px; }
.rv-body .answer-line { margin-top: 0; }
.rv-body .solution { margin: 12px 0 0; }

/* ---------- Battle royale ---------- */

.battle { max-width: 960px; margin: 0 auto; }
.b-lobby {
  max-width: 640px;
  margin: 26px auto 0;
  padding: 26px 24px;
  border-radius: 28px;
  border: 1px solid var(--edge);
  background: var(--card);
  text-align: center;
}
.b-countdown { color: var(--ash); font-size: 1.05rem; }
.b-countdown .num { display: block; margin-top: 4px; color: var(--ink); font-size: clamp(3rem, 8vw, 4.4rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.b-sub { margin-top: 10px; color: var(--ash); text-wrap: pretty; }
.b-actions { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.b-actions.center { margin: 26px auto 0; }
.b-actions .pill { height: 52px; padding: 0 22px; }
.b-players { margin: 22px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 210px)); justify-content: center; gap: 10px; }
.b-player {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "av name" "av tags";
  align-items: center;
  column-gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--edge);
  background: var(--card);
  transition: opacity 0.4s, filter 0.4s, border-color 0.3s;
}
.b-player .av { grid-area: av; }
.b-name { grid-area: name; min-width: 0; font-weight: 650; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-tags { grid-area: tags; display: flex; gap: 6px; min-height: 18px; }
.bot-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--edge-2); color: var(--smoke); font-family: var(--f-num); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.5; vertical-align: 1px; }
.b-player .you-tag { font-size: 0.62rem; padding: 1px 7px; }
.b-player.is-me { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.b-player.is-out { opacity: 0.42; filter: grayscale(1); }
.b-player.is-out .b-name { text-decoration: line-through; }
.b-check { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); }
.b-check::after { content: ""; position: absolute; left: 6px; top: 3.5px; width: 5px; height: 9px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.b-player.was-right .b-check { background: var(--mint); }
.b-place { color: var(--smoke); font-size: 0.72rem; font-weight: 700; line-height: 1.5; }
.b-rules { max-width: 640px; margin: 26px auto 0; display: grid; gap: 8px; color: var(--ash); font-size: 0.92rem; }
.b-rules li { padding-left: 18px; position: relative; }
.b-rules li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 7px; height: 7px; border-radius: 2px; background: var(--red); }
.b-rules strong { color: var(--ink); }
.b-count-big { margin-top: clamp(30px, 8vh, 80px); text-align: center; }
.b-count-big .num { margin-top: 6px; font-size: clamp(6rem, 22vw, 11rem); font-weight: 700; line-height: 1; color: var(--red); text-shadow: 0 0 60px var(--red-glow); }
.b-hud { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 24px; gap: 18px; }
.b-round { display: flex; align-items: baseline; gap: 10px; }
.b-round .num { font-size: 1.45rem; font-weight: 700; }
.b-timer { display: flex; align-items: center; gap: 12px; min-width: 0; }
.b-bar { flex: 1; min-width: 40px; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.b-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red-deep), var(--red-top)); transform-origin: left center; box-shadow: 0 0 12px var(--red-glow); }
.b-timer .num { min-width: 3.6ch; text-align: right; font-weight: 700; }
.b-timer .num.low { color: var(--red); }
.b-alive { color: var(--ash); white-space: nowrap; }
.b-alive .num { color: var(--ink); font-weight: 700; font-size: 1.2rem; }
.b-hud.is-storm { border-color: var(--red-edge); box-shadow: 0 0 0 1px var(--red-edge), 0 20px 50px -24px var(--red-glow); }
.b-card .label-mono { text-align: center; }
.b-card .statement { margin-top: 14px; }
.b-card.is-reveal { text-align: center; }
.b-locked, .b-verdict { max-width: 560px; margin: 24px auto 0; padding: 18px 20px; border-radius: 20px; border: 1px solid var(--edge-2); background: var(--surface); text-align: center; color: var(--ash); }
.b-locked.good, .b-verdict.good { border-color: var(--mint-edge); background: var(--mint-soft); }
.b-locked.bad, .b-verdict.bad { border-color: var(--red-edge); background: var(--red-soft); }
.b-verdict-main { color: var(--ink); font-weight: 700; font-size: 1.15rem; margin-bottom: 4px; }
.b-note { margin-top: 6px; color: var(--red-ink); font-weight: 600; }
.b-solution { max-width: 640px; margin: 14px auto 0; text-align: left; }
.b-solution summary { width: fit-content; margin: 0 auto; color: var(--ash); font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.b-final.is-win { border-color: var(--red-edge); box-shadow: 0 40px 110px -40px var(--red-glow); }
.b-final-title { margin-top: 8px; font-family: var(--f-display); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.05; text-wrap: balance; }
.b-final.is-win .b-final-title { background: var(--headline); -webkit-background-clip: text; background-clip: text; color: transparent; }
.b-standings { max-width: 860px; margin: 18px auto 0; display: grid; gap: 8px; }
.b-standings li { display: grid; grid-template-columns: 48px auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 20px; border-radius: 18px; border: 1px solid var(--edge); background: var(--card); }
.b-standings li.is-first { border-color: var(--red-edge); }
.b-standings li.is-me { background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-edge); }
.b-st-place { color: var(--smoke); font-weight: 700; font-size: 1.1rem; }
.is-first .b-st-place { color: var(--red); }
.b-st-name { min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-st-out { color: var(--ash); font-size: 0.88rem; }

/* ---------- Dialogs ---------- */

dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border-radius: 26px;
  border: 1px solid var(--edge);
  background: var(--menu);
  color: var(--ink);
  box-shadow: 0 40px 120px -20px var(--shadow), 0 0 120px -40px var(--red-glow);
}
dialog::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#auth form { padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 6px; }
.dlg-mark { display: block; align-self: flex-start; height: 24px; width: auto; aspect-ratio: 4934 / 939; margin-bottom: 20px; color: var(--ink); overflow: visible; }
#auth h2 { margin-bottom: 10px; font-family: var(--f-display); font-weight: 400; font-size: 2.1rem; line-height: 1; }
#auth label { margin-top: 10px; color: var(--ash); font-size: 0.88rem; font-weight: 600; }
#auth input { height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--edge-2); background: var(--well); font-size: 1rem; }
#auth input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.field-hint { margin-top: 8px; color: var(--smoke); font-size: 0.85rem; }
.form-error { min-height: 1.4em; margin-top: 8px; color: var(--red-ink); font-weight: 600; font-size: 0.92rem; }
.dialog-actions { display: flex; gap: 10px; margin-top: 6px; }
.dialog-actions .btn-submit { flex: 1; }
.switch { margin-top: 16px; text-align: center; color: var(--ash); font-size: 0.92rem; }

/* ---------- Footer ---------- */

.foot { padding: 28px var(--gutter) 34px; text-align: center; color: var(--smoke); font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
.foot-links { margin-bottom: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
.foot-links a { color: var(--ash); text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Page-load sequence (first visit to the home page only) ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero.enter .h-lead { animation: rise 0.8s var(--ease) both; }
.hero.enter .h-main { animation: rise 0.9s var(--ease) 0.08s both; }
.hero.enter .hero-cta { animation: rise 0.9s var(--ease) 0.18s both; }
.lb.enter .lb-controls { animation: rise 0.8s var(--ease) 0.26s both; }
.lb.enter .pod, .lb.enter .row { animation: rise 0.8s var(--ease) both; animation-delay: calc(0.32s + var(--i, 0) * 60ms); }
.stage.slide-next { animation: slide-in-r 0.35s var(--ease); }
.stage.slide-prev { animation: slide-in-l 0.35s var(--ease); }
@keyframes slide-in-r { from { opacity: 0; transform: translateX(24px); } }
@keyframes slide-in-l { from { opacity: 0; transform: translateX(-24px); } }
.phase-question .b-card, .phase-reveal .b-card { animation: rise 0.35s var(--ease); }

/* ---------- Toasts ---------- */

.toasts { position: fixed; z-index: 60; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  padding: 13px 18px;
  border-radius: 16px;
  border: 1px solid var(--edge-2);
  background: var(--menu);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.94rem;
  text-align: center;
  box-shadow: 0 20px 50px -20px var(--shadow);
  animation: toast-in 0.35s var(--ease);
  transition: opacity 0.4s, transform 0.4s;
}
.toast.is-good { border-color: var(--mint-edge); }
.toast.is-bad { border-color: var(--red-edge); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Figures that go with a question ---------- */

.fig-wrap { margin: 20px auto 0; display: flex; justify-content: center; }
.fig { display: block; height: auto; overflow: visible; }
.fig .f-line { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; fill: none; }
.fig .f-cell { fill: var(--surface-2); stroke: var(--ink); stroke-width: 1.6; }
.fig .f-block { fill: var(--red); stroke: var(--fig-gap); stroke-width: 2; }
.fig .f-frame { fill: var(--surface); stroke: var(--edge-2); stroke-width: 1; rx: 12px; }
.fig .f-rule { stroke: var(--edge); stroke-width: 1; }
.fig .f-num { fill: var(--ash); font-family: var(--f-num); font-size: 15px; font-weight: 600; text-anchor: middle; }
.fig .f-face { fill: var(--ink); font-family: var(--f-display); font-size: 24px; text-anchor: middle; }
.fig .f-stick { stroke: var(--stick); stroke-width: 4; stroke-linecap: round; }
.fig .f-head { fill: var(--red); }
.fig .f-street { stroke: var(--edge-3); stroke-width: 2; stroke-linecap: round; }
.fig .f-x { stroke: var(--red); stroke-width: 3; stroke-linecap: round; }
.fig .f-pt, .fig .f-dot { fill: var(--ink); }
.fig .f-via { fill: var(--red); }
.fig .f-tag { fill: var(--ink); font-family: var(--f-display); font-size: 17px; text-anchor: middle; }
.fig .f-label { fill: var(--ash); font-size: 13px; text-anchor: middle; }
.rv-body .fig-wrap { margin: 0 0 14px; justify-content: flex-start; }

/* ---------- Leaderboard: three boards, names that open profiles ---------- */

.seg { grid-template-columns: repeat(3, 1fr); }
.seg-thumb { width: calc((100% - 8px) / 3); }
.seg[data-active="monthly"] .seg-thumb { transform: translateX(100%); }
.seg[data-active="rating"] .seg-thumb { transform: translateX(200%); }
.row-name, .pod-name { color: inherit; text-decoration: none; }
.row-name::after, .pod-name::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.row-name:hover, .pod-name:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.row-name:focus-visible, .pod-name:focus-visible { outline: none; }
.row-name:focus-visible::after, .pod-name:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
.row .li-chip, .pod .li-chip, .pod > .you-tag { position: relative; z-index: 1; }
.pod > .you-tag { position: absolute; }
.pod:hover { border-color: var(--edge-2); }
.pod-1:hover, .pod.is-me:hover { border-color: var(--red); }
.prov { margin-left: 1px; color: var(--smoke); font-family: var(--f-num); font-size: 0.6em; font-weight: 700; vertical-align: 0.6em; }
.row-pts .prov { font-size: 0.7em; }
.lb-note { flex-basis: 100%; text-align: center; color: var(--smoke); font-size: 0.84rem; }
.hero-try { color: var(--ash); font-size: 0.95rem; }
.hero-try a { color: var(--ink); font-weight: 650; text-underline-offset: 3px; }
.acct-rating { display: block; margin-top: 4px; }
.acct-rating .num { color: var(--ink); font-weight: 700; }

/* ---------- Log in, sign up, reset ---------- */

#auth .auth-form { padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 6px; }
.auth-lede { margin-bottom: 6px; color: var(--ash); line-height: 1.5; }
.oauth { display: grid; gap: 8px; margin: 4px 0 2px; }
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border-radius: 14px;
  border: 1px solid var(--edge-2);
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s;
}
.oauth-btn:hover { background: var(--surface-2); border-color: var(--edge-3); }
.oauth-or { margin: 8px 0 0; text-align: center; color: var(--smoke); font-family: var(--f-num); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
.label-row { margin-top: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
#auth .label-row label { margin-top: 0; }
.link.small { color: var(--ash); font-size: 0.85rem; font-weight: 600; }
.opt { color: var(--smoke); font-weight: 500; }
.auth-legal { margin-top: 8px; text-align: center; color: var(--smoke); font-size: 0.82rem; line-height: 1.5; }
.auth-legal a { color: var(--ash); }

/* ---------- Report dialog ---------- */

dialog.report { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; }
.report-form { padding: 28px 26px 24px; display: flex; flex-direction: column; gap: 8px; }
.report-form h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.9rem; line-height: 1.05; overflow-wrap: anywhere; }
.report-reasons { display: grid; gap: 6px; margin-top: 4px; }
.report-reason { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--edge-2); font-weight: 600; transition: border-color 0.2s, background-color 0.2s; }
.report-reason:hover { border-color: var(--edge-3); }
.report-reason:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.report-reason input { width: 18px; height: 18px; margin: 0; accent-color: var(--red); }
.report-note-label { margin-top: 8px; color: var(--ash); font-size: 0.88rem; font-weight: 600; }
.report-form textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--edge-2);
  background: var(--well);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.report-form textarea:focus, .field select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

/* ---------- Settings ---------- */

.field-note { color: var(--smoke); font-size: 0.86rem; line-height: 1.5; }
.field-note.is-ok { color: var(--mint); }
.field-note.is-wait { color: var(--ash); }
.form-card .field + .field { margin-top: 24px; }
.form-card.is-danger { border-color: var(--red-edge); }
.btn-danger { height: 54px; padding: 0 24px; border-radius: 16px; border: 1px solid var(--red-edge); background: var(--red-soft); color: var(--red-ink); font-weight: 700; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.btn-danger:hover { background: var(--red); color: #fff; }
.as-btn, .btn-ghost.small { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.btn-ghost.small { height: 40px; padding: 0 16px; border-radius: 12px; font-size: 0.9rem; }
.signin { margin-top: 16px; display: grid; gap: 8px; }
.signin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 16px; background: var(--surface); }
:root[data-theme="light"] .signin-row { background: var(--surface-2); }
.signin-name { font-weight: 700; }
.signin-state { color: var(--smoke); font-size: 0.88rem; }
.signin-state.is-on { color: var(--mint); }
.field select { height: 54px; width: auto; padding: 0 14px; }

/* ---------- Public profiles ---------- */

.pp-head { max-width: 960px; margin: 22px auto 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px 28px; }
.pp-id .h-lead { font-size: clamp(1.15rem, 2.2vw, 1.45rem); }
.pp-name { margin-top: 2px; font-family: var(--f-display); font-weight: 400; font-size: clamp(2.4rem, 6vw, 3.8rem); line-height: 1.02; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.pp-tags { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ash); font-size: 0.9rem; }
.pp-verified { display: inline-flex; align-items: center; gap: 5px; color: var(--mint); font-weight: 650; font-size: 0.85rem; }
.ico-check { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pp-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pill-quiet { color: var(--ash); }

.pp-rating {
  max-width: 960px;
  margin: 26px auto 0;
  padding: 26px 28px 22px;
  border-radius: 28px;
  border: 1px solid var(--red-edge);
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(0, 2fr);
  align-items: center;
  gap: 18px 30px;
  background: radial-gradient(70% 140% at 0% 0%, var(--red-soft), transparent 70%), var(--card);
  box-shadow: var(--card-shadow);
}
.pp-rating.is-solo { grid-template-columns: 1fr; }
.pp-big { margin-top: 8px; font-size: clamp(3.2rem, 8vw, 4.6rem); font-weight: 700; line-height: 1; letter-spacing: -0.045em; }
.pp-big .num { font-family: var(--f-num); }
.pp-big.is-none { font-family: var(--f-display); font-weight: 400; color: var(--ash); letter-spacing: -0.02em; }
.pp-sub { margin-top: 10px; color: var(--ash); font-size: 0.92rem; }
.pp-rating .btn-compete { margin-top: 18px; }
.pp-chart { min-width: 0; }
.rc { position: relative; border-radius: 14px; outline: none; }
.rc:focus-visible { box-shadow: 0 0 0 2px var(--focus); }
.rc-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.rc-grid { stroke: var(--edge); stroke-width: 1; }
.rc-tick { fill: var(--smoke); font-family: var(--f-num); font-size: 12px; text-anchor: end; }
.rc-area { fill: var(--red); opacity: 0.1; }
.rc-line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rc-dot { fill: var(--red); stroke: var(--ring); stroke-width: 2; }
.rc-end { fill: var(--ink); font-family: var(--f-num); font-size: 14px; font-weight: 700; }
.rc-cross { stroke: var(--edge-3); stroke-width: 1; }
.rc-cross, .rc-hover, .rc-tip { visibility: hidden; }
.rc.is-active .rc-cross, .rc.is-active .rc-hover, .rc.is-active .rc-tip { visibility: visible; }
.rc-tip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 1px;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--edge-2);
  background: var(--menu);
  color: var(--ash);
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 16px 40px -18px var(--shadow);
  pointer-events: none;
  transform: translate(14px, -50%);
}
.rc-tip.flip { transform: translate(calc(-100% - 14px), -50%); }
.rc-tip strong { color: var(--ink); font-size: 1.15rem; }
.rc-delta { font-weight: 700; }
.rc-delta.up { color: var(--mint); }
.rc-delta.down { color: var(--red-ink); }
.rc-table { margin-top: 8px; }
.rc-table summary { width: fit-content; color: var(--ash); font-size: 0.84rem; font-weight: 600; }
.rc-table table { margin-top: 10px; width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.rc-table th { padding: 6px 8px; text-align: left; color: var(--smoke); font-weight: 600; }
.rc-table td { padding: 7px 8px; color: var(--ink-soft); border-top: 1px solid var(--edge); }

.pp-stats { max-width: 960px; margin: 14px auto 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pp-stats .kpi { padding: 18px 18px 16px; border-radius: 20px; border: 1px solid var(--edge); background: var(--card); box-shadow: var(--card-shadow); }
.pp-stats .kpi dd { font-size: 1.75rem; }
.kpi-sub { margin-top: 4px; color: var(--smoke); font-size: 0.8rem; line-height: 1.35; }
.pp-streak { display: inline-flex; align-items: center; gap: 6px; }
.pp-streak svg { width: 15px; height: 18px; fill: var(--red); filter: drop-shadow(0 0 8px var(--red-glow)); }

.pp-sec { max-width: 960px; margin: 36px auto 0; }
.pp-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pp-sec-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; line-height: 1.1; }
.pp-count { color: var(--ash); font-size: 0.92rem; }
.pp-count .num { color: var(--ink); font-weight: 700; }
.pp-sec .hist { max-width: none; margin: 0; }
.hist-row.is-static:hover { background: var(--surface); }
.pp-year { max-width: 960px; margin-top: 36px; }
.empty-note.left { margin-top: 0; text-align: left; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.badge { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; border: 1px solid var(--edge); background: var(--card); box-shadow: var(--card-shadow); }
.badge-sym { position: relative; display: grid; place-items: center; width: 54px; height: 54px; clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); background: var(--surface-3); color: var(--smoke); }
.badge-sym .katex { font-size: 1.1rem; }
.badge-sym.has-flame .katex { transform: translateY(4px); }
.badge-sym.has-flame svg { position: absolute; top: 9px; left: 50%; width: 10px; height: 12px; margin-left: -5px; fill: currentColor; opacity: 0.9; }
.badge.is-earned { border-color: var(--red-edge); }
.badge.is-earned .badge-sym { color: #fff; background: linear-gradient(160deg, var(--red-top), var(--red-deep)); }
.badge-name { display: block; font-weight: 700; }
.badge:not(.is-earned) .badge-name { color: var(--ash); }
.badge-desc { display: block; margin-top: 1px; color: var(--ash); font-size: 0.84rem; line-height: 1.4; }
.badge-prog { margin-top: 8px; display: grid; gap: 4px; color: var(--smoke); font-size: 0.74rem; }
.badge-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.badge-bar i { display: block; height: 100%; border-radius: inherit; background: var(--red); }

/* ---------- Privacy, terms, not found ---------- */

.legal { max-width: 720px; margin: 30px auto 0; padding: 30px 32px; border-radius: 28px; border: 1px solid var(--edge); background: var(--card); box-shadow: var(--card-shadow); display: grid; gap: 24px; }
.legal-sec h2 { margin-bottom: 8px; font-family: var(--f-display); font-weight: 400; font-size: 1.5rem; line-height: 1.15; }
.legal p, .legal li { color: var(--ink-soft); line-height: 1.6; }
.legal ul { display: grid; gap: 8px; }
.legal li { position: relative; padding-left: 18px; }
.legal li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 7px; height: 7px; border-radius: 2px; background: var(--red); }
.legal a { color: var(--ink); }
.legal-date { color: var(--smoke); font-size: 0.88rem; }
.nf-code { font-family: var(--f-num); font-size: clamp(4.5rem, 14vw, 7.5rem); font-weight: 700; line-height: 1; color: var(--red); text-shadow: 0 0 60px var(--red-glow); }

/* ---------- Moderation ---------- */

.mod-kpis { max-width: 960px; margin: 24px auto 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mod-list { max-width: 960px; margin: 22px auto 0; display: grid; gap: 12px; }
.mod-item { padding: 20px 22px; border-radius: 22px; border: 1px solid var(--edge); background: var(--card); box-shadow: var(--card-shadow); display: grid; gap: 14px; }
.mod-who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mod-name { color: var(--ink); font-weight: 700; font-size: 1.1rem; }
.mod-flags { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--ash); font-size: 0.85rem; }
.mod-flags .chip { padding: 2px 10px; font-size: 0.78rem; }
.mod-reports { display: grid; gap: 6px; }
.mod-reports li { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); font-size: 0.9rem; }
:root[data-theme="light"] .mod-reports li { background: var(--surface-2); }
.mod-note { color: var(--ink-soft); }
.mod-by { margin-left: auto; color: var(--smoke); }
.mod-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mod-log { max-width: 960px; margin: 10px auto 0; }
.mod-log ol { margin-top: 12px; display: grid; gap: 6px; color: var(--ash); font-size: 0.88rem; }
.mod-log .num { color: var(--smoke); }

/* ---------- Battle: ratings ---------- */

.b-rating { color: var(--smoke); font-size: 0.72rem; font-weight: 600; line-height: 1.5; }
.b-rated { margin-top: 14px; color: var(--ash); font-size: 0.9rem; text-wrap: pretty; }
.b-rated .chip { padding: 2px 10px; font-size: 0.75rem; vertical-align: 1px; }
.b-rating-change { margin-top: 10px; color: var(--ash); font-size: 1.05rem; }
.b-rating-change .strong { color: var(--ink); font-weight: 700; }
.b-rating-change .delta { font-weight: 700; }
.b-rating-change.up .delta, .b-st-delta.up { color: var(--mint); }
.b-rating-change.down .delta, .b-st-delta.down { color: var(--red-ink); }
.b-st-name a { color: inherit; text-decoration: none; }
.b-st-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.b-st-delta { margin-left: 10px; font-weight: 700; }

/* ---------- Smaller screens ---------- */

@media (max-width: 960px) {
  .top-nav .nav-text { display: none; }
  .pill-nav { width: 44px; padding: 0; }
  .pill-nav.has-streak { width: auto; padding: 0 14px; }
}

@media (max-width: 860px) {
  .orbs { grid-template-columns: repeat(3, 1fr); gap: 26px 12px; max-width: 460px; }
  .plans { grid-template-columns: 1fr; }
  .streak-hero { grid-template-columns: 1fr; }
  .royale { grid-template-columns: 1fr; text-align: center; }
  .royale-lede { margin-left: auto; margin-right: auto; }
}

@media (max-width: 760px) {
  .podium { gap: 10px; grid-template-columns: 1fr 1.1fr 1fr; }
  .pod { padding: 18px 8px 16px; border-radius: 22px; }
  .pod-1 { padding-top: 24px; padding-bottom: 22px; }
  .pod-rank { font-size: 3.4rem; }
  .pod-1 .pod-rank { font-size: 4.6rem; }
  .pod-who { margin-top: 10px; flex-direction: column; gap: 6px; }
  .pod-id { align-items: center; }
  .pod .av-lg { --s: 40px; }
  .pod-name { font-size: 0.92rem; }
  .pod-score .num { font-size: 1.35rem; }
  .pod-1 .pod-score .num { font-size: 1.75rem; }
  .pod-unit, .pod-meta .t { display: none; }
  .pod-meta { margin-top: 8px; font-size: 0.78rem; }
  .pod > .you-tag { top: 8px; right: 8px; }
  .pod .li-chip { padding: 2px 7px; }
  .row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas: "rank who pts" "rank meta pts";
    gap: 6px 12px;
    padding: 12px 14px;
  }
  .row-who .av { --s: 36px; }
  .row-meta { font-size: 0.8rem; gap: 10px; padding-left: 48px; }
  .hud { gap: 8px; padding-right: 16px; }
  .hud-label { display: none; }
  .stage { padding: 18px 14px 22px; border-radius: 24px; }
  .stage-head { grid-template-columns: 40px 1fr 40px; gap: 6px; }
  .nav-arrow { width: 40px; height: 40px; }
  .stage .statement { font-size: 1.1rem; }
  .keypad { padding: 8px; gap: 6px; border-radius: 20px; }
  .key { height: 52px; font-size: 1.2rem; border-radius: 12px; }
  .fx { left: 8px; right: 8px; }
  .year { padding: 20px 14px; }
  .month { grid-template-columns: 30px 1fr; gap: 6px; }
  .mdots { gap: 3px; }
  .streak-hero { padding: 24px 20px; }
  .modes { grid-template-columns: 1fr; }
  .setup { padding: 22px 18px 24px; }
  .b-hud { grid-template-columns: auto minmax(0, 1fr); padding: 10px 16px; }
  .b-alive { grid-column: 1 / -1; text-align: center; font-size: 0.85rem; }
  .b-players { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
  .b-standings li { grid-template-columns: 38px auto minmax(0, 1fr); padding: 10px 14px; }
  .b-st-out { grid-column: 3; font-size: 0.8rem; }
  .rv-body { padding-left: 18px; }
}

@media (max-width: 520px) {
  .top { padding-top: 14px; padding-bottom: 14px; gap: 8px; }
  .wm { height: 24px; }
  .top-nav { gap: 6px; }
  .pill-nav, .pill-icon { width: 40px; height: 40px; }
  .pill-nav.has-streak { width: auto; padding: 0 11px; }
  .nav-membership { display: none; } /* still in the account menu and the footer */
  .acct-pill { width: 40px; height: 40px; padding: 0; }
  .acct-pill .av { --s: 30px; }
  .acct-name { display: none; }
  .pill-mono { padding: 0 12px; height: 40px; letter-spacing: 0.12em; }
  .hero-stats { flex-direction: column; gap: 6px; }
  .btn-compete { height: 58px; padding: 0 36px; }
  .seg button { padding: 0 22px; }
  .period-pill { gap: 10px; padding: 0 14px; }
  .orb { width: 82px; height: 82px; }
  .orb-sym .katex { font-size: 1.8rem; }
  .intro-cta { flex-direction: column; }
  .intro-cta .pill { height: 52px; }
  .ring { width: 40px; height: 40px; }
  .hud-time, .hud-score .num { font-size: 1.2rem; }
  .hud-of { display: none; }
  .pdot { width: 22px; height: 22px; }
  .pdot::before { inset: 6px; }
  .key { height: 48px; }
  .key.check { font-size: 0.82rem; letter-spacing: 0.18em; }
  .points-table { grid-template-columns: repeat(2, 1fr); }
  .rules-inner { padding: 26px 20px 22px; }
  .kpi dd { font-size: 1.25rem; }
  .hist-row { gap: 14px; padding: 16px 18px; }
  .row-id .li-chip span { display: none; }
  .row-id .li-chip { padding: 2px 6px; }
  .topics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .topic { padding: 16px 14px 14px; border-radius: 18px; }
  .topic-name { font-size: 1.2rem; }
  .topic-blurb { font-size: 0.82rem; }
  .royale { padding: 24px 18px; }
  .train-hud { padding-right: 16px; }
  .hud-topic { font-size: 0.85rem; }
  .hud-level { display: none; }
  .b-players { grid-template-columns: 1fr 1fr; }
  .summary-actions .pill, .b-actions .pill { height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Smaller screens: profiles, settings, moderation ---------- */

@media (max-width: 860px) {
  .pp-head { grid-template-columns: auto minmax(0, 1fr); }
  .pp-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .pp-rating { grid-template-columns: 1fr; }
  .pp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .seg button { padding: 0 16px; font-size: 0.9rem; }
  .pp-head { gap: 14px 16px; }
  .pp-head .av-xl { --s: 84px; }
  .pp-rating { padding: 22px 18px 18px; border-radius: 24px; }
  .pp-stats .kpi { padding: 14px 14px 12px; }
  .pp-stats .kpi dd { font-size: 1.4rem; }
  .badges { grid-template-columns: 1fr; }
  .legal { padding: 24px 20px; }
  .mod-by { margin-left: 0; }
  .signin-row { grid-template-columns: minmax(0, 1fr) auto; }
  .signin-row .signin-state { grid-row: 2; }
  .rc-tick { font-size: 14px; }
}

/* Phones: the header keeps to one line. "Compete now" lives on the home page (the wordmark goes there). */
@media (max-width: 520px) {
  .top .play { display: none; }
}
@media (max-width: 400px) {
  .wm { height: 21px; }
  .top-nav { gap: 5px; }
  .top { gap: 6px; }
}
