/* ==========================================================================
   MathClash · signed-in app · "Contest Scoreboard" on Flexoki (light + dark)
   Restyles the bundle's .app-shell; app-shell.js adds the round header, the
   15 result cells, the live "worth now" readout and the theme switch.
   Landing, sign-in and About keep their own world (landing-v3 / auth-pro).
   Prefix `:root body` outranks the bundle, polish.css and party/games css.
   ========================================================================== */

@font-face { font-family: "Geist"; src: url("fonts/geist-variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-latin-normal.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-latin-italic.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-greek-normal.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "STIX Two Text"; src: url("fonts/stix-two-text-greek-italic.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap;
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }

/* ---- tokens: Flexoki (stephango.com/flexoki). Light = paper, dark = ink. ---- */
:root:has(.app-shell) {
  color-scheme: light;
  --bg: #fffcf0;            /* paper */
  --bg-2: #f2f0e5;          /* rail, empty cells */
  --cell: #f2f0e5;
  --ui: #e6e4d9;            /* hairlines */
  --ui-2: #dad8ce;          /* hover borders */
  --ui-3: #cecdc3;          /* active borders, tracks */
  --tx: #100f0f;
  --tx-hi: #100f0f;
  --tx-2: #66655f;          /* between Flexoki 600 and 700: AA on paper, rail and solved cells */
  --tx-3: #878580;          /* non-essential only (3.6:1) */
  --act: #bc5215;           /* orange 600: the only action colour */
  --act-hi: #9d4310;
  --act-ink: #fffcf0;
  --act-soft: #ffe7ce;
  --ok: #66800b; --ok-ink: #536907; --ok-bg: #edeecf; --ok-line: #cdd597;
  --no: #af3029; --no-ink: #942822; --no-bg: #ffe1d5; --no-line: #fdb2a2;
  --gold: #ad8301; --gold-ink: #8e6b01; --gold-flag: #d0a215; --gold-bg: #faeec6;
  --rival: #205ea6;
  --silver: #6f6e69; --bronze: #9d4310;   /* silver as text: 4.97:1 on paper */
  --tier-plat: #24837b; --tier-champ: #5e409d; --tier-legend: #a02f6f;
  --shadow: 0 1px 2px rgba(16, 15, 15, 0.06), 0 8px 24px -12px rgba(16, 15, 15, 0.18);
  --ui-font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --math-font: "STIX Two Text", "STIX Two Math", "Cambria Math", "Times New Roman", serif;
  --rail-w: 248px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  /* the bundle and polish read these; re-point them so stray rules land on-system */
  --mc3-font: var(--ui-font);
  --mc3-acc: var(--act); --mc3-acc-ink: var(--act-ink); --mc3-acc-hi: var(--act-hi); --mc3-acc-rgb: 188, 82, 21;
  --mc3-ember: var(--rival); --mc3-red: var(--no);
  --mc3-black: var(--bg); --mc3-g1: var(--bg-2); --mc3-g2: var(--bg-2); --mc3-g3: var(--ui);
  --mc3-t1: var(--tx); --mc3-t2: var(--tx-2); --mc3-t3: var(--tx-2); --mc3-line: var(--ui); --mc3-line-2: var(--ui-2);
  --bg-raised: var(--bg-2); --card: var(--bg); --card-alt: var(--bg-2); --well: var(--bg); --border: var(--ui); --border-bright: var(--ui-2);
  --text: var(--tx); --muted: var(--tx-2); --blue: var(--act); --blue-strong: var(--act); --cyan: var(--act); --green: var(--ok);
  --red: var(--no); --purple: var(--tx-2); --focus: var(--act);
  --font-sans: var(--ui-font); --font-mono: var(--ui-font);
}
/* dark (ink) unless the player picked light: the default since 2026-11-19, as on the landing */
:root:has(.app-shell):not([data-mc-theme="light"]) {
  color-scheme: dark;
  --bg: #100f0f; --bg-2: #1c1b1a; --cell: #1c1b1a; --ui: #282726; --ui-2: #343331; --ui-3: #403e3c;
  --tx: #cecdc3; --tx-hi: #fffcf0; --tx-2: #878580; --tx-3: #6f6e69;
  --act: #da702c; --act-hi: #ec8b49; --act-ink: #100f0f; --act-soft: #40200d;
  --ok: #879a39; --ok-ink: #a0af54; --ok-bg: #1a1e0c; --ok-line: #313d07;
  --no: #d14d41; --no-ink: #e8705f; --no-bg: #261312; --no-line: #551b18;
  --gold: #d0a215; --gold-ink: #d0a215; --gold-flag: #d0a215; --gold-bg: #241e08;
  --rival: #4385be; --silver: #9f9d96; --bronze: #da702c; --tier-plat: #3aa99f; --tier-champ: #8b7ec8; --tier-legend: #ce5d97;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  --mc3-acc-rgb: 218, 112, 44;
}

/* The reversed plate: whatever needs you now is printed in the opposite ink.
   It re-declares the tokens of the other theme, so everything inside follows. */
:root:has(.app-shell) :is(.problem-card, .duel-active-card, .party-question, .mcx-plate) {
  --bg: #100f0f; --bg-2: #1c1b1a; --cell: #1c1b1a; --ui: #343331; --ui-2: #403e3c; --ui-3: #575653;
  --tx: #e6e4d9; --tx-hi: #fffcf0; --tx-2: #9f9d96; --tx-3: #878580;
  --act: #da702c; --act-hi: #ec8b49; --act-ink: #100f0f; --act-soft: #40200d;
  --ok: #879a39; --ok-ink: #a0af54; --ok-bg: #1a1e0c; --ok-line: #313d07;
  --no: #d14d41; --no-ink: #e8705f; --no-bg: #261312; --no-line: #551b18;
  color-scheme: dark;
}
:root:has(.app-shell):not([data-mc-theme="light"]) :is(.problem-card, .duel-active-card, .party-question, .mcx-plate) {
  --bg: #fffcf0; --bg-2: #f2f0e5; --cell: #f2f0e5; --ui: #e6e4d9; --ui-2: #dad8ce; --ui-3: #cecdc3;
  --tx: #100f0f; --tx-hi: #100f0f; --tx-2: #66655f; --tx-3: #878580;
  --act: #bc5215; --act-hi: #9d4310; --act-ink: #fffcf0; --act-soft: #ffe7ce;
  --ok: #66800b; --ok-ink: #536907; --ok-bg: #edeecf; --ok-line: #cdd597;
  --no: #af3029; --no-ink: #942822; --no-bg: #ffe1d5; --no-line: #fdb2a2;
  color-scheme: light;
}

/* ---- page, browser surfaces, retired ambience ---------------------------- */
:root:has(.app-shell), :root:has(.app-shell) body { background: var(--bg) !important; color: var(--tx); }
:root:has(.app-shell) :is(#mc-aurora, #mc-grain, #mc-sweep, #mc-cursor-dot, #mc-cursor-ring, #mc-ticker, #mc-rail-l, #mc-rail-r, .math-background),
:root body .app-shell :is(.mc-emblem, .mc-glare, .mc-tchip, .mode-selector-indicator, .section-kicker, .eyebrow, .rank-progression-kicker, .rank-card-kicker, .problem-context, .pair-kicker, .preview-kicker),
:root:has(.app-shell) body::before, :root:has(.app-shell) body::after,
:root body .app-shell::before, :root body .app-shell::after,
:root body .app-shell :is(.card, .mc-deco)::before, :root body .app-shell :is(.card, .mc-deco)::after { display: none !important; }
:root body .app-shell {
  animation: none !important;       /* polish.css mounts it with a transform, which would trap the fixed rail */
  transform: none !important;
  min-height: 100vh;
  color: var(--tx);
  font: 400 15px/1.45 var(--ui-font);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
:root:has(.app-shell) ::selection { background: var(--act); color: var(--act-ink); }
:root body .app-shell :is(button, input, select, textarea) { font-family: var(--ui-font); }
:root body .app-shell :is(input, textarea) { caret-color: var(--act); }
:root body .app-shell :is(.mono, .num, .timer, .challenge-pill, .live-badge, small, strong, td, th) { font-family: var(--ui-font); font-variant-numeric: tabular-nums; }
:root:has(.app-shell) :focus-visible { outline: 2px solid var(--act) !important; outline-offset: 2px; box-shadow: none !important; }
:root:has(.app-shell) { scrollbar-color: var(--ui-3) transparent; }
:root body .app-shell a { color: var(--act); text-underline-offset: 3px; }
:root body .app-shell :is(h1, h2, h3) { color: var(--tx-hi); letter-spacing: -0.025em; text-wrap: balance; }

/* ---- the rail ------------------------------------------------------------- */
:root body .app-shell .navbar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--rail-w);
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 22px 14px 16px;
  background: var(--bg-2) !important;
  border: 0 !important;
  border-right: 1px solid var(--ui) !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  animation: none !important;
}
:root body .app-shell .navbar::after { display: none; }
:root body .app-shell .brand-lockup {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 10px 0;
  height: 40px;
  font: 650 18px/1 var(--ui-font);
  letter-spacing: -0.03em;
  color: var(--tx-hi);
}
:root body .app-shell .brand-mark {
  width: 26px; height: 26px; flex: none;
  border: 0; border-radius: 0; box-shadow: none !important; background: none !important;
  -webkit-mask: none; mask: none;
}
:root body .app-shell .brand-mark svg { display: none; }
:root body .app-shell .brand-mark::before {
  content: ""; display: block; width: 26px; height: 26px;
  background: var(--tx-hi);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M13 22H41M21 22V47M33 22V42Q33 47.5 39 46' fill='none' stroke='%23000' stroke-width='5.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M13 22H41M21 22V47M33 22V42Q33 47.5 39 46' fill='none' stroke='%23000' stroke-width='5.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
:root body .app-shell .brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M52 10L43 22H48L41 32L54 17H49Z' fill='%23da702c'/%3E%3C/svg%3E") center / contain no-repeat;
}
:root body .app-shell .brand-mark { position: relative; display: block; }

/* the six sections sit in the rail under the mark */
:root body .app-shell .mode-selector {
  position: fixed !important;
  z-index: 41;
  top: 82px; left: 0;
  width: var(--rail-w);
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}
:root body .app-shell .mode-selector-viewport { overflow: visible !important; mask: none !important; -webkit-mask: none !important; padding: 0 !important; }
:root body .app-shell .mode-selector-track {
  display: flex !important; flex-direction: column; gap: 2px;
  width: auto !important; transform: none !important; padding: 0 !important;
}
:root body .app-shell .mode-tab {
  position: relative;
  display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: flex-start !important;
  gap: 12px !important;
  width: 100%; min-width: 0; min-height: 42px !important; height: 42px;
  margin: 0 !important; padding: 0 12px !important;
  border: 0 !important; border-radius: 9px !important;
  background: transparent !important; box-shadow: none !important;
  color: var(--tx-2) !important;
  font: 500 14.5px/1 var(--ui-font) !important;
  letter-spacing: -0.01em; text-transform: none !important; text-align: left; white-space: nowrap;
  transform: none !important; animation: none !important; opacity: 1 !important;
  transition: background-color .15s var(--ease), color .15s var(--ease);
  flex: none !important;
}
:root body .app-shell .mode-tab:hover:not(.active) { background: var(--ui) !important; color: var(--tx) !important; }
:root body .app-shell .mode-tab.active { background: var(--bg) !important; color: var(--tx-hi) !important; font-weight: 600 !important; box-shadow: inset 0 0 0 1px var(--ui) !important; }
:root body .app-shell .mode-tab .mc-tab-ic { display: grid !important; place-items: center; width: 20px; height: 20px; margin: 0 !important; color: inherit !important; opacity: 1 !important; filter: none !important; flex: none; }
:root body .app-shell .mode-tab .mc-tab-ic svg { width: 19px !important; height: 19px !important; stroke-width: 1.9; }
:root body .app-shell .mode-tab.active .mc-tab-ic { color: var(--act) !important; }
:root body .app-shell .mode-tab .mcx-count {
  margin-left: auto; padding-left: 8px;
  font: 500 12.5px/1 var(--ui-font); color: var(--tx-2); font-variant-numeric: tabular-nums;
}
:root body .app-shell .mode-tab.active .mcx-count { color: var(--act); font-weight: 600; }

/* rail foot: profile, streak, then the quiet controls */
:root body .app-shell .nav-right {
  margin-top: auto;
  display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px !important;
  padding-top: 12px;
  border-top: 1px solid var(--ui);
}
:root body .app-shell .nav-divider { display: none !important; }
:root body .app-shell .navbar :is(.btn-ghost, .profile-trigger, .streak-badge) {
  min-height: 38px; height: 38px;
  padding: 0 10px !important;
  border: 0 !important; border-radius: 9px !important;
  background: transparent !important; box-shadow: none !important;
  color: var(--tx-2) !important;
  font: 500 13.5px/1 var(--ui-font) !important; letter-spacing: -0.005em; text-transform: none !important;
  transform: none !important;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
:root body .app-shell .navbar :is(.btn-ghost, .profile-trigger):hover:not(:disabled) { background: var(--ui) !important; color: var(--tx-hi) !important; }
:root body .app-shell .navbar .profile-trigger {
  order: -2; flex: 1 1 100%;
  display: flex !important; align-items: center; justify-content: flex-start; gap: 10px;
  height: 46px; padding: 0 8px !important;
}
:root body .app-shell .profile-trigger > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:root body .app-shell .profile-trigger .nav-player { display: flex; align-items: center; gap: 10px; min-width: 0; }
:root body .app-shell .profile-trigger strong { color: var(--tx-hi) !important; font: 600 14.5px/1.2 var(--ui-font) !important; overflow: hidden; text-overflow: ellipsis; }
:root body .app-shell .profile-trigger .mcx-tier { display: block; color: var(--tx-2); font: 400 12.5px/1.2 var(--ui-font); margin-top: 2px; }
:root body .app-shell .navbar .streak-badge {
  order: -1; flex: 1 1 100%;
  display: flex !important; align-items: center; justify-content: flex-start; gap: 10px;
  color: var(--tx) !important; padding: 0 8px !important; height: 34px; min-height: 34px;
}
:root body .app-shell .navbar .streak-badge * { font-family: var(--ui-font) !important; color: inherit; }
:root body .app-shell .navbar .streak-badge svg { width: 20px; height: 20px; flex: none; margin: 0 4px 0 6px; filter: none !important; animation: none !important; }
:root body .app-shell .navbar .streak-badge .streak-flame-outer { fill: var(--act) !important; }
:root body .app-shell .navbar .streak-badge .streak-flame-inner { fill: var(--gold-flag) !important; }
:root body .app-shell .navbar .streak-badge .streak-flame-spark { display: none; }
:root body .app-shell .navbar :is(.shortcut-button, .sound-btn, .mcx-theme, .btn-ghost:has(.logout-label)) {
  width: 40px; min-width: 40px; padding: 0 !important; justify-content: center; display: inline-flex; align-items: center;
}
:root body .app-shell .navbar :is(.shortcut-button span, .logout-label) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:root body .app-shell .navbar :is(.btn-ghost, .mcx-theme) svg { width: 18px; height: 18px; }
:root body .app-shell .navbar .sound-btn.muted { color: var(--tx-3) !important; }
:root body .app-shell .navbar .btn-ghost:has(.logout-label) { margin-left: auto; }
:root body .app-shell .mcx-theme {
  height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--tx-2); cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
:root body .app-shell .mcx-theme:hover { background: var(--ui); color: var(--tx-hi); }

/* ---- rank badges: tier ink from the palette ------------------------------ */
:root body .app-shell .rank-badge-bronze { --rank-color: var(--bronze) !important; }
:root body .app-shell .rank-badge-silver { --rank-color: var(--silver) !important; }
:root body .app-shell .rank-badge-gold { --rank-color: var(--gold) !important; }
:root body .app-shell .rank-badge-platinum { --rank-color: var(--tier-plat) !important; }
:root body .app-shell .rank-badge-diamond { --rank-color: var(--rival) !important; }
:root body .app-shell .rank-badge-champion { --rank-color: var(--tier-champ) !important; }
:root body .app-shell .rank-badge-legend { --rank-color: var(--tier-legend) !important; }
:root body .app-shell .rank-badge {
  display: inline-grid; place-items: center; flex: none;
  color: var(--rank-color) !important;
  background: color-mix(in srgb, var(--rank-color) 14%, transparent) !important;
  border: 0 !important; box-shadow: none !important; filter: none !important; animation: none !important;
}
:root body .app-shell .rank-badge-sm { width: 26px; height: 26px; border-radius: 7px; }
:root body .app-shell .rank-badge-sm svg { width: 14px; height: 14px; }
:root body .app-shell .rank-badge-lg { width: 44px; height: 44px; border-radius: 11px; }
:root body .app-shell .rank-badge-lg svg { width: 22px; height: 22px; }
:root body .app-shell .rank-badge-sparkle { display: none !important; }

/* ---- layout -------------------------------------------------------------- */
:root body .app-shell .main-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 340px !important;
  align-items: start;
  gap: 32px !important;
  width: auto !important; max-width: 1240px !important;
  margin: 0 0 0 var(--rail-w) !important;
  padding: 32px 40px 64px !important;
}
:root body .app-shell .problem-col { min-width: 0; }
:root body .app-shell .mode-panels { min-width: 0; }
:root body .app-shell .mode-panel { animation: none !important; }
:root body .app-shell .mode-panel.active { display: flex; flex-direction: column; gap: 20px; }
:root body .app-shell .arena-side-stack { display: flex !important; flex-direction: column; gap: 20px !important; position: sticky; top: 24px; min-width: 0; }
:root body .app-shell .site-footer { margin-left: var(--rail-w); padding: 20px 40px 40px; border: 0; background: none; color: var(--tx-2); font-size: 13px; text-align: left; max-width: 1240px; }
:root body .app-shell .site-footer a { color: var(--tx-2); }
:root body .app-shell .site-footer a:hover { color: var(--tx-hi); }
/* Party and Games take the whole row; Daily and Duels keep live standings, Leaderboard and Streaks their standing card */
:root body .app-shell .main-grid:has(#panel-games.active, #panel-party.active) { grid-template-columns: minmax(0, 1fr) !important; }
:root body .app-shell .main-grid:has(#panel-games.active, #panel-party.active) > :not(.problem-col) { display: none !important; }
:root body .app-shell .main-grid:has(#panel-leaderboard.active, #panel-streaks.active) { grid-template-columns: minmax(0, 1fr) 300px !important; }
:root body .app-shell .main-grid > .leaderboard-col { position: sticky; top: 24px; min-width: 0; }

/* your standing (Leaderboard, Streaks) */
:root body .app-shell .rank-card { padding: 22px !important; display: flex; flex-direction: column; gap: 4px; }
:root body .app-shell .rank-card-kicker { display: block !important; order: 1; margin: 2px 0 0; color: var(--tx-2) !important; font: 500 13px/1.3 var(--ui-font) !important; text-transform: none !important; letter-spacing: 0 !important; }
:root body .app-shell .rank-card-kicker svg { display: none; }
:root body .app-shell .rank-card-name { order: 2; }
:root body .app-shell .rank-card-stats { order: 3; }
:root body .app-shell .rank-card-note { order: 4; }
:root body .app-shell .rank-card-rank { font: 650 44px/1 var(--ui-font) !important; letter-spacing: -0.04em; color: var(--tx-hi) !important; text-shadow: none !important; background: none !important; -webkit-text-fill-color: currentColor; filter: none !important; animation: none !important; }
:root body .app-shell .rank-card-name { margin: 2px 0 14px !important; color: var(--tx-2) !important; font: 500 14px/1.3 var(--ui-font) !important; }
:root body .app-shell .rank-card-stats { display: grid !important; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--ui); border-radius: 10px; overflow: hidden; background: var(--ui); }
:root body .app-shell .rank-card-stats > div { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; background: var(--bg) !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
:root body .app-shell .rank-card-stats span { color: var(--tx-2) !important; font: 500 12.5px/1.2 var(--ui-font) !important; }
:root body .app-shell .rank-card-stats strong { color: var(--tx-hi) !important; font: 650 19px/1 var(--ui-font) !important; letter-spacing: -0.02em; }
:root body .app-shell .rank-card-note { margin-top: 12px; color: var(--tx-2); font: 400 13px/1.45 var(--ui-font); }

/* streak flames in palette ink, hotter as the streak grows */
:root:has(.app-shell) .streak-flame :is(.streak-flame-outer) { fill: var(--act) !important; }
:root:has(.app-shell) .streak-flame :is(.streak-flame-inner) { fill: var(--gold-flag) !important; }
:root:has(.app-shell) .streak-flame-hot .streak-flame-outer { fill: #bc5215 !important; }
:root:has(.app-shell) .streak-flame-deep-red .streak-flame-outer { fill: var(--no) !important; }
:root:has(.app-shell) .streak-flame-violet .streak-flame-outer { fill: #8b7ec8 !important; }
:root:has(.app-shell) .streak-flame-purple .streak-flame-outer { fill: #a02f6f !important; }
:root:has(.app-shell) .streak-flame { filter: none !important; animation: none !important; }
:root:has(.app-shell) .streak-flame-spark { display: none !important; }

/* ---- surfaces ------------------------------------------------------------ */
:root body .app-shell .card {
  border: 1px solid var(--ui) !important;
  border-radius: 14px !important;
  background: var(--bg) !important;
  box-shadow: none !important;
  color: var(--tx);
  padding: 22px 24px;
  transform: none !important;
  animation: none !important;
}
:root body .app-shell .card :is(h2, h3) > svg, :root body .app-shell .lb-header h2 svg { display: none !important; }
:root body .app-shell :is(.focus-progress-meta span, .rank-card-stats span, .profile-pair-label) { text-transform: none !important; letter-spacing: 0 !important; }
:root body .app-shell .card :is(h2, h3) { font: 650 20px/1.2 var(--ui-font) !important; letter-spacing: -0.025em; color: var(--tx-hi) !important; margin: 0; text-transform: none !important; }
:root body .app-shell :is(.duel-sub, .lb-subtitle, .focus-card-copy, .party-head p, .duel-fineprint, .focus-card-note, .rank-progression-note, .shortcut-intro) { color: var(--tx-2) !important; font: 400 14px/1.5 var(--ui-font) !important; }
:root body .app-shell .duel-fineprint, :root body .app-shell .focus-card-note { font-size: 13px !important; }

/* ---- buttons + inputs ---------------------------------------------------- */
:root body .app-shell .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent !important; border-radius: 10px !important;
  font: 600 15px/1 var(--ui-font) !important; letter-spacing: -0.01em; text-transform: none !important;
  box-shadow: none !important; text-shadow: none !important; filter: none !important;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
  animation: none !important;
}
:root body .app-shell .btn svg { width: 16px; height: 16px; }
:root body .app-shell .btn:active:not(:disabled) { transform: scale(0.98); }
:root body .app-shell :is(.btn-primary, .btn-success) { background: var(--act) !important; color: var(--act-ink) !important; }
:root body .app-shell :is(.btn-primary, .btn-success):hover:not(:disabled) { background: var(--act-hi) !important; }
:root body .app-shell :is(.btn-ghost, .btn-skip) { background: transparent !important; color: var(--tx) !important; border-color: var(--ui-2) !important; }
:root body .app-shell :is(.btn-ghost, .btn-skip):hover:not(:disabled) { background: var(--bg-2) !important; border-color: var(--ui-3) !important; color: var(--tx-hi) !important; }
:root body .app-shell .btn-delete { background: transparent !important; color: var(--no) !important; border-color: var(--no-line) !important; }
:root body .app-shell .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
:root body .app-shell .btn-block { width: 100%; }
:root body .app-shell :is(.input, input[type="text"], input[type="number"], input[type="email"], select, textarea) {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--ui-2) !important; border-radius: 10px !important;
  background: var(--bg) !important; color: var(--tx-hi) !important;
  font: 500 16px/1.2 var(--ui-font) !important;
  box-shadow: none !important;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
:root body .app-shell :is(.input, input, select, textarea)::placeholder { color: var(--tx-2) !important; opacity: 1; }
:root body .app-shell :is(.input, input, select, textarea):hover:not(:disabled):not(:focus) { border-color: var(--ui-3) !important; }
:root body .app-shell :is(.input, input, select, textarea):focus { outline: none !important; border-color: var(--act) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--act) 22%, transparent) !important; }
:root body .app-shell :is(input[type="number"])::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
:root body .app-shell input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
:root body .app-shell .field-label { color: var(--tx-2) !important; font: 500 13px/1.3 var(--ui-font) !important; text-transform: none !important; letter-spacing: 0 !important; }

/* ---- round header + today's cells (app-shell.js) --------------------------- */
:root body .app-shell .mcx-round { display: flex; flex-direction: column; gap: 16px; container-type: inline-size; }
@container (max-width: 700px) {
  :root body .app-shell .mcx-cells { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  :root body .app-shell .mcx-cell { height: 56px; }
}
:root body .app-shell .mcx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
:root body .app-shell .mcx-head h1 { margin: 0; font: 650 30px/1.1 var(--ui-font); letter-spacing: -0.035em; color: var(--tx-hi); }
:root body .app-shell .mcx-head p { margin: 7px 0 0; color: var(--tx-2); font-size: 14px; }
:root body .app-shell .mcx-head p b { color: var(--act); font-weight: 600; }
:root body .app-shell .mcx-figs { display: flex; gap: 28px; margin: 0; }
:root body .app-shell .mcx-figs div { display: flex; flex-direction: column-reverse; gap: 4px; }
:root body .app-shell .mcx-figs dt { color: var(--tx-2); font-size: 12.5px; }
:root body .app-shell .mcx-figs dd { margin: 0; font: 650 22px/1 var(--ui-font); letter-spacing: -0.02em; color: var(--tx-hi); }
:root body .app-shell .mcx-cells { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 5px; }
:root body .app-shell .mcx-cell {
  position: relative; height: 62px; min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 7px 7px 6px;
  border: 1px solid var(--ui); border-radius: 8px;
  background: var(--cell);
  font-variant-numeric: tabular-nums; overflow: hidden;
}
:root body .app-shell .mcx-cell i { font: 600 12px/1 var(--ui-font); font-style: normal; color: var(--tx-2); }
:root body .app-shell .mcx-cell b { font: 650 13.5px/1 var(--ui-font); color: var(--tx-hi); letter-spacing: -0.02em; white-space: nowrap; }
:root body .app-shell .mcx-cell small { font: 500 11.5px/1 var(--ui-font); color: var(--tx-2); white-space: nowrap; }
:root body .app-shell .mcx-cell.is-ok { border-color: var(--ok-line); }
:root body .app-shell .mcx-cell.is-ok i { color: var(--ok-ink); }
:root body .app-shell .mcx-cell.is-ok b { color: var(--ok-ink); }
:root body .app-shell .mcx-cell.is-fast::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 13px 13px 0; border-color: transparent var(--gold-flag) transparent transparent; }
:root body .app-shell .mcx-cell.is-now { background: var(--bg); border: 2px solid var(--act); padding: 6px 6px 5px; }
:root body .app-shell .mcx-cell.is-now :is(i, b) { color: var(--act); }
:root body .app-shell .mcx-cell .mcx-tries { position: absolute; right: 6px; top: 7px; display: flex; gap: 2px; }
:root body .app-shell .mcx-cell.is-fast .mcx-tries { right: 17px; }
:root body .app-shell .mcx-cell .mcx-tries span { width: 5px; height: 5px; border-radius: 50%; background: var(--no); }
:root body .app-shell .mcx-key { display: flex; gap: 18px; flex-wrap: wrap; margin: -6px 0 0; color: var(--tx-2); font-size: 12.5px; }
:root body .app-shell .mcx-key span { display: inline-flex; align-items: center; gap: 6px; }
:root body .app-shell .mcx-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
:root body .app-shell .mcx-key .k-ok { background: var(--ok-line); box-shadow: inset 0 0 0 1px var(--ok); }
:root body .app-shell .mcx-key .k-now { box-shadow: inset 0 0 0 2px var(--act); }
:root body .app-shell .mcx-key .k-fast { background: linear-gradient(225deg, var(--gold-flag) 50%, var(--cell) 50%); box-shadow: inset 0 0 0 1px var(--ui-3); }
:root body .app-shell .mcx-key .k-try { width: 6px; height: 6px; border-radius: 50%; background: var(--no); }

/* ---- the open problem: the reversed plate ---------------------------------- */
:root body .app-shell .problem-card {
  position: relative;
  min-height: 0 !important; height: auto !important;
  padding: 22px 26px 26px !important;
  border: 0 !important; border-radius: 16px !important;
  background: var(--bg) !important;
  color: var(--tx) !important;
  box-shadow: var(--shadow) !important;
}
:root body .app-shell .problem-header { display: flex !important; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 4px; padding: 0; border: 0; }
:root body .app-shell .problem-header .stars { display: inline-flex; gap: 3px; align-items: center; order: 1; }
:root body .app-shell .problem-header .stars svg { width: 7px; height: 14px; border-radius: 2px; background: var(--act); filter: none !important; animation: none !important; }
:root body .app-shell .problem-header .stars svg * { display: none; }
:root body .app-shell .problem-header .stars svg.star-empty { background: var(--ui-3); }
:root body .app-shell .problem-header .stars::before { content: "Difficulty"; margin-right: 6px; color: var(--tx-2); font: 500 13px/1 var(--ui-font); }
:root body .app-shell .problem-header .challenge-pill { display: none !important; }
:root body .app-shell .problem-header .timer {
  order: 3; margin-left: auto;
  padding: 0; border: 0 !important; background: none !important; box-shadow: none !important;
  color: var(--tx-2) !important; font: 500 14px/1 var(--ui-font) !important; letter-spacing: 0;
}
:root body .app-shell .mcx-worth { order: 2; display: inline-flex; align-items: baseline; gap: 6px; margin-left: 18px; color: var(--tx-2); font-size: 13px; }
:root body .app-shell .mcx-worth b { color: var(--act); font: 650 17px/1 var(--ui-font); letter-spacing: -0.02em; }
:root body .app-shell .mcx-worth em { font-style: normal; color: var(--tx); font-weight: 600; }
:root body .app-shell .mcx-drain { height: 4px; margin: 14px 0 0; border-radius: 4px; background: var(--ui); overflow: hidden; }
:root body .app-shell .mcx-drain i { display: block; height: 100%; width: var(--charge, 100%); background: var(--act); border-radius: inherit; transition: width .9s linear; }
:root body .app-shell .problem-body { margin: 0; padding: 22px 0 24px; border: 0; background: none; min-height: 0 !important; display: block !important; }
:root body .app-shell .problem-copy {
  display: block;
  color: var(--tx-hi) !important;
  font: 400 clamp(22px, 2.3vw, 28px)/1.38 var(--math-font) !important;
  letter-spacing: 0 !important;
  text-wrap: pretty;
  animation: none !important;
}
:root body .app-shell .answer-row { display: flex !important; flex-direction: row !important; gap: 10px; flex-wrap: wrap; margin: 0; }
:root body .app-shell .answer-row :is(.answer-input, input) { flex: 1 1 220px; min-width: 0; height: 54px; min-height: 54px; font: 500 20px/1 var(--ui-font) !important; }
:root body .app-shell .answer-row .btn { min-height: 54px; padding: 0 24px; }
:root body .app-shell .answer-row .btn-skip { color: var(--tx-2) !important; }
:root body .app-shell .feedback {
  margin: 0 0 14px; padding: 12px 14px;
  border: 1px solid var(--ui) !important; border-radius: 10px !important;
  background: var(--bg-2) !important; color: var(--tx) !important;
  font: 500 14.5px/1.4 var(--ui-font) !important; box-shadow: none !important; animation: none !important;
}
:root body .app-shell .feedback.ok { background: var(--ok-bg) !important; border-color: var(--ok-line) !important; color: var(--ok-ink) !important; }
:root body .app-shell .feedback.err { background: var(--no-bg) !important; border-color: var(--no-line) !important; color: var(--no-ink) !important; }
:root body .app-shell .feedback-title { display: flex; align-items: center; gap: 8px; font-weight: 650; color: inherit !important; }
:root body .app-shell .feedback-title svg { width: 16px; height: 16px; }
:root body .app-shell .feedback-breakdown, :root body .app-shell .feedback-note { margin-top: 6px; color: var(--tx-2) !important; font: 400 13px/1.45 var(--ui-font) !important; font-variant-numeric: tabular-nums; }
:root body .app-shell .next-btn { margin-top: 14px; min-height: 52px; }
:root body .app-shell .shake { animation: mcx-shake .3s var(--ease); }
@keyframes mcx-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* app-moments.js: the correct-answer moment, re-inked */
:root body .app-shell .mc-moment { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
:root body .app-shell .mc-moment-word { font: 650 20px/1 var(--ui-font); color: var(--ok-ink); letter-spacing: -0.02em; }
:root body .app-shell .mc-moment-pts { font: 650 20px/1 var(--ui-font); color: var(--tx-hi); }
:root body .app-shell .mc-moment-pts b { font-weight: 700; }
:root body .app-shell .mc-moment-pts small { margin-left: 4px; color: var(--tx-2); font-size: 13px; font-weight: 500; }
:root body .app-shell .mc-moment-mult { color: var(--tx-2); font-size: 13px; }
:root body .app-shell .mc-has-moment .feedback-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- monthly tier: one ruled line under the plate ---------------------------- */
:root body .app-shell .rank-progression {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "id meta pts" "track track track" "note note note";
  align-items: center; gap: 10px 16px;
  padding: 18px 22px !important;
}
:root body .app-shell .rank-progression-header { display: contents !important; }
:root body .app-shell .rank-progression-identity { grid-area: id; display: flex; align-items: center; gap: 12px; }
:root body .app-shell .rank-progression-identity h2 { font: 650 18px/1 var(--ui-font) !important; }
:root body .app-shell .rank-progression-points { grid-area: pts; display: flex; align-items: baseline; gap: 6px; }
:root body .app-shell .rank-progression-points strong { font: 650 22px/1 var(--ui-font) !important; color: var(--tx-hi) !important; letter-spacing: -0.02em; animation: none !important; }
:root body .app-shell .rank-progression-points span { color: var(--tx-2); font-size: 13px; }
:root body .app-shell .rank-progression-meta { grid-area: meta; display: flex; gap: 14px; justify-content: flex-start; color: var(--tx-2); font-size: 13.5px; }
:root body .app-shell .rank-progression-meta strong { color: var(--tx); font-weight: 600; }
:root body .app-shell .rank-progress-track { grid-area: track; height: 6px !important; border-radius: 6px !important; background: var(--ui) !important; border: 0 !important; overflow: hidden; box-shadow: none !important; }
:root body .app-shell .rank-progress-fill { height: 100%; border-radius: inherit !important; background: var(--rank-color, var(--act)) !important; box-shadow: none !important; animation: none !important; }
:root body .app-shell .rank-progression-bronze { --rank-color: var(--bronze); }
:root body .app-shell .rank-progression-silver { --rank-color: var(--silver); }
:root body .app-shell .rank-progression-gold { --rank-color: var(--gold); }
:root body .app-shell .rank-progression-note { grid-area: note; margin: 0 !important; }

/* ---- standings tables (side card, Leaderboard, Streaks) ---------------------- */
:root body .app-shell :is(.leaderboard-card, .leaderboard-page) { padding: 20px 0 8px !important; }
:root body .app-shell .lb-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 20px 14px; margin: 0; }
:root body .app-shell .leaderboard-page .lb-header { padding: 4px 24px 18px; }
:root body .app-shell .leaderboard-page .lb-header h2 { font-size: 26px !important; letter-spacing: -0.03em; }
:root body .app-shell .lb-subtitle { margin-top: 6px; }
:root body .app-shell .live-badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 4px 9px 4px 8px; border: 1px solid var(--ok-line) !important; border-radius: 999px;
  background: var(--ok-bg) !important; color: var(--ok-ink) !important;
  font: 600 11.5px/1 var(--ui-font) !important; letter-spacing: 0.02em; box-shadow: none !important;
}
:root body .app-shell .live-badge::before, :root body .app-shell .live-dot { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok) !important; box-shadow: none !important; animation: none !important; }
:root body .app-shell .live-badge .live-dot { display: none; }
:root body .app-shell .lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
:root body .app-shell .lb-table th {
  height: 30px; padding: 0 12px; text-align: left;
  border-bottom: 1px solid var(--ui) !important; background: none !important;
  color: var(--tx-2) !important; font: 500 12.5px/1 var(--ui-font) !important; text-transform: none !important; letter-spacing: 0 !important;
}
:root body .app-shell .lb-table td { height: 44px; padding: 0 12px; border-bottom: 1px solid var(--ui) !important; background: none !important; color: var(--tx); vertical-align: middle; }
:root body .app-shell .lb-table :is(th, td):first-child { padding-left: 20px; width: 44px; }
:root body .app-shell .lb-table :is(th, td):last-child { padding-right: 20px; }
:root body .app-shell .leaderboard-page .lb-table :is(th, td):first-child { padding-left: 24px; }
:root body .app-shell .leaderboard-page .lb-table :is(th, td):last-child { padding-right: 24px; }
:root body .app-shell .lb-table .num { text-align: right; }
:root body .app-shell .lb-table td.rank { color: var(--tx-2); font-weight: 600; }
:root body .app-shell .lb-table td.pts { color: var(--tx-hi); font-weight: 600; }
:root body .app-shell .lb-table tbody tr { transition: background-color .15s var(--ease); animation: none !important; opacity: 1 !important; transform: none !important; }
:root body .app-shell .lb-table :is(td, th)::before, :root body .app-shell .lb-table :is(td, th)::after { content: none !important; display: none !important; }
:root body .app-shell .lb-table td.rank { background: none !important; box-shadow: none !important; }
:root body .app-shell .lb-table tbody tr:hover td { background: var(--bg-2) !important; }
:root body .app-shell .lb-table tbody tr:nth-child(1) td.rank { color: var(--gold-ink) !important; }
:root body .app-shell .lb-table tbody tr:nth-child(2) td.rank { color: var(--silver) !important; }
:root body .app-shell .lb-table tbody tr:nth-child(3) td.rank { color: var(--bronze) !important; }
:root body .app-shell .lb-table tbody tr:nth-child(-n+3) td { font-weight: 600; }
:root body .app-shell .lb-table tbody tr.me td { background: var(--act-soft) !important; color: var(--tx-hi); font-weight: 700; }
:root body .app-shell .lb-table tbody tr.me td.rank { color: var(--act-hi) !important; }
:root body .app-shell .lb-table td.player { display: table-cell !important; }
:root body .app-shell .player-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
:root body .app-shell .player-profile-trigger {
  display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left;
}
:root body .app-shell .player-profile-trigger > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root body .app-shell .player-profile-trigger:hover > span:last-child { text-decoration: underline; text-underline-offset: 3px; }
:root body .app-shell .rank-medal { display: none !important; }
:root body .app-shell .player-cell > svg { width: 14px; height: 14px; color: var(--tx-3); flex: none; }
:root body .app-shell .streak-count { display: table-cell; }
:root body .app-shell .streak-count svg { width: 13px; height: 13px; margin-left: 4px; vertical-align: -1px; color: var(--act); }
:root body .app-shell :is(.lb-empty, .leaderboard-loading) { padding: 28px 24px; color: var(--tx-2); text-align: center; }
:root body .app-shell .leaderboard-card .lb-header h2 { font-size: 17px !important; }
:root body .app-shell .leaderboard-card .lb-table td { height: 38px; font-size: 13.5px; }
:root body .app-shell .leaderboard-card .lb-table :is(th, td):nth-child(3) { display: none; }  /* solved: the wide table carries it */
:root body .app-shell .leaderboard-card { max-height: calc(100vh - 48px); overflow: auto; overscroll-behavior: contain; }

/* switches: Point / 1v1 / 2v2, Create / Join, 1v1 / 2v2 */
:root body .app-shell :is(.leaderboard-switcher, .duel-kind-switch) {
  display: inline-flex !important; gap: 2px; padding: 3px; margin: 0;
  border: 1px solid var(--ui) !important; border-radius: 11px !important; background: var(--bg-2) !important; box-shadow: none !important;
  width: auto !important; align-self: flex-start;
}
:root body .app-shell .leaderboard-page .leaderboard-switcher { margin: 0 24px 14px; }
:root body .app-shell :is(.leaderboard-switch, .duel-kind-btn) {
  display: inline-flex !important; align-items: center; gap: 7px; white-space: nowrap; flex: none !important; width: auto !important;
  min-height: 34px; padding: 0 14px !important;
  border: 0 !important; border-radius: 8px !important; background: transparent !important; box-shadow: none !important;
  color: var(--tx-2) !important; font: 500 14px/1 var(--ui-font) !important; text-transform: none !important; letter-spacing: -0.01em;
  transform: none !important; animation: none !important;
}
:root body .app-shell :is(.leaderboard-switch, .duel-kind-btn):hover:not(.active) { color: var(--tx-hi) !important; }
:root body .app-shell :is(.leaderboard-switch, .duel-kind-btn).active { background: var(--bg) !important; color: var(--tx-hi) !important; font-weight: 600 !important; box-shadow: 0 1px 2px rgba(16, 15, 15, .12), inset 0 0 0 1px var(--ui) !important; }
:root body .app-shell .duel-kind-btn .mc-tab-ic { display: inline-grid !important; color: inherit !important; opacity: 1 !important; }
:root body .app-shell .duel-kind-btn .mc-tab-ic svg { width: 15px; height: 15px; }

/* ---- practice focus ---------------------------------------------------------- */
:root body .app-shell .focus-card { padding: 20px !important; display: flex; flex-direction: column; gap: 12px; }
:root body .app-shell .focus-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
:root body .app-shell .focus-card-heading h2 { font-size: 17px !important; }
:root body .app-shell .focus-status { display: inline-flex; align-items: center; gap: 6px; color: var(--tx-2) !important; font: 600 13px/1 var(--ui-font) !important; background: none !important; border: 0 !important; }
:root body .app-shell .focus-status svg { width: 15px; height: 15px; }
:root body .app-shell .focus-card-copy { margin: 0 !important; }
:root body .app-shell .focus-progress-meta { display: flex; justify-content: space-between; color: var(--tx-2); font-size: 13px; }
:root body .app-shell .focus-progress-meta strong { color: var(--tx-hi); }
:root body .app-shell .focus-progress-track { height: 6px; border-radius: 6px; background: var(--ui) !important; overflow: hidden; border: 0 !important; }
:root body .app-shell .focus-progress-fill { height: 100%; background: var(--ok) !important; border-radius: inherit; box-shadow: none !important; }
:root body .app-shell .focus-topic-grid { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px; }
:root body .app-shell .focus-topic {
  display: flex !important; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 40px; padding: 0 12px !important;
  border: 1px solid var(--ui) !important; border-radius: 9px !important; background: var(--bg) !important; box-shadow: none !important;
  color: var(--tx) !important; font: 500 13.5px/1.2 var(--ui-font) !important; text-align: left; transform: none !important;
}
:root body .app-shell .focus-topic:first-child { grid-column: 1 / -1; }
:root body .app-shell .focus-topic small { color: var(--tx-2) !important; font: 500 12px/1 var(--ui-font) !important; }
:root body .app-shell .focus-topic:hover:not(.active) { border-color: var(--ui-3) !important; }
:root body .app-shell .focus-topic.active { border-color: var(--act) !important; background: var(--act-soft) !important; color: var(--tx-hi) !important; font-weight: 600 !important; }
:root body .app-shell :is(.focus-topic.active small, .party-format-btn.active span) { color: var(--tx) !important; }
:root body .app-shell .focus-start { min-height: 40px; }
:root body .app-shell :is(.topic-tag, [class*="topic-"]) { filter: none; }

/* ---- duels --------------------------------------------------------------------- */
:root body .app-shell .duel-screen { display: flex; flex-direction: column; gap: 20px; }
:root body .app-shell .duel-card { padding: 26px 28px !important; display: flex; flex-direction: column; gap: 14px; text-align: left !important; align-items: stretch; }
:root body .app-shell .duel-card > * { text-align: left !important; }
:root body .app-shell .duel-meta { justify-content: flex-start !important; align-self: flex-start; }
:root body .app-shell .duel-title { display: flex; align-items: center; gap: 10px; font: 650 26px/1.15 var(--ui-font) !important; letter-spacing: -0.03em; margin: 0; }
:root body .app-shell .duel-sub { margin: 0 !important; max-width: 62ch; }
:root body .app-shell .duel-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 12px 14px; border: 1px solid var(--ui); border-radius: 10px; background: var(--bg-2);
  color: var(--tx); font: 500 14px/1.3 var(--ui-font) !important;
}
:root body .app-shell .duel-meta span { color: var(--tx-2); }
:root body .app-shell .duel-card > .btn { margin-top: 2px; }
:root body .app-shell .radar { border-color: var(--ui-2) !important; background: radial-gradient(circle, var(--act-soft), transparent 70%) !important; }
:root body .app-shell .radar-sweep { background: conic-gradient(from 0deg, transparent 75%, color-mix(in srgb, var(--act) 45%, transparent)) !important; }
:root body .app-shell .search-elapsed { color: var(--tx-2); font-variant-numeric: tabular-nums; }

/* a live duel: the scoreboard of two rows of five cells, then the plate */
:root body .app-shell .duel-active-card { padding: 22px 26px 26px !important; border: 0 !important; border-radius: 16px !important; background: var(--bg) !important; box-shadow: var(--shadow) !important; color: var(--tx); }
:root body .app-shell :is(.duel-scoreboard, .duel-team-scoreboard) { display: grid !important; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid var(--ui); background: none !important; border-radius: 0 !important; }
:root body .app-shell .duel-player { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 0 !important; background: none !important; border: 0 !important; box-shadow: none !important; }
:root body .app-shell .duel-player:last-child { align-items: flex-end; text-align: right; }
:root body .app-shell .duel-pname { color: var(--tx) !important; font: 600 15px/1.2 var(--ui-font) !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
:root body .app-shell .duel-pname.me-name { color: var(--act) !important; }
:root body .app-shell .duel-pscore { font: 650 30px/1 var(--ui-font) !important; color: var(--tx-hi) !important; letter-spacing: -0.03em; }
:root body .app-shell .duel-pips { display: flex !important; gap: 4px; }
:root body .app-shell .duel-pip { width: 34px !important; height: 34px !important; border-radius: 6px !important; border: 1px solid var(--ui) !important; background: var(--cell) !important; box-shadow: none !important; transform: none !important; }
:root body .app-shell .duel-pip.filled { background: var(--ok-bg) !important; border-color: var(--ok) !important; box-shadow: inset 0 0 0 1px var(--ok) !important; }
:root body .app-shell .duel-vs { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--ui-2) !important; background: var(--bg-2) !important; color: var(--tx-2) !important; font: 650 13px/1 var(--ui-font) !important; box-shadow: none !important; }
:root body .app-shell .duel-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; color: var(--tx-2); font-size: 13.5px; }
:root body .app-shell .duel-toolbar .timer { color: var(--tx-hi) !important; font: 600 14px/1 var(--ui-font) !important; background: none !important; border: 0 !important; padding: 0 !important; }
:root body .app-shell .duel-toolbar .btn-skip { margin-left: auto; min-height: 34px; padding: 0 12px; font-size: 13.5px !important; }
:root body .app-shell .duel-ready { padding: 30px 0; text-align: center; color: var(--tx-2); font: 500 16px/1.4 var(--ui-font); }
:root body .app-shell .duel-feed { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ui); }
:root body .app-shell .feed-line { color: var(--tx-2); font-size: 13.5px; }
:root body .app-shell .duel-end-banner { padding: 18px 20px; border-radius: 12px; border: 1px solid var(--ui); background: var(--bg-2) !important; color: var(--tx-hi) !important; font: 650 22px/1.2 var(--ui-font) !important; text-align: center; }
:root body .app-shell :is(.duel-end-score, .duel-end-points) { color: var(--tx); font-variant-numeric: tabular-nums; text-align: center; }
:root body .app-shell .duel-end-points { color: var(--act); font-weight: 650; font-size: 18px; }
:root body .app-shell :is(.duel-team-card, .pair-ready-panel, .pair-invite-item, .pair-outgoing) { border: 1px solid var(--ui) !important; border-radius: 12px !important; background: var(--bg-2) !important; box-shadow: none !important; color: var(--tx); }
:root body .app-shell .team-card-me { border-color: var(--act) !important; }
:root body .app-shell :is(.duel-team-label, .pair-section-heading, .pair-ready-heading) { color: var(--tx-hi); font-weight: 650; }
:root body .app-shell .duel-team-members, :root body .app-shell .pair-members { color: var(--tx-2); }
:root body .app-shell .pair-invite-form { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; max-width: 440px; margin: 0 !important; text-align: left; }
:root body .app-shell .pair-invite-form .field { align-items: stretch; text-align: left; }
:root body .app-shell .field { display: flex; flex-direction: column; gap: 6px; }

