/* Polaris Mathematics — one layout, four age tiers.
   sprout (K–2) playful · explorer (3–5) adventurous · navigator (6–8) Polaris navy/gold · scholar (9–12) editorial */

:root {
  --navy-dark: #071221; --navy: #0C1E36; --navy-light: #162E4E; --gold: #D4AF37; --gold-light: #E9C46A; --gold-dark: #A67C1E; --cream: #FAF9F6;
}

/* ---------- tier tokens ---------- */
body[data-tier="navigator"] {
  --bg: var(--navy-dark); --bg-grad: radial-gradient(1200px 600px at 50% -10%, #12294A 0%, #0C1E36 45%, #071221 100%);
  --surface: rgba(22, 46, 78, .55); --surface-2: #132845; --ink: #F2EFE6; --muted: #8E9BAA; --line: rgba(212, 175, 55, .2);
  --accent: var(--gold); --accent-2: var(--gold-light); --accent-ink: #0C1E36; --good: #5CC98B; --bad: #E57373; --warn: #E9C46A;
  --r: 12px; --r-sm: 8px; --head: 'Cinzel', Georgia, serif; --body: 'Inter', system-ui, sans-serif; --head-w: 600; --head-tt: none; --head-ls: .02em;
  --btn-shadow: none; --card-shadow: 0 20px 50px rgba(0, 0, 0, .25);
  --v-a: #D4AF37; --v-b: #7FB3E8; --v-soft: rgba(212, 175, 55, .12); --v-ink: #F2EFE6;
  --st-mastered: #D4AF37; --st-fluent: #8FB98B; --st-learning: #5E7A9C; --st-new: rgba(255, 255, 255, .08);
  --key-bg: rgba(255, 255, 255, .05); --key-ink: #F2EFE6; --prob-size: clamp(44px, 12vw, 72px);
}
body[data-tier="sprout"] {
  --bg: #FFF7E8; --bg-grad: linear-gradient(180deg, #DDF1FF 0%, #F2F9FF 220px, #FFF7E8 520px);
  --surface: #FFFFFF; --surface-2: #FFF1D6; --ink: #24324A; --muted: #6B7A90; --line: #F1E3C7;
  --accent: #FFB800; --accent-2: #FFD23F; --accent-ink: #3B2600; --good: #22A55B; --bad: #EF5D5D; --warn: #E08A00;
  --r: 26px; --r-sm: 18px; --head: 'Fredoka', 'Andika', system-ui, sans-serif; --body: 'Andika', 'Fredoka', system-ui, sans-serif; --head-w: 600; --head-tt: none; --head-ls: 0;
  --btn-shadow: 0 5px 0 rgba(36, 50, 74, .16); --card-shadow: 0 8px 0 rgba(36, 50, 74, .06), 0 12px 30px rgba(36, 50, 74, .08);
  --v-a: #FF6B6B; --v-b: #FFC53D; --v-soft: #FFF1D6; --v-ink: #24324A;
  --st-mastered: #FFB800; --st-fluent: #FFE08A; --st-learning: #9AD8D1; --st-new: #EEF0F4;
  --key-bg: #FFFFFF; --key-ink: #24324A; --prob-size: clamp(52px, 15vw, 88px);
}
body[data-tier="explorer"] {
  --bg: #0B1A33; --bg-grad: radial-gradient(900px 500px at 80% -10%, #24467E 0%, transparent 60%), radial-gradient(700px 500px at 0% 20%, #1D3566 0%, transparent 55%), #0B1A33;
  --surface: #132B4F; --surface-2: #1B3A66; --ink: #F4F1E8; --muted: #A5B6D0; --line: rgba(233, 196, 106, .25);
  --accent: #E9C46A; --accent-2: #4CC9F0; --accent-ink: #1A1300; --good: #3DDC97; --bad: #FF6B6B; --warn: #FFD166;
  --r: 18px; --r-sm: 12px; --head: 'Fredoka', system-ui, sans-serif; --head-w: 600; --body: 'Inter', system-ui, sans-serif; --head-tt: none; --head-ls: .01em;
  --btn-shadow: 0 4px 0 rgba(0, 0, 0, .3); --card-shadow: 0 0 0 1px rgba(76, 201, 240, .08), 0 18px 40px rgba(0, 0, 0, .3);
  --v-a: #FF7AA2; --v-b: #4CC9F0; --v-soft: rgba(76, 201, 240, .1); --v-ink: #F4F1E8;
  --st-mastered: #E9C46A; --st-fluent: #4CC9F0; --st-learning: #6C7FB0; --st-new: rgba(255, 255, 255, .1);
  --key-bg: #1B3A66; --key-ink: #F4F1E8; --prob-size: clamp(48px, 13vw, 80px);
}
body[data-tier="scholar"] {
  --bg: #FAF9F6; --bg-grad: #FAF9F6;
  --surface: #FFFFFF; --surface-2: #F4F2EC; --ink: #0C1E36; --muted: #5E6B7A; --line: #E4E0D5;
  --accent: #0C1E36; --accent-2: #A67C1E; --accent-ink: #FFFFFF; --good: #2E7D32; --bad: #C62828; --warn: #A67C1E;
  --r: 6px; --r-sm: 4px; --head: 'Playfair Display', Georgia, serif; --body: 'Inter', system-ui, sans-serif; --head-w: 600; --head-tt: none; --head-ls: 0;
  --btn-shadow: none; --card-shadow: 0 1px 0 rgba(12, 30, 54, .04);
  --v-a: #0C1E36; --v-b: #A67C1E; --v-soft: #F1EEE6; --v-ink: #0C1E36;
  --st-mastered: #0C1E36; --st-fluent: #6E86A6; --st-learning: #C8B88A; --st-new: #EDEAE2;
  --key-bg: #FFFFFF; --key-ink: #0C1E36; --prob-size: clamp(40px, 10vw, 64px);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg-grad); background-color: var(--bg); background-attachment: fixed; color: var(--ink); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; transition: background-color .4s, color .4s; }
body[data-tier="sprout"] { font-size: 18px; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--head); font-weight: var(--head-w); letter-spacing: var(--head-ls); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(26px, 6vw, 38px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; justify-content: center; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
body[data-tier="sprout"] .eyebrow { font-family: var(--head); font-size: 15px; letter-spacing: .02em; text-transform: none; color: #E08A00; }
body[data-tier="scholar"] .eyebrow { color: var(--accent-2); letter-spacing: .14em; }
.ic { display: inline-flex; width: 20px; height: 20px; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#app { max-width: 980px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--card-shadow); }
body[data-tier="navigator"] .card { backdrop-filter: blur(8px); }
body[data-tier="sprout"] .card { border: 3px solid var(--line); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: var(--btn-shadow); transition: transform .12s, filter .15s, background .2s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.big { min-height: 54px; padding: 12px 28px; font-size: 18px; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .45; pointer-events: none; }
body[data-tier="sprout"] .btn { border-width: 0; font-family: var(--head); font-weight: 600; border-radius: 999px; }
body[data-tier="sprout"] .btn.primary { background: linear-gradient(180deg, #FFD23F, #FFB800); box-shadow: 0 5px 0 #D18F00; }
body[data-tier="sprout"] .btn:not(.primary):not(.ghost) { background: #E7F6F4; color: #1E6E66; box-shadow: 0 5px 0 #B9E2DD; }
body[data-tier="sprout"] .btn.big { min-height: 62px; font-size: 22px; padding: 12px 34px; }
body[data-tier="explorer"] .btn { font-family: var(--head); font-weight: 600; letter-spacing: .01em; }
body[data-tier="explorer"] .btn.primary { background: linear-gradient(180deg, #F3D27E, #E0B550); box-shadow: 0 4px 0 #9C7A22, 0 0 24px rgba(233, 196, 106, .25); }
body[data-tier="navigator"] .btn.primary { background: linear-gradient(180deg, #E2C150, #C9A12D); box-shadow: 0 6px 20px rgba(212, 175, 55, .25); }
body[data-tier="navigator"] .btn { font-size: 14px; letter-spacing: .02em; }
body[data-tier="scholar"] .btn { font-size: 14px; border-radius: 4px; }
body[data-tier="scholar"] .btn.primary { background: var(--navy); }
.link { background: none; border: 0; color: var(--accent); padding: 8px 4px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; }
body[data-tier="sprout"] .link { color: #1E6E66; font-family: var(--head); font-size: 16px; }
body[data-tier="scholar"] .link { color: var(--accent-2); }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

/* ---------- logo & top bar ---------- */
.logo { width: 38px; height: 38px; flex: none; }
.logo-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .9; }
.logo-star { fill: var(--accent); }
body[data-tier="sprout"] .logo-star { fill: #FFB800; }
body[data-tier="sprout"] .logo-ring { stroke: #FFB800; }
body[data-tier="scholar"] .logo-star, body[data-tier="scholar"] .logo-ring { fill: var(--accent-2); }
body[data-tier="scholar"] .logo-ring { fill: none; stroke: var(--accent-2); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
body[data-tier="sprout"] .top { border-bottom: 0; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; }
.wm { display: flex; flex-direction: column; line-height: 1; }
.wm b { font-family: 'Cinzel', serif; font-weight: 600; font-size: 22px; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
.wm small { font-size: 9px; letter-spacing: .42em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
body[data-tier="sprout"] .wm b { font-family: 'Fredoka'; letter-spacing: .02em; text-transform: none; font-size: 26px; color: #F0A30A; }
body[data-tier="sprout"] .wm small { letter-spacing: .1em; font-family: 'Fredoka'; }
body[data-tier="explorer"] .wm b { font-family: 'Fredoka'; letter-spacing: .06em; }
body[data-tier="scholar"] .wm b { font-family: 'Playfair Display'; letter-spacing: .02em; text-transform: none; color: var(--ink); font-size: 23px; }
.top-r { display: flex; align-items: center; gap: 8px; }
.who-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); max-width: 190px; }
.who-txt { display: flex; flex-direction: column; text-align: left; line-height: 1.1; font-weight: 600; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.who-txt small { font-weight: 400; color: var(--muted); font-size: 11px; }
.streak { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: #FF8A3D; font-size: 15px; }
.streak .ic svg { fill: #FF8A3D; stroke: none; }
.av { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; background: var(--surface-2); overflow: hidden; }
.av svg { width: 100%; height: 100%; }
.av.mono { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-family: var(--head); }
.av.lg { width: 72px; height: 72px; font-size: 30px; }
.av.plus { background: transparent; border: 2px dashed var(--line); color: var(--accent); font-size: 34px; }
@media (max-width: 520px) { .who-txt { display: none; } .who-chip { padding: 4px; } .wm small { display: none; } .wm b { font-size: 18px; } }

/* ---------- who / setup ---------- */
.who { padding: 8vh 0 40px; text-align: center; }
.who-brand .logo { width: 64px; height: 64px; }
.who-brand h1 { font-family: 'Cinzel', serif; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-top: 12px; font-size: clamp(26px, 7vw, 40px); }
.who-brand h1 span { display: block; font-size: 11px; letter-spacing: .5em; color: var(--muted); margin-top: 6px; }
.who-brand p { color: var(--muted); font-family: 'Playfair Display', serif; font-style: italic; margin-top: 10px; }
.who h2 { margin: 44px 0 18px; font-family: 'Inter'; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; max-width: 640px; margin: 0 auto; }
.who-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: transform .15s, border-color .15s; }
.who-tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.who-tile small { color: var(--muted); font-size: 12px; }
.fine { margin-top: 26px; font-size: 13px; color: var(--muted); }

.setup { padding: 24px 0 40px; }
.setup-card { max-width: 560px; margin: 0 auto; padding: 28px clamp(18px, 5vw, 36px); text-align: left; position: relative; }
.setup-card h1 { margin-bottom: 18px; }
.setup-pip { width: 90px; position: absolute; right: 18px; top: -40px; animation: bob 2.6s ease-in-out infinite; }
.field { display: block; margin: 18px 0; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.field em { font-style: normal; color: var(--muted); font-weight: 400; }
.field input, .set-row input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 17px; }
.field input:focus, .set-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.grade-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.gg small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.gg div { display: flex; gap: 6px; flex-wrap: wrap; }
.gchip { min-width: 46px; height: 46px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 17px; }
.gchip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.av-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.avp { width: 54px; height: 54px; padding: 3px; border-radius: 50%; border: 2px solid transparent; background: var(--surface-2); }
.avp svg, .avp .av { width: 100%; height: 100%; }
.avp.on { border-color: var(--accent); transform: scale(1.06); }
.setup .back { margin-bottom: 8px; }

/* ---------- home ---------- */
.home { display: grid; gap: 22px; }
.hello h1 { font-size: clamp(26px, 6vw, 34px); }
body[data-tier="navigator"] .hello h1 { letter-spacing: .04em; }
.greet { display: flex; align-items: center; gap: 14px; }
.pip-big { width: 110px; flex: none; animation: bob 2.6s ease-in-out infinite; cursor: pointer; }
.pip-big.bounce, .pip-corner.bounce { animation: jump .6s ease; }
.bubble { position: relative; background: #fff; border: 3px solid var(--line); border-radius: 24px; padding: 14px 20px; font-family: var(--head); font-size: clamp(20px, 5vw, 26px); font-weight: 600; }
.bubble::before { content: ''; position: absolute; left: -14px; top: 50%; margin-top: -10px; border: 10px solid transparent; border-right: 14px solid var(--line); border-left: 0; }

.facts-card { padding: clamp(18px, 4vw, 28px); display: grid; gap: 18px; }
body[data-tier="sprout"] .facts-card { background: linear-gradient(180deg, #FFFFFF, #FFFBF0); }
body[data-tier="explorer"] .facts-card { background: linear-gradient(160deg, #18355F 0%, #0F2546 100%); }
body[data-tier="scholar"] .facts-card { border-left: 3px solid var(--accent-2); }
.fc-head p { margin-top: 6px; }
.op-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.op-tabs.n1 { grid-template-columns: 1fr; max-width: 240px; }
.op-tabs.n2 { grid-template-columns: repeat(2, 1fr); max-width: 480px; }
.op-tabs.n3 { grid-template-columns: repeat(3, 1fr); }
.op-tab { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.op-sym { font-size: 22px; line-height: 1; font-weight: 700; }
.op-tab.on { background: var(--surface-2); color: var(--ink); border-color: var(--accent); }
.op-tab.on .op-sym { color: var(--accent); }
body[data-tier="sprout"] .op-tab { flex-direction: column; gap: 2px; border: 3px solid var(--line); border-radius: 22px; font-family: var(--head); font-size: 16px; padding: 10px; }
body[data-tier="sprout"] .op-sym { font-size: 34px; }
body[data-tier="sprout"] .op-tab.on { background: #FFF1D6; border-color: #FFB800; }
body[data-tier="sprout"] .op-tab.on .op-sym { color: #E08A00; }
body[data-tier="scholar"] .op-tab { border-radius: 0; border-width: 0 0 2px; padding: 8px 4px; }
body[data-tier="scholar"] .op-tab.on { background: transparent; border-color: var(--accent-2); }
@media (max-width: 560px) { .op-tabs:not(.n1) .op-name { display: none; } body[data-tier="sprout"] .op-name { display: block !important; font-size: 13px; } }
.fc-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fc-actions .btn.primary { flex: 1 1 200px; }

/* star jar (sprout) */
.jar-wrap { display: flex; align-items: center; gap: 20px; }
.jar { width: 110px; flex: none; }
.jar-lid { fill: #C58B4A; }
.jar-glass { fill: rgba(170, 220, 255, .25); stroke: #8CC7EE; stroke-width: 4; }
.jar-shine { stroke: #fff; stroke-width: 6; stroke-linecap: round; opacity: .7; }
.jar-star { fill: #FFC53D; stroke: #F0A30A; stroke-width: 1; }
.jar-star.dim { fill: #FFE7A3; }
.jar-txt { display: flex; flex-direction: column; font-family: var(--head); }
.jar-txt b { font-size: 54px; line-height: 1; color: #E08A00; }
.jar-txt span { font-size: 20px; font-weight: 600; }
.jar-txt small { color: var(--muted); font-size: 15px; }

/* constellation (explorer) */
.constellation svg { width: 100%; height: auto; max-height: 180px; display: block; background: radial-gradient(closest-side, rgba(76, 201, 240, .08), transparent); border-radius: 12px; }
.con { fill: rgba(255, 255, 255, .22); }
.con.fluent { fill: #4CC9F0; filter: drop-shadow(0 0 3px #4CC9F0); }
.con.mastered { fill: #FFE7A0; filter: drop-shadow(0 0 4px #E9C46A); }
.con.learning { fill: rgba(255, 122, 162, .7); }
.con-line { stroke: rgba(233, 196, 106, .35); stroke-width: .6; }
.con-legend, .seg-legend, .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: var(--st-new); }
.dot.mastered { background: var(--st-mastered); } .dot.fluent { background: var(--st-fluent); } .dot.learning { background: var(--st-learning); }
.dot.new { background: var(--st-new); box-shadow: inset 0 0 0 1px var(--line); }
.seg-legend b { color: var(--ink); margin-left: 3px; }

/* segment bar (navigator / scholar) */
.segbar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--st-new); gap: 2px; }
.segbar.thin { height: 4px; margin-top: 14px; border-radius: 0; }
.seg.mastered { background: linear-gradient(90deg, #C9A12D, #E9C46A); } .seg.fluent { background: var(--st-fluent); } .seg.learning { background: var(--st-learning); } .seg.new { background: transparent; }
body[data-tier="scholar"] .seg.mastered { background: var(--st-mastered); }
.sch-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sch-stats b { display: block; font-family: 'Playfair Display'; font-size: 34px; font-weight: 600; line-height: 1.1; }
.sch-stats span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* skills */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.skill { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--card-shadow); }
.sk-icon { grid-row: span 2; width: 52px; height: 52px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--accent); font-family: var(--head); font-weight: 700; font-size: 19px; white-space: nowrap; }
.sk-body p { color: var(--muted); font-size: 14px; }
.sk-actions { display: flex; gap: 8px; margin-top: 6px; }
.lvl { font-size: 12px; color: var(--accent); font-weight: 600; }
.pips, .lvl-badge { display: inline-flex; gap: 2px; }
.pips i, .lvl-badge i { width: 18px; height: 18px; display: inline-block; }
.pips svg, .lvl-badge svg { width: 100%; height: 100%; fill: #EDE6D4; }
.pips i.on svg, .lvl-badge i.on svg { fill: #FFB800; }
body[data-tier="sprout"] .skill { border: 3px solid var(--line); }
body[data-tier="sprout"] .skills .skill:nth-child(4n+1) .sk-icon { background: #FFE3E3; color: #E5484D; }
body[data-tier="sprout"] .skills .skill:nth-child(4n+2) .sk-icon { background: #DFF5F2; color: #1E8E83; }
body[data-tier="sprout"] .skills .skill:nth-child(4n+3) .sk-icon { background: #EDE7FF; color: #6E56CF; }
body[data-tier="sprout"] .skills .skill:nth-child(4n) .sk-icon { background: #FFF1D6; color: #E08A00; }
body[data-tier="explorer"] .sk-icon { background: linear-gradient(135deg, #24467E, #1B3A66); color: #E9C46A; box-shadow: inset 0 0 0 1px rgba(233, 196, 106, .3); }
body[data-tier="scholar"] .skills { gap: 0; border-top: 1px solid var(--line); grid-template-columns: 1fr; }
body[data-tier="scholar"] .skill { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; background: transparent; grid-template-columns: auto 1fr auto; align-items: center; padding: 14px 0; }
body[data-tier="scholar"] .sk-icon { grid-row: auto; background: transparent; color: var(--accent-2); width: 56px; font-family: 'Playfair Display'; font-style: italic; }
body[data-tier="scholar"] .sk-actions { margin: 0; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.foot span { display: flex; align-items: center; gap: 8px; }
.foot .logo { width: 16px; height: 16px; }
.foot em { font-family: 'Playfair Display'; text-transform: none; letter-spacing: 0; font-size: 14px; }
body[data-tier="sprout"] .foot { display: none; }

/* ---------- lesson ---------- */
.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.steps { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.st { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.st i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; border: 1px solid currentColor; display: grid; place-items: center; font-size: 11px; }
.st.on { background: var(--surface-2); color: var(--ink); }
.st.on i, .st.done i { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
@media (max-width: 560px) { .st span { display: none; } .st { padding: 6px; } }
.lesson-card { padding: clamp(20px, 5vw, 40px); max-width: 760px; margin: 0 auto; display: grid; gap: 16px; text-align: center; justify-items: center; }
.lesson-card h1 { margin-bottom: 4px; }
body[data-tier="navigator"] .lesson-card h1 { text-transform: uppercase; letter-spacing: .06em; }
.idea { font-size: 18px; max-width: 600px; }
body[data-tier="sprout"] .idea { font-size: 22px; }
body[data-tier="scholar"] .idea { text-align: left; font-size: 17px; }
.lesson-pip { width: 90px; animation: bob 2.6s ease-in-out infinite; }
.viz-wrap { background: var(--v-soft); border-radius: var(--r-sm); padding: 16px; max-width: 100%; overflow-x: auto; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.viz-wrap.sm { padding: 10px; }
.viz { max-width: 100%; height: auto; }
.viz-wrap.sm .viz { max-height: 110px; width: auto; }
.l-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; flex-wrap: wrap; margin-top: 4px; }
.l-actions.center { justify-content: center; }
.work { text-align: left; margin: 0; padding-left: 0; list-style: none; counter-reset: w; display: grid; gap: 8px; max-width: 560px; width: 100%; }
.work li { counter-increment: w; display: flex; gap: 10px; align-items: baseline; animation: rise .35s ease; }
.work li::before { content: counter(w); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--accent); border: 1px solid var(--line); }

/* ---------- problems & input ---------- */
.problem { font-family: var(--head); font-weight: 600; font-size: clamp(30px, 8vw, 44px); line-height: 1.2; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .25em; text-align: center; }
.problem.big { font-size: var(--prob-size); font-variant-numeric: tabular-nums; }
body[data-tier="navigator"] .problem { font-family: 'Inter'; font-weight: 300; letter-spacing: -.01em; }
body[data-tier="scholar"] .problem { font-family: 'Playfair Display'; font-weight: 500; }
.problem.pop { animation: pop .3s ease; }
.q-html { display: inline-block; line-height: 1.35; }
.q-html b { color: var(--accent); }
.skill-play .problem { font-size: clamp(30px, 8vw, 46px); }
.blank { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.2em; padding: 0 .15em; border: 2px dashed var(--accent); border-radius: 8px; color: var(--accent); font-size: .8em; }
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; font-size: .82em; margin: 0 .08em; }
.fr > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .2em .05em; }
.fr > span:last-child { padding: .05em .2em 0; }
.fr .blank { font-size: .9em; margin: 2px 0; }
sup { font-size: .55em; }
.vert { display: inline-grid; justify-items: end; font-variant-numeric: tabular-nums; font-size: 1.2em; line-height: 1.15; }
.vert em { font-style: normal; margin-right: .5em; color: var(--accent); }
.vline { width: 100%; height: 3px; background: currentColor; margin: 4px 0; }

.ans-inline, .ans-box { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; min-height: 1.15em; padding: 0 .2em; border-bottom: 4px solid var(--accent); color: var(--accent); }
.ans-box { display: flex; margin: 6px auto 0; min-width: 160px; max-width: 260px; height: 60px; font-family: var(--head); font-size: 34px; font-weight: 600; border: 2px solid var(--line); border-bottom: 4px solid var(--accent); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.caret { width: 3px; height: .9em; background: var(--accent); animation: blink 1s steps(1) infinite; }
.ans-inline .caret { height: .8em; }
.reveal { color: var(--good); animation: pop .3s ease; }
.warm-n { color: var(--muted); margin-right: .4em; }

.keypad { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 58px; gap: 8px; max-width: 380px; width: 100%; margin: 14px auto 0; }
.kp { border: 1px solid var(--line); background: var(--key-bg); color: var(--key-ink); border-radius: var(--r-sm); font-size: 26px; font-weight: 600; font-family: var(--head); box-shadow: var(--btn-shadow); transition: transform .08s, background .1s; touch-action: manipulation; user-select: none; }
.kp:active, .kp.hit { transform: translateY(2px); box-shadow: none; background: var(--surface-2); }
.k-back { grid-column: 4; grid-row: 1; font-size: 22px; color: var(--muted); }
.k-zero { grid-column: 1 / 4; grid-row: 4; }
.k-go { grid-column: 4; grid-row: 2 / 5; background: var(--accent); color: var(--accent-ink); border-color: transparent; font-size: 28px; }
.ex1 .k-x { grid-column: 4; grid-row: 2; } .ex1 .k-go { grid-row: 3 / 5; }
.ex2 .k-x { grid-column: 4; } .ex2 .k-go { grid-row: 4; }
body[data-tier="sprout"] .keypad { grid-auto-rows: 64px; gap: 10px; }
body[data-tier="sprout"] .kp { border: 0; border-radius: 20px; font-size: 30px; box-shadow: 0 5px 0 #E8DCC2; }
body[data-tier="sprout"] .keypad .kp:nth-child(3n+1) { color: #E5484D; } body[data-tier="sprout"] .keypad .kp:nth-child(3n+2) { color: #1E8E83; } body[data-tier="sprout"] .keypad .kp:nth-child(3n) { color: #6E56CF; }
body[data-tier="sprout"] .k-go { background: linear-gradient(180deg, #4ED37F, #22A55B); color: #fff !important; box-shadow: 0 5px 0 #17803F; }
body[data-tier="sprout"] .k-back { color: var(--muted) !important; }
body[data-tier="explorer"] .kp { box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
body[data-tier="scholar"] .kp { font-family: 'Inter'; font-weight: 500; font-size: 22px; }
@media (hover: hover) and (pointer: fine) { body:not([data-tier="sprout"]) .facts-play .keypad { opacity: .75; } }

.choices { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.choice { min-width: 84px; min-height: 64px; padding: 10px 18px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); font-family: var(--head); font-size: 26px; font-weight: 600; box-shadow: var(--btn-shadow); }
.choice:hover { border-color: var(--accent); }
.choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 15%, var(--surface)); }
.choice.wrong { border-color: var(--bad); opacity: .7; }
.skill-play .choices .choice { font-size: 20px; }

.fb { min-height: 28px; font-weight: 600; font-size: 18px; text-align: center; }
.fb.good { color: var(--good); }
.fb.bad { color: var(--bad); }
.fb.warn { color: var(--warn); }
.fb .muted { font-weight: 400; color: var(--muted); }
.fb.fast { animation: pop .3s ease; }
.fb .work { margin: 10px auto 0; color: var(--ink); font-weight: 400; font-size: 16px; }
body[data-tier="sprout"] .fb { font-family: var(--head); font-size: 24px; }
.newstar { display: inline-flex; align-items: center; gap: 4px; color: #E0A400; animation: pop .4s ease; }
.newstar .ic svg { fill: #FFC53D; stroke: none; }

/* ---------- play screens ---------- */
.play { max-width: 720px; margin: 0 auto; min-height: calc(100vh - 24px); min-height: calc(100dvh - 24px - env(safe-area-inset-bottom)); display: flex; flex-direction: column; padding-top: 12px; position: relative; }
.play-top { display: flex; align-items: center; gap: 12px; }
.timebar { flex: 1; height: 10px; border-radius: 99px; background: var(--st-new); overflow: hidden; }
.timebar span { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 99px; }
.timebar span.low { background: var(--warn); }
body[data-tier="sprout"] .timebar { height: 16px; border: 3px solid var(--line); background: #fff; }
body[data-tier="sprout"] .timebar span { background: linear-gradient(90deg, #4CC2B6, #7ADFC9); }
body[data-tier="explorer"] .timebar span { background: linear-gradient(90deg, #4CC9F0, #E9C46A); box-shadow: 0 0 12px #4CC9F0; }
body[data-tier="scholar"] .timebar { height: 3px; }
.count { min-width: 36px; text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dots { flex: 1; display: flex; gap: 6px; justify-content: center; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--st-new); box-shadow: inset 0 0 0 1px var(--line); }
.dots i.ok { background: var(--good); } .dots i.no { background: var(--bad); } .dots i.cur { box-shadow: 0 0 0 2px var(--accent); }
.lvl-badge { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px 0 8px; text-align: center; min-height: 200px; }
.help { display: grid; justify-items: center; gap: 8px; }
.copyline { font-family: var(--head); font-size: 30px; font-weight: 600; }
.hint { color: var(--muted); max-width: 460px; }
body[data-tier="sprout"] .hint { font-size: 19px; color: var(--ink); }
.pip-corner { position: absolute; right: 0; top: 56px; width: 76px; animation: bob 2.6s ease-in-out infinite; z-index: 2; }
.play-foot { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
@media (max-height: 700px) { .keypad { grid-auto-rows: 50px; gap: 6px; margin-top: 8px; } body[data-tier="sprout"] .keypad { grid-auto-rows: 54px; } .stage { padding: 8px 0 4px; gap: 8px; } .pip-corner { width: 58px; } }

/* ---------- summary ---------- */
.sum-card { max-width: 620px; margin: 4vh auto 0; padding: clamp(24px, 6vw, 44px); text-align: center; display: grid; gap: 18px; justify-items: center; }
.sum-card .sub { font-size: 20px; }
body[data-tier="sprout"] .sum-card h1 { font-size: 46px; color: #E08A00; }
body[data-tier="explorer"] .sum-card { background: linear-gradient(180deg, #1B3A66, #102849); }
.badge-emblem { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(233, 196, 106, .25), transparent 70%); animation: pop .6s ease; }
.badge-emblem .logo { width: 64px; height: 64px; }
.sum-stars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.big-star { width: 52px; height: 52px; animation: starIn .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.big-star svg { width: 100%; height: 100%; fill: #FFC53D; stroke: #F0A30A; stroke-width: 1; }
.big-star.dim svg { fill: #FFE7A3; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; width: 100%; }
.stats div { padding: 14px 8px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.stats b { display: block; font-size: 28px; font-family: var(--head); color: var(--accent); line-height: 1.1; }
.stats span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
body[data-tier="scholar"] .stats b { color: var(--ink); }
.watch { width: 100%; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.sum-card .fc-body { width: 100%; }

/* ---------- progress ---------- */
.progress { display: grid; gap: 16px; }
.grids { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.grids .card, .progress > .card { padding: 18px; }
.grids h2 small { font-size: 14px; color: var(--muted); font-family: var(--body); margin-left: 6px; }
.fgrid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; margin-top: 12px; }
.fh { font-size: 10px; color: var(--muted); display: grid; place-items: center; aspect-ratio: 1; }
.fc { aspect-ratio: 1; border-radius: 3px; background: var(--st-new); }
.fc.mastered { background: var(--st-mastered); } .fc.fluent { background: var(--st-fluent); } .fc.learning { background: var(--st-learning); } .fc.na { background: transparent; }
body[data-tier="sprout"] .fc { border-radius: 50%; }
.sk-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.sk-table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sk-table th, .sk-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
#modal[hidden] { display: none; }
.m-back { position: absolute; inset: 0; background: rgba(7, 18, 33, .6); backdrop-filter: blur(4px); }
.m-card { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 26px; background: var(--surface-2); }
body[data-tier="navigator"] .m-card { background: #0F223D; }
.m-x { position: absolute; right: 14px; top: 14px; }
.m-card h2 { margin-bottom: 14px; padding-right: 40px; }
.keylist { margin: 0 0 16px; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.keylist li { padding: 10px 14px; background: var(--surface); border-radius: var(--r-sm); border: 1px solid var(--line); }
.table-wrap { overflow: auto; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row.col { flex-direction: column; align-items: stretch; }
.switch { width: 52px; height: 30px; border-radius: 99px; border: 0; background: var(--st-new); position: relative; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.switch i { position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch.on { background: var(--accent); }
.switch.on i { left: 25px; }
.seg-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-pick button { min-width: 42px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; }
.seg-pick button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ---------- SVG visual classes ---------- */
.v-a { fill: var(--v-a); } .v-b { fill: var(--v-b); }
.v-x { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 3 3; } .v-xline { stroke: var(--bad); stroke-width: 2.5; stroke-linecap: round; }
.v-frame { fill: var(--surface); stroke: var(--v-ink); stroke-width: 2; } .v-grid { stroke: var(--v-ink); stroke-width: 1; opacity: .3; }
.v-axis { stroke: var(--v-ink); stroke-width: 2; } .v-hop { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 5 4; }
.v-txt, .v-small, .v-label, .v-big, .v-thx, .v-tdx { fill: var(--v-ink); font-family: var(--body); }
.v-small { font-size: 12px; } .v-label { font-size: 15px; font-weight: 700; fill: var(--accent); } .v-big { font-size: 56px; font-weight: 700; font-family: var(--head); }
.v-bag { fill: var(--surface); stroke: var(--line); stroke-width: 2; } .v-bag.on { stroke: var(--v-a); stroke-width: 3; }
.v-rod { fill: #6FC3E8; stroke: #2C7FA8; stroke-width: 1; } .v-cube { fill: #FFC53D; stroke: #C48A00; stroke-width: 1; }
.v-fill { fill: var(--v-a); stroke: var(--surface); stroke-width: 2; } .v-empty { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
body[data-tier="sprout"] .v-empty, body[data-tier="scholar"] .v-empty { stroke: #CFC6B2; }
.v-fill-soft { fill: var(--v-soft); } .v-outline { fill: none; stroke: var(--v-ink); stroke-width: 2.5; } .v-outline-thick { fill: none; stroke: var(--v-ink); stroke-width: 4; stroke-linecap: round; }
.v-pan { fill: var(--v-soft); stroke: var(--v-ink); stroke-width: 2; }
.v-gator { fill: none; stroke: #3FA34D; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; } .v-teeth { stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.v-line { stroke: var(--v-a); stroke-width: 3; } .v-rise { fill: none; stroke: var(--v-b); stroke-width: 2.5; stroke-dasharray: 5 4; }
.v-th { fill: var(--surface-2); stroke: var(--line); } .v-td { fill: var(--surface); stroke: var(--line); } .v-td.on { fill: var(--v-soft); }
.v-thx { font-size: 11px; font-weight: 700; fill: var(--accent); } .v-tdx { font-size: 11px; }
body[data-tier="sprout"] .v-a { fill: #FF6B6B; } body[data-tier="sprout"] .v-b { fill: #FFC53D; }

/* Pip */
.pip { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 0 rgba(240, 163, 10, .2)); }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes jump { 0% { transform: scale(1); } 30% { transform: translateY(-18px) scale(1.08) rotate(-8deg); } 60% { transform: translateY(0) scale(.95); } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(.85); opacity: .3; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
body:not([data-tier="sprout"]) .problem.pop { animation-duration: .18s; }
body[data-tier="scholar"] .problem.pop, body[data-tier="scholar"] .fb.fast { animation: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.ans-ghost { opacity: .3; }

/* ---------- grade picker ---------- */
.grade-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; }
body[data-tier="sprout"] .grade-chip { font-family: var(--head); border-width: 3px; }
.grade-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; max-width: 560px; margin: 0 auto; text-align: left; }
.gp small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }
.gp div { display: flex; gap: 8px; flex-wrap: wrap; }
.gbig { width: 58px; height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 700; transition: transform .12s, border-color .12s; }
.gbig:hover { transform: translateY(-2px); border-color: var(--accent); }
.gbig.t-sprout { font-family: 'Fredoka'; background: #FFF4D6; color: #9A5B00; border: 0; border-radius: 50%; box-shadow: 0 4px 0 #E8C77A; }
.gbig.t-explorer { font-family: 'Fredoka'; background: #1B3A66; color: #E9C46A; border-color: #4CC9F0; }
.gbig.t-navigator { font-family: 'Cinzel'; color: var(--gold); }
.gbig.t-scholar { font-family: 'Playfair Display'; background: #FAF9F6; color: #0C1E36; border-radius: 4px; }
.gbig.on { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) { .grade-pick { grid-template-columns: 1fr; } }

/* ---------- level card ---------- */
.lv { display: grid; gap: 8px; }
.lv-num { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.lv-num small { letter-spacing: .06em; text-transform: none; font-weight: 600; color: var(--muted); font-size: 12px; }
.lv-num .of { color: var(--muted); font-weight: 600; }
.lv h3 { font-size: clamp(22px, 5.5vw, 30px); }
.lv-tip { color: var(--muted); max-width: 620px; }
body[data-tier="sprout"] .lv-num { font-family: var(--head); font-size: 16px; letter-spacing: .04em; color: #E08A00; }
body[data-tier="sprout"] .lv-tip { color: var(--ink); font-size: 19px; }
.lv-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.lf { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid var(--line); color: var(--muted); background: transparent; white-space: nowrap; }
.lf.learning { color: var(--ink); border-color: var(--st-learning); }
.lf.fluent { color: var(--ink); background: color-mix(in srgb, var(--st-fluent) 30%, transparent); border-color: var(--st-fluent); }
.lf.mastered { color: var(--accent-ink); background: var(--st-mastered); border-color: transparent; }
.lf i { width: 16px; height: 16px; display: inline-block; }
.lf i svg { width: 100%; height: 100%; fill: #E7E2D6; }
body[data-tier="sprout"] .lf { font-family: var(--head); font-size: 16px; border-width: 2px; padding: 6px 12px; background: #fff; }
body[data-tier="sprout"] .lf.fluent i svg { fill: #FFE08A; }
body[data-tier="sprout"] .lf.mastered { background: #FFF1D6; color: #8A4B00; border-color: #FFB800; }
body[data-tier="sprout"] .lf.mastered i svg { fill: #FFB800; }
body[data-tier="explorer"] .lf.mastered { box-shadow: 0 0 10px rgba(233, 196, 106, .45); }
body[data-tier="scholar"] .lf { border-radius: 3px; }
.lv-left { font-size: 14px; color: var(--muted); }
body[data-tier="sprout"] .lv-left { font-family: var(--head); font-size: 17px; color: var(--ink); }
.ladder { display: flex; gap: 4px; margin-top: 6px; }
.ladder i { flex: 1; height: 8px; border-radius: 99px; background: var(--st-new); max-width: 44px; }
.ladder i.done { background: var(--st-mastered); }
.ladder i.cur { background: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
body[data-tier="sprout"] .ladder i { height: 12px; }
body[data-tier="scholar"] .ladder i { border-radius: 0; height: 4px; }
.goal { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--line); }
.goal b { color: var(--accent); }
.goal .ic svg { fill: #FFC53D; stroke: none; }
body[data-tier="sprout"] .goal { font-family: var(--head); font-size: 18px; background: #FFF8E6; }
body[data-tier="scholar"] .goal { background: transparent; border-style: solid; font-weight: 500; }
.sprint { border-left: 3px solid var(--accent-2); }
.lv-box { display: block; margin-top: 4px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--v-soft); font-size: .92em; }

/* ---------- round extras ---------- */
.start-at { font-size: .6em; }
.start-at b { color: var(--accent); }
.lv-intro { max-width: 460px; }
.lv-intro b { color: var(--accent); display: block; font-family: var(--head); font-size: 20px; }

/* ---------- summary ---------- */
.best { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent); }
.best .ic svg { fill: currentColor; stroke: none; }
.done-today { font-weight: 600; }
body[data-tier="sprout"] .done-today { font-family: var(--head); font-size: 20px; color: #1E8E83; }
.ticket { width: 100%; max-width: 420px; display: grid; gap: 4px; text-align: left; padding: 16px 18px; border-radius: var(--r-sm); background: var(--surface); border: 2px dashed var(--line); position: relative; }
.t-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.t-top span:first-child { display: flex; align-items: center; gap: 6px; }
.t-top .logo { width: 16px; height: 16px; }
.ticket > b { font-family: var(--head); font-size: 18px; }
.t-lvl { color: var(--accent); font-weight: 600; font-size: 14px; }
.t-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.t-stats b { display: block; font-size: 20px; color: var(--ink); letter-spacing: 0; }
.ticket small { color: var(--muted); font-size: 11px; text-align: right; margin-top: 4px; }

/* ---------- progress ---------- */
.lv-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.lv-list li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.lv-list li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1px solid var(--line); flex: none; }
.lv-list li span .ic { width: 14px; height: 14px; }
.lv-list li.done { color: var(--ink); }
.lv-list li.done span { background: var(--st-mastered); color: var(--accent-ink); border-color: transparent; }
.lv-list li.cur { color: var(--ink); font-weight: 700; }
.lv-list li.cur span { border: 2px solid var(--accent); color: var(--accent); }
.lv-list small { color: var(--muted); font-weight: 400; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; margin-top: 6px; }
.key-h { font-size: 16px; margin: 4px 0 10px; }

/* ---------- rewards ---------- */
.pts-chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--accent); }
.pts-chip .ic { width: 16px; height: 16px; }
.pts-chip .ic svg { fill: #FFC53D; stroke: none; }
body[data-tier="sprout"] .pts-chip { border-width: 3px; font-family: var(--head); color: #E08A00; }
@media (max-width: 520px) { .grade-chip { padding: 7px 10px; font-size: 13px; } .streak { display: none; } }
.score { position: relative; min-width: 64px; text-align: right; line-height: 1; }
.score b { font-size: 22px; font-family: var(--head); color: var(--accent); font-variant-numeric: tabular-nums; }
.score small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.float-pts { position: absolute; right: 0; top: -4px; font-weight: 800; color: var(--good); animation: floatUp .9s ease-out forwards; pointer-events: none; }
@keyframes floatUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-34px); opacity: 0; } }
.lvl-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; min-height: 22px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ls-dots, .ls-ladder { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ls-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--st-new); box-shadow: inset 0 0 0 1px var(--line); transition: background .3s, transform .3s; }
.ls-dots i.fluent, .ls-dots i.mastered { background: var(--st-mastered); box-shadow: 0 0 8px color-mix(in srgb, var(--st-mastered) 70%, transparent); transform: scale(1.15); }
.ls-dots i.learning { background: var(--st-learning); }
.ls-ladder i { width: 14px; height: 8px; border-radius: 99px; background: var(--st-new); transition: background .3s; }
.ls-ladder i.done { background: var(--good); } .ls-ladder i.cur { background: var(--accent); }
body[data-tier="sprout"] .lvl-strip { font-family: var(--head); font-size: 15px; color: var(--ink); }
body[data-tier="sprout"] .ls-dots i { width: 16px; height: 16px; }
.combo { min-height: 26px; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #FF8A3D; font-size: 16px; }
.combo .ic svg { fill: #FF8A3D; stroke: none; }
.combo b { font-size: 22px; }
.combo.hot { transform: scale(1.3); transition: transform .2s; }
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); animation: rise .25s ease; }
.overlay[hidden] { display: none; }
.ov-card { text-align: center; display: grid; gap: 8px; justify-items: center; padding: 30px 26px; border-radius: var(--r); background: var(--surface-2); border: 2px solid var(--accent); box-shadow: var(--card-shadow); max-width: 420px; animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
.ov-card h2 { font-size: clamp(28px, 7vw, 40px); color: var(--accent); }
.ov-card p { font-size: 17px; }
.ov-big { font-family: var(--head); font-weight: 700; font-size: 22px !important; color: var(--good); }
.ov-star { width: 84px; height: 84px; animation: starIn .7s cubic-bezier(.3, 1.6, .5, 1); }
.ov-star svg { width: 100%; height: 100%; fill: #FFC53D; stroke: #F0A30A; stroke-width: 1; }
.pts-big b { display: block; font-family: var(--head); font-size: clamp(48px, 13vw, 72px); line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.pts-big span { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.cleared { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cleared > span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--good) 15%, var(--surface)); border: 1px solid var(--good); font-weight: 700; animation: pop .5s ease both; }
.cleared .ic { width: 16px; height: 16px; color: var(--good); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; width: 100%; }
.badge { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 14px 8px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.badge b { font-size: 13px; line-height: 1.2; }
.badge small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.b-medal { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #5B3A00; background: radial-gradient(circle at 35% 30%, #FFE9A8, #E0B23C 60%, #B8861B); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15), 0 3px 8px rgba(0, 0, 0, .15); }
.badge.locked { opacity: .45; } .badge.locked .b-medal { background: var(--st-new); color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
.badge.fresh { animation: starIn .7s cubic-bezier(.3, 1.6, .5, 1) both; border-color: var(--accent); }
.new-badges { width: 100%; }
.stats.big4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { .stats.big4 { grid-template-columns: repeat(2, 1fr); } }
.hchart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 18px; }
.hbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; max-width: 40px; }
.hbar span { width: 100%; background: linear-gradient(180deg, var(--accent-2, var(--accent)), var(--accent)); border-radius: 6px 6px 2px 2px; position: relative; min-height: 6px; }
.hbar span b { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--ink); }
.hbar i { font-style: normal; font-size: 12px; color: var(--muted); }
body[data-tier="scholar"] .hbar span { background: var(--navy); border-radius: 0; }
.small { font-size: 13px; }
.send-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.report { padding: 24px 0 40px; }
.rep { max-width: 860px; margin: 0 auto; padding: clamp(18px, 4vw, 36px); display: grid; gap: 16px; }
.rep-head { display: flex; gap: 16px; align-items: center; }
.rep-head .logo { width: 54px; height: 54px; }
.rep h2 { font-size: 18px; margin-top: 6px; }
.rep-bar { height: 6px; border-radius: 99px; background: var(--st-new); margin-bottom: 4px; max-width: 160px; }
.rep-bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
@media print { body { background: #fff !important; color: #000; } .no-print { display: none; } .card { box-shadow: none; backdrop-filter: none; background: #fff; border-color: #ccc; } .rep * { color: #000 !important; } }
.tbl { overflow-x: auto; max-width: 100%; }
.rep { min-width: 0; }
.rep .sk-table { font-size: 13px; }
.rep .sk-table th, .rep .sk-table td { padding: 8px 5px; }
.badges.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.badges.three .badge small { display: none; }
.voice-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-pick button { padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; }
.voice-pick button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.voice-pick small { font-weight: 500; opacity: .7; margin-left: 2px; }

/* =====================================================================
   Fit-to-screen layer: every tool fits one screen (phones 360x600 and up,
   laptops 1280x720); sizes scale with screen height; nothing under 13px.
   ===================================================================== */
.eyebrow { font-size: 13px; letter-spacing: .12em; }
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
#app > main { flex: 1; min-height: 0; }
#app[data-screen="lesson"], #app[data-screen="facts"], #app[data-screen="skill"] { height: 100vh; height: 100dvh; }
#app[data-screen="lesson"] > main, #app[data-screen="facts"] > main, #app[data-screen="skill"] > main { overflow: hidden; }
.top { padding: 8px 0; margin-bottom: 10px; }
.top .logo { width: 34px; height: 34px; }
.wm b { font-size: 20px; }
.st i { font-size: 13px; width: 22px; height: 22px; }
.lvl-badge, .lv-num, .lv-num small, .gp small, .stats span, .sk-table th, .lvl, .t-top, .score small, .who-brand h1 span, .badge small, .legend, .lv-list small { font-size: 13px; }
.fh { font-size: 12px; }
.hbar b { font-size: 12px; }
.hide-sm { display: inline; }
@media (max-width: 420px) { .hide-sm { display: none; } }

/* home */
.home { display: grid; gap: 12px; align-content: start; }
@media (min-width: 900px) { .home { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }
.facts-card { padding: clamp(12px, 2vh, 18px) 16px; gap: clamp(8px, 1.4vh, 12px); }
.fc-top { display: flex; align-items: center; gap: 10px; }
.fc-title .eyebrow { margin: 0 0 2px; }
.fc-title h2 { font-size: clamp(20px, 3.2vh, 24px); }
.pip-mini { width: clamp(44px, 8vh, 60px); flex: none; animation: bob 2.6s ease-in-out infinite; cursor: pointer; }
.pip-mini.bounce { animation: jump .6s ease; }
.op-tab { min-height: 44px; padding: 6px; }
body[data-tier="sprout"] .op-tab { flex-direction: row; gap: 8px; padding: 6px 10px; border-radius: 18px; font-size: 16px; }
body[data-tier="sprout"] .op-sym { font-size: 26px; }
@media (max-width: 560px) { body[data-tier="sprout"] .op-tabs:not(.n1) .op-name { display: inline !important; } }
.lv { gap: clamp(4px, .8vh, 8px); }
.lv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lv-count { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.lv h3 { font-size: clamp(20px, 3.4vh, 28px); }
.lv-tip { font-size: clamp(15px, 2.2vh, 17px); line-height: 1.4; }
body[data-tier="sprout"] .lv-tip { font-size: clamp(16px, 2.5vh, 19px); }
.lv-facts { gap: 5px; margin: 0; }
.lf { font-size: 14px; padding: 3px 9px; }
body[data-tier="sprout"] .lf { font-size: 15px; padding: 3px 9px; border-width: 2px; }
.ladder { margin-top: 2px; }
.fc-actions { gap: 8px; flex-wrap: nowrap; }
.fc-actions .btn.big { flex: 1; min-height: clamp(48px, 7.5vh, 58px); font-size: 18px; padding: 8px 16px; }
body[data-tier="sprout"] .fc-actions .btn.big { font-size: 21px; }
.fc-actions .btn:not(.big) { min-height: clamp(48px, 7.5vh, 58px); }
.goal { margin: 0; padding: 6px 12px; font-size: 14px; }
body[data-tier="sprout"] .goal { font-size: 16px; }
.sprint-row { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.sprint-row > div { flex: 1; display: grid; gap: 2px; }
.sprint-row span { font-size: 14px; color: var(--muted); }
.topics .sec-head { margin-bottom: 6px; }
.topics h2 { font-size: 20px; }
.topic-row { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 8px; scrollbar-width: thin; }
.topic { flex: 0 0 auto; width: 122px; scroll-snap-align: start; display: grid; justify-items: center; align-content: start; gap: 5px; padding: 10px 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); text-align: center; box-shadow: var(--card-shadow); }
.topic .sk-icon { width: 44px; height: 44px; font-size: 16px; grid-row: auto; }
.t-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.topic .pips i { width: 14px; height: 14px; }
body[data-tier="sprout"] .topic { border-width: 3px; }
body[data-tier="sprout"] .t-name { font-family: var(--head); font-size: 15px; }
body[data-tier="sprout"] .topic-row .topic:nth-child(4n+1) .sk-icon { background: #FFE3E3; color: #E5484D; }
body[data-tier="sprout"] .topic-row .topic:nth-child(4n+2) .sk-icon { background: #DFF5F2; color: #1E8E83; }
body[data-tier="sprout"] .topic-row .topic:nth-child(4n+3) .sk-icon { background: #EDE7FF; color: #6E56CF; }
body[data-tier="sprout"] .topic-row .topic:nth-child(4n) .sk-icon { background: #FFF1D6; color: #E08A00; }
body[data-tier="explorer"] .topic .sk-icon { background: linear-gradient(135deg, #24467E, #1B3A66); color: #E9C46A; }
body[data-tier="scholar"] .topic { box-shadow: none; }
body[data-tier="scholar"] .topic .sk-icon { background: transparent; color: var(--accent-2); font-family: 'Playfair Display'; font-style: italic; }
@media (min-width: 900px) { .topic-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); overflow: visible; } .topic { width: auto; } }
.idea-sm { font-size: 16px; margin-bottom: 8px; }
.grow { flex: 1; }

/* lesson */
.lesson { display: flex; flex-direction: column; }
.lesson-nav { margin-bottom: 8px; }
.lesson-card { flex: 1; min-height: 0; width: 100%; padding: clamp(14px, 2.6vh, 32px) clamp(14px, 4vw, 32px); gap: clamp(6px, 1.4vh, 14px); align-content: start; overflow-y: auto; }
.lesson-card h1 { font-size: clamp(22px, 4vh, 34px); }
.idea { font-size: clamp(16px, 2.4vh, 19px); }
body[data-tier="sprout"] .idea { font-size: clamp(17px, 2.8vh, 22px); }
.lesson-pip { width: clamp(44px, 8vh, 76px); }
.viz-wrap { padding: clamp(6px, 1.2vh, 14px); }
.viz-wrap .viz { max-height: 22vh; width: auto; max-width: 100%; }
.lesson-card .l-actions { margin-top: auto; padding-top: 4px; }
.lesson-card .problem { font-size: clamp(28px, 5.5vh, 44px); }
.work { gap: 6px; font-size: clamp(15px, 2.2vh, 17px); }

/* practice screens */
.play { min-height: 0; height: 100%; padding-top: 8px; }
.play-top .icon-btn { width: 40px; height: 40px; flex: none; }
.stage { min-height: 0; overflow-y: auto; gap: clamp(4px, 1vh, 10px); padding: clamp(4px, 1vh, 12px) 0 4px; }
#viz .viz, .help .viz { max-height: 19vh; width: auto; max-width: 100%; }
.viz-wrap.sm .viz { max-height: 14vh; }
.problem.big { font-size: clamp(40px, 9vh, 76px); }
body[data-tier="sprout"] .problem.big { font-size: clamp(44px, 10vh, 84px); }
.skill-play .problem { font-size: clamp(26px, 5.2vh, 44px); }
.keypad { grid-auto-rows: clamp(44px, 7.4vh, 60px); gap: clamp(5px, 1vh, 8px); margin-top: 8px; }
body[data-tier="sprout"] .keypad { grid-auto-rows: clamp(46px, 8vh, 64px); gap: clamp(6px, 1vh, 10px); }
@media (max-height: 700px) { .keypad { grid-auto-rows: clamp(42px, 7.2vh, 52px); } body[data-tier="sprout"] .keypad { grid-auto-rows: clamp(44px, 7.6vh, 54px); } }
.ans-box { height: clamp(44px, 7vh, 60px); font-size: clamp(26px, 4.6vh, 34px); margin-top: 4px; }
.choices { margin-top: 8px; }
.choice { min-height: clamp(50px, 8vh, 64px); }
.fb { font-size: 16px; min-height: 22px; }
body[data-tier="sprout"] .fb { font-size: 20px; }
.fb .work { font-size: 15px; margin-top: 6px; }
.hint { font-size: 15px; }
body[data-tier="sprout"] .hint { font-size: 17px; }
.pip-corner { width: clamp(44px, 8vh, 70px); top: 52px; }
.lvl-strip { margin-top: 6px; }
.combo { min-height: 22px; }
.dots i { width: 11px; height: 11px; }
.dots { gap: 5px; }

/* summary */
.sum-card { margin: 0 auto; width: 100%; max-width: 560px; gap: clamp(8px, 1.6vh, 14px); padding: clamp(14px, 2.4vh, 26px) 16px; }
.sum-head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.sum-head > div:not(.pts-big):not(.pip-mini):not(.badge-emblem) { flex: 1; }
.sum-head h1 { font-size: clamp(22px, 3.6vh, 30px); }
body[data-tier="sprout"] .sum-head h1 { font-size: clamp(24px, 4vh, 34px); color: #E08A00; }
.pts-big { text-align: right; flex: none; }
.pts-big b { font-size: clamp(30px, 6vh, 48px); }
.pts-big span { font-size: 13px; letter-spacing: .1em; }
.sum-head .badge-emblem { width: 52px; height: 52px; flex: none; }
.sum-head .badge-emblem .logo { width: 42px; height: 42px; }
.done-today { font-size: 15px; margin-top: 2px; }
body[data-tier="sprout"] .done-today { font-size: 17px; }
.sum-card .sub { font-size: 17px; }
.cleared > span { padding: 5px 12px; font-size: 14px; }
.mini-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.mb { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--accent); font-weight: 700; font-size: 14px; animation: starIn .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.mb .b-medal { width: 32px; height: 32px; font-size: 13px; }
.ticket { padding: 10px 14px; gap: 2px; }
.t-top { letter-spacing: .02em; text-transform: none; }
.t-lvl { font-size: 15px; }
.t-stats { margin-top: 4px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.t-stats b { font-size: 20px; }
.watch { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.watch .eyebrow { margin: 0 4px 0 0; }
.chip { font-size: 14px; }
.sum-card .l-actions .btn.big { min-height: 50px; }

/* progress */
.progress { display: flex; flex-direction: column; gap: 10px; }
.prog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prog-head h1 { font-size: clamp(20px, 3.4vh, 28px); }
.ptabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.ptabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.ptabs button.on { background: var(--accent); color: var(--accent-ink); }
.pbody { display: grid; gap: 10px; align-content: start; }
.card.pad { padding: 12px 14px; }
.card.pad h3 { font-size: 16px; margin-bottom: 4px; }
.stats.big4 > div { padding: 10px 6px; }
.stats.big4 b { font-size: clamp(20px, 3.4vh, 28px); }
.hchart { height: clamp(80px, 15vh, 150px); }
.op-rows { display: grid; gap: 2px; }
.op-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.2fr) 48px; align-items: center; gap: 10px; border: 0; background: transparent; padding: 7px 0; text-align: left; font-weight: 600; font-size: 15px; }
.op-row .op-sym { font-size: 20px; color: var(--accent); }
.op-row .rep-bar { margin: 0; max-width: none; height: 8px; }
.or-num { text-align: right; color: var(--muted); }
.badges.all { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.badges.all .badge { padding: 8px 4px; }
.badges.all .badge small { display: none; }
.badges.all .b-medal { width: 40px; height: 40px; }
.op-tabs.small .op-tab { min-height: 38px; }
.seg-pick.center { justify-content: center; }
.lv-list { columns: 2; column-gap: 18px; display: block; margin: 4px 0; font-size: 15px; }
.lv-list li { break-inside: avoid; margin-bottom: 5px; }
.fgrid { max-width: min(100%, 52vh); margin: 6px auto 0; }
.legend { justify-content: center; margin-top: 4px; }
.pbody .sk-table { font-size: 15px; }

/* grade picker */
.who { padding: clamp(16px, 5vh, 60px) 0 20px; }
.who h2 { margin: clamp(16px, 4vh, 40px) 0 14px; }
.who-brand .logo { width: clamp(44px, 8vh, 64px); height: clamp(44px, 8vh, 64px); }
.gbig { width: clamp(52px, 8vh, 58px); height: clamp(52px, 8vh, 58px); }

/* fit, round 2 */
body { overflow-x: hidden; }
.home { grid-template-columns: minmax(0, 1fr); }
.home > * { min-width: 0; }
@media (min-width: 900px) { .home { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.play-top { gap: 8px; min-width: 0; }
.dots { min-width: 0; flex-wrap: wrap; gap: 4px; }
.dots i { width: 10px; height: 10px; }
@media (max-width: 400px) { .play-top .icon-btn { width: 36px; height: 36px; } .lvl-badge { font-size: 13px; } }
.lesson-nav { min-width: 0; gap: 6px; }
.lv-list li span { font-size: 13px; }

/* grade picker: one row per grade band */
.grade-pick { display: grid; grid-template-columns: 1fr; gap: 8px; max-width: 480px; }
.gp { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; }
.gp small { margin: 0; text-align: right; }
.gp div { gap: 6px; flex-wrap: nowrap; }
.gbig { width: clamp(46px, 7.4vh, 56px); height: clamp(46px, 7.4vh, 56px); font-size: 20px; }
@media (max-width: 400px) { .gp { grid-template-columns: 74px 1fr; } .gbig { width: 46px; height: 46px; } }
.who-brand h1 { margin-top: 6px; font-size: clamp(24px, 4.4vh, 38px); }
.who-brand p { margin-top: 4px; }
.who .fine { margin-top: 14px; }

/* summary: tighter on short screens */
@media (max-height: 760px) {
  .sum-card { gap: 8px; padding: 12px 14px; }
  .t-top { display: none; }
  .ticket { padding: 8px 12px; }
  .t-stats b { font-size: 18px; }
  .sum-card .l-actions { gap: 6px; }
  .sum-card .l-actions .btn { min-height: 44px; padding: 8px 12px; }
  .sum-card .l-actions .btn.big { min-height: 46px; font-size: 17px; }
  .pip-mini.cheer, .sum-head .badge-emblem { width: 44px; height: auto; }
}
@media (max-height: 640px) {
  .watch { display: none; }
  .mini-badges .mb:nth-child(n+3) { display: none; }
  .done-today { display: none; }
}

/* badges tab: smaller medals, more per row */
.badges.all { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.badges.all .badge { padding: 6px 2px; gap: 3px; }
.badges.all .badge b { font-size: 13px; }
.badges.all .b-medal { width: 34px; height: 34px; font-size: 13px; }

/* progress on short screens */
@media (max-height: 640px) {
  .hchart { height: 70px; }
  .stats.big4 > div { padding: 6px; }
  .op-row { padding: 4px 0; }
  .lv-list { font-size: 14px; }
  .lv-list li { margin-bottom: 3px; }
  .lv-list li span { width: 22px; height: 22px; }
  .fgrid { max-width: min(100%, 44vh); }
  .prog-head .btn { padding: 6px 10px; }
}

/* fit, round 3 */
.topic { padding: 8px 6px; gap: 4px; }
.topic .sk-icon { width: auto; min-width: 40px; height: 40px; padding: 0 6px; font-size: 15px; white-space: nowrap; }
@media (max-height: 640px) { .facts-card { gap: 7px; } .lv-tip { font-size: 15px; } .fc-actions .btn.big, .fc-actions .btn:not(.big) { min-height: 46px; } .topic .sk-icon { height: 34px; } }
.top .grade-chip, .top .pts-chip { white-space: nowrap; }
@media (max-width: 380px) { .top { gap: 6px; } .top-r { gap: 5px; } .wm b { font-size: 18px; } .pts-chip, .grade-chip { padding: 6px 9px; } }

/* very short screens (about 600px tall) */
@media (max-height: 620px) {
  .top { padding: 4px 0; margin-bottom: 6px; }
  .pip-mini { display: none; }
  body[data-tier="sprout"] .lf { font-size: 14px; padding: 2px 8px; }
  .sum-card .l-actions .btn { min-height: 42px; }
  .sum-card .l-actions .btn.big { min-height: 44px; }
  .cleared > span:nth-child(n+3):not(:last-child) { display: none; }
  .ticket .t-lvl { font-size: 14px; }
  .sum-card .sub { font-size: 16px; }
  .badges.all .badge { padding: 4px 2px; }
  .badges.all .b-medal { width: 30px; height: 30px; }
  .fgrid { max-width: min(100%, 40vh); }
  .ptabs button { padding: 6px 4px; }
  .progress { gap: 7px; }
  .pbody { gap: 7px; }
  .pbody .sk-table th, .pbody .sk-table td { padding: 6px; }
}

.sum-card .l-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 420px; }
.sum-card .l-actions .btn.big { grid-column: 1 / -1; }
@media (max-height: 620px) { .fgrid { max-width: min(100%, 37vh); } .legend { margin-top: 2px; gap: 4px 10px; } }

.fc-actions .btn { white-space: nowrap; }
.fc-actions .btn.big { flex: 1 1 auto; }
body[data-tier="sprout"] .fc-actions .btn:not(.big) { padding: 8px 14px; font-size: 16px; }
.lvl-strip { flex-wrap: nowrap; }
.ls-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.ls-dots, .ls-ladder { flex: 0 1 auto; flex-wrap: nowrap; }
.ls-dots i { width: clamp(8px, 2.6vw, 14px); height: clamp(8px, 2.6vw, 14px); flex: none; }
body[data-tier="sprout"] .ls-dots i { width: clamp(9px, 2.8vw, 16px); height: clamp(9px, 2.8vw, 16px); }
.pip-corner { top: auto; bottom: calc(4 * clamp(46px, 8vh, 64px) + 40px); right: 0; }

@media (max-width: 400px) { .fc-actions .btn { padding-left: 10px; padding-right: 10px; } .fc-actions .btn.big { font-size: 17px; } }
