/* Chess Advance: "Playground Premium".
   Chunky, rounded and bright like a game, on calm cream space with navy type. Shapes come from the logo:
   gold circle, coral square, navy knight. Three themes share one set of tokens: brand (default), light, dark.
   Rules: one coral action per screen; gold is for rewards; mint means correct; kids' text is 16px or more;
   every control is at least 44px. Layout: desktop 1024px and up, tablet 640-1023px, phone under 640px. */

@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/static/fonts/nunito-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/static/fonts/nunito-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/fredoka-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/fredoka-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Tokens ---------- */
:root, [data-theme="brand"] {
  --bg: #FFF7EA; --bg2: #FDEBCF; --surface: #FFFFFF; --surface2: #FFF3E0;
  --ink: #1E2650; --ink2: #555D80; --line: #EFDFC4;
  --header: #253164; --header-ink: #FFFFFF;
  --primary: #C4532F; --primary-edge: #9A3B1F;
  --gold: #EFAE30; --gold-edge: #C98A12; --gold-soft: #FDE7B5; --gold-ink: #6E4700;
  --coral: #D96949; --coral-soft: #FADBD0; --coral-ink: #8F3418;
  --navy: #253164; --navy-soft: #E3E7F6; --navy-ink: #253164;
  --mint: #2FA67A; --mint-soft: #D5F2E5; --mint-ink: #11593F;
  --sky: #4C7BE0; --sky-soft: #DDE8FC; --sky-ink: #1F4BA8;
  --lock: #E9E2D6; --board-l: #F3E8D3; --board-d: #8D9DD5;
  --link: #2C3C86;
  --shadow: 0 2px 0 rgba(37, 49, 100, .06), 0 14px 30px -14px rgba(37, 49, 100, .28);
  color-scheme: light;
}
[data-theme="light"] {
  --bg: #F6F7FB; --bg2: #ECEFF8; --surface: #FFFFFF; --surface2: #F3F5FB;
  --ink: #1E2650; --ink2: #565E80; --line: #E1E5F0;
  --header: #FFFFFF; --header-ink: #1E2650;
  --gold-soft: #FDEFCB; --coral-soft: #FBE3DA; --navy-soft: #E6EAF7; --mint-soft: #DAF3E8; --sky-soft: #E1EAFC;
  --lock: #E6E8EF; --board-l: #EEF1F8;
  --shadow: 0 1px 0 rgba(30, 38, 80, .05), 0 12px 28px -14px rgba(30, 38, 80, .22);
}
[data-theme="dark"] {
  --bg: #0E1330; --bg2: #141A3D; --surface: #1A2149; --surface2: #232B57;
  --ink: #F4F5FB; --ink2: #B4BAD9; --line: #2E3769;
  --header: #0A0E26; --header-ink: #FFFFFF;
  --primary-edge: #86331A; --gold-edge: #B07A0E; --gold-soft: #3A3116; --gold-ink: #F8CB6E;
  --coral: #E07A5A; --coral-soft: #3D2522; --coral-ink: #F6A88E;
  --navy-soft: #262F60; --navy-ink: #C9D1F2;
  --mint: #38B98A; --mint-soft: #15382F; --mint-ink: #7BE3BC;
  --sky: #6E95EC; --sky-soft: #1D2C5A; --sky-ink: #A9C2F7;
  --lock: #2A3263; --board-l: #DCD3C2; --board-d: #5F6EAB;
  --link: #A9C2F7;
  --shadow: 0 16px 32px -16px rgba(0, 0, 0, .65);
  color-scheme: dark;
}
:root {
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-2xl: 28px; --r-pill: 999px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 24px;
  --tabbar-h: 0px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 16px/1.55 var(--font-body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100vh; }
main { max-width: 1200px; margin: 0 auto; padding: 32px var(--gutter) 64px; }
body.has-tabs main { padding-bottom: calc(64px + var(--tabbar-h)); }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 2px; font-weight: 700; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, .disp { font-family: var(--font-display); color: var(--ink); letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: clamp(28px, 3.4vw, 36px); font-weight: 700; margin: 0 0 16px; }
h2 { font-size: 24px; font-weight: 600; margin: 36px 0 14px; }
h3 { font-size: 19px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink2); font-weight: 600; }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; }
code { font: 700 .92em ui-monospace, "Cascadia Code", Consolas, monospace; word-break: break-all; background: var(--surface2); padding: 2px 6px; border-radius: 6px; }
.eyebrow { display: block; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; margin-bottom: 8px; min-height: 44px; }
p:has(> a.back:only-child) { margin: 0; }

/* ---------- Header ---------- */
.top { background: var(--header); color: var(--header-ink); position: sticky; top: 0; z-index: 30; border-bottom: 2px solid var(--line); }
[data-theme="brand"] .top, [data-theme="dark"] .top { border-bottom-color: transparent; }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; gap: 20px; }
.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; flex: none; }
.logo-tile { width: 56px; height: 56px; border-radius: 18px; background: #FFF7EA; display: grid; place-items: center; flex: none; }
[data-theme="light"] .logo-tile { background: var(--bg2); }
.logo-tile .logo-mark { width: 44px; height: 40px; }
.logo-sun { fill: var(--gold); }
.logo-square { fill: var(--coral); }
.logo-knight { fill: var(--ink); }
.logo-tile .logo-knight { fill: #253164; }
.logo-word { display: flex; flex-direction: column; font: 700 25px/.92 var(--font-display); letter-spacing: -.01em; color: var(--header-ink); }
.top-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.top-nav > a, .more-menu > summary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; min-height: 44px; border-radius: 14px;
  color: var(--header-ink); text-decoration: none; font-weight: 700; font-size: 16px; white-space: nowrap; cursor: pointer; list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.top-nav > a:hover, .more-menu > summary:hover { background: color-mix(in srgb, var(--header-ink) 9%, transparent); }
.top-nav > a[aria-current="page"], .more-menu.current > summary { background: color-mix(in srgb, var(--header-ink) 13%, transparent); box-shadow: inset 0 -3px 0 var(--gold); font-weight: 800; }
.top-nav .short, .tabbar .long { display: none; }
.more-menu { position: relative; }
.more-pop, .user-pop { position: absolute; top: calc(100% + 10px); background: var(--surface); color: var(--ink); border-radius: 20px; box-shadow: var(--shadow), 0 0 0 2px var(--line);
  padding: 10px; display: grid; gap: 2px; min-width: 240px; z-index: 40; }
.more-pop { left: 0; }
.more-pop a, .pop-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 48px; border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px; }
.more-pop a:hover, .pop-row:hover { background: var(--surface2); }
.more-pop a[aria-current="page"] { background: var(--gold-soft); }
.more-pop .short { display: none; }
.top-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; min-height: 40px; border-radius: var(--r-pill); font-weight: 800; text-decoration: none; font-size: 16px; }
.pill-star { background: var(--gold); color: #3A2600; }
.pill-flame { background: #D96949; color: #FFFFFF; }
.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 16px; color: var(--header-ink); font-weight: 700; }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: #D96949; color: #FFFFFF; font: 700 18px var(--font-display); flex: none; }
.avatar.kid { background: var(--gold); color: #253164; font: 400 30px/1 "DejaVu Sans", "Segoe UI Symbol", serif; }
.user-pop { right: 0; min-width: 290px; gap: 6px; padding: 14px; }
.user-pop .who { margin: 0 4px 4px; display: flex; flex-direction: column; }
.user-pop .who span { color: var(--ink2); font-size: 14px; font-weight: 700; }
.pop-label { margin: 6px 4px 0; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.user-pop form { margin: 0; }
button.pop-row { width: 100%; background: none; border: 0; box-shadow: none; font: inherit; font-weight: 700; justify-content: flex-start; }
button.pop-row:active { transform: none; }
.theme-picker { display: grid; gap: 6px; }
.theme-picker button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; box-shadow: none; }
.theme-picker button:active { transform: none; }
.theme-picker button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.theme-picker .swatch { width: 36px; height: 36px; border-radius: 12px; background: var(--surface2); display: grid; place-items: center; flex: none; color: var(--ink); }
.theme-picker .swatch svg { width: 24px; height: 24px; }
.theme-picker strong { display: block; font-size: 16px; }
.theme-picker small { display: block; color: var(--ink2); font-size: 14px; font-weight: 600; }

/* Floating tab bar under 1024px */
.tabbar { display: none; }
@media (max-width: 1023px) {
  :root { --tabbar-h: 96px; }
  .top-nav { display: none; }
  .tabbar { display: flex; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 35;
    width: min(calc(100% - 24px), 780px); background: var(--surface); border-radius: 26px; padding: 8px; gap: 6px;
    box-shadow: 0 0 0 2px var(--line), 0 18px 36px -12px rgba(30, 38, 80, .35); }
  .tabbar > a, .more-tab > summary { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60px; padding: 6px 4px;
    border-radius: 18px; color: var(--ink2); text-decoration: none; font-weight: 800; font-size: 14px; list-style: none; cursor: pointer; }
  .more-tab { flex: 1; display: flex; }
  .more-tab > summary::-webkit-details-marker { display: none; }
  .tabbar > a .ic, .more-tab > summary .ic { width: 24px; height: 24px; }
  .tabbar > a[aria-current="page"], .more-tab.current > summary, .more-tab[open] > summary { background: var(--coral-soft); color: var(--coral-ink); }
  .sheet { position: absolute; right: 0; bottom: calc(100% + 10px); width: min(320px, 100%); background: var(--surface); border-radius: 22px; padding: 10px;
    box-shadow: 0 0 0 2px var(--line), var(--shadow); display: grid; gap: 2px; }
  .sheet a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 17px; }
  .sheet a[aria-current="page"] { background: var(--gold-soft); }
  .sheet .short { display: none; }
  .sheet .long { display: inline; }
}
@media (max-width: 639px) {
  :root { --gutter: 16px; --tabbar-h: 92px; }
  .top-inner { padding: 10px var(--gutter); gap: 10px; }
  .logo-word, .user-name { display: none; }
  .logo-tile { width: 48px; height: 48px; border-radius: 16px; }
  .logo-tile .logo-mark { width: 38px; height: 35px; }
  .avatar { width: 46px; height: 46px; }
  .pill { padding: 8px 12px; }
  .tabbar { width: calc(100% - 20px); bottom: calc(10px + env(safe-area-inset-bottom)); gap: 2px; padding: 6px; border-radius: 24px; }
  .tabbar > a, .more-tab > summary { font-size: 13px; min-height: 58px; }
  .user-pop { position: fixed; left: 12px; right: 12px; top: 74px; min-width: 0; }
}

/* ---------- Buttons ---------- */
button, .button { font: 600 18px/1 var(--font-display); border: 0; border-radius: var(--r-lg); padding: 12px 24px; min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--primary); color: #FFFFFF; box-shadow: 0 4px 0 var(--primary-edge); transition: transform .08s ease, box-shadow .08s ease; -webkit-tap-highlight-color: transparent; }
button:active, .button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-edge); }
button:disabled, .button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); }
button.secondary:active, .button.secondary:active { box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line); }
button.gold, .button.gold { background: var(--gold); color: #3A2600; box-shadow: 0 4px 0 var(--gold-edge); }
button.gold:active, .button.gold:active { box-shadow: 0 1px 0 var(--gold-edge); }
button.mint, .button.mint { background: var(--mint); color: #FFFFFF; box-shadow: 0 4px 0 #1E7A57; }
button.small, .button.small { font-size: 15px; min-height: 44px; padding: 8px 16px; border-radius: var(--r-md); }
.button.big-button, button.big-button { font-size: 20px; min-height: 60px; padding: 14px 30px; }
button.link { background: none; box-shadow: none; color: var(--link); padding: 0 6px; min-height: 44px; font: 700 16px var(--font-body); text-decoration: underline; text-underline-offset: 3px; }
button.link:active { transform: none; }
button.danger { background: var(--surface); color: #B42318; box-shadow: inset 0 0 0 2px #F3B8B0, 0 4px 0 #F3B8B0; }
[data-theme="dark"] button.danger { color: #FF8A7A; box-shadow: inset 0 0 0 2px #6B2A24, 0 4px 0 #6B2A24; }
button.icon-btn, .button.icon-btn { width: 48px; min-height: 48px; padding: 0; border-radius: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; }
.button-row form { margin: 0; }

/* ---------- Forms ---------- */
input, select, textarea { font: 700 17px/1.3 var(--font-body); color: var(--ink); background: var(--surface2); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 16px; min-height: 52px; width: 100%; transition: border-color .12s ease, box-shadow .12s ease; }
textarea { line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--ink2); opacity: .75; font-weight: 600; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--primary); flex: none; }
input[type="file"] { padding: 10px; font-size: 15px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 800; color: var(--ink); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 180px; }
.inline-form label { flex: 1 1 180px; }
.inline-form label > input, .inline-form label > select { flex: none; width: 100%; }
form.inline { display: inline; margin: 0; }
label.check, ul.checklist label { flex-direction: row; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; min-height: 44px; }
ul.checklist { list-style: none; padding: 0; columns: 2 240px; margin: 0 0 12px; }
ul.checklist li { break-inside: avoid; }
details > summary { cursor: pointer; font-weight: 800; color: var(--ink2); min-height: 44px; display: flex; align-items: center; }
details label { margin-top: 8px; }
.settings-form { display: grid; gap: 16px; max-width: 640px; }
.settings-form h2 { margin: 8px 0 0; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface); border-radius: 18px; box-shadow: inset 0 0 0 2px var(--line); flex-wrap: wrap; }
.segmented a, .segmented button { min-height: 44px; padding: 8px 16px; border-radius: 14px; font: 700 16px var(--font-body); color: var(--ink2); text-decoration: none;
  display: inline-flex; align-items: center; background: none; box-shadow: none; }
.segmented a:active, .segmented button:active { transform: none; }
.segmented [aria-current="true"], .segmented [aria-pressed="true"] { background: var(--navy); color: #FFFFFF; }
[data-theme="dark"] .segmented [aria-current="true"], [data-theme="dark"] .segmented [aria-pressed="true"] { background: var(--sky); color: #0E1330; }

/* ---------- Cards, tiles, chips ---------- */
.card, .step { background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card > h2:first-child, .step > h2:first-child { margin-top: 0; }
a.card { display: block; color: inherit; text-decoration: none; font-weight: inherit; transition: transform .12s ease; }
a.card:hover { transform: translateY(-2px); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.cards > .card { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1023px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile, .stat { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 16px; color: inherit; text-decoration: none; min-width: 0; }
.stat { flex-direction: column; align-items: flex-start; gap: 4px; }
.tile .tile-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none; }
.tile .tile-icon .ic { width: 28px; height: 28px; }
.tile strong, .stat strong { display: block; font: 700 28px/1.05 var(--font-display); color: var(--ink); overflow-wrap: anywhere; }
.tile span, .stat > span:not(.label):not(.bar) { font-size: 15px; font-weight: 700; color: var(--ink2); }
.stat .label, .kpi .label { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.t-gold .tile-icon { background: var(--gold-soft); color: var(--gold-ink); }
.t-coral .tile-icon { background: var(--coral-soft); color: var(--coral-ink); }
.t-sky .tile-icon { background: var(--sky-soft); color: var(--sky-ink); }
.t-mint .tile-icon { background: var(--mint-soft); color: var(--mint-ink); }
@media (max-width: 639px) {
  .tiles { gap: 12px; }
  .tile { padding: 14px; gap: 12px; }
  .tile .tile-icon { width: 44px; height: 44px; border-radius: 14px; }
  .tile .tile-icon .ic { width: 22px; height: 22px; }
  .tile strong { font-size: 22px; }
  .tile span { font-size: 14px; }
  .card, .step { padding: 18px; border-radius: 24px; }
}

.tag, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); font-weight: 800; font-size: 14px; line-height: 1.3;
  background: var(--surface2); color: var(--ink2); white-space: nowrap; vertical-align: middle; }
.tag.passed, .chip-beginner, .tag.lesson-published { background: var(--mint-soft); color: var(--mint-ink); }
.tag.attempted, .chip-due, .tag.lesson-review { background: var(--gold-soft); color: var(--gold-ink); }
.tag.watched, .chip-intermediate { background: var(--sky-soft); color: var(--sky-ink); }
.chip-advanced { background: var(--coral-soft); color: var(--coral-ink); }
.tag.locked { background: var(--lock); color: var(--ink2); }
.tag.lesson-draft { background: var(--surface2); color: var(--ink2); }
.tag.reason-stuck { background: var(--coral-soft); color: var(--coral-ink); }
.tag.reason-overdue { background: var(--gold-soft); color: var(--gold-ink); }
.tag.reason-inactive { background: var(--sky-soft); color: var(--sky-ink); }
.tag.reason-new { background: var(--navy-soft); color: var(--navy-ink); }
h1 .tag { font: 800 14px var(--font-body); vertical-align: middle; }

.bar { display: inline-block; width: 120px; max-width: 100%; height: 12px; background: var(--surface2); border-radius: var(--r-pill); overflow: hidden; vertical-align: middle; box-shadow: inset 0 0 0 1px var(--line); }
.bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--gold); }

.flash { padding: 14px 18px; border-radius: 16px; background: var(--mint-soft); color: var(--mint-ink); font-weight: 800; }
.flash.error { background: var(--coral-soft); color: var(--coral-ink); }
.flash.info { background: var(--sky-soft); color: var(--sky-ink); }
.note-gold { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--gold-soft); color: var(--gold-ink); font-weight: 800; font-size: 15px; }
.error-text { color: var(--coral-ink); font-weight: 700; }
.right { color: var(--mint-ink); }

.chips { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--surface2); border-radius: var(--r-pill); padding: 6px 8px 6px 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }

/* ---------- Tables (coach screens). Under 640px each row becomes a card. ---------- */
table.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
table.list th, table.list td { text-align: left; padding: 14px 16px; border-bottom: 2px solid var(--surface2); vertical-align: middle; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list th { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); background: var(--surface2); }
table.list td a:not(.button) { font-weight: 800; }
tr.dim td { color: var(--ink2); }
tr.problem td { background: var(--coral-soft); }
table.leaderboard tr.me td { background: var(--gold-soft); font-weight: 800; }
.table-wrap { overflow-x: auto; border-radius: 24px; box-shadow: var(--shadow); margin-bottom: 20px; background: var(--surface); }
.table-wrap table.list { box-shadow: none; margin: 0; }
@media (max-width: 899px) and (min-width: 640px) {
  table.list { display: block; overflow-x: auto; }
}
@media (max-width: 639px) {
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list { background: none; box-shadow: none; border-radius: 0; overflow: visible; }
  table.list thead { display: none; }
  table.list tr { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 12px; }
  table.list td { border: 0; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; min-height: 36px; }
  table.list td::before { content: attr(data-label); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); text-align: left; flex: none; max-width: 45%; }
  table.list td:first-child { font: 600 19px/1.25 var(--font-display); text-align: left; justify-content: flex-start; padding-bottom: 8px; }
  table.list td:first-child::before { display: none; }
  table.list td:empty, table.list td.empty { display: none; }
  table.list td.action { padding-top: 8px; }
  table.list td.action::before { display: none; }
  table.list td.action > .button, table.list td.action > a.button, table.list td.action > form, table.list td.action > form > button { width: 100%; }
  table.list tfoot { display: none; }
}

/* ---------- Chess board ---------- */
.board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; width: 100%;
  border-radius: 20px; overflow: hidden; user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 6px var(--surface), var(--shadow); container-type: inline-size; touch-action: manipulation; }