/* ---- party ------------------------------------------------------------------------ */
:root body .app-shell .party-shell { display: flex; flex-direction: column; gap: 16px; max-width: 880px; }
:root body .app-shell .party-card { padding: 26px 28px !important; display: flex; flex-direction: column; gap: 20px; }
:root body .app-shell .party-head h2 { font-size: 26px !important; letter-spacing: -0.03em; }
:root body .app-shell .party-head p { margin-top: 6px !important; }
:root body .app-shell .party-field { display: flex; flex-direction: column; gap: 10px; }
:root body .app-shell .party-field .field-label { display: flex; justify-content: space-between; }
:root body .app-shell .party-avail { color: var(--tx-2) !important; font: 500 12.5px/1 var(--ui-font) !important; text-transform: none !important; }
:root body .app-shell .party-format { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
:root body .app-shell .party-format-btn {
  display: flex !important; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px 16px !important; border: 1px solid var(--ui-2) !important; border-radius: 11px !important;
  background: var(--bg) !important; box-shadow: none !important; color: var(--tx) !important; transform: none !important;
}
:root body .app-shell .party-format-btn strong { color: var(--tx-hi) !important; font: 600 15px/1.2 var(--ui-font) !important; }
:root body .app-shell .party-format-btn span { color: var(--tx-2) !important; font: 400 13px/1.35 var(--ui-font) !important; }
:root body .app-shell .party-format-btn:hover:not(.active) { border-color: var(--ui-3) !important; }
:root body .app-shell .party-format-btn.active { border-color: var(--act) !important; background: var(--act-soft) !important; box-shadow: inset 0 0 0 1px var(--act) !important; }
:root body .app-shell .party-chips { display: flex !important; flex-wrap: wrap; gap: 6px; }
:root body .app-shell .party-chip {
  min-width: 52px; min-height: 38px; padding: 0 14px !important;
  border: 1px solid var(--ui-2) !important; border-radius: 9px !important; background: var(--bg) !important; box-shadow: none !important;
  color: var(--tx) !important; font: 500 14px/1 var(--ui-font) !important; font-variant-numeric: tabular-nums; transform: none !important;
}
:root body .app-shell .party-chip:hover:not(.active) { border-color: var(--ui-3) !important; }
:root body .app-shell .party-chip.active { border-color: var(--act) !important; background: var(--act) !important; color: var(--act-ink) !important; font-weight: 600 !important; }
:root body .app-shell .party-code { background: none !important; border: 0 !important; box-shadow: none !important; }
:root body .app-shell .party-digit {
  color: var(--tx-hi) !important; font-family: var(--ui-font) !important; font-weight: 650 !important; font-variant-numeric: tabular-nums;
  background: var(--bg-2) !important; border: 1px solid var(--ui-2) !important; border-radius: 12px !important; box-shadow: none !important; text-shadow: none !important;
}
:root body .app-shell .party-code-input { font: 600 22px/1 var(--ui-font) !important; letter-spacing: 0.25em !important; text-transform: uppercase; text-align: center; }
:root body .app-shell :is(.party-roster, .party-standings, .party-dist, .party-summary, .party-section) { border-color: var(--ui) !important; background: none !important; color: var(--tx); box-shadow: none !important; }
:root body .app-shell :is(.party-player, .party-row) { border-color: var(--ui) !important; background: var(--bg-2) !important; color: var(--tx) !important; box-shadow: none !important; border-radius: 9px !important; }
:root body .app-shell :is(.party-me, .party-standings-me) { border-color: var(--act) !important; background: var(--act-soft) !important; }
:root body .app-shell :is(.party-option) { border: 1px solid var(--ui-2) !important; background: var(--bg) !important; color: var(--tx-hi) !important; border-radius: 11px !important; box-shadow: none !important; transform: none !important; }
:root body .app-shell .party-option:hover:not(:disabled) { border-color: var(--act) !important; }
:root body .app-shell .party-option.picked { border-color: var(--act) !important; background: var(--act-soft) !important; }
:root body .app-shell .party-option.correct { border-color: var(--ok) !important; background: var(--ok-bg) !important; }
:root body .app-shell .party-option.wrong { border-color: var(--no) !important; background: var(--no-bg) !important; }
:root body .app-shell .party-letter { background: var(--bg-2) !important; color: var(--tx-2) !important; border-radius: 7px !important; font-family: var(--ui-font) !important; }
:root body .app-shell .party-question { color: var(--tx-hi) !important; font: 400 clamp(22px, 2.4vw, 30px)/1.35 var(--math-font) !important; }
:root body .app-shell :is(.party-timebar, .party-dist-bar) { background: var(--ui) !important; border: 0 !important; border-radius: 999px; box-shadow: none !important; }
:root body .app-shell .party-timebar > * { background: var(--act) !important; box-shadow: none !important; }
/* final podium: three result columns, place inked gold, silver, bronze */
:root body .app-shell .party-final { color: var(--tx) !important; }
:root body .app-shell .party-final .party-section-head { width: 100%; justify-content: flex-start; }
:root body .app-shell .party-step b { color: var(--tx-hi) !important; font: 650 18px/1 var(--ui-font) !important; }
:root body .app-shell .party-step-bar { width: 100%; min-width: 96px; display: grid; place-items: center; border: 1px solid var(--ui-2) !important; border-bottom: 0 !important; border-radius: 10px 10px 0 0 !important; background: var(--bg-2) !important; box-shadow: none !important; }
:root body .app-shell .party-step-bar span { background: none !important; color: var(--tx-2) !important; font: 650 30px/1 var(--ui-font) !important; box-shadow: none !important; }
:root body .app-shell .place-1 .party-step-bar { background: var(--gold-bg) !important; border-color: var(--gold) !important; }
:root body .app-shell .place-1 .party-step-bar span { color: var(--gold-ink) !important; }
:root body .app-shell .party-stage-bar { background: none !important; }
:root body .app-shell :is(.party-progress, .party-section-head, .party-code-label, .party-step-name) { color: var(--tx-2) !important; font: 500 13px/1.3 var(--ui-font) !important; text-transform: none !important; letter-spacing: 0 !important; }
:root body .app-shell .party-info > * { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--ui-2) !important; border-radius: 999px !important; background: var(--bg-2) !important; color: var(--tx) !important; font: 500 12.5px/1 var(--ui-font) !important; box-shadow: none !important; }
:root body .app-shell .party-question { padding: 24px 26px !important; border-radius: 16px !important; background: var(--bg) !important; box-shadow: var(--shadow) !important; }
:root body .app-shell .party-dist-bar > * { background: var(--ok) !important; }
:root body .app-shell .party-podium .place-2 .party-step-bar span { color: var(--silver) !important; }
:root body .app-shell .party-podium .place-3 .party-step-bar span { color: var(--bronze) !important; }
:root body .app-shell :is(.party-name, .party-player-name) { color: var(--tx-hi) !important; }
:root body .app-shell :is(.party-score, .party-rank, .party-time) { font-variant-numeric: tabular-nums; color: var(--tx) !important; }
:root body .app-shell :is(.party-qr) { background: #fffcf0 !important; border-radius: 10px; padding: 8px; }
:root body .app-shell :is(.party-link, .party-share) { color: var(--act) !important; }
:root body .app-shell .party-locked-note, :root body .app-shell .party-code-hint, :root body .app-shell .party-empty, :root body .app-shell .party-waiting, :root body .app-shell .party-wait-host { color: var(--tx-2) !important; }

/* ---- games ----------------------------------------------------------------------- */
:root body .app-shell .mc-games-panel.active { gap: 18px; }
:root body .app-shell .mc-games-title { margin: 0; font: 650 30px/1.1 var(--ui-font) !important; letter-spacing: -0.035em; color: var(--tx-hi) !important; }
:root body .app-shell .mc-games-sub { margin: 6px 0 0 !important; color: var(--tx-2) !important; font: 400 14.5px/1.5 var(--ui-font) !important; }
:root body .app-shell .mc-games-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px !important; }
:root body .app-shell .mc-game-card {
  display: grid !important; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; column-gap: 14px; row-gap: 4px; align-items: start;
  padding: 18px !important; min-height: 0 !important; text-align: left;
  border: 1px solid var(--ui) !important; border-radius: 14px !important; background: var(--bg) !important; box-shadow: none !important;
  color: var(--tx) !important; transform: none !important; animation: none !important;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
:root body .app-shell .mc-game-card::before, :root body .app-shell .mc-game-card::after { display: none !important; }
:root body .app-shell .mc-game-card { background-image: none !important; border-left-width: 1px !important; }
:root body .app-shell .mc-game-cta { display: inline-flex !important; align-items: center; gap: 4px; }
:root body .app-shell .mc-game-cta svg { width: 14px; height: 14px; }
:root body .app-shell .mc-game-card:hover { border-color: var(--ui-3) !important; background: var(--bg-2) !important; }
:root body .app-shell .mc-game-icon { grid-row: 1 / 4; width: 44px !important; height: 44px !important; border-radius: 11px !important; display: grid !important; place-items: center; background: var(--bg-2) !important; color: var(--act) !important; border: 1px solid var(--ui) !important; box-shadow: none !important; margin: 0 !important; }
:root body .app-shell .mc-game-icon svg { width: 22px; height: 22px; }
:root body .app-shell .mc-game-name { font: 650 16px/1.25 var(--ui-font) !important; color: var(--tx-hi) !important; letter-spacing: -0.015em; margin: 0 !important; }
:root body .app-shell .mc-game-blurb { color: var(--tx-2) !important; font: 400 13.5px/1.45 var(--ui-font) !important; margin: 0 !important; }
:root body .app-shell .mc-game-cta { color: var(--act) !important; font: 600 13.5px/1 var(--ui-font) !important; letter-spacing: 0 !important; text-transform: none !important; margin-top: 8px !important; }

/* ---- dialogs (profile, shortcuts) -------------------------------------------------- */
:root:has(.app-shell) :is(.modal-overlay, .profile-modal-overlay, .shortcut-overlay) { background: color-mix(in srgb, #100f0f 55%, transparent) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
:root:has(.app-shell) :is(.profile-modal, .shortcut-modal) {
  border: 1px solid var(--ui) !important; border-radius: 16px !important;
  background: var(--bg) !important; color: var(--tx) !important; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .55) !important;
  font-family: var(--ui-font) !important;
}
:root:has(.app-shell) :is(.profile-modal, .shortcut-modal) :is(h2, h3, strong) { color: var(--tx-hi) !important; font-family: var(--ui-font) !important; }
:root:has(.app-shell) :is(.profile-modal, .shortcut-modal) :is(p, span, small, li) { font-family: var(--ui-font) !important; }
:root:has(.app-shell) .profile-stat-grid > * { border: 1px solid var(--ui) !important; background: var(--bg-2) !important; border-radius: 10px !important; box-shadow: none !important; }
:root:has(.app-shell) :is(.profile-modal-close, .shortcut-close) { color: var(--tx-2) !important; background: transparent !important; border: 0 !important; border-radius: 8px !important; }
:root:has(.app-shell) :is(.profile-modal-close, .shortcut-close):hover { background: var(--bg-2) !important; color: var(--tx-hi) !important; }
:root:has(.app-shell) .shortcut-list kbd, :root:has(.app-shell) .shortcut-modal kbd { border: 1px solid var(--ui-2) !important; border-bottom-width: 2px !important; border-radius: 6px !important; background: var(--bg-2) !important; color: var(--tx-hi) !important; font: 600 12.5px/1 var(--ui-font) !important; box-shadow: none !important; }
:root:has(.app-shell) :is(.error-box) { border: 1px solid var(--no-line) !important; background: var(--no-bg) !important; color: var(--no-ink) !important; border-radius: 10px !important; }
:root:has(.app-shell) :is(.notice-box) { border: 1px solid var(--ui) !important; background: var(--bg-2) !important; color: var(--tx) !important; border-radius: 10px !important; }

/* ---- the collapsed rail (laptops, tablets) ---------------------------------------- */
@media (max-width: 1279px) {
  :root body .app-shell .main-grid, :root body .app-shell .main-grid:has(#panel-leaderboard.active, #panel-streaks.active) { grid-template-columns: minmax(0, 1fr) !important; padding: 28px 32px 56px !important; gap: 24px !important; max-width: 940px !important; }
  :root body .app-shell :is(.arena-side-stack, .main-grid > .leaderboard-col) { position: static; }
  :root body .app-shell .arena-side-stack { display: grid !important; grid-template-columns: 1fr 1fr; align-items: start; }
  :root body .app-shell .leaderboard-card { max-height: none; }
}
@media (max-width: 1060px) {
  :root:has(.app-shell) { --rail-w: 76px; }
  :root body .app-shell .navbar { padding: 18px 10px 14px; align-items: center; }
  :root body .app-shell .brand-lockup { padding: 0; justify-content: center; width: 100%; font-size: 0; gap: 0; }
  :root body .app-shell .mode-selector { padding: 0 10px !important; top: 76px; }
  :root body .app-shell .mode-tab { justify-content: center !important; padding: 0 !important; font-size: 0 !important; height: 46px; min-height: 46px !important; }
  :root body .app-shell .mode-tab .mcx-count { display: none; }
  :root body .app-shell .mode-tab .mc-tab-ic svg { width: 21px !important; height: 21px !important; }
  :root body .app-shell .nav-right { flex-direction: column; align-items: center; width: 100%; padding-top: 10px; }
  :root body .app-shell .navbar .profile-trigger { flex: none; width: 46px; justify-content: center; padding: 0 !important; }
  :root body .app-shell .profile-trigger strong, :root body .app-shell .profile-trigger .mcx-tier { display: none; }
  :root body .app-shell .navbar .streak-badge { flex: none; width: 46px; justify-content: center; padding: 0 !important; font-size: 0 !important; }
  :root body .app-shell .navbar .streak-badge svg { margin: 0; }
  :root body .app-shell .navbar .btn-ghost:has(.logout-label) { margin-left: 0; }
  :root body .app-shell .main-grid { grid-template-columns: minmax(0, 1fr) !important; max-width: 920px !important; }
  :root body .app-shell .arena-side-stack { position: static; }
  :root body .app-shell .leaderboard-card { max-height: none; }
}

/* ---- phones: top bar + bottom tab bar ---------------------------------------------- */
@media (max-width: 720px) {
  :root:has(.app-shell) { --rail-w: 0px; }
  :root body .app-shell .navbar {
    position: sticky !important; inset: auto; top: 0; width: auto; height: 56px;
    flex-direction: row; align-items: center; padding: 0 12px 0 16px;
    border-right: 0 !important; border-bottom: 1px solid var(--ui) !important;
    background: color-mix(in srgb, var(--bg) 92%, transparent) !important;
    -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  }
  :root body .app-shell .brand-lockup { width: auto; justify-content: flex-start; font-size: 17px; gap: 9px; padding: 0; }
  :root body .app-shell .nav-right { margin: 0 0 0 auto; flex-direction: row; flex-wrap: nowrap; width: auto; padding: 0; border: 0; gap: 2px !important; }
  :root body .app-shell .navbar .profile-trigger, :root body .app-shell .navbar .streak-badge { order: 0; flex: none; width: 40px; height: 40px; min-height: 40px; }
  :root body .app-shell .navbar :is(.shortcut-button, .streak-badge) { display: none !important; }
  :root body .app-shell .profile-trigger .nav-player { gap: 0; }
  :root body .app-shell .arena-side-stack { grid-template-columns: 1fr; }
  :root body .app-shell .mcx-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  :root body .app-shell .mcx-worth { margin-left: 0; }
  :root body .app-shell .problem-header .timer { margin-left: auto; }
  :root body .app-shell .lb-table { min-width: 0 !important; table-layout: auto; }
  :root body .app-shell .leaderboard-page .lb-table :is(th, td):nth-child(3):not(:last-child) { display: none; }
  :root body .app-shell .leaderboard-switch { font-size: 0 !important; gap: 0; }
  :root body .app-shell .leaderboard-switch::after { font: inherit; font-size: 14px; }
  :root body .app-shell .leaderboard-switch:nth-child(1)::after { content: "Points" / ""; }
  :root body .app-shell .leaderboard-switch:nth-child(2)::after { content: "1v1 duels" / ""; }
  :root body .app-shell .leaderboard-switch:nth-child(3)::after { content: "2v2 pairs" / ""; }
  :root body .app-shell .mode-selector {
    top: auto; bottom: 0; left: 0; right: 0; width: auto;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)) !important;
    background: color-mix(in srgb, var(--bg-2) 96%, transparent) !important;
    border-top: 1px solid var(--ui) !important;
    -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  }
  :root body .app-shell .mode-selector-track { flex-direction: row; gap: 0; }
  :root body .app-shell .mode-tab { flex: 1 1 0 !important; flex-direction: column !important; gap: 4px !important; height: 52px; min-height: 52px !important; padding: 0 !important; border-radius: 10px !important; font-size: 0 !important; }
  :root body .app-shell .mode-tab::after { font: 500 10.5px/1 var(--ui-font); letter-spacing: 0; }
  :root body .app-shell .mode-tab:nth-child(1)::after { content: "Daily" / ""; }
  :root body .app-shell .mode-tab:nth-child(2)::after { content: "Duels" / ""; }
  :root body .app-shell .mode-tab:nth-child(3)::after { content: "Party" / ""; }
  :root body .app-shell .mode-tab:nth-child(4)::after { content: "Board" / ""; }
  :root body .app-shell .mode-tab:nth-child(5)::after { content: "Streaks" / ""; }
  :root body .app-shell .mode-tab:nth-child(7)::after { content: "Games" / ""; }
  :root body .app-shell .mode-tab.active { background: transparent !important; box-shadow: none !important; color: var(--act-hi) !important; }
  :root body .app-shell .mode-tab .mc-tab-ic svg { width: 22px !important; height: 22px !important; }
  :root body .app-shell .main-grid { margin: 0 !important; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)) !important; gap: 18px !important; }
  :root body .app-shell .site-footer { margin: 0; padding: 0 16px calc(90px + env(safe-area-inset-bottom)); }
  :root body .app-shell .mcx-head h1 { font-size: 25px; }
  :root body .app-shell .mcx-figs { gap: 18px; width: 100%; justify-content: space-between; }
  :root body .app-shell .mcx-figs dd { font-size: 19px; }
  :root body .app-shell .mcx-cells { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  :root body .app-shell .mcx-cell { height: 54px; }
  :root body .app-shell :is(.card, .problem-card, .duel-card, .party-card, .duel-active-card) { padding: 18px !important; border-radius: 14px !important; }
  :root body .app-shell :is(.leaderboard-card, .leaderboard-page) { padding: 16px 0 6px !important; }
  :root body .app-shell .lb-table :is(th, td):first-child { padding-left: 14px !important; }
  :root body .app-shell .lb-table :is(th, td):last-child { padding-right: 14px !important; }
  :root body .app-shell .leaderboard-page .lb-header { padding: 2px 16px 14px; }
  :root body .app-shell .leaderboard-page .leaderboard-switcher { margin: 0 14px 12px; display: flex !important; flex-direction: row !important; max-width: calc(100% - 28px); }
  :root body .app-shell .leaderboard-switch { flex: none; }
  :root body .app-shell .party-format { grid-template-columns: 1fr; }
  :root body .app-shell .answer-row .btn-skip { flex: 1 1 auto; }
  :root body .app-shell .rank-progression { grid-template-columns: auto 1fr; grid-template-areas: "id pts" "meta meta" "track track" "note note"; }
}

/* ---- motion: state only ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  :root body .app-shell *, :root body .app-shell *::before, :root body .app-shell *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
@media (hover: none) {
  :root body .app-shell .lb-table tbody tr:hover td { background: none !important; }
  :root body .app-shell .lb-table tbody tr.me:hover td { background: var(--act-soft) !important; }
}

/* ==========================================================================
   About / Contact / Privacy + FAQ (.info-screen), opened from the app and
   landing footers. Same system, Read mode: one column of slate panels.
   ========================================================================== */
html body .info-screen {
  --muted: var(--mc3-t3);
  --text: var(--mc3-t1);
  --cyan: var(--mc3-acc);
  --border: var(--mc3-line);
  background: var(--mc3-black) !important;
  color: var(--mc3-t2);
  font-family: var(--mc3-font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
html:has(.info-screen) :is(#mc-aurora, #mc-grain, #mc-sweep, #mc-ticker, #mc-cursor-dot, #mc-cursor-ring) { display: none !important; }
html body .info-screen .info-shell { width: min(860px, 100%); }
html body .info-screen .info-brand { font: 650 1.1875rem/1 var(--mc3-font); letter-spacing: -0.03em; color: var(--mc3-t1); }
html body .info-screen .info-brand span { color: inherit !important; }
html body .info-screen .brand-mark {
  width: 26px; height: 26px; border: 0; border-radius: 0; box-shadow: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M13 22H41M21 22V47M33 22V42Q33 47.5 39 46' fill='none' stroke='%23f3f6fb' stroke-width='5.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M52 10L43 22H48L41 32L54 17H49Z' fill='%23ffc83d'/%3E%3C/svg%3E") center / contain no-repeat;
}
html body .info-screen .brand-mark svg { display: none; }
html body .info-screen .info-hero .eyebrow { display: none; }
html body .info-screen .info-hero h1 {
  font: 650 clamp(3rem, 7vw, 5.25rem)/1.02 var(--mc3-font);
  letter-spacing: -0.04em;
  color: var(--mc3-t1);
  text-shadow: none;
}
html body .info-screen .info-hero h1 span { color: var(--mc3-t3) !important; background: none !important; -webkit-text-fill-color: currentColor; text-shadow: none; }
html body .info-screen .info-hero p { font: 500 clamp(1.125rem, 1.6vw, 1.3125rem)/1.42 var(--mc3-font); color: var(--mc3-t3); }
html body .info-screen .info-grid { gap: 16px; }
html body .info-screen .info-card {
  padding: 32px;
  border: 1px solid var(--mc3-line) !important;
  border-radius: 28px;
  background: var(--mc3-g1) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
html body .info-screen .info-card::before,
html body .info-screen .info-card::after { display: none !important; }
html body .info-screen .info-card-heading {
  font: 650 1.375rem/1.15 var(--mc3-font) !important;
  letter-spacing: -0.03em !important;
  text-transform: none !important;
  color: var(--mc3-t1) !important;
}
html body .info-screen .info-card-heading svg { color: var(--mc3-t2) !important; stroke: currentColor; }
html body .info-screen .info-card-heading small { font: 400 0.8125rem/1.3 var(--mc3-font); letter-spacing: 0; color: var(--mc3-t3); }
html body .info-screen .info-card p { font: 400 1.0625rem/1.55 var(--mc3-font); color: var(--mc3-t2); }
html body .info-screen .info-card :is(b, strong) { color: var(--mc3-t1); font-weight: 600; }
html body .info-screen .info-callout { color: var(--mc3-t1) !important; font-weight: 600 !important; }
html body .info-screen :is(.info-note, .info-summary) { color: var(--mc3-t3) !important; }
html body .info-screen .privacy-list > div { border-color: var(--mc3-line) !important; background: none !important; }
html body .info-screen :is(.info-back-link, .info-email) { color: var(--mc3-acc); font: 500 0.9375rem/1.3 var(--mc3-font); letter-spacing: -0.005em; text-transform: none; }
html body .info-screen :is(.info-back-link, .info-email):hover { color: var(--mc3-acc-hi); text-decoration: underline; }
html body .info-screen .info-bottom { color: var(--mc3-t3); font: 400 0.8125rem/1.4 var(--mc3-font); }
@media (max-width: 680px) {
  html body .info-screen .info-card { padding: 24px 20px; border-radius: 24px; }
}

/* ---- carried over from app-pro.css: tab switches never animate; polish.js's ghost stays hidden ---- */
:root:has(.app-shell) .mc-ghost { display: none !important; }
:root body .app-shell .mc-panel-enter > * { animation: none !important; opacity: 1 !important; transform: none !important; }

/* ---- the one authored moment: a correct answer lands (app-moments.js counts the points up) ---- */
:root body .app-shell .feedback { animation: mcx-feedback-in .32s var(--ease) both !important; }
:root body .app-shell .mc-moment-pts { font-size: 30px; letter-spacing: -0.035em; }
:root body .app-shell .mc-moment-mult {
  align-self: center; margin-left: auto; height: 26px; display: inline-flex; align-items: center; padding: 0 10px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--ok-line); color: var(--ok-ink); font: 600 12.5px/1 var(--ui-font);
  animation: mcx-lock .36s var(--ease) .62s both;
}
:root body .app-shell :is(.rank-progress-fill, .focus-progress-fill) { transition: width .7s var(--ease); }
@keyframes mcx-feedback-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
@keyframes mcx-lock { from { opacity: 0; transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  :root body .app-shell .feedback { animation: mcx-fade .2s ease both !important; }
  :root body .app-shell .mc-moment-mult { animation: none; }
}
@keyframes mcx-fade { from { opacity: 0; } }

/* ---- the games' fullscreen stage (games-tab.js mounts it on <body>) -------------- */
:root:has(.app-shell) :is(.mc-game-overlay, .mc-game-overlay:fullscreen, .mc-game-stage) { background: var(--bg) !important; color: var(--tx) !important; }
:root:has(.app-shell) .mc-game-topbar { background: color-mix(in srgb, var(--bg-2) 94%, transparent) !important; border: 1px solid var(--ui) !important; box-shadow: var(--shadow) !important; }
/* the stage takes focus only so keys reach the game: no ring (it showed as an orange line past the top bar) */
:root:has(.app-shell) :is(.mc-game-stage, .mc-keypad button):focus-visible { outline: none !important; }
:root:has(.app-shell) .mc-game-title { color: var(--tx-hi) !important; opacity: 1 !important; font: 600 14px/1 var(--ui-font) !important; }
:root:has(.app-shell) :is(.mc-game-exit, .mc-game-fs, .mc-game-action, .mc-game-action-secondary) { background: var(--bg) !important; border: 1px solid var(--ui-2) !important; color: var(--tx-hi) !important; box-shadow: none !important; }
:root:has(.app-shell) :is(.mc-game-exit, .mc-game-fs, .mc-game-action, .mc-game-action-secondary):hover { background: var(--bg-2) !important; border-color: var(--ui-3) !important; }
:root:has(.app-shell) .mc-game-action:not(.mc-game-action-secondary) { background: var(--act) !important; border-color: var(--act) !important; color: var(--act-ink) !important; }
:root:has(.app-shell) .mc-canvas-wrap canvas { background: var(--bg) !important; box-shadow: 0 0 0 1px var(--ui), var(--shadow) !important; border-radius: 12px !important; }
:root:has(.app-shell) :is(.mc-game-error, .mc-game-locked) { color: var(--tx-2) !important; }

/* ---- the empty duel scoreboard (app-shell.js) ------------------------------------- */
:root body .app-shell .mcx-duelboard { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--ui); border-radius: 12px; background: var(--bg-2); }
:root body .app-shell .mcx-drow { display: grid; grid-template-columns: minmax(70px, 120px) repeat(5, minmax(0, 1fr)); gap: 6px; align-items: center; }
:root body .app-shell .mcx-drow span { color: var(--tx-hi); font: 600 14px/1.2 var(--ui-font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root body .app-shell .mcx-drow:first-child span { color: var(--act); }
:root body .app-shell .mcx-drow i { height: 34px; border: 1px solid var(--ui-2); border-radius: 7px; background: var(--bg); }
:root body .app-shell .mcx-duelboard p { margin: 4px 0 0; color: var(--tx-2); font-size: 13px; }

/* live duel feed: plain lines under the plate */
:root body .app-shell .feed-line { display: flex; align-items: center; gap: 8px; padding: 2px 0 !important; border: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; color: var(--tx-2) !important; font: 500 13.5px/1.4 var(--ui-font) !important; }
:root body .app-shell .feed-line::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
:root body .app-shell .duel-feed { max-height: 120px; overflow: auto; }

/* dialogs sit centred at their own height (the bundle anchors them top-left at full height) */
:root:has(.app-shell) :is(.modal-overlay, .profile-modal-overlay, .shortcut-overlay) { display: flex !important; align-items: center !important; justify-content: center !important; padding: 24px; z-index: 60 !important; }
:root:has(.app-shell) :is(.profile-modal, .shortcut-modal) { margin: auto !important; height: auto !important; max-height: calc(100vh - 48px); overflow: auto; width: min(560px, 100%) !important; padding: 24px !important; }
:root:has(.app-shell) :is(.profile-modal-close, .shortcut-close) { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0 !important; display: inline-grid !important; place-items: center; }
:root:has(.app-shell) .profile-stat-grid strong { color: var(--tx-hi) !important; font: 650 20px/1.1 var(--ui-font) !important; letter-spacing: -0.02em; }
:root:has(.app-shell) .profile-stat-grid span { color: var(--tx-2) !important; font: 500 12.5px/1.2 var(--ui-font) !important; text-transform: none !important; letter-spacing: 0 !important; }

/* typeset maths (app-shell.js): italic variables, upright digits, real superscripts */
:root body .app-shell .math-token { font-family: var(--math-font); font-weight: inherit !important; white-space: nowrap; color: inherit !important; background: none !important; }
:root body .app-shell .math-token i { font-style: italic; padding-right: 0.04em; }
:root body .app-shell .math-token :is(sup, sub) { font-size: 0.66em; line-height: 0; }
:root body .app-shell .math-token sup { vertical-align: 0.45em; }
:root body .app-shell .math-token sub { vertical-align: -0.2em; }

/* end screens: the result reads as a headline, not a grey box */
:root body .app-shell .duel-end-banner { padding: 0 !important; border: 0 !important; background: none !important; text-align: left; font: 650 34px/1.1 var(--ui-font) !important; letter-spacing: -0.035em; }
:root body .app-shell .duel-end-score { text-align: left; font: 650 44px/1 var(--ui-font) !important; letter-spacing: -0.03em; color: var(--tx-hi) !important; }
:root body .app-shell .duel-end-points { text-align: left; }
/* the party's final screen is projected in class: one centred column */
:root body .app-shell .party-final { justify-items: center !important; text-align: center !important; }
:root body .app-shell .party-final > * { text-align: center !important; justify-self: center; }
:root body .app-shell .party-final :is(.duel-title, .party-section-head) { justify-content: center !important; width: 100%; }
:root body .app-shell .party-final > .party-standings { justify-self: stretch; text-align: left !important; }
:root body .app-shell .party-final .duel-sub { max-width: none !important; width: 100%; margin: 0 !important; text-align: center !important; }
:root body .app-shell .party-final > svg { display: block; margin: 0 auto; color: var(--gold) !important; }

/* ==== review round 1 ==================================================== */
/* tier marks: the glyph in tier ink, no tile and no shield plate */
:root body .app-shell .rank-badge, :root:has(.app-shell) .rank-badge { background: none !important; border-radius: 0 !important; }
:root body .app-shell .rank-badge::before, :root body .app-shell .rank-badge::after, :root:has(.app-shell) .rank-badge::before, :root:has(.app-shell) .rank-badge::after { display: none !important; }
:root body .app-shell .rank-badge-sm { width: 18px !important; height: 18px !important; }
:root body .app-shell .rank-badge-sm svg { width: 16px !important; height: 16px !important; }
:root body .app-shell .rank-badge-lg, :root:has(.app-shell) .profile-modal .rank-badge { width: 30px !important; height: 30px !important; }
:root body .app-shell .rank-badge-lg svg, :root:has(.app-shell) .profile-modal .rank-badge svg { width: 26px !important; height: 26px !important; }

/* games: a ruled list of six, name, what it is, play */
:root body .app-shell .mc-games-grid { display: block !important; border-top: 1px solid var(--ui); }
:root body .app-shell .mc-game-card {
  display: grid !important; grid-template-columns: 20px minmax(150px, 210px) minmax(0, 1fr) auto auto !important; grid-template-rows: auto !important;
  align-items: center; column-gap: 18px !important; row-gap: 2px !important; width: 100%;
  padding: 16px 12px !important; border: 0 !important; border-bottom: 1px solid var(--ui) !important; border-radius: 0 !important; background: none !important;
}
:root body .app-shell .mc-game-card:hover { background: var(--bg-2) !important; }
:root body .app-shell .mc-game-icon { grid-row: auto !important; width: 20px !important; height: 20px !important; border: 0 !important; background: none !important; color: var(--tx-2) !important; }
:root body .app-shell .mc-game-icon svg { width: 18px; height: 18px; }
:root body .app-shell .mc-game-card:hover .mc-game-icon { color: var(--act) !important; }
:root body .app-shell .mc-game-cta { margin: 0 !important; }
/* the player's record in each game (this device), beside Play */
:root body .app-shell .mc-game-best { justify-self: end; color: var(--tx-2) !important; font: 500 13px/1 var(--ui-font) !important; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* today's cells: solving inks the cell (a sweep, once, while it is on screen) */
:root body .app-shell .mcx-cell {
  background: linear-gradient(var(--ok-bg), var(--ok-bg)) left / 0% 100% no-repeat, var(--cell);
  transition: background-size .55s var(--ease), border-color .3s var(--ease);
}
:root body .app-shell .mcx-cell.is-ok { background-size: 100% 100%, auto; }
:root body .app-shell .mcx-cell.is-ok :is(b, small) { animation: mcx-ink-text .4s var(--ease) .2s both; }
@keyframes mcx-ink-text { from { opacity: 0; } }
:root body .app-shell .mcx-cell small { display: flex; justify-content: space-between; gap: 2px; }
:root body .app-shell .mcx-cell small em { font-style: normal; color: var(--ok-ink); font-weight: 600; letter-spacing: .02em; }
@media (prefers-reduced-motion: reduce) { :root body .app-shell .mcx-cell { transition: none; } :root body .app-shell .mcx-cell.is-ok :is(b, small) { animation: none; } }
/* the plate names the cell it fills */
:root body .app-shell .mcx-pnum { order: 0; color: var(--tx-hi); font: 650 14px/1 var(--ui-font); margin-right: 4px; }

/* duel end: the outcome is the headline, then the final board */
:root body .app-shell .duel-end-banner { font-size: 44px !important; }
:root body .app-shell .duel-end-score { font: 500 15px/1.3 var(--ui-font) !important; color: var(--tx-2) !important; }
:root body .app-shell .mcx-won .duel-end-banner { color: var(--tx-hi) !important; }
:root body .app-shell .mcx-won .duel-end-points { color: var(--ok-ink) !important; }
:root body .app-shell .mcx-lost .duel-end-points { color: var(--no-ink) !important; }
:root body .app-shell .mcx-draw .duel-end-points { color: var(--tx-2) !important; }
:root body .app-shell .duel-card:is(.mcx-lost, .mcx-draw) > svg:first-child { display: none; }
:root body .app-shell .duel-card.mcx-won > svg:first-child { color: var(--gold) !important; }
:root body .app-shell .mcx-final .mcx-drow { grid-template-columns: minmax(70px, 140px) repeat(5, minmax(0, 1fr)) 36px; }
:root body .app-shell .mcx-final .mcx-drow b { text-align: right; font: 650 22px/1 var(--ui-font); color: var(--tx-2); }
:root body .app-shell .mcx-final .mcx-drow span { color: var(--tx-2) !important; }
:root body .app-shell .mcx-final .mcx-drow.me span { color: var(--act) !important; }
:root body .app-shell .mcx-final .mcx-drow.win :is(span, b) { color: var(--tx-hi) !important; }
:root body .app-shell .mcx-final .mcx-drow i.on { background: var(--ok-bg); border-color: var(--ok); }

/* your standing and the profile: ruled lists, not stat tiles */
:root body .app-shell .rank-card-rank { font-size: 28px !important; }
:root body .app-shell .rank-card-stats { display: block !important; border: 0 !important; border-radius: 0 !important; background: none !important; border-top: 1px solid var(--ui) !important; }
:root body .app-shell .rank-card-stats > div { flex-direction: row !important; justify-content: space-between; align-items: baseline; padding: 10px 0 !important; background: none !important; border-bottom: 1px solid var(--ui) !important; }
:root body .app-shell .rank-card-stats strong { font-size: 16px !important; }
:root:has(.app-shell) .profile-stat-grid { display: block !important; border-top: 1px solid var(--ui); }
:root:has(.app-shell) .profile-stat-grid > * { display: flex !important; flex-direction: row !important; justify-content: space-between; align-items: baseline; padding: 11px 2px !important; border: 0 !important; border-bottom: 1px solid var(--ui) !important; border-radius: 0 !important; background: none !important; }
:root:has(.app-shell) .profile-stat-grid strong { font-size: 16px !important; display: inline-flex; align-items: center; gap: 6px; }

/* phones: the open problem reaches the first screen */
@media (max-width: 600px) {
  :root body .app-shell .mcx-round { gap: 12px; }
  :root body .app-shell .mcx-figs { display: flex !important; justify-content: space-between; gap: 8px; }
  :root body .app-shell .mcx-figs dd { font-size: 17px; }
  :root body .app-shell .mcx-figs dt { font-size: 11.5px; }
  :root body .app-shell .mcx-figs dt span { display: none; }
  :root body .app-shell .mcx-cells { grid-template-columns: repeat(15, minmax(0, 1fr)) !important; gap: 3px; }
  :root body .app-shell .mcx-cell { height: 26px !important; padding: 0 !important; align-items: center; justify-content: center; border-radius: 5px; }
  :root body .app-shell .mcx-cell :is(b, small, .mcx-tries) { display: none !important; }
  :root body .app-shell .mcx-cell i { font-size: 10.5px; }
  :root body .app-shell .mcx-cell.is-fast::after { border-width: 0 7px 7px 0; }
  :root body .app-shell .mcx-key { display: none; }
  :root body .app-shell .mcx-head p { margin-top: 4px; font-size: 13px; }
  :root body .app-shell .mcx-head h1 { font-size: 23px; }
  :root body .app-shell .mc-game-card { grid-template-columns: 20px minmax(0, 1fr) auto !important; }
  :root body .app-shell .mc-game-blurb { grid-column: 2; grid-row: 2; }
  :root body .app-shell .mc-game-cta { grid-column: 3; grid-row: 1; }
  :root body .app-shell .mc-game-best { grid-column: 3; grid-row: 2; font-size: 12.5px !important; }
}

/* ==== review round 2 ==================================================== */
/* your standing: one ruled block at body size; the table's YOU row already carries the rank */
:root body .app-shell .rank-card { display: grid !important; grid-template-columns: auto 1fr; grid-template-areas: "k k" "r n" "s s" "o o"; column-gap: 10px; row-gap: 6px; align-items: baseline; }
:root body .app-shell .rank-card-kicker { grid-area: k; margin: 0 0 4px !important; }
:root body .app-shell .rank-card-rank { grid-area: r; font: 650 18px/1.2 var(--ui-font) !important; letter-spacing: -0.01em; }
:root body .app-shell .rank-card-name { grid-area: n; margin: 0 !important; color: var(--tx-hi) !important; font-weight: 600 !important; }
:root body .app-shell .rank-card-stats { grid-area: s; margin-top: 8px; }
:root body .app-shell .rank-card-note { grid-area: o; }
/* profile rows at their own height */
:root:has(.app-shell) .profile-stat-grid > * { min-height: 0 !important; height: auto !important; }
/* the party's final screen gets the results headline */
:root body .app-shell .party-final .duel-title { font-size: 44px !important; letter-spacing: -0.035em; line-height: 1.05 !important; }