.sq { position: relative; min-width: 0; min-height: 0; border: 0; border-radius: 0; padding: 0; margin: 0; box-shadow: none; display: grid; place-items: center;
  font: 400 10.5cqw/1 "DejaVu Sans", "Segoe UI Symbol", "Noto Sans Symbols 2", serif; color: #1E2650; cursor: pointer; transition: none; }
.sq:active { transform: none; box-shadow: none; }
.sq.light { background: var(--board-l); }
.sq.dark { background: var(--board-d); }
.sq.white { color: #FFFFFF; -webkit-text-stroke: .9cqw #1E2650; paint-order: stroke fill; }
.sq.black { color: #1E2650; }
.sq.last { background-image: linear-gradient(rgba(239, 174, 48, .45), rgba(239, 174, 48, .45)); }
.sq.selected { background: #F0B643; }
.sq.target::after { content: ""; width: 30%; height: 30%; border-radius: 50%; background: rgba(30, 38, 80, .28); position: absolute; }
.sq.target.white::after, .sq.target.black::after { width: 86%; height: 86%; background: none; box-shadow: inset 0 0 0 1.2cqw rgba(30, 38, 80, .35); }
.sq.hint { background: #F0B643; }
.sq.hint-target::after { content: ""; width: 30%; height: 30%; border-radius: 50%; background: rgba(30, 38, 80, .28); position: absolute; }
.sq.flash-good { background: var(--mint) !important; }
.coord { position: absolute; font: 800 max(9px, 2.6cqw)/1 var(--font-body); color: rgba(30, 38, 80, .55); -webkit-text-stroke: 0; pointer-events: none; }
.coord.r { top: 6%; left: 7%; }
.coord.f { bottom: 6%; right: 8%; }
.sq.dark .coord { color: rgba(255, 255, 255, .85); }
.board.static { pointer-events: none; border-radius: 14px; box-shadow: 0 0 0 4px var(--surface2); }
.board.static .sq { cursor: default; }
.board.mini { max-width: 240px; }

/* ---------- Log in ---------- */
body.chrome-bare main { max-width: none; padding: 0; }
.login-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-brand { background: #253164; color: #FFFFFF; position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login-brand .logo-word { color: #FFFFFF; font-size: 40px; }
.login-brand .logo-tile { width: 84px; height: 84px; border-radius: 24px; }
.login-brand .logo-tile .logo-mark { width: 64px; height: 58px; }
.login-brand h1 { color: #FFFFFF; font-size: clamp(36px, 4.4vw, 56px); line-height: 1.02; margin: 0 0 12px; max-width: 10em; position: relative; z-index: 2; }
.login-brand p { color: #D9DEF3; font-size: 18px; max-width: 22em; position: relative; z-index: 2; margin: 0; }
.login-brand .sun { position: absolute; right: -120px; bottom: -160px; width: 440px; height: 440px; border-radius: 50%; background: #EFAE30; }
.login-brand .square { position: absolute; right: 70px; bottom: 60px; width: 210px; height: 210px; border-radius: 26px; background: #D96949; transform: rotate(-9deg); display: grid; place-items: center; }
.login-brand .square span { font: 400 170px/1 "DejaVu Sans", "Segoe UI Symbol", serif; color: #FFFFFF; -webkit-text-stroke: 6px #1E2650; paint-order: stroke fill; transform: rotate(9deg); }
.login-brand .copy { position: relative; z-index: 2; margin-bottom: 270px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-form form { width: min(100%, 440px); display: flex; flex-direction: column; gap: 18px; }
.login-form h2 { font-size: 40px; font-weight: 700; margin: 0; }
.login-form .lead { color: var(--ink2); font-size: 17px; margin: -8px 0 0; }
.login-form input { background: var(--surface); }
.login-form button { width: 100%; min-height: 60px; font-size: 20px; }
@media (max-width: 899px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { padding: 24px; min-height: 0; border-radius: 0 0 36px 36px; gap: 16px; }
  .login-brand .logo-tile { width: 56px; height: 56px; border-radius: 18px; }
  .login-brand .logo-tile .logo-mark { width: 44px; height: 40px; }
  .login-brand .logo-word { font-size: 26px; }
  .login-brand .copy { margin: 0; max-width: 58%; }
  .login-brand h1 { font-size: clamp(28px, 7vw, 40px); }
  .login-brand p { display: none; }
  .login-brand .sun { width: 220px; height: 220px; right: -60px; bottom: -110px; }
  .login-brand .square { width: 110px; height: 110px; right: 40px; bottom: 30px; border-radius: 18px; }
  .login-brand .square span { font-size: 88px; -webkit-text-stroke: 3px #1E2650; }
  .login-form { padding: 28px var(--gutter) 48px; align-items: flex-start; }
  .login-form h2 { font-size: 30px; }
}

/* ---------- Student home ---------- */
.home-top { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 24px; }
.hero { flex: 2 1 520px; min-width: 0; background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 32px; position: relative; overflow: hidden;
  display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.hero::before { content: ""; position: absolute; right: -70px; top: -70px; width: 240px; height: 240px; border-radius: 50%; background: var(--gold-soft); }
.hero-text { flex: 1 1 300px; display: flex; flex-direction: column; gap: 12px; position: relative; min-width: 0; }
.hero-text .chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-text .hi { font: 600 20px var(--font-display); color: var(--ink2); margin: 0; }
.hero-text h1 { font-size: clamp(36px, 4vw, 48px); line-height: 1; margin: 0; }
.hero-text .goal { font-size: 18px; color: var(--ink2); margin: 0; }
.hero-text .button-row { margin: 6px 0 0; }
.hero-board { flex: 0 1 230px; min-width: 190px; position: relative; }
.hero-board .board { box-shadow: 0 0 0 6px var(--surface2); }
.corner { flex: 1 1 300px; min-width: 0; background: #253164; color: #FFFFFF; border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 28px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px; }
.corner::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 140px; height: 140px; border-radius: 28px; background: #D96949; transform: rotate(14deg); }
.corner > * { position: relative; z-index: 1; }
.corner .eyebrow { color: #EFAE30; }
.corner h2 { color: #FFFFFF; font-size: 30px; font-weight: 700; margin: 0; }
.corner p { color: #D9DEF3; margin: 0; }
.corner .grow { flex: 1; }
.corner .button { align-self: flex-start; }
.home-grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.home-grid > .journey { flex: 2 1 560px; }
.home-grid > aside { flex: 1 1 300px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.home-grid > aside .card { margin: 0; }
@media (max-width: 1023px) {
  .hero { padding: 24px; }
  .corner { flex-basis: 100%; }
}
@media (max-width: 639px) {
  .home-top { gap: 16px; margin-bottom: 16px; }
  .hero { padding: 20px; flex-basis: 100%; }
  .hero::before { width: 150px; height: 150px; right: -70px; top: -70px; }
  .hero-board { display: none; }
  .hero-text h1 { font-size: 36px; }
  .hero-text .goal { font-size: 16px; }
  .hero .button-row .button { flex: 1 1 100%; }
  .corner { padding: 18px 20px; border-radius: 24px; flex-direction: row; align-items: center; gap: 12px; }
  .corner h2 { font-size: 19px; }
  .corner p, .corner .grow { display: none; }
  .corner .text { flex: 1; min-width: 0; }
  .corner .button { align-self: center; min-height: 48px; padding: 10px 16px; }
  .corner::after { width: 90px; height: 90px; right: -40px; bottom: -40px; }
  .home-grid { gap: 16px; }
}

.journey { background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 28px 32px; min-width: 0; }
.journey-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.journey-head h2 { margin: 0; font-size: 28px; }
.journey-head .muted { font-weight: 800; }
.level-row { margin-top: 18px; }
.level-row .level-label { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.path { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px 0; position: relative; }
.path li { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; }
.path li::before { content: ""; position: absolute; top: 31px; left: -50%; right: 50%; border-top: 4px dashed var(--line); z-index: 0; }
.path li:first-child::before { display: none; }
.path li:nth-child(2n) { padding-top: 18px; }
.path li:nth-child(2n)::before { top: 13px; }
.path li:nth-child(2n+3)::before { top: 31px; }
.node { position: relative; z-index: 1; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; flex: none; }
.node .ic { width: 28px; height: 28px; }
.node.done { background: var(--mint); color: #FFFFFF; box-shadow: 0 5px 0 #1E7A57; }
.node.now { width: 72px; height: 72px; margin-top: -4px; background: var(--primary); color: #FFFFFF; box-shadow: 0 0 0 8px var(--coral-soft), 0 5px 0 8px var(--coral-soft); }
.node.try { background: var(--gold); color: #3A2600; box-shadow: 0 5px 0 var(--gold-edge); }
.node.lock { background: var(--lock); color: var(--ink2); }
.path .name { font-weight: 800; font-size: 15px; line-height: 1.2; color: var(--ink); max-width: 120px; text-decoration: none; }
.path li.locked .name { color: var(--ink2); }
.path .due { font-size: 13px; }
@media (max-width: 639px) {
  .journey { padding: 20px; border-radius: 24px; }
  .journey-head h2 { font-size: 22px; }
  .path { display: flex; flex-direction: column; gap: 10px; }
  .path li { flex-direction: row; text-align: left; gap: 14px; padding: 0 !important; }
  .path li::before { display: none; }
  .path li:nth-child(4n+2), .path li:nth-child(4n) { margin-left: 40px; }
  .path li:nth-child(4n+3) { margin-left: 80px; }
  .node { width: 54px; height: 54px; }
  .node.now { width: 60px; height: 60px; margin: 0; }
  .path .name { font-size: 16px; max-width: none; }
}

.mini-board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; font-weight: 800; }
.rank-row.me { background: var(--gold-soft); }
.rank-row .medal { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font: 700 15px var(--font-display); background: var(--surface2); color: var(--ink2); flex: none; }
.rank-row:nth-child(1) .medal { background: #EFAE30; color: #3A2600; }
.rank-row:nth-child(2) .medal { background: #C9D1EA; color: #1E2650; }
.rank-row:nth-child(3) .medal { background: #D96949; color: #FFFFFF; }
.rank-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .pts { color: var(--ink2); }
.side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.side-head h2 { margin: 0; font-size: 22px; }
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px; }
.shelf li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; font-weight: 800; color: var(--ink2); line-height: 1.2; }
.medallion { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font: 700 22px var(--font-display); color: #FFFFFF; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); flex: none; }
.medallion.m0 { background: #EFAE30; color: #3A2600; }
.medallion.m1 { background: #D96949; }
.medallion.m2 { background: #2FA67A; }
.medallion.m3 { background: #4C7BE0; }
.medallion.m4 { background: #253164; }
.medallion.off { background: var(--lock); color: var(--ink2); box-shadow: none; }

/* Achievements grid and certificates */
.badges { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 0 0 16px; }
.badge { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow); }
.badge > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.badge strong { font: 600 18px/1.2 var(--font-display); }
.badge .muted { font-size: 14px; }
.badge .when { font-size: 14px; color: var(--ink2); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.badge .bar { width: 70px; }
.badge:not(.earned) { background: var(--surface2); box-shadow: none; }
.badges-inline li { background: var(--gold-soft); color: var(--gold-ink); padding: 6px 14px; }
.certs { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.certs li { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Lesson player ---------- */
body.chrome-player main { max-width: 1200px; padding-top: 24px; }
.player-top { background: #253164; color: #FFFFFF; position: sticky; top: 0; z-index: 30; }
.player-top-inner { max-width: 1200px; margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; gap: 20px; }
.player-top .logo-tile { width: 48px; height: 48px; border-radius: 16px; }
.player-top .logo-tile .logo-mark { width: 38px; height: 35px; }
.player-title { display: flex; flex-direction: column; min-width: 0; }
.player-title .eyebrow { color: #C9D1F2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-title strong { font: 600 22px/1.15 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segments { flex: 1; display: flex; gap: 6px; min-width: 120px; }
.segments span { flex: 1; height: 12px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .22); }
.segments span.done { background: var(--mint); }
.segments span.now { background: var(--gold); }
.player-top .pill-star { flex: none; }
.close-btn { width: 48px; height: 48px; border-radius: 16px; background: rgba(255, 255, 255, .14); color: #FFFFFF; display: grid; place-items: center; flex: none; text-decoration: none; }
@media (max-width: 639px) {
  .player-top-inner { flex-wrap: wrap; gap: 10px 12px; padding: 10px var(--gutter) 12px; }
  .player-top .logo { display: none; }
  .player-title { flex: 1; order: 2; }
  .close-btn { order: 1; }
  .player-top .pill-star { order: 3; }
  .segments { order: 4; flex-basis: 100%; }
  .player-title strong { font-size: 19px; }
}

.screen { display: block; }
.js .screen:not(.active) { display: none; }
.screen-grid { display: grid; grid-template-columns: minmax(0, 650px) minmax(0, 1fr); gap: 28px; align-items: start; }
.screen-panel { display: flex; flex-direction: column; gap: 16px; }
.screen-card { background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 32px; max-width: 820px; margin: 0 auto; }
.screen-card h2 { margin-top: 0; font-size: 32px; font-weight: 700; }
.screen-card .big-text { font-size: 19px; line-height: 1.6; }
.screen-nav { display: flex; gap: 12px; justify-content: space-between; align-items: center; max-width: 820px; margin: 20px auto 0; flex-wrap: wrap; }
.player:has(.screen.active .screen-grid) .screen-nav, .screen-nav.wide { max-width: none; }
.screen-nav .button, .screen-nav button { min-width: 140px; }
.mascot { display: flex; gap: 14px; align-items: flex-start; }
.mascot .logo-tile { width: 64px; height: 64px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.mascot .logo-tile .logo-mark { width: 46px; height: 42px; }
.bubble { position: relative; flex: 1; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 16px 20px; min-width: 0; }
.bubble::before { content: ""; position: absolute; left: -9px; top: 22px; width: 18px; height: 18px; background: var(--surface); transform: rotate(45deg); border-radius: 3px; }
.bubble .who-moves { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: var(--ink2); margin: 0 0 4px; }
.bubble .who-moves i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.bubble .who-moves i.b { background: var(--ink); }
.bubble .say { font: 600 24px/1.2 var(--font-display); margin: 0; }
.bubble .say.good { color: var(--mint-ink); }
.bubble .say.bad { color: var(--coral-ink); }
.tools { display: flex; gap: 12px; }
.tools > * { flex: 1 1 0; }
.tools button, .tools .button { width: 100%; }
.tools [hidden] { display: none; }
.hint-note { font-size: 14px; font-weight: 700; color: var(--ink2); margin: -4px 0 0; }
.puzzle-board-wrap { max-width: 650px; width: 100%; }
@media (max-width: 1023px) {
  .screen-grid { grid-template-columns: 1fr; gap: 16px; }
  .screen-grid .puzzle-board-wrap { order: 2; max-width: none; }
  .screen-grid .screen-panel { display: contents; }
  .screen-grid .mascot { order: 1; }
  .screen-grid .tools { order: 3; }
  .screen-grid .hint-note { order: 4; }
  .screen-grid .side-card { order: 5; }
}
@media (max-width: 639px) {
  body.chrome-player main { padding-top: 16px; padding-bottom: 120px; }
  .screen-card { padding: 20px; border-radius: 24px; }
  .screen-card h2 { font-size: 26px; }
  .mascot .logo-tile { width: 52px; height: 52px; border-radius: 16px; }
  .bubble { padding: 12px 16px; }
  .bubble .say { font-size: 20px; }
  .tools { gap: 8px; }
  .tools button, .tools .button { min-height: 56px; }
  .tools:has(> :nth-child(3)) button, .tools:has(> :nth-child(3)) .button { min-height: 64px; flex-direction: column; gap: 4px; font-size: 15px; padding: 8px 4px; }
  .screen-nav { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -2px 0 var(--line); z-index: 20; flex-wrap: nowrap; }
  .screen-nav .button, .screen-nav button { flex: 1; min-width: 0; }
}

.video { position: relative; aspect-ratio: 16 / 9; background: #0A0E26; border-radius: 20px; overflow: hidden; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.watch-status { margin: 14px 0 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.locked-until-watched::before { content: "Watch the lesson video first, then the questions and puzzles open."; display: block; margin: 0 auto 12px; max-width: 820px;
  padding: 14px 18px; border-radius: 16px; background: var(--gold-soft); color: var(--gold-ink); font-weight: 800; }

.quiz { padding: 0; margin: 0; list-style: none; }
.quiz > li { margin-bottom: 20px; }
.question-text { font: 600 26px/1.25 var(--font-display); margin: 0 0 18px; }
.choice { flex-direction: row; align-items: center; gap: 14px; color: var(--ink); font-size: 18px; font-weight: 700; padding: 14px 18px; margin-bottom: 12px; min-height: 60px;
  background: var(--surface); border: 0; border-radius: 18px; cursor: pointer; box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); }
.choice:has(input:checked) { box-shadow: inset 0 0 0 3px var(--gold), 0 4px 0 var(--gold-edge); background: var(--gold-soft); }
.choice input { width: 24px; height: 24px; }
@media (max-width: 639px) { .question-text { font-size: 22px; } .choice { font-size: 17px; } }

.puzzle-msg { font-weight: 800; margin-top: 10px; min-height: 1.5em; }
.puzzle[data-status="solved"] .puzzle-msg { color: var(--mint-ink); }
.puzzle[data-status="failed"] .puzzle-msg { color: var(--coral-ink); }
.puzzle[data-status="solved"] .board { box-shadow: 0 0 0 6px var(--mint), var(--shadow); }

/* Practice: a column of puzzle cards */
.puzzles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.puzzles > .puzzle { background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 20px; }
.puzzles > .puzzle .board { margin: 12px 0 4px; }
.practice-tools { display: flex; gap: 8px; margin: 8px 0 0; flex-wrap: wrap; }
.practice-tools [hidden] { display: none; }

/* ---------- Result / celebration ---------- */
.result { text-align: center; max-width: 620px; margin: 0 auto 32px; padding: 16px 0 0; position: relative; }
.result::before { content: ""; position: absolute; left: 50%; top: 40px; width: 560px; height: 400px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, var(--gold-soft), transparent); z-index: -1; }
.result .stars { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 0 0 18px; }
.result .stars span { display: inline-grid; color: var(--lock); }
.result .stars .ic { width: 64px; height: 64px; }
.result .stars span:nth-child(2) .ic { width: 92px; height: 92px; }
.result .stars span.on { color: var(--gold); filter: drop-shadow(0 4px 0 var(--gold-edge)); animation: pop .5s ease-out both; animation-delay: calc(var(--n) * .25s); }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.result .eyebrow { color: var(--coral-ink); margin-bottom: 6px; }
.result h1 { font-size: clamp(40px, 6vw, 56px); margin: 0 0 8px; }
.result .line { font-size: 18px; color: var(--ink2); margin: 0 0 22px; }
.result .tiles3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.result .tiles3 div { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 16px 8px; }
.result .tiles3 strong { display: block; font: 700 32px/1.1 var(--font-display); }
.result .tiles3 span { font-size: 14px; font-weight: 800; color: var(--ink2); }
.result .tiles3 .g strong { color: var(--gold-ink); }
.result .tiles3 .m strong { color: var(--mint-ink); }
.result .tiles3 .s strong { color: var(--sky-ink); }
.new-badge { display: flex; align-items: center; gap: 16px; text-align: left; background: #253164; color: #FFFFFF; border-radius: 22px; padding: 16px 20px; margin-bottom: 12px; }
.new-badge .medallion { background: #EFAE30; color: #3A2600; }
.new-badge .eyebrow { color: #EFAE30; }
.new-badge strong { font: 600 20px var(--font-display); }
.result .actions { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-top: 20px; }
.result .actions .button { width: 100%; }
.result.fail .eyebrow { color: var(--gold-ink); }
.result.fail::before { background: radial-gradient(closest-side, var(--sky-soft), transparent); }
@media (max-width: 639px) {
  .result .stars .ic { width: 48px; height: 48px; }
  .result .stars span:nth-child(2) .ic { width: 68px; height: 68px; }
  .result .tiles3 strong { font-size: 24px; }
  .result .actions { grid-template-columns: 1fr; }
  .result::before { width: 360px; }
}
@media (prefers-reduced-motion: reduce) { .result .stars span.on { animation: none; } }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.review-list li { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-weight: 700; }
.review-list .mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.review-list .mark.ok { background: var(--mint-soft); color: var(--mint-ink); }
.review-list .mark.no { background: var(--coral-soft); color: var(--coral-ink); }
.review-list .grow { flex: 1; min-width: 160px; }

/* ---------- Coach overview ---------- */
.greet { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.greet h1 { margin: 0; font-size: clamp(30px, 3.6vw, 40px); }
.greet p { margin: 4px 0 0; color: var(--ink2); font-size: 17px; }
.kpi { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 20px; min-width: 0; text-decoration: none; color: inherit; }
.kpi strong { display: block; font: 700 34px/1.1 var(--font-display); margin: 8px 0 4px; }
.kpi .sub { font-size: 15px; font-weight: 700; color: var(--ink2); }
.kpi.k-ink strong { color: var(--ink); }
.kpi.k-mint strong { color: var(--mint-ink); }
.kpi.k-sky strong { color: var(--sky-ink); }
.kpi.k-coral strong { color: var(--coral-ink); }
.coach-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.coach-grid > div { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.coach-grid .card { margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 24px; }
.card-head > a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 800; }
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.more-att { margin-top: 12px; }
.more-att > summary { list-style: none; margin-bottom: 12px; }
.more-att > summary::-webkit-details-marker { display: none; }
.more-att[open] > summary { display: none; }
.att { background: var(--surface2); border-radius: 18px; padding: 14px; display: flex; gap: 14px; align-items: center; }
.att .initials { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font: 700 17px var(--font-display); color: #FFFFFF; flex: none; }
.att .initials.k-stuck { background: #D96949; }
.att .initials.k-overdue { background: #C98A12; }
.att .initials.k-inactive { background: #4C7BE0; }
.att .initials.k-new { background: #253164; }
.att .what { flex: 1; min-width: 0; }
.att .what a { font-size: 17px; color: var(--ink); text-decoration: none; }
.att .what a:hover { text-decoration: underline; }
.att .what p { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--ink2); }
.att .reasons { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.att .act { display: flex; gap: 10px; align-items: center; flex: none; }
.missed-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.missed-bars .row { display: flex; justify-content: space-between; gap: 12px; font-weight: 800; }
.missed-bars .row a { color: var(--ink); text-decoration: none; }
.missed-bars .row span { color: var(--coral-ink); }
.missed-bars .track { height: 12px; border-radius: var(--r-pill); background: var(--surface2); margin: 6px 0 4px; overflow: hidden; }
.missed-bars .track i { display: block; height: 100%; border-radius: var(--r-pill); background: #D96949; }
.missed-bars small { font-size: 14px; font-weight: 700; color: var(--ink2); }
.waiting { background: #253164; color: #FFFFFF; border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 24px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.waiting::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: #EFAE30; opacity: .9; }
.waiting > * { position: relative; z-index: 1; }
.waiting .eyebrow { color: #EFAE30; }
.waiting h3 { color: #FFFFFF; font-size: 21px; margin: 0; max-width: calc(100% - 90px); }
.waiting p { color: #D9DEF3; margin: 0 0 8px; max-width: calc(100% - 90px); }
.waiting .button { align-self: flex-start; }
.waiting ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (max-width: 1023px) {
  .coach-grid { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .greet { margin-bottom: 16px; }
  .greet .segmented { width: 100%; }
  .kpi { padding: 14px 16px; }
  .kpi strong { font-size: 26px; margin: 4px 0 2px; }
  .kpi { display: flex; flex-direction: column; }
  .kpi .label { order: 2; letter-spacing: 0; text-transform: none; font-size: 15px; font-weight: 700; }
  .kpi .sub { display: none; }
  .att { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; background: var(--surface); box-shadow: var(--shadow); border-radius: 22px; }
  .att-list { gap: 14px; }
  .card.attention-card { background: none; box-shadow: none; padding: 0; }
  .att .reasons { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .att .act { grid-column: 1 / -1; }
  .att .act .button { width: 100%; }
}

/* Class grid */
.grid-wrap { overflow-x: auto; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); margin-bottom: 16px; }
table.class-grid { border-collapse: separate; border-spacing: 0; font-size: 15px; }
table.class-grid th, table.class-grid td { border-bottom: 2px solid var(--surface2); border-right: 2px solid var(--surface2); padding: 8px; text-align: center; }
table.class-grid th.name { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; font-weight: 800; }
table.class-grid th.level { background: var(--surface2); font-weight: 800; }
table.class-grid th.lesson { vertical-align: bottom; height: 170px; font-weight: 700; color: var(--ink2); }
table.class-grid th.lesson span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
table.class-grid td.total { color: var(--ink2); white-space: nowrap; font-weight: 700; }
.cell { min-width: 60px; white-space: nowrap; font-weight: 700; }
.cell.passed { background: var(--mint-soft); color: var(--mint-ink); }
.cell.attempted { background: var(--gold-soft); color: var(--gold-ink); }
.cell.stuck { background: var(--coral-soft); color: var(--coral-ink); font-weight: 800; }
.cell.watched { color: var(--sky-ink); }
.cell.not_started { color: var(--ink2); }
.cell.locked { background: repeating-linear-gradient(45deg, var(--surface2), var(--surface2) 5px, var(--surface) 5px, var(--surface) 10px); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink2); font-weight: 700; font-size: 15px; }
.legend .cell { display: inline-block; min-width: 52px; padding: 4px 8px; border-radius: 10px; text-align: center; box-shadow: inset 0 0 0 2px var(--line); }
.level-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-btn { min-height: 44px; padding: 8px 18px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink2); box-shadow: inset 0 0 0 2px var(--line); border: 0; font: 800 15px var(--font-body); cursor: pointer; transform: none; }
.chip-btn:active { transform: none; }
.chip-btn[aria-pressed="true"] { background: var(--navy); color: #FFFFFF; box-shadow: none; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
nav.segmented { margin-bottom: 16px; }
table.class-grid th.name a { display: block; padding: 9px 0; }
.js table.class-grid [data-level].hidden-level { display: none; }
@media (max-width: 639px) {
  table.class-grid th.lesson { height: auto; }
  table.class-grid th.lesson span { writing-mode: horizontal-tb; transform: none; white-space: normal; display: block; min-width: 76px; font-size: 13px; line-height: 1.2; }
  table.class-grid th.name a { font-size: 15px; }
}
@media print { .grid-wrap { overflow: visible; box-shadow: none; } table.class-grid th.name { position: static; } .js table.class-grid [data-level].hidden-level { display: table-cell; } }

/* Coach lists of puzzles */
.puzzle-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.missed-puzzles .board.static { max-width: 240px; margin-bottom: 12px; }
.missed-puzzles .card p { margin: 6px 0 0; }

/* Leaderboard toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 20px; }
.toolbar .inline-form select { min-width: 200px; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border-radius: 18px; box-shadow: inset 0 0 0 2px var(--line); }
.tabs a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 14px; text-decoration: none; font-weight: 800; color: var(--ink2); }
.tabs a.active { background: var(--navy); color: #FFFFFF; }
[data-theme="dark"] .tabs a.active { background: var(--sky); color: #0E1330; }

/* Online chess, reports */
.online p { margin: 0 0 8px; }
.ratings { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.report-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 4px solid var(--gold); padding-bottom: 12px; margin-bottom: 20px; }
.report-head p { margin: 0; }
.report-head h1 { margin: 4px 0; }
.report-head .logo-mark { flex: none; }
.summary { font-size: 17px; background: var(--surface); border-left: 6px solid var(--coral); padding: 16px 20px; border-radius: 16px; box-shadow: var(--shadow); }

/* Certificate: scales down on small screens, prints full size */
.certificate { background: #FFFDF5; color: #2B2417; padding: 1.6cqw; border: 3px solid #C99A2E; border-radius: 6px; width: min(100%, 900px); margin: 0 auto; page: cert; container-type: inline-size; }
.certificate-wrap { container-type: inline-size; width: min(100%, 900px); margin: 0 auto; }
.certificate-inner { border: 1px solid #B08D3C; padding: 4.4cqw 3.6cqw; text-align: center; font-family: Georgia, "Times New Roman", serif; }
.certificate-inner p { margin: 1cqw 0; font-size: max(13px, 2cqw); }
.cert-mark { display: block; margin: 0 auto 4px; }
.cert-mark svg { width: max(48px, 8cqw); height: auto; }
.certificate .logo-knight { fill: #253164; }
.cert-club { letter-spacing: .2em; text-transform: uppercase; font-size: max(11px, 1.6cqw) !important; color: #6B5A33; }
.certificate h1 { font: normal max(24px, 4.6cqw)/1.15 Georgia, serif; margin: 1cqw 0 2.4cqw; color: #253164; }
.cert-name { font-size: max(22px, 4.2cqw) !important; font-style: italic; border-bottom: 1px solid #B08D3C; display: inline-block; padding: 0 3cqw 4px; margin: 1cqw 0 2cqw !important; }
.cert-sign { display: flex; justify-content: space-around; gap: 3cqw; margin-top: 4.4cqw; font-size: max(12px, 1.8cqw); color: #6B5A33; }
.cert-sign div { display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 1; max-width: 220px; }
.cert-sign .line { border-bottom: 1px solid #2B2417; width: 100%; padding-bottom: 4px; margin-bottom: 4px; color: #2B2417; font-size: max(13px, 1.9cqw); min-height: 1.6em; }
.cert-number { font-size: max(11px, 1.4cqw) !important; color: #8A7A55; margin-top: 2.6cqw !important; }

/* Lesson editor bits kept from the old builder pages */
.lesson-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 20px; }
.row-tools { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.paste-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.paste-form textarea { font-family: ui-monospace, Consolas, monospace; font-size: 15px; }
.paste-form button { align-self: flex-start; }
.upload { margin: 12px 0; }
.builder-steps { margin: 0 0 12px; padding-left: 22px; color: var(--ink2); font-size: 15px; font-weight: 600; }
.builder-steps strong { color: var(--ink); }

/* Student import and login cards */
.import-form textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 15px; }
.import-form label > span { display: block; margin-bottom: 4px; }
.file-pick { margin: 8px 0; }
.login-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.login-card { border: 2px dashed var(--line); border-radius: 20px; padding: 16px 18px; background: var(--surface); break-inside: avoid; }
.login-card .logo-word { color: var(--ink); font-size: 18px; }
.login-card .logo-knight { fill: var(--ink); }
.login-card .brand { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.login-card .who { font: 600 21px var(--font-display); margin: 0; }
.login-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 10px 0 0; }
.login-card dt { color: var(--ink2); font-weight: 700; }
.login-card dd { margin: 0; overflow-wrap: anywhere; }
.login-card code { font-size: 17px; }
.login.narrow { max-width: 460px; margin: 24px auto; display: flex; flex-direction: column; gap: 16px; }
.login.narrow h1 { margin: 0; }

@page cert { size: letter landscape; margin: .4in; }
@media print {
  .top, .tabbar, .player-top, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  :root, [data-theme] { --bg: #fff; --surface: #fff; --surface2: #f4f4f4; --ink: #000; --ink2: #333; --line: #ccc; --shadow: none; }
  main { padding: 0 !important; max-width: none; }
  .card, table.list, .summary, .tile, .kpi { box-shadow: none !important; border: 1px solid #ccc; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .login-cards { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .login-card { border-color: #999; border-radius: 0; background: #fff; color: #000; padding: 18px; }
  .certificate { width: 100%; }
}

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

/* Back links at the top of inner pages */
.back-link { margin: 0 0 8px; }
.back-link a, a.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 800; color: var(--ink2); text-decoration: none; }
.back-link a:hover, a.back-link:hover { color: var(--ink); text-decoration: underline; }

/* Page heads, people lists and row lists on coach pages */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink2); font-size: 17px; }
.page-head .button-row { margin: 0; }
.filter { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 18px; box-shadow: inset 0 0 0 2px var(--line); padding: 0 16px; margin-bottom: 16px; color: var(--ink2); }
.filter input { border: 0; box-shadow: none; background: transparent; flex: 1; min-width: 0; padding-left: 0; }
.filter input:focus { outline: none; }
.filter:focus-within { box-shadow: inset 0 0 0 2px var(--sky); }
.initials { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font: 700 17px var(--font-display); color: #FFFFFF; background: #253164; flex: none; }
.initials.big { width: 72px; height: 72px; border-radius: 22px; font-size: 28px; background: #D96949; }
.people { list-style: none; margin: 0 0 24px; padding: 0; background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); overflow: hidden; }
.people li + li { border-top: 2px solid var(--surface2); }
.people a { display: flex; align-items: center; gap: 14px; padding: 12px 18px; min-height: 68px; color: var(--ink); text-decoration: none; }
.people a:hover { background: var(--surface2); }
.people li:nth-child(4n+2) .initials { background: #4C7BE0; }
.people li:nth-child(4n+3) .initials { background: #2FA67A; }
.people li:nth-child(4n+4) .initials { background: #D96949; }
.people .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.people .who strong { font-size: 17px; }
.people .who small, .rows small { font-size: 14px; font-weight: 600; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; }
.people .when { font-size: 14px; font-weight: 700; color: var(--ink2); width: 120px; text-align: right; }
.people .ic { color: var(--ink2); flex: none; }
.profile-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.profile-head .who { flex: 1; min-width: 200px; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 4px 0 0; color: var(--ink2); font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.profile-head .button-row { margin: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.two-col > div { min-width: 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.rows li + li { border-top: 2px solid var(--surface2); }
.rows .grow { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.rows strong { font-size: 16px; }
.stack-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.stack-form label { flex: 1; min-width: 180px; }
@media (max-width: 1023px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .page-head .button-row { width: 100%; }
  .page-head .button-row .button { flex: 1; }
  .people a { padding: 12px 14px; gap: 12px; }
  .people .when { display: none; }
  .people .chip { display: none; }
  .initials.big { width: 56px; height: 56px; font-size: 22px; border-radius: 18px; }
  .profile-head .button-row, .profile-head .button-row .button { width: 100%; }
  .stack-form button { width: 100%; }
}
.card-head .button-row { margin: 0; }
.card-head h2 .chip { font-family: var(--font-body); }
.class-card h3 { font-size: 18px; margin: 16px 0 8px; }
.inline-form > * { min-width: 0; max-width: 100%; }
.staff-list li { padding: 12px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.staff-list li.dim { opacity: .7; }
.staff-list .person { display: flex; align-items: center; gap: 14px; flex: 1 1 320px; min-width: 0; }
.manage-staff { margin: 0; }
.manage-staff > summary { list-style: none; }
.manage-staff > summary::-webkit-details-marker { display: none; }
.manage-staff[open] { flex-basis: 100%; }
.manage-staff[open] > summary { margin-bottom: 12px; }
.manage-body { display: grid; gap: 12px; background: var(--surface2); border-radius: 18px; padding: 16px; }
.manage-body form { margin: 0; }
.filter { flex-direction: row; }
@media (max-width: 639px) {
  .staff-list li { padding: 12px 14px; }
  .staff-list .person { flex-wrap: wrap; }
  .staff-list .person .who { flex-basis: calc(100% - 60px); }
}
.missed-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.missed-list .card { margin: 0; }
.missed-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.missed-top .q { font-size: 17px; }
.missed-top .rate { font: 700 22px var(--font-display); color: var(--coral-ink); }
.missed-list .track, .missed-puzzles .track { height: 12px; border-radius: var(--r-pill); background: var(--surface2); margin: 8px 0 6px; overflow: hidden; }
.missed-list .track i, .missed-puzzles .track i { display: block; height: 100%; border-radius: var(--r-pill); background: #D96949; }
.answers { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 0; font-size: 15px; }
.answers dt { font-weight: 800; color: var(--ink2); }
.answers dd { margin: 0; font-weight: 700; }
@media (max-width: 639px) { .missed-list { grid-template-columns: 1fr; } .answers { grid-template-columns: 1fr; gap: 2px; } .answers dd { margin-bottom: 6px; } }

/* ---------- Lesson studio ---------- */
.studio-top { background: #253164; color: #FFFFFF; position: sticky; top: 0; z-index: 30; }
.studio-top-inner { max-width: 1200px; margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; gap: 16px; }
.studio-top .player-title { flex: 1; }
.studio-actions { display: flex; gap: 10px; align-items: center; flex: none; }
.studio-actions form { margin: 0; }
.button.on-navy { background: rgba(255, 255, 255, .14); color: #FFFFFF; box-shadow: none; }
.button.on-navy:active { transform: none; }
.button .short, .studio-bar { display: none; }
.stepper { display: flex; align-items: center; gap: 20px; list-style: none; margin: 0; padding: 0; flex: none; }
.stepper li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); font-weight: 800; font-size: 14px; color: #FFFFFF; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.stepper li { position: relative; }
.stepper li + li::before { content: ""; position: absolute; left: -16px; top: 50%; width: 12px; height: 3px; margin-top: -1.5px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.stepper li b { font-weight: 800; }
.stepper li.now { background: #EFAE30; color: #3A2600; box-shadow: none; }
.stepper li.done { background: #2FA67A; box-shadow: none; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: #C9D1F2; flex: none; min-width: 70px; }
.save-state.bad { color: #FFB4A6; }
.studio-tabs { display: none; }
.studio { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.studio-main .card-head { align-items: baseline; }
.studio-side .card { margin-bottom: 20px; }
.step-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.step-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 14px 16px; }
.step-card.needs { box-shadow: inset 0 0 0 3px #D96949, var(--shadow); }
.step-card .num { font: 700 20px var(--font-display); color: var(--ink2); width: 22px; text-align: center; flex: none; }
.step-card .kind-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.step-card .kind-icon .glyph { font: 30px/1 "DejaVu Sans", "Segoe UI Symbol", serif; }
.step-card .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-card .grow strong { font-size: 17px; overflow-wrap: anywhere; }
.step-card .grow small { font-size: 14px; font-weight: 600; color: var(--ink2); }
.step-card .grow small.miss { color: var(--coral-ink); }
.step-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.updown { display: inline-flex; gap: 4px; }
.updown .icon-btn, .row-tools .icon-btn { background: var(--surface2); color: var(--ink); box-shadow: none; }
.updown .icon-btn:disabled, .row-tools .icon-btn:disabled { opacity: .35; }
.k-video .kind-icon, .tray-btn.k-video { background: var(--coral-soft); color: var(--coral-ink); }
.k-explain .kind-icon, .tray-btn.k-explain { background: var(--sky-soft); color: var(--sky-ink); }
.k-puzzle .kind-icon, .tray-btn.k-puzzle { background: var(--gold-soft); color: var(--gold-ink); }
.k-quiz .kind-icon, .tray-btn.k-quiz { background: var(--mint-soft); color: var(--mint-ink); }
.tray-btn.k-lichess { background: var(--navy-soft); color: var(--navy-ink); }
.k-video .eyebrow { color: var(--coral-ink); } .k-explain .eyebrow { color: var(--sky-ink); } .k-puzzle .eyebrow { color: var(--gold-ink); } .k-quiz .eyebrow { color: var(--mint-ink); }
.add-tray { border: 3px dashed var(--line); border-radius: var(--r-xl); padding: 18px; }
.add-tray h3 { margin: 0 0 12px; font-size: 18px; }
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tray-btn { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 18px; text-decoration: none; min-height: 84px; }
.tray-btn strong { font: 600 20px var(--font-display); }
.tray-btn span { font-size: 14px; font-weight: 700; opacity: .85; }
.tray-btn:hover { filter: brightness(.97); }
.about-form { display: grid; gap: 14px; }
.about-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.about-form .save-btn { justify-self: start; }
.checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; }
.checks .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; color: #FFFFFF; background: #2FA67A; }
.checks li.bad .dot { background: #D96949; }
.checks li.meh .dot { background: var(--gold); color: #3A2600; }
.send-form { display: grid; gap: 12px; border-top: 2px solid var(--surface2); padding-top: 16px; }
.send-form button { justify-self: start; }
.more-actions .button-row { margin: 0; }
.studio-narrow { max-width: 760px; margin: 0 auto; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink2); font-weight: 800; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: var(--surface2); }
.quiz-list { list-style: none; margin: 0 0 20px; padding: 0; }
.quiz-list .card-head h3 { margin: 0; font-size: 20px; }
.question-form { display: grid; gap: 12px; }
.question-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.question-form legend { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.question-form > button { justify-self: start; }
.choice-edit { display: flex; align-items: center; gap: 10px; }
.choice-edit input[type="radio"] { width: 28px; height: 28px; flex: none; accent-color: #2FA67A; margin: 0; }
.choice-edit input:not([type]) , .choice-edit input[name="choice"] { flex: 1; min-width: 0; }
.paste-many { margin-top: 20px; border-top: 2px solid var(--surface2); padding-top: 16px; }
.paste-many > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 800; cursor: pointer; }
.paste-many form { margin-top: 12px; }
.lesson-rows .pos { width: 36px; height: 36px; border-radius: 12px; background: var(--surface2); display: grid; place-items: center; font: 700 16px var(--font-display); flex: none; }
.lesson-rows a { color: var(--ink); text-decoration: none; }
.lesson-rows a:hover strong { text-decoration: underline; }
.waiting.wide { margin-bottom: 24px; }
.waiting.wide li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.waiting.wide li span { color: #D9DEF3; font-weight: 700; }

/* Puzzle editor */
.puzzle-editor { display: grid; grid-template-columns: minmax(0, 620px) minmax(0, 1fr); gap: 32px; align-items: start; }
.editor-board-wrap { position: sticky; top: 96px; }
.editor-board { touch-action: none; }
.editor-msg { text-align: center; font-weight: 700; color: var(--ink2); min-height: 1.4em; margin: 12px 0 0; }
.editor-msg.bad { color: var(--coral-ink); }
.editor-msg.good { color: var(--mint-ink); }
.editor-panel h2 { margin: 0 0 4px; font-size: 28px; }
.pstep { display: grid; gap: 16px; align-content: start; }
.pstep > p { margin: 0; }
.js .puzzle-editor.ready[data-step="setup"] .pstep:not([data-pstep-panel="setup"]),
.js .puzzle-editor.ready[data-step="answer"] .pstep:not([data-pstep-panel="answer"]),
.js .puzzle-editor.ready[data-step="hint"] .pstep:not([data-pstep-panel="hint"]),
.js .puzzle-editor.ready[data-step="check"] .pstep:not([data-pstep-panel="check"]) { display: none; }
.tray-pieces { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 14px; }
.piece-btn { aspect-ratio: 1; min-height: 52px; padding: 0; border-radius: 14px; background: var(--board-l); box-shadow: none; display: grid; place-items: center;
  font: 400 34px/1 "DejaVu Sans", "Segoe UI Symbol", serif; color: #1E2650; container-type: normal; }
.piece-btn.white { color: #FFFFFF; -webkit-text-stroke: 1.4px #1E2650; paint-order: stroke fill; }
.piece-btn:active { transform: none; box-shadow: none; }
.piece-btn[aria-pressed="true"] { background: var(--gold-soft); box-shadow: inset 0 0 0 3px #EFAE30; }
.piece-btn.eraser { background: var(--coral-soft); color: var(--coral-ink); }
.piece-btn.eraser[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #D96949; }
.who-first { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-weight: 800; }
.who-first .segmented { margin: 0; }
.pstep .button-row { margin: 0; }
.paste-code > summary { list-style: none; }
.paste-code > summary::-webkit-details-marker { display: none; }
.paste-code .inline-form { margin-top: 10px; }
.pstep-nav { display: flex; justify-content: space-between; gap: 12px; border-top: 2px solid var(--surface2); padding-top: 16px; }
.move-list { list-style: none; margin: 0; padding: 14px; display: grid; gap: 8px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.move-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; font: 600 20px var(--font-display); }
.move-list li.student { background: var(--coral-soft); }
.move-list li.reply { background: var(--surface2); }
.move-list li .tag { font-family: var(--font-body); color: #FFFFFF; background: #C4532F; }
.move-list li.reply .tag { background: #253164; }
.move-list li.next { border: 2px dashed var(--line); font: 700 15px var(--font-body); color: var(--ink2); }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -55%); font-family: "DejaVu Sans", "Segoe UI Symbol", serif; line-height: 1; color: #1E2650; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .25)); }
.drag-ghost.white { color: #FFFFFF; -webkit-text-stroke: 2px #1E2650; paint-order: stroke fill; }
.delete-puzzle { margin-top: 24px; }
.psteps { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex: none; }
.pstep-pill { min-height: 44px; padding: 6px 14px 6px 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .14); color: #FFFFFF; box-shadow: none; font: 800 15px var(--font-body); gap: 8px; }
.pstep-pill:active { transform: none; box-shadow: none; }
.pstep-pill b { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: grid; place-items: center; }
.pstep-pill[aria-current="step"] { background: #EFAE30; color: #3A2600; }
.pstep-pill[aria-current="step"] b { background: #FFFFFF; }
.pstep-pill.done b { background: #2FA67A; }

/* Review */
.review-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.review-stage .card-head { margin-bottom: 10px; }
.step-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.step-chips .chip-btn[aria-pressed="true"] { background: #EFAE30; color: #3A2600; }
.device-wrap { display: flex; justify-content: center; margin-bottom: 8px; }
.device { position: relative; overflow: hidden; background: #1E2650; border-radius: 34px; box-shadow: 0 0 0 16px #1E2650, var(--shadow); margin: 16px; }
.device[data-device="computer"] { border-radius: 14px; box-shadow: 0 0 0 10px #1E2650, var(--shadow); margin: 10px; }
.device iframe { border: 0; transform-origin: 0 0; background: var(--bg); display: block; }
.glance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.glance div { background: var(--surface2); border-radius: 16px; padding: 12px; }
.glance strong { display: block; font: 700 26px var(--font-display); }
.glance span { font-size: 14px; font-weight: 700; color: var(--ink2); }
.note-row { display: flex; gap: 12px; margin-bottom: 16px; }
.note-row .initials { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; background: #4C7BE0; }
.note-bubble { background: var(--surface2); border-radius: 0 18px 18px 18px; padding: 10px 14px; flex: 1; }
.note-bubble p { margin: 4px 0 0; }
.review-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.review-actions > *, .review-actions form button { flex: 1 1 100%; }
.review-actions form { display: flex; }
body.framed main { padding-top: 16px; }

@media (max-width: 1023px) {
  .studio, .review-grid { grid-template-columns: 1fr; }
  .stepper li { padding: 6px 10px; }
  .stepper li + li::before { display: none; }
  .save-state { display: none; }
  .puzzle-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
  .studio-top .psteps .pstep-pill span { display: none; }
  .studio-top .psteps .pstep-pill { padding: 6px; }
  .studio-top .psteps .pstep-pill[aria-current="step"] span { display: inline; }
  .studio-top .psteps .pstep-pill[aria-current="step"] { padding-right: 14px; }
}
@media (max-width: 899px) {
  .puzzle-editor { grid-template-columns: 1fr; }
  .editor-board-wrap { position: static; max-width: 560px; margin: 0 auto; width: 100%; }
}
@media (max-width: 639px) {
  .studio-top-inner { flex-wrap: wrap; gap: 10px 12px; padding: 10px var(--gutter) 12px; }
  .studio-top .player-title strong { font-size: 19px; }
  .studio-top .stepper { order: 3; }
  .studio-top .stepper li:not(.now) { display: none; }
  .studio-top .studio-actions { display: none; }
  .studio-top .psteps { order: 4; flex-basis: 100%; justify-content: space-between; }
  .studio-tabs { display: flex; width: 100%; margin-bottom: 16px; }
  .studio-tabs button { flex: 1; }
  .js .studio[data-tab="steps"] .studio-side, .js .studio[data-tab="about"] .studio-main, .js .studio[data-tab="checks"] .studio-main { display: none; }
  .js .studio[data-tab="about"] [data-panel="checks"], .js .studio[data-tab="checks"] [data-panel="about"] { display: none; }
  .step-card { flex-wrap: wrap; padding: 14px; gap: 12px; position: relative; }
  .step-card .kind-icon { width: 44px; height: 44px; border-radius: 14px; }
  .step-card .num { display: none; }
  .step-card .grow { flex-basis: calc(100% - 60px); }
  .step-card > .tag { margin-left: 56px; }
  .step-tools { margin-left: auto; }
  .tray { grid-template-columns: 1fr 1fr; }
  .tray-btn { min-height: 64px; padding: 12px 14px; }
  .tray-btn span { display: none; }
  .about-form .two { grid-template-columns: 1fr; }
  .studio-bar { display: flex; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -2px 0 var(--line); }
  .studio-bar > *, .studio-bar form button { flex: 1; }
  .studio-bar form { display: flex; }
  body.studio-page main { padding-bottom: 120px; }
  .tray-pieces { gap: 6px; padding: 10px; }
  .piece-btn { min-height: 44px; font-size: 28px; border-radius: 12px; }
  .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button .long { display: none; }
  .button .short { display: inline; }
}
.ranks { list-style: none; padding: 10px; display: grid; gap: 4px; }
.ranks .rank-row { padding: 12px; }
.ranks .rank-row .medal { width: 40px; height: 40px; border-radius: 12px; font-size: 17px; }
.ranks .rank-row .who { display: flex; flex-direction: column; white-space: normal; }
.ranks .rank-row .who strong { font-size: 17px; }
.ranks .rank-row .who small { font-size: 14px; font-weight: 600; color: var(--ink2); }
.ranks .rank-row .pts { display: inline-flex; align-items: center; gap: 6px; font: 700 20px var(--font-display); color: var(--gold-ink); }
.ranks .rank-row .pts .ic { color: #EFAE30; }
.rating-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
a.chip-btn { display: inline-flex; align-items: center; text-decoration: none; }
.card.stat.child .bar { display: block; width: 100%; margin: 8px 0; }
.card.stat.child { text-decoration: none; color: inherit; }
.card.stat.child > span:last-child { color: var(--link); font-weight: 800; }

/* ---------- Play the computer ---------- */
.bot-face { --face: var(--mint); width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; flex: none; background: var(--face); color: #FFFFFF;
  font: 400 42px/1 "DejaVu Sans", "Segoe UI Symbol", "Noto Sans Symbols 2", serif; -webkit-text-stroke: 2px #1E2650; paint-order: stroke fill; box-shadow: 0 4px 0 rgba(30, 38, 80, .18); }
.bot-face.sm { width: 36px; height: 36px; border-radius: 12px; font-size: 24px; -webkit-text-stroke-width: 1.2px; box-shadow: none; }
.bot-face.lg { width: 84px; height: 84px; border-radius: 26px; font-size: 58px; }
.tone-mint { --face: #2FA67A; } .tone-sky { --face: #4C7BE0; } .tone-gold { --face: #EFAE30; }
.tone-coral { --face: #D96949; } .tone-navy { --face: #253164; } .tone-ink { --face: #1E2650; }
.bot-face.tone-navy, .bot-face.tone-ink { -webkit-text-stroke-color: #0A0E26; }
.bot-face.you { background: var(--surface2); color: var(--ink); -webkit-text-stroke: 0; }

.bots { border: 0; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bot-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; padding: 18px; border-radius: var(--r-2xl);
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); cursor: pointer; color: var(--ink); font-weight: 600; }
.bot-card input { position: absolute; opacity: 0; pointer-events: none; }
.bot-card:has(input:checked) { box-shadow: inset 0 0 0 3px var(--gold), 0 4px 0 var(--gold-edge); background: var(--gold-soft); }
.bot-card:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 3px; }
.bot-card .bot-face { grid-row: span 2; }
.bot-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-info strong { font: 600 21px/1.15 var(--font-display); }
.bot-level { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.bot-info .blurb { font-size: 15px; color: var(--ink2); line-height: 1.35; }
.bot-card > .tag { justify-self: start; grid-column: 2; }
.tag.reward { background: var(--gold-soft); color: var(--gold-ink); }
.bot-card:has(input:checked) .tag.reward { background: var(--surface); }
.play-bar { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 28px; }
.side-pick { border: 0; margin: 0; }
.side-pick label { position: relative; display: inline-flex; }
.side-pick input { position: absolute; opacity: 0; pointer-events: none; }
.side-pick span { min-height: 44px; padding: 8px 18px; border-radius: 14px; font: 700 16px var(--font-body); color: var(--ink2); display: inline-flex; align-items: center; cursor: pointer; }
.side-pick input:checked + span { background: var(--navy); color: #FFFFFF; }
[data-theme="dark"] .side-pick input:checked + span { background: var(--sky); color: #0E1330; }
.side-pick input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.play-bar > button { min-width: 220px; }
.continue-game { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.continue-game h2 { font-size: 26px; }
.game-rows li > .bot-face { flex: none; }
.side-head { flex-wrap: wrap; }
.tag.result-win { background: var(--mint-soft); color: var(--mint-ink); }
.tag.result-loss { background: var(--coral-soft); color: var(--coral-ink); }
.tag.result-draw { background: var(--sky-soft); color: var(--sky-ink); }
.tag.result-open { background: var(--surface2); color: var(--ink2); }
@media (max-width: 1023px) { .bots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .bots { grid-template-columns: 1fr; gap: 12px; }
  .bot-card { padding: 14px; gap: 4px 14px; }
  .bot-card .bot-face.lg { width: 64px; height: 64px; font-size: 44px; border-radius: 20px; }
  .play-bar { position: sticky; bottom: calc(var(--tabbar-h) + 8px); z-index: 10; background: var(--bg); padding: 10px 0; margin-bottom: 16px; }
  .side-pick { display: flex; width: 100%; }
  .side-pick label { flex: 1; }
  .side-pick span { width: 100%; justify-content: center; padding: 8px 6px; }
  .play-bar > button { width: 100%; }
}

/* The game: board with a seat above and below, the bot's bubble and tools beside it */
.game .puzzle-board-wrap { display: flex; flex-direction: column; gap: 12px; }
.seat { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.seat strong { font: 600 18px var(--font-display); }
.captured { font: 400 22px/1 "DejaVu Sans", "Segoe UI Symbol", serif; color: var(--ink2); letter-spacing: -.12em; overflow: hidden; white-space: nowrap; min-width: 0; }
.game .mascot .bot-face { width: 64px; height: 64px; }
.sq.check { background: radial-gradient(circle, #FF6B57 0, rgba(255, 107, 87, .55) 45%, transparent 75%), var(--board-l); }
.sq.dark.check { background: radial-gradient(circle, #FF6B57 0, rgba(255, 107, 87, .55) 45%, transparent 75%), var(--board-d); }
.sq.better { box-shadow: inset 0 0 0 1.4cqw #2FA67A; }
.game-over h2 { margin: 4px 0 6px; font-size: 30px; }
.game-over.result-win { box-shadow: inset 0 0 0 3px var(--mint), var(--shadow); }
.game-over .earned { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 8px 0; }
.game-over .earned .pill { flex: none; white-space: nowrap; }
.game-over .earned .pill:not(.pill-star) { background: var(--gold-soft); font-size: 20px; padding: 4px 10px; }
.over-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.over-actions form { margin: 0; display: flex; }
.over-actions > * { flex: 1 1 160px; }
.over-actions button, .over-actions .button { width: 100%; }
.review-progress { display: grid; gap: 6px; margin: 12px 0 0; }
.review-progress .bar { width: 100%; }
.review-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.rv { border-radius: 16px; padding: 10px 8px; text-align: center; font-size: 13px; font-weight: 800; line-height: 1.2; }
.rv strong { display: block; font: 700 26px/1.1 var(--font-display); }
.rv-good { background: var(--mint-soft); color: var(--mint-ink); }
.rv-meh { background: var(--gold-soft); color: var(--gold-ink); }
.rv-bad { background: var(--coral-soft); color: var(--coral-ink); }
.rv-oops { background: #D96949; color: #FFFFFF; }
.rv-oops strong { color: #FFFFFF; }
.review-nav { display: flex; gap: 10px; justify-content: space-between; }
.review-nav [data-action="key"] { flex: 1; }
.review-nav .icon-btn { width: 56px; min-height: 52px; }
.game-moves { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; max-height: 260px; overflow-y: auto; }
.game-moves li { display: flex; align-items: center; gap: 4px; }
.game-moves .n { width: 30px; flex: none; color: var(--ink2); font-weight: 800; font-size: 14px; }
.game-moves .mv { min-height: 36px; padding: 4px 8px; border-radius: 10px; background: none; box-shadow: none; color: var(--ink); font: 700 16px var(--font-body); flex: 1; justify-content: flex-start; gap: 6px; }
.game-moves .mv:disabled { opacity: 1; cursor: default; }
.game-moves .mv:active { transform: none; }
.game-moves .mv[aria-current="true"] { background: var(--navy); color: #FFFFFF; }
.game-moves .mv[data-label]::after { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.game-moves .mv[data-label="best"]::after, .game-moves .mv[data-label="good"]::after { background: #2FA67A; }
.game-moves .mv[data-label="inaccuracy"]::after { background: #EFAE30; }
.game-moves .mv[data-label="mistake"]::after { background: #F08A6B; }
.game-moves .mv[data-label="blunder"]::after { background: #C4532F; width: 12px; height: 12px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #C4532F; }
.game .tools button.danger { box-shadow: inset 0 0 0 2px #F3B8B0, 0 4px 0 #F3B8B0; }
.promo { position: fixed; inset: 0; z-index: 60; background: rgba(14, 19, 48, .55); display: grid; place-items: center; padding: 16px; }
.promo-card { background: var(--surface); border-radius: var(--r-2xl); padding: 20px; box-shadow: var(--shadow); text-align: center; }
.promo-card p { font: 600 20px var(--font-display); margin: 0 0 12px; }
.promo-row { display: flex; gap: 10px; }
.promo-row button { width: 72px; height: 72px; padding: 0; font: 400 48px/1 "DejaVu Sans", "Segoe UI Symbol", serif; }
canvas.confetti-later { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
@media (max-width: 1023px) {
  .game.screen-grid .puzzle-board-wrap { max-width: 640px; width: 100%; justify-self: center; }
  .game.screen-grid .card.game-over, .game.screen-grid .review-panel { order: 3; margin: 0; }
  .game.screen-grid .side-card { order: 5; }
}
@media (max-width: 639px) {
  body.game-page main { padding-bottom: 32px; }
  .seat { min-height: 32px; }
  .seat strong { font-size: 16px; }
  .game .mascot .bot-face { width: 52px; height: 52px; font-size: 34px; border-radius: 16px; }
  .game-over h2 { font-size: 26px; }
  .rv strong { font-size: 22px; }
  .game-moves { max-height: 200px; }
}
.play-card-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.play-card-row p { margin: 0; font-size: 17px; }
.play-card .button { width: 100%; }
.side-head > a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Family: cheers, weekly goal, puzzles together ---------- */
.family-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.family-grid .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.family-grid .card { margin: 0; }
.family-grid h2 { margin-top: 0; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.sticker { flex-direction: column; gap: 6px; min-height: 96px; padding: 10px 6px; background: var(--surface2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); font: 700 15px/1.2 var(--font-body); text-align: center; }
.sticker:active { box-shadow: inset 0 0 0 2px var(--gold), 0 1px 0 var(--gold-edge); }
.sticker .emoji { font-size: 34px; line-height: 1; }
.cheer-list .emoji, .note .emoji { font-size: 28px; line-height: 1; flex: none; }
.cheer-list small { display: block; }
.tag.thanked { background: var(--coral-soft); color: var(--coral-ink); }
.goal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; margin-top: 12px; }
.goal-form .wide { grid-column: 1 / -1; }
.goal-line { font-size: 18px; margin: 0 0 8px; }
.goal-line strong { font: 700 28px var(--font-display); }
.goal-card .bar { width: 100%; height: 16px; margin-bottom: 12px; }
.goal-card .bar > span { background: var(--mint); }
.goal-card .good { color: var(--mint-ink); }
.change-goal > summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; cursor: pointer; color: var(--link); }
.fp-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag.fp-solved { background: var(--mint-soft); color: var(--mint-ink); }
.tag.fp-failed { background: var(--coral-soft); color: var(--coral-ink); }
.tag.fp-in_progress { background: var(--surface2); color: var(--ink2); }
.together-card h3 { margin: 20px 0 10px; }
.puzzle-ideas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.idea { display: flex; flex-direction: column; gap: 6px; background: var(--surface2); border-radius: var(--r-xl); padding: 10px; margin: 0; }
.idea .board { box-shadow: none; border-radius: 10px; }
.idea strong { font-size: 15px; line-height: 1.25; }
.idea button { margin-top: auto; padding: 6px 8px; font-size: 14px; }
.family-line { background: var(--surface2); border-radius: var(--r-md); padding: 10px 14px; font-weight: 700; }
.from-home { background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 24px; }
.from-home h2 { margin: 0 0 12px; font-size: 22px; display: flex; align-items: center; gap: 8px; color: var(--coral-ink); }
.from-home-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.note { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-xl); background: var(--surface2); color: var(--ink); text-decoration: none; min-width: 0; }
.note .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.note strong { font: 600 18px/1.2 var(--font-display); }
.note small { font-size: 14px; font-weight: 700; color: var(--ink2); }
.note form { margin: 0; flex: none; }
.cheer-note { background: var(--coral-soft); }
.puzzle-note { background: var(--sky-soft); }
.goal-note.done { background: var(--mint-soft); }
.goal-progress { display: flex; align-items: center; gap: 8px; }
.goal-progress .bar { flex: 1; width: auto; }
.goal-progress .bar > span { background: var(--mint); }
.family-puzzle { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
.family-puzzle h1 { margin: 4px 0; }
.family-puzzle .board { margin: 16px 0 4px; }
.family-puzzle .puzzle-msg { font: 600 22px/1.25 var(--font-display); }
@media (max-width: 1023px) {
  .family-grid { display: flex; flex-direction: column; }
  .family-grid .col { display: contents; }
  .family-grid .cheer-card { order: 1; } .family-grid .goal-card { order: 2; }
  .family-grid .together-card { order: 3; } .family-grid .name-card { order: 4; }
  .family-puzzle { grid-template-columns: 1fr; }
  .family-puzzle .puzzle { max-width: 560px; }
}
@media (max-width: 639px) {
  .sticker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .puzzle-ideas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .goal-form { grid-template-columns: 1fr; }
  .from-home { padding: 16px; }
  .cheer-note { flex-wrap: wrap; }
  .cheer-note form { width: 100%; }
  .cheer-note form button { width: 100%; }
}

/* ---------- Avatars and staff photos ---------- */
svg.av { display: block; flex: none; overflow: visible; }
svg.av.big { width: 72px; height: 72px; }
svg.avatar { background: none; border-radius: 50%; }
img.photo { object-fit: cover; background: var(--surface2); }
.hero-text .hi { display: flex; align-items: center; gap: 12px; }
.hi-av { position: relative; flex: none; border-radius: 50%; }
.hi-av:hover svg { transform: rotate(-6deg) scale(1.05); }
.hi-av svg { transition: transform .15s; }
.new-unlock { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); background: var(--gold); color: #3A2600; border: 2px solid var(--surface);
  border-radius: var(--r-pill); padding: 0 8px; font: 700 13px/20px var(--font-display); white-space: nowrap; }
.rank-row svg.av, .rank-row .initials { width: 44px; height: 44px; }
.mini-board-list .rank-row svg.av { width: 32px; height: 32px; }
.avatar-page { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.avatar-preview { position: sticky; top: 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.avatar-preview h1 { margin: 8px 0 0; }
.avatar-preview > button { width: 100%; }
.avatar-preview .flash { margin: 0; width: 100%; }
.next-unlock { width: 100%; display: flex; flex-direction: column; gap: 6px; background: var(--gold-soft); color: var(--gold-ink); border-radius: 16px; padding: 12px 14px; font-weight: 700; text-align: left; }
.next-unlock .bar { width: 100%; }
.next-unlock .bar > span { background: var(--gold); }
.next-unlock small { font-size: 14px; }
.avatar-form { display: flex; flex-direction: column; gap: 20px; }
.avatar-form fieldset { border: 0; margin: 0; min-width: 0; }
.avatar-form legend { float: left; width: 100%; padding: 0; margin: 0 0 14px; font: 600 22px var(--font-display); color: var(--ink); }
.pick-grid { clear: both; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.pick-grid.colors { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 18px;
  border: 3px solid transparent; background: var(--surface2); cursor: pointer; text-align: center; font-size: 16px; font-weight: 700; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { border-color: var(--coral); background: var(--coral-soft); }
.pick:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.pick:not(.locked):hover { border-color: var(--line); }
.pick:not(.locked):has(input:checked):hover { border-color: var(--coral); }
.pick-name { font-weight: 800; }
.pick.locked { cursor: not-allowed; }
.pick.locked svg, .pick.locked .dot { filter: grayscale(1); opacity: .4; }
.pick-need { display: flex; align-items: flex-start; justify-content: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--ink2); line-height: 1.25; }
.pick-need .ic { flex: none; margin-top: 1px; }
.pick .dot { width: 56px; height: 56px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35); }
.save-bottom { display: none; }
.avatar-admin { border-top: 2px solid var(--surface2); margin-top: 16px; padding-top: 14px; }
.avatar-admin h3 { margin: 0 0 4px; }
.avatar-admin .button-row { margin: 8px 0 0; }
.avatar-admin form { margin: 0; }
.account-stack { display: flex; flex-direction: column; gap: 4px; }
.account-stack > * { width: 100%; max-width: 460px; margin-left: auto; margin-right: auto; }
.photo-card { max-width: 460px; width: 100%; margin: 0 auto 24px; }
.photo-card h2 { margin: 0 0 12px; }
.photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.photo-row p { margin: 0; font-size: 15px; }
@media (max-width: 1023px) {
  .avatar-page { grid-template-columns: 1fr; }
  .avatar-preview { position: static; }
  .save-bottom { display: inline-flex; width: 100%; }
}
@media (max-width: 639px) {
  svg.av.big { width: 56px; height: 56px; }
  .avatar-preview .preview svg { width: 136px; height: 136px; }
  .pick-grid, .pick-grid.colors { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pick { padding: 10px 4px; }
  .pick svg.av { width: 64px; height: 64px; }
  .ranks .rank-row svg.av, .ranks .rank-row .initials { width: 36px; height: 36px; }
  .ranks .rank-row { gap: 10px; }
  .pick .dot { width: 48px; height: 48px; }
  .pick-need { font-size: 13px; }
}

/* ---------- Family contact card ---------- */
.print-only { display: none; }
.contact-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.contact-form-card h1 { margin: 4px 0 6px; }
.contact-form { display: flex; flex-direction: column; gap: 22px; margin-top: 8px; }
.contact-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.contact-form legend { font: 600 20px var(--font-display); color: var(--ink); padding: 0; margin: 0 0 10px; }
.contact-form .wide { grid-column: 1 / -1; }
.contact-form p.wide { margin: -6px 0 0; }
.contact-form .button-row { margin: 0; }
label.check.consent { align-items: flex-start; background: var(--surface2); padding: 14px 16px; border-radius: 16px; font-size: 15px; font-weight: 600; line-height: 1.45; }
label.check.consent input { margin-top: 2px; flex: none; }
.who-sees h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 20px; }
.who-sees .rows { margin-bottom: 12px; }
.who-sees .rows small { display: block; }
.delete-card { margin-top: 8px; }
.delete-card > summary { list-style: none; }
.delete-card > summary::-webkit-details-marker { display: none; }
.delete-card form { margin-top: 10px; }
.contact-mini h2 { margin: 0 0 8px; }
.contact-mini .button { margin-top: 4px; }
.contact-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.contact-note { display: flex; align-items: center; gap: 8px; }
.family-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.family-card h2 { margin: 0; }
.contact-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 18px; align-items: center; margin: 14px 0; }
.contact-dl dt { font-size: 14px; font-weight: 800; color: var(--ink2); }
.contact-dl dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.contact-dl form { margin: 0; }
.leave > summary { list-style: none; }
.leave > summary::-webkit-details-marker { display: none; }
.leave form { margin-top: 10px; }
.log-rows { padding: 8px 18px; }
.narrow-card { max-width: 560px; }
@media (max-width: 1023px) {
  .contact-page { grid-template-columns: 1fr; }
  .family-grid .contact-mini { order: 5; }
}
@media (max-width: 639px) {
  .contact-form fieldset { grid-template-columns: 1fr; }
  .contact-form .button-row .button, .contact-form .button-row button { width: 100%; }
  .family-cards { grid-template-columns: 1fr; }
  .contact-dl { grid-template-columns: 1fr; gap: 4px; }
  .contact-dl dd { margin-bottom: 10px; }
  .log-rows { padding: 4px 14px; }
}
@media print {
  .family-card, .contact-form-card, .who-sees, .contact-mini, .contact-link, .contact-note { display: none !important; }
  .print-only { display: block; }
}

/* ---------- Puzzle of the day ---------- */
a.pill-flame { text-decoration: none; }
.pill-flame.todo { background: transparent; color: var(--header-ink); box-shadow: inset 0 0 0 2px #D96949; }
.pill-flame.todo .ic { color: #D96949; }
.daily-card .side-head { align-items: center; }
.streak-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--coral-soft); color: var(--coral-ink); border-radius: var(--r-pill); padding: 4px 12px; font: 700 16px var(--font-display); }
.streak-chip .ic { color: #D96949; }
.daily-row { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; margin-bottom: 14px; }
.daily-row .board.static { width: 120px; flex: none; }
.daily-row p { margin: 0; font-weight: 700; }
.daily-card .button { width: 100%; }
.daily-card.done .daily-row p { color: var(--mint-ink); }
.daily-page { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
.daily-page h1 { margin: 4px 0; }
.daily-page .board { margin: 16px 0 4px; }
.daily-page .puzzle-msg { font: 600 22px/1.25 var(--font-display); }
.streak-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.big-flame { display: flex; align-items: center; gap: 6px; color: #D96949; }
.big-flame strong { font: 700 64px/1 var(--font-display); color: var(--ink); }
.big-flame.cold { color: var(--ink2); opacity: .55; }
.streak-words { font: 600 20px var(--font-display); margin: 0 0 8px; }
.week-flames { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; width: 100%; }
.week-flames li { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-flames small { font-size: 13px; font-weight: 700; color: var(--ink2); }
.flame-dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); color: var(--ink2); opacity: .5; }
.week-flames .lit .flame-dot { background: #D96949; color: #FFF3C4; opacity: 1; }
.week-flames .today .flame-dot { opacity: 1; box-shadow: inset 0 0 0 2px #D96949; color: #D96949; background: var(--surface); }
.streak-card p { margin: 0; }
@media (max-width: 1023px) {
  .daily-page { grid-template-columns: 1fr; }
  .daily-page .puzzle { max-width: 560px; }
}
@media (max-width: 639px) {
  .flame-dot { width: 34px; height: 34px; }
  .big-flame strong { font-size: 52px; }
}

/* ---------- Puzzle race ---------- */
.race-mode-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none; background: var(--gold-soft); color: var(--gold-ink); }
.race-mode-icon.sm { width: 40px; height: 40px; border-radius: 12px; }
.race-mode-icon.m-3 { background: var(--coral-soft); color: var(--coral-ink); }
.race-mode-icon.m-5 { background: var(--sky-soft); color: var(--sky-ink); }
.race-mode-icon.m-survival { background: var(--mint-soft); color: var(--mint-ink); }
.corner.race-promo { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 28px; }
.corner.race-promo .race-mode-icon { background: #EFAE30; color: #3A2600; }
.corner.race-promo .text { flex: 1 1 260px; }
.corner.race-promo p { flex: 1 1 100%; order: 3; }
.corner.race-promo .grow { display: none; }
.corner.race-promo .button { align-self: center; }
.race-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 24px; }
.race-mode { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.race-mode h2 { margin: 4px 0 0; font-size: 26px; }
.race-mode p { margin: 0; color: var(--ink2); font-weight: 700; }
.race-mode p.race-best { color: var(--ink); flex: 1; display: flex; align-items: flex-end; }
.race-mode p.race-best strong { font: 700 22px var(--font-display); margin-left: 6px; }
.race-mode button { width: 100%; margin-top: 6px; }
.race-open { margin-bottom: 24px; flex-direction: row; align-items: center; flex-wrap: wrap; }
.race-lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.race-lower .card { margin: 0; }
.race-boards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.race-boards h3 { font-size: 17px; margin: 0 0 8px; }
.race-boards .rank-row { padding: 8px; gap: 8px; }
.race-card p { margin: 0 0 14px; font-weight: 700; }
.race-card .button { width: 100%; }

.race-page { display: grid; grid-template-columns: minmax(0, 600px) minmax(260px, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "main bar" "main side"; gap: 20px 28px; align-items: start; }
.race-bar { grid-area: bar; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.race-main { grid-area: main; min-width: 0; }
.race-side { grid-area: side; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.race-side form { margin: 0; }
.race-clock { font: 700 56px/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.race-clock.none { color: var(--mint-ink); }
.race-clock.none .ic { width: 52px; height: 52px; }
.race-clock.low { color: #C4532F; animation: tick 1s ease-in-out infinite; }
@keyframes tick { 50% { transform: scale(1.06); } }
.race-score { display: flex; flex-direction: column; align-items: center; }
.race-score strong { font: 700 64px/1 var(--font-display); color: var(--gold-ink); }
.race-score span { font-weight: 800; color: var(--ink2); }
.race-strikes { display: inline-flex; gap: 8px; }
.race-strikes > span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); color: var(--ink2); box-shadow: inset 0 0 0 2px var(--line); }
.race-strikes > span:not(.used) .ic { opacity: .35; }
.race-strikes > span.used { background: #D96949; color: #FFFFFF; box-shadow: none; animation: pop .35s ease-out; }
.race-puzzle .board { margin: 0 0 4px; transition: box-shadow .15s; }
.race-puzzle[data-status="solved"] .board { box-shadow: 0 0 0 6px var(--mint), var(--shadow); }
.race-puzzle[data-status="failed"] .board { box-shadow: 0 0 0 6px #D96949, var(--shadow); }
.race-puzzle .puzzle-msg { font: 600 21px/1.25 var(--font-display); }
.race-over-msg { grid-area: main; align-self: start; justify-self: center; margin: 38% 0 0; z-index: 2; background: #253164; color: #FFFFFF; font: 700 34px/1.1 var(--font-display);
  padding: 18px 30px; border-radius: var(--r-xl); box-shadow: var(--shadow); text-align: center; animation: pop .35s ease-out; }
.race-over .race-main .board { pointer-events: none; opacity: .55; transition: opacity .3s; }
.race-dots { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.race-dots li { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.race-dots li.ok { background: var(--mint-soft); color: var(--mint-ink); }
.race-dots li.miss { background: var(--coral-soft); color: var(--coral-ink); }
.race-dots.big li { width: 36px; height: 36px; }
@media (prefers-reduced-motion: reduce) { .race-clock.low, .race-strikes > span.used, .race-over-msg { animation: none; } }

.race-result { max-width: 820px; margin: 0 auto; }
.race-score-card { text-align: center; }
.race-score-card .eyebrow { color: var(--coral-ink); }
.race-big { font: 700 110px/1 var(--font-display); color: var(--gold-ink); margin: 12px 0 0; }
.race-big-label { font: 600 22px var(--font-display); margin: 4px 0 12px; }
.race-score-card p { margin: 0 0 10px; font-weight: 700; }
.new-best { display: inline-flex; align-items: center; gap: 8px; background: #EFAE30; color: #3A2600; border-radius: var(--r-pill); padding: 8px 18px; font: 700 20px var(--font-display); }
.race-score-card .button-row { justify-content: center; margin: 18px 0 0; }
.race-missed { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.race-miss { margin: 0; display: flex; gap: 16px; align-items: flex-start; }
.race-miss .board.static { width: 140px; flex: none; }
.race-miss p { margin: 8px 0 0; }

@media (max-width: 1023px) {
  .race-page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "main" "side"; max-width: 600px; margin: 0 auto; gap: 14px; }
  .race-bar { flex-direction: row; justify-content: space-between; padding: 14px 20px; }
  .race-clock { font-size: 40px; min-width: 104px; text-align: left; }
  .race-clock.none .ic { width: 40px; height: 40px; }
  .race-score { flex-direction: row; align-items: baseline; gap: 6px; }
  .race-score strong { font-size: 44px; }
  .race-over-msg { margin-top: 45%; }
  .race-lower { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .race-modes { grid-template-columns: 1fr; gap: 14px; }
  .race-mode { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; }
  .race-mode .race-mode-icon { grid-row: span 2; width: 48px; height: 48px; }
  .race-mode h2 { font-size: 22px; margin: 0; }
  .race-mode p { grid-column: 2; font-size: 15px; }
  .race-mode p.race-best { grid-column: 1 / -1; }
  .race-mode button { grid-column: 1 / -1; }
  .race-boards { grid-template-columns: 1fr; }
  .race-bar { padding: 10px 16px; }
  .race-clock { font-size: 34px; min-width: 88px; }
  .race-score strong { font-size: 36px; }
  .race-score span { font-size: 15px; }
  .race-strikes { gap: 5px; }
  .race-strikes > span { width: 32px; height: 32px; }
  .race-puzzle .puzzle-msg { font-size: 18px; }
  .race-over-msg { font-size: 26px; padding: 14px 22px; }
  .race-big { font-size: 84px; }
  .race-missed { grid-template-columns: 1fr; }
  .race-miss .board.static { width: 110px; }
  .race-score-card .button-row > * { flex: 1 1 100%; }
  .race-score-card .button-row button, .race-score-card .button-row .button { width: 100%; }
  .corner.race-promo .race-mode-icon { display: none; }
}

/* ---------- Live class board ---------- */
.live-banner { display: flex; align-items: center; gap: 12px; max-width: 1180px; margin: 16px auto 0; padding: 12px 20px; border-radius: var(--r-xl);
  background: #2FA67A; color: #FFFFFF; text-decoration: none; font-weight: 700; font-size: 17px; box-shadow: var(--shadow); width: calc(100% - 2 * var(--gutter)); }
.live-banner strong { font-weight: 900; }
.live-banner .go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; background: #FFFFFF; color: #11593F; border-radius: var(--r-pill); padding: 6px 14px; font: 600 16px var(--font-display); white-space: nowrap; }
.live-dot { width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; flex: none; box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); animation: live-pulse 1.6s ease-out infinite; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
.live-head .live-dot { background: #2FA67A; box-shadow: 0 0 0 0 rgba(47, 166, 122, .6); animation-name: live-pulse-green; }
@keyframes live-pulse-green { 70% { box-shadow: 0 0 0 10px rgba(47, 166, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 166, 122, 0); } }
.live-dot.off { background: var(--lock); animation: none; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.live-steps { list-style: none; counter-reset: step; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.live-steps li { counter-increment: step; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 18px 20px 18px 64px; position: relative; color: var(--ink2); font-weight: 600; }
.live-steps li::before { content: counter(step); position: absolute; left: 18px; top: 16px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy-soft); color: var(--navy-ink); font: 700 18px var(--font-display); }
.live-steps strong { color: var(--ink); }

.live-screen { display: grid; grid-template-columns: minmax(0, min(68vh, 680px)) minmax(300px, 1fr); gap: 32px; align-items: start; }
.live-board .board.static { border-radius: 20px; box-shadow: 0 0 0 6px var(--surface), var(--shadow); }
.live-board .sq { font-size: 10.5cqw; }
.live-board .board.static .sq.last { background-image: linear-gradient(rgba(47, 166, 122, .55), rgba(47, 166, 122, .55)); }
.live-panel { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.live-panel .eyebrow { color: var(--coral-ink); }
.live-prompt { font-size: clamp(28px, 3vw, 40px); margin: 0; line-height: 1.15; }
.live-count { display: flex; align-items: baseline; gap: 10px; }
.live-count strong { font: 700 88px/1 var(--font-display); color: var(--gold-ink); }
.live-count span { font: 600 24px var(--font-display); color: var(--ink2); }
.live-panel form { margin: 0; }
.live-answer { font: 600 28px var(--font-display); margin: 0; }
.live-answer strong { color: var(--mint-ink); font-weight: 700; }
.live-tally { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 10px; }
.live-tally li { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 4px 12px; }
.live-tally .san { font: 700 22px var(--font-display); display: inline-flex; align-items: center; gap: 4px; }
.live-tally .track { height: 22px; border-radius: var(--r-pill); background: var(--surface2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.live-tally .track i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--sky); min-width: 8px; }
.live-tally .right .track i { background: var(--mint); }
.live-tally .right .san { color: var(--mint-ink); }
.live-tally .n { font: 700 22px var(--font-display); text-align: right; }
.live-tally .names { grid-column: 1 / -1; color: var(--ink2); font-weight: 700; font-size: 15px; }
.live-top { width: 100%; }
.live-top h2 { font-size: 20px; margin: 0 0 8px; }
.live-who { width: 100%; }
.live-who summary { cursor: pointer; font-weight: 800; color: var(--ink2); min-height: 44px; display: flex; align-items: center; gap: 6px; }
.live-who ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.live-who li { background: var(--surface2); border-radius: var(--r-pill); padding: 4px 12px; font-weight: 700; font-size: 15px; }
.live-who li.done { background: var(--mint-soft); color: var(--mint-ink); }
.live-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.live-coach main { max-width: 1400px; }

.live-paste summary, .live-level summary { cursor: pointer; display: flex; align-items: center; gap: 12px; list-style: none; min-height: 44px; }
.live-paste summary::-webkit-details-marker, .live-level summary::-webkit-details-marker { display: none; }
.live-paste summary h2, .live-level summary h2 { margin: 0; display: inline-flex; align-items: center; gap: 10px; }
.live-paste[open] summary { margin-bottom: 16px; }
.live-paste .stack-form { flex-direction: column; align-items: stretch; }
.live-level { margin-bottom: 20px; }
.live-level summary { padding: 4px 0; }
.live-level h3 { margin: 18px 0 10px; }
.live-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.live-picks form { margin: 0; }
.live-pick { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; min-height: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); font: 700 15px/1.25 var(--font-body); text-align: left; }
.live-pick:active { box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line); }
.live-pick .board.static { box-shadow: none; border-radius: 10px; }
.live-pick small { display: block; color: var(--mint-ink); font-weight: 800; }
.live-pick.used { opacity: .7; }

.live-rounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.live-round { margin: 0; display: flex; gap: 14px; align-items: flex-start; }
.live-round .board.static { width: 120px; flex: none; }
.live-round .title { display: block; }
.live-round p { margin: 6px 0 0; }
.table-scroll { overflow-x: auto; }
.mark-ok { color: var(--mint-ink); font-weight: 800; }
.mark-no { color: var(--coral-ink); font-weight: 800; text-decoration: line-through; text-decoration-thickness: 2px; }

.live-page { max-width: 620px; margin: 0 auto; }
.live-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.live-head h1 { margin: 0; }
.live-score { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--mint-soft); color: var(--mint-ink); border-radius: var(--r-pill); padding: 6px 14px; font: 700 17px var(--font-display); }
.live-score[hidden] { display: none; }
.live-wait { background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--shadow); padding: 40px 28px; text-align: center; font: 600 22px/1.3 var(--font-display); color: var(--ink2); }
.live-puzzle .puzzle-msg { font: 600 22px/1.25 var(--font-display); }
.live-puzzle .puzzle-msg.sent { color: var(--sky-ink); }
.live-puzzle .puzzle-msg.good { color: var(--mint-ink); }
.live-puzzle .puzzle-msg.bad { color: var(--coral-ink); }
.live-puzzle[data-status="answered"] .board, .live-puzzle[data-status="revealed"] .board { pointer-events: none; }

@media (max-width: 1023px) {
  .live-screen { grid-template-columns: 1fr; max-width: 680px; margin: 0 auto; gap: 20px; }
  .live-steps { grid-template-columns: 1fr; }
  .live-count strong { font-size: 64px; }
}
@media (max-width: 639px) {
  .live-banner { margin-top: 12px; padding: 10px 14px; font-size: 15px; width: calc(100% - 32px); }
  .live-banner .go { padding: 6px 10px; }
  .live-prompt { font-size: 24px; }
  .live-tally li { grid-template-columns: 84px 1fr 30px; }
  .live-tally .san, .live-tally .n { font-size: 19px; }
  .live-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-wait { padding: 28px 18px; font-size: 19px; }
  .live-puzzle .puzzle-msg { font-size: 19px; }
  .live-round .board.static { width: 96px; }
}

/* ---------- Playing a classmate ---------- */
.segmented [aria-current="page"] { background: var(--navy); color: #FFFFFF; }
[data-theme="dark"] .segmented [aria-current="page"] { background: var(--sky); color: #0E1330; }
.play-tabs { margin: 0; }
.play-tabs a { display: inline-flex; align-items: center; gap: 8px; }
.banners:empty { display: none; }
.banners .live-banner .av { flex: none; }
.game-banner { background: var(--navy); }
.game-banner .go { color: #253164; }
[data-theme="dark"] .game-banner { background: var(--sky-soft); }
.challenge-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 1180px; width: calc(100% - 2 * var(--gutter)); margin: 16px auto 0; padding: 10px 16px;
  border-radius: var(--r-xl); background: var(--gold-soft); color: var(--gold-ink); box-shadow: inset 0 0 0 2px var(--gold), var(--shadow); font-weight: 700; font-size: 17px; }
.challenge-banner .grow { flex: 1 1 200px; min-width: 0; }
.challenge-banner strong { font-weight: 900; }
.challenge-banner small { display: block; font-size: 14px; font-weight: 700; opacity: .85; }
.challenge-banner form { margin: 0; }
.challenge-banner .av { flex: none; }
.versus-page { display: grid; gap: 20px; }
.versus-page > .continue-game, .versus-page > .flash { margin: 0; }
.challenge-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; box-shadow: inset 0 0 0 3px var(--gold), var(--shadow); }
.challenge-card h2 { margin: 0; font-size: 24px; }
.challenge-card p { margin: 2px 0 0; }
.challenge-card .grow { flex: 1 1 200px; min-width: 0; }
.challenge-card form { margin: 0; }
.challenge-card .av { flex: none; }
.waiting-card { box-shadow: inset 0 0 0 3px var(--sky), var(--shadow); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid var(--sky-soft); border-top-color: var(--sky); flex: none; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.versus-setup h2 { margin: 20px 0 4px; }
.setup-row { display: flex; gap: 16px 24px; flex-wrap: wrap; }
.setup-field { display: grid; gap: 6px; }
.setup-label { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.classmates li > .av { flex: none; }
.classmates small { display: inline-flex; align-items: center; gap: 6px; }
.presence { width: 10px; height: 10px; border-radius: 50%; background: var(--lock); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.classmates .online .presence { background: var(--mint); box-shadow: none; }
.classmates .busy .presence { background: var(--gold); box-shadow: none; }
.classmates .online [data-presence] { color: var(--mint-ink); }
.versus .seat .captured { flex: 1; }
.clock { margin-left: auto; min-width: 84px; padding: 4px 12px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line);
  font: 700 22px/1.3 var(--font-display); text-align: center; font-variant-numeric: tabular-nums; color: var(--ink2); }
.clock.running { background: var(--navy); color: #FFFFFF; box-shadow: none; }
[data-theme="dark"] .clock.running { background: var(--sky); color: #0E1330; }
.clock.running.low { background: var(--coral); color: #FFFFFF; }
.sticker-pop { flex: none; padding: 4px 12px; border-radius: var(--r-pill); background: var(--gold-soft); color: var(--gold-ink);
  box-shadow: inset 0 0 0 2px var(--gold); font-weight: 800; font-size: 15px; white-space: nowrap; }
.sticker-pop.pop { animation: sticker-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes sticker-pop { from { transform: scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sticker-pop.pop { animation: none; } }
.stickers { display: flex; flex-wrap: wrap; gap: 8px; }
.stickers button { font-size: 15px; }
.draw-offer, .away-note { box-shadow: inset 0 0 0 3px var(--gold), var(--shadow); }
.draw-offer p, .away-note p { margin: 0 0 12px; font-size: 17px; font-weight: 700; }
.away-note button { width: 100%; }
.versus .review-nav { margin-top: 12px; }
.rematch-ask { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--surface2); }
.rematch-ask p { margin: 0; font-weight: 700; font-size: 17px; }
.game-over.result-loss { box-shadow: inset 0 0 0 3px var(--sky-soft), var(--shadow); }
@media (max-width: 1023px) {
  .game.versus .draw-offer, .game.versus .away-note { order: 1; margin: 0; }
  .game.versus .stickers { order: 4; }
}
@media (max-width: 639px) {
  .page-head .play-tabs { width: 100%; }
  .play-tabs a { flex: 1; justify-content: center; }
  .challenge-banner { margin-top: 12px; padding: 10px 14px; font-size: 15px; width: calc(100% - 32px); }
  .challenge-banner .grow { flex-basis: calc(100% - 56px); }
  .challenge-banner form { flex: 1; }
  .challenge-banner button { width: 100%; }
  .challenge-card h2 { font-size: 20px; }
  .challenge-card form { flex: 1; }
  .challenge-card button { width: 100%; }
  .setup-field, .setup-field .side-pick { width: 100%; }
  .classmates li { flex-wrap: nowrap; }
  .classmates .grow { min-width: 0; }
  .classmates button { padding-inline: 12px; }
  .clock { min-width: 72px; font-size: 19px; padding: 2px 10px; }
  .stickers button { flex: 1 1 calc(50% - 4px); }
}
.versus .seat strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Both clocks stay on screen on a laptop: the board shrinks to fit the window's height. */
@media (min-width: 1024px) {
  .game.versus .puzzle-board-wrap { width: min(100%, max(420px, calc(100dvh - 230px))); justify-self: center; }
}
