:root {
  --accent: #7950f2;
  --bg: #f8f4ff;
  --card: #ffffff;
  --ink: #2b2d42;
  --muted: #6c6f80;
  --good: #2f9e44;
  --bad: #e03131;
  --shade: #ffa94d;
  --radius: 18px;
  --shadow: 0 4px 0 rgba(0,0,0,.08), 0 8px 24px rgba(60,40,120,.08);
  font-family: ui-rounded, "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh;
  background-image: radial-gradient(circle at 10% 0%, #ffe3f1 0, transparent 35%), radial-gradient(circle at 90% 10%, #d0ebff 0, transparent 35%); }
button { font: inherit; color: inherit; cursor: pointer; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: color-mix(in srgb, var(--accent) 92%, white); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.topbar h1 { font-size: clamp(1rem, 3.5vw, 1.4rem); margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.stars, .ai-status { background: rgba(255,255,255,.22); padding: 5px 10px; border-radius: 999px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.icon-btn { background: rgba(255,255,255,.25); border: 0; border-radius: 12px; padding: 6px 12px; font-size: 1.2rem; color: inherit; }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* Home */
.hero { text-align: center; margin: 12px 0 20px; }
.hero h2 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0; }
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.grade-card { border: 0; background: var(--card); border-radius: var(--radius); padding: 16px 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px; border-bottom: 6px solid var(--c);
  animation: pop .4s both; transition: transform .15s; }
.grade-card:hover { transform: translateY(-4px) rotate(-1deg); }
.grade-num { width: 64px; height: 64px; border-radius: 50%; background: var(--c); color: #fff; font-size: 2rem; font-weight: 900;
  display: grid; place-items: center; text-shadow: 0 2px 0 rgba(0,0,0,.15); }
.grade-name { font-weight: 800; }
.grade-meta { color: var(--muted); font-size: .8rem; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.topic-card { border: 0; background: var(--card); border-radius: var(--radius); padding: 18px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 6px; animation: pop .4s both; transition: transform .15s; border-top: 6px solid var(--accent); }
.topic-card:hover { transform: scale(1.04); }
.topic-icon { font-size: 2.6rem; }
.topic-name { font-weight: 800; text-align: center; }
.topic-stars { font-size: .8rem; color: var(--muted); }

/* Player */
.player { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 18px; }
.round-info { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.prompt { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--accent) 10%, white); border-radius: 14px; padding: 12px 14px; }
.prompt-text { flex: 1; font-size: clamp(1.1rem, 3.5vw, 1.5rem); font-weight: 800; }
.icon-btn.speak { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.activity-area { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0; min-height: 200px; }
.activity-area.shake { animation: shake .4s; }
.feedback { min-height: 1.8em; text-align: center; font-size: 1.25rem; font-weight: 800; }
.feedback.good { color: var(--good); animation: pop .4s; }
.feedback.bad { color: var(--bad); }
.feedback.info { color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.btn { border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 800; font-size: 1.05rem; box-shadow: 0 4px 0 rgba(0,0,0,.15); transition: transform .1s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn.check { background: var(--good); color: #fff; }
.btn.next { background: var(--accent); color: #fff; }
.btn.hint { background: #fff3bf; }
.btn.how { background: #d0ebff; }
.btn.ghost { background: #f1f3f5; color: var(--muted); }
.btn:disabled { opacity: .5; }
.help-box { margin-top: 14px; display: grid; gap: 10px; }
.help { background: #fff9db; border-radius: 14px; padding: 12px 14px; line-height: 1.5; }
.help ol { margin: 6px 0; padding-left: 22px; }
.help.ai { background: #f3f0ff; white-space: pre-wrap; }
.help.thinking { color: var(--muted); animation: pulse 1.2s infinite; }
.answer-reveal { margin-top: 6px; }

/* Shared inputs */
.num-input { font: inherit; font-size: 1.5rem; font-weight: 800; width: 120px; padding: 8px 10px; text-align: center; border: 3px solid #dee2e6; border-radius: 12px; outline: none; }
.num-input:focus { border-color: var(--accent); }
.answer-row { display: flex; align-items: center; gap: 8px; font-size: 1.4rem; font-weight: 800; flex-wrap: wrap; justify-content: center; }
.choices { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.choice { min-width: 76px; padding: 14px 18px; font-size: 1.6rem; font-weight: 900; background: #fff; border: 3px solid #dee2e6; border-radius: 16px; transition: transform .1s; }
.choice:hover { transform: scale(1.06); }
.choice.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, white); }
.small-btn { border: 0; background: color-mix(in srgb, var(--accent) 15%, white); border-radius: 10px; min-width: 40px; padding: 8px 12px; font-weight: 900; font-size: 1.1rem; }
.small-btn.wide { padding: 10px 16px; font-size: 1rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.tap-counter, .drag-tip { color: var(--muted); font-weight: 700; }
.equation { font-size: 1.4rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }

/* Counting */
.emoji-field { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
.emoji-item { font-size: 2.6rem; background: none; border: 3px dashed transparent; border-radius: 50%; width: 70px; height: 70px; position: relative; animation: drop .5s both; }
.emoji-item.counted { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); }
.emoji-item.counted::after { content: attr(data-num); position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff; font-size: .9rem; font-weight: 900; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.compare { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.group-box { width: 230px; min-height: 160px; background: #f8f9fa; border: 4px solid #dee2e6; border-radius: 18px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 4px; padding: 10px; }
.group-box.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, white); }
.emoji-small { font-size: 2rem; }
.shape-grid { display: grid; grid-template-columns: repeat(3, 100px); gap: 10px; }
.shape-btn { width: 100px; height: 100px; background: #f8f9fa; border: 4px solid transparent; border-radius: 18px; padding: 12px; }
.shape-btn.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); }
.shape { width: 100%; height: 100%; }

/* Ten frames */
.tenframes { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.tenframe { display: grid; grid-template-columns: repeat(5, 52px); grid-template-rows: repeat(2, 52px); border: 4px solid #495057; border-radius: 6px; background: #fff; }
.tf-cell { border: 2px solid #adb5bd; display: grid; place-items: center; }
.tf-cell.empty { cursor: pointer; }
.tf-cell.empty:hover { background: #e7f5ff; }
.counter { width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); cursor: pointer; transition: opacity .2s, transform .2s; }
.counter.red { background: #ff6b6b; }
.counter.blue { background: #4dabf7; }
.counter.pop { animation: pop .3s; }
.counter.gone { opacity: .25; transform: scale(.7); background: repeating-linear-gradient(45deg, #ff6b6b, #ff6b6b 4px, #fff 4px, #fff 8px); }

/* Place value */
.pv-tray { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.pv-col { background: #f8f9fa; border-radius: 16px; padding: 10px; width: 180px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pv-head { font-weight: 900; }
.pv-blocks { min-height: 130px; display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-end; justify-content: center; }
.pv-block { animation: pop .25s; }
.pv-o { width: 14px; height: 14px; background: #fcc419; border: 1px solid #e67700; }
.pv-t { width: 14px; height: 120px; background: repeating-linear-gradient(#51cf66 0 11px, #2f9e44 11px 12px); border: 1px solid #2f9e44; }
.pv-h { width: 60px; height: 60px; background: repeating-linear-gradient(90deg, #4dabf7 0 5px, #1c7ed6 5px 6px), #4dabf7; border: 1px solid #1c7ed6; }
.pv-buttons { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.2rem; }
.pv-total { font-size: 1.4rem; font-weight: 900; }

/* Clock */
.clock { width: 230px; }
.clock-face { fill: #fff; stroke: var(--accent); stroke-width: 6; }
.clock-num { font-size: 18px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.tick { stroke: #adb5bd; stroke-width: 2; }
.hand { stroke-linecap: round; }
.hand.hour { stroke: #2b2d42; stroke-width: 8; }
.hand.minute { stroke: #e8590c; stroke-width: 5; }

/* Number line */
.numberline { width: 100%; max-width: 680px; touch-action: none; cursor: pointer; }
.nl-axis { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.nl-tick { stroke: var(--ink); stroke-width: 2; }
.nl-label { font-size: 15px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.nl-show { font-size: 15px; font-weight: 900; text-anchor: middle; fill: var(--muted); }
.nl-marker circle { fill: var(--accent); stroke: #fff; stroke-width: 3; }
.nl-val { font-size: 18px; font-weight: 900; text-anchor: middle; fill: var(--accent); }
.nl-arc { fill: none; stroke: #fd7e14; stroke-width: 3; stroke-dasharray: 6 5; }

/* Fractions */
.frac-pie { width: 230px; }
.frac-bar { width: 100%; max-width: 460px; }
.frac-part { fill: #fff; stroke: var(--ink); stroke-width: 3; cursor: pointer; transition: fill .15s; }
.frac-part.on { fill: var(--shade); }
.frac-part:hover { fill: #ffe8cc; }
.frac-part.on:hover { fill: #ff922b; }
.frac-label { font-size: 1.3rem; }
.frac-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 520px; font-weight: 900; font-size: 1.2rem; }
.frac-row span { width: 50px; text-align: right; }
.frac-row svg { flex: 1; }

/* Arrays */
.array-grid { display: grid; grid-template-columns: repeat(10, 30px); gap: 4px; }
.array-dot { width: 30px; height: 30px; border-radius: 50%; background: #e9ecef; cursor: pointer; transition: background .1s, transform .1s; }
.array-dot.on { background: #f06595; transform: scale(1.05); }
.area-model { display: grid; gap: 6px; width: 100%; max-width: 560px; }
.am-head { font-weight: 900; text-align: center; align-self: center; }
.am-cell { background: #e7f5ff; border: 3px solid #74c0fc; border-radius: 12px; min-height: 80px; display: grid; place-items: center; padding: 6px; transition: background .2s; }
.am-cell.ok { background: #d3f9d8; border-color: #51cf66; }
.am-cell .num-input { width: 100%; max-width: 110px; font-size: 1.2rem; }

/* Angle */
.angle-svg { width: 100%; max-width: 440px; touch-action: none; }
.protractor { fill: #e7f5ff; stroke: #74c0fc; stroke-width: 2; opacity: .8; }
.prot-num { font-size: 12px; text-anchor: middle; fill: #1c7ed6; font-weight: 700; }
.arm { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.knob { fill: #fd7e14; stroke: #fff; stroke-width: 3; cursor: grab; }
.angle-wedge { fill: rgba(253,126,20,.3); }
.angle-val { font-size: 20px; font-weight: 900; text-anchor: middle; fill: var(--ink); }

/* Percent */
.pct-grid { display: grid; grid-template-columns: repeat(10, 30px); gap: 2px; touch-action: none; user-select: none; }
.pct-cell { width: 30px; height: 30px; background: #e9ecef; border-radius: 4px; cursor: pointer; }
.pct-cell.on { background: #20c997; }
.pct-bar { display: flex; width: 100%; max-width: 520px; height: 60px; border: 3px solid var(--ink); border-radius: 8px; overflow: hidden; }
.pct-seg { flex: 1; min-width: 0; overflow: hidden; border: 0; border-right: 2px solid var(--ink); background: #fff; font-weight: 900; font-size: 1.1rem; }
.pct-seg:last-child { border-right: 0; }
.pct-seg.on { background: #63e6be; }
.pct-scale { display: flex; justify-content: space-between; width: 100%; max-width: 520px; font-weight: 800; color: var(--muted); }

/* Ratio */
.ratio-tape { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ratio-group { background: #fff4e6; border: 3px solid #ffa94d; border-radius: 12px; padding: 6px 10px; font-size: 1.5rem; text-align: center; animation: pop .25s; }

/* Grid area */
.grid-svg { width: 100%; max-width: 480px; }
.gridline { stroke: #dee2e6; stroke-width: 1; }
.axis { stroke: #495057; stroke-width: 2; }
.area-shape { fill: rgba(121,80,242,.35); stroke: var(--accent); stroke-width: 3; }
.height-line { stroke: #e8590c; stroke-width: 2; stroke-dasharray: 5 4; }
.dim { font-size: 13px; text-anchor: middle; font-weight: 800; fill: var(--ink); }

/* Spinner */
.spinner { width: 220px; }
.wheel { transform-origin: 120px 120px; transition: transform 1.2s cubic-bezier(.2,.8,.3,1); }
.tally { font-weight: 800; color: var(--muted); }

/* Balance scale */
.balance { width: 100%; max-width: 480px; }
.stand { fill: #868e96; }
.beam { fill: #495057; }
.scale-arm { transform-origin: 230px 117px; transition: transform .8s cubic-bezier(.3,1.6,.5,1); }
.string { fill: rgba(255,255,255,.6); stroke: #868e96; stroke-width: 3; }
.pivot { fill: #fcc419; }
.xbox { fill: #845ef7; rx: 3; }
.xbox-t { fill: #fff; font-size: 12px; font-weight: 900; text-anchor: middle; }
.unit { fill: #ffa94d; stroke: #e8590c; stroke-width: 1.5; }

/* Graphs */
.graph-wrap { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; align-items: center; width: 100%; }
.graph-side { display: flex; flex-direction: column; gap: 12px; min-width: 240px; flex: 1; max-width: 340px; }
.plot { width: 100%; max-width: 420px; background: #fff; border: 2px solid #dee2e6; border-radius: 12px; touch-action: none; transition: box-shadow .3s; }
.plot.matched { box-shadow: 0 0 0 5px #51cf66; }
.axis-num { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.axis-num.end { text-anchor: end; }
.target-curve { fill: none; stroke: #adb5bd; stroke-width: 5; stroke-dasharray: 10 7; }
.my-curve { fill: none; stroke: var(--accent); stroke-width: 4; }
.line-a { fill: none; stroke: #f03e3e; stroke-width: 4; }
.line-b { fill: none; stroke: #1c7ed6; stroke-width: 4; }
.guess-dot { fill: #fcc419; stroke: #333; stroke-width: 2; }
.legend { font-weight: 800; padding-left: 10px; border-left: 6px solid #adb5bd; }
.legend.a { border-color: #f03e3e; } .legend.b { border-color: #1c7ed6; }
.legend.cos { border-color: #f03e3e; } .legend.sin { border-color: #1c7ed6; }
.sliders { display: grid; gap: 10px; }
.slider { display: grid; gap: 4px; font-weight: 700; }
.slider input { width: 100%; accent-color: var(--accent); height: 28px; }
.tangent { stroke: #f03e3e; stroke-width: 3; }
.rise-run { fill: none; stroke: #2f9e44; stroke-width: 3; stroke-dasharray: 5 4; }
.riemann { fill: rgba(121,80,242,.25); stroke: var(--accent); stroke-width: 1; }

/* Triangles & circles */
.tri-svg { width: 100%; max-width: 420px; }
.tri { fill: #fff3bf; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.right-angle { fill: none; stroke: var(--ink); stroke-width: 2; }
.side-lbl { font-size: 18px; font-weight: 900; text-anchor: middle; fill: var(--accent); }
.side-lbl.end { text-anchor: end; } .side-lbl.start { text-anchor: start; }
.angle-lbl { font-size: 16px; font-weight: 800; fill: #e8590c; }
.angle-arc { fill: none; stroke: #e8590c; stroke-width: 2; }
.sq { stroke-width: 2; opacity: .7; }
.sq-a { fill: #ffc9c9; stroke: #f03e3e; } .sq-b { fill: #a5d8ff; stroke: #1c7ed6; } .sq-c { fill: #b2f2bb; stroke: #2f9e44; }
.circle-svg { width: 240px; }
.circ-fill { fill: rgba(121,80,242,.25); stroke: var(--accent); stroke-width: 4; }
.circ-edge { fill: none; stroke: var(--accent); stroke-width: 8; stroke-dasharray: 628; animation: draw 1.5s ease-out; }
.radius { stroke: #e8590c; stroke-width: 3; }

/* Unit circle */
.unit-circle { width: 100%; max-width: 320px; touch-action: none; }
.uc-circle { fill: none; stroke: var(--ink); stroke-width: 2; }
.uc-tick { fill: #868e96; }
.cos-line { stroke: #f03e3e; stroke-width: 4; }
.sin-line { stroke: #1c7ed6; stroke-width: 4; }
.c-cos { color: #f03e3e; } .c-sin { color: #1c7ed6; }

/* Word problems */
.word-problem { background: #fff9db; border-radius: 16px; padding: 16px 20px; font-size: 1.25rem; max-width: 620px; text-align: center; }
.word-problem p { margin: 0 0 6px; }
.word-problem .src { color: var(--muted); }
.word-problem.loading { animation: pulse 1.2s infinite; }

/* Confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
#confetti i { position: absolute; bottom: 30%; width: 10px; height: 14px; border-radius: 2px; animation: confetti 1.3s ease-out forwards; }

/* ---------- Grade page: strands, mixed review, mastery */
.grade-course { font-size: .72rem; font-weight: 800; color: var(--c); }
.grade-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.grade-head h2 { margin: 0; font-size: 1.8rem; }
.course { color: var(--muted); font-weight: 700; }
.strand { margin-bottom: 22px; }
.strand-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.strand-head h3 { margin: 0; font-size: 1.15rem; flex: 1; }
.strand-code { background: var(--accent); color: #fff; font-weight: 900; border-radius: 8px; padding: 3px 8px; font-size: .8rem; }
.strand-meta { color: var(--muted); font-size: .85rem; font-weight: 700; }
.mastery { width: 80%; height: 6px; background: #e9ecef; border-radius: 3px; overflow: hidden; }
.mastery i { display: block; height: 100%; background: linear-gradient(90deg, #ffd43b, #51cf66); }
.home-links { display: flex; justify-content: center; margin: 20px 0; }
.player-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.round-info { margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip { background: color-mix(in srgb, var(--accent) 15%, white); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.set-dots { display: flex; gap: 5px; }
.set-dots i { width: 14px; height: 14px; border-radius: 50%; background: #e9ecef; display: block; }
.set-dots.big { justify-content: center; margin: 10px 0; } .set-dots.big i { width: 22px; height: 22px; }
.set-dots .dot-now { background: #fff; box-shadow: 0 0 0 3px var(--accent) inset; }
.set-dots .dot-first { background: #51cf66; } .set-dots .dot-later { background: #a9e34b; }
.set-dots .dot-shown { background: #74c0fc; } .set-dots .dot-skipped { background: #ced4da; }
.summary { text-align: center; padding: 16px 0; }
.summary-msg { font-size: 2rem; font-weight: 900; }
.summary-score { font-size: 3.4rem; font-weight: 900; color: var(--accent); }
.summary-list { list-style: none; padding: 0; margin: 10px 0 18px; line-height: 1.9; font-weight: 700; }

/* Progress page */
.progress-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.big-stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; display: grid; }
.big-stat b { font-size: 1.8rem; } .big-stat span { color: var(--muted); font-weight: 700; font-size: .85rem; }
.progress-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; border-left: 8px solid var(--c); }
.progress-card h3 { margin: 0 0 8px; }
.progress-row { display: grid; grid-template-columns: minmax(120px, 1.3fr) 2fr auto; gap: 10px; align-items: center; padding: 4px 0; font-weight: 700; font-size: .9rem; }
.pr-bar { height: 12px; background: #e9ecef; border-radius: 6px; overflow: hidden; } .pr-bar i { display: block; height: 100%; }
.pr-num { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.pr-weak { font-size: .85rem; color: #e8590c; margin: 0 0 6px; }
.empty-note { text-align: center; color: var(--muted); }

/* Money */
.money-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.money-tray { min-height: 90px; width: 100%; max-width: 620px; background: #f1f8f2; border: 3px dashed #8ce99a; border-radius: 16px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; padding: 8px; }
.money-tray.static { border-style: solid; background: #fff9db; border-color: #ffe066; }
.tray-empty { color: var(--muted); font-weight: 700; }
.money-palette { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.money-btn { background: none; border: 0; padding: 2px; display: inline-flex; transition: transform .1s; }
.money-btn:hover { transform: scale(1.08); } .money-btn.in-tray { animation: pop .2s; }
.coin-t { font-size: 15px; font-weight: 900; text-anchor: middle; fill: #343a40; }
.bill-t { font-size: 20px; font-weight: 900; text-anchor: middle; fill: #1b1b1b; }
.receipt { font-family: ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 1px solid #dee2e6; box-shadow: var(--shadow); padding: 12px 16px; width: min(320px, 100%); border-radius: 4px; }
.receipt-h { text-align: center; font-weight: 900; margin-bottom: 6px; }
.receipt-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.receipt-row.total { border-top: 2px dashed #adb5bd; margin-top: 4px; padding-top: 6px; font-weight: 900; }
.price-tag { background: #fff; border: 3px solid var(--accent); border-radius: 18px; padding: 14px 18px; width: min(420px, 100%); display: grid; gap: 8px; position: relative; }
.tag-title { font-size: 1.3rem; font-weight: 900; }
.tag-badge { position: absolute; top: -14px; right: 14px; background: #fa5252; color: #fff; font-weight: 900; padding: 4px 12px; border-radius: 999px; transform: rotate(6deg); }
.tag-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 700; border-radius: 10px; padding: 2px 6px; transition: background .2s; }
.tag-row.ok { background: #d3f9d8; }
.tag-row .num-input { width: 110px; font-size: 1.1rem; padding: 4px 6px; }
.dollar { display: flex; align-items: center; gap: 4px; font-weight: 900; }
.budget { width: min(520px, 100%); background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px; }
.budget-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid #f1f3f5; }
.budget-row.income b { color: var(--good); } .budget-row.save { border: 0; font-weight: 900; }
.budget-bar { display: flex; width: min(520px, 100%); height: 44px; border-radius: 10px; overflow: hidden; font-size: .7rem; font-weight: 800; }
.budget-bar > div { display: grid; place-items: center; overflow: hidden; white-space: nowrap; padding: 0 2px; }
.budget-bar .save-seg { background: repeating-linear-gradient(45deg, #d3f9d8, #d3f9d8 6px, #b2f2bb 6px, #b2f2bb 12px); font-size: .9rem; }
.interest-chart { width: 100%; max-width: 440px; }
.ibar rect { fill: #74c0fc; } .ibar { opacity: 0; transition: opacity .3s; } .ibar.shown { opacity: 1; }
.ibar.mystery rect { fill: #ffd43b; }
.ibar-v { font-size: 12px; font-weight: 800; text-anchor: middle; fill: var(--ink); } .ibar-y { font-size: 12px; text-anchor: middle; fill: var(--muted); }

/* Coding robot */
.robot-wrap { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; align-items: flex-start; width: 100%; }
.robot-grid { position: relative; display: grid; width: min(380px, 100%); aspect-ratio: 1; background: #f8f9fa; border: 3px solid #495057; border-radius: 10px; }
.robot-cell { border: 1px solid #dee2e6; display: grid; place-items: center; font-size: clamp(1rem, 4vw, 1.7rem); }
.robot { position: absolute; display: grid; place-items: center; font-size: clamp(1.1rem, 4.5vw, 1.9rem); transition: left .25s, top .25s; pointer-events: none; }
.robot.crash { animation: shake .4s; }
.robot-side { display: flex; flex-direction: column; gap: 8px; min-width: 240px; flex: 1; max-width: 360px; }
.code-palette, .program { display: flex; flex-wrap: wrap; gap: 6px; }
.program { min-height: 52px; background: #f3f0ff; border-radius: 12px; padding: 6px; align-items: center; }
.code-block { border: 0; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.15); border-radius: 10px; padding: 8px 10px; font-size: 1.15rem; font-weight: 900; }
.code-block.repeat { background: #fff3bf; font-size: .95rem; } .code-block.pending { background: #ffe066; animation: pulse 1s infinite; font-size: .9rem; }

/* Patterns & data */
.pattern-row { display: flex; flex-wrap: wrap; gap: 6px; font-size: 2.2rem; justify-content: center; }
.pattern-row span { animation: drop .4s both; } .pattern-q { border: 3px dashed var(--accent); border-radius: 12px; padding: 0 12px; color: var(--accent); font-weight: 900; }
.figures { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; align-items: flex-end; }
.fig { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: .9rem; }
.fig-q { width: 70px; height: 70px; border: 3px dashed var(--accent); border-radius: 12px; display: grid; place-items: center; font-size: 2rem; color: var(--accent); }
.tile { fill: #ffa94d; stroke: #e8590c; } .tile.fixed { fill: #ced4da; stroke: #868e96; }
.pattern-table, .tally-table { border-collapse: collapse; font-weight: 800; }
.pattern-table th, .pattern-table td, .tally-table th, .tally-table td { border: 2px solid #dee2e6; padding: 6px 12px; text-align: center; }
.tally-table caption { font-weight: 900; margin-bottom: 4px; } .tally { font-size: 1.3rem; letter-spacing: 2px; min-width: 120px; text-align: left !important; }
.bar-chart { width: 100%; max-width: 480px; background: #fff; border-radius: 12px; touch-action: none; }
.bar-chart.editable .bar { stroke: #495057; stroke-width: 1; } .bar-chart.editable { cursor: ns-resize; }
.chart-title { font-size: 14px; font-weight: 900; text-anchor: middle; } .bar-lbl { font-size: 12px; font-weight: 800; text-anchor: middle; }
.dot-plot { width: 100%; max-width: 540px; } .dot { fill: var(--accent); animation: pop .3s both; }
.data-card { background: #f8f9fa; border-radius: 12px; padding: 10px 14px; text-align: center; max-width: 560px; }
.data-list { font-size: 1.3rem; font-weight: 900; margin-top: 4px; }

/* Measurement */
.ruler-svg { width: 100%; max-width: 620px; }
.ruler-body { fill: #fff3bf; stroke: #e67700; stroke-width: 2; } .ruler-tick { stroke: #5c3d00; stroke-width: 1; }
.ruler-num { font-size: 12px; text-anchor: middle; font-weight: 800; } .ruler-unit { font-size: 10px; text-anchor: end; fill: var(--muted); }
.guide { stroke: #e8590c; stroke-width: 1; stroke-dasharray: 3 3; }
.stairs { display: flex; gap: 4px; align-items: flex-start; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
.stair { background: #e7f5ff; border: 2px solid #74c0fc; border-radius: 10px; padding: 6px 8px; display: grid; text-align: center; min-width: 54px; }
.stair b { font-size: 1.1rem; } .stair small { color: var(--muted); font-size: .65rem; }
.stair.from { background: #ffe8cc; border-color: #fd7e14; } .stair.to { background: #d3f9d8; border-color: #40c057; }
.thermo { width: 160px; touch-action: none; cursor: ns-resize; }
.thermo-tube { fill: #fff; stroke: #adb5bd; stroke-width: 3; } .thermo-bulb { fill: #fff; stroke: #adb5bd; stroke-width: 3; }
.mercury, .mercury-bulb { fill: #fa5252; } .thermo-num { font-size: 13px; font-weight: 800; }
.zero-line { stroke: #4dabf7; stroke-width: 2; stroke-dasharray: 4 3; } .thermo-start { font-size: 13px; font-weight: 900; fill: var(--muted); }

/* Coordinates, vectors, counting */
.point-a { fill: #845ef7; } .pt-lbl { font-size: 15px; font-weight: 900; fill: var(--ink); } .pt-lbl.u { fill: #f03e3e; } .pt-lbl.v { fill: #1c7ed6; }
.vec-u { stroke: #f03e3e; stroke-width: 4; } .vec-v { stroke: #1c7ed6; stroke-width: 4; } .vec-v.ghost { stroke-dasharray: 5 5; opacity: .6; } .vec-g { stroke: #2f9e44; stroke-width: 4; stroke-dasharray: 6 4; }
.ar-u { fill: #f03e3e; } .ar-v { fill: #1c7ed6; } .ar-g { fill: #2f9e44; }
.slots { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.slot { display: grid; gap: 4px; text-align: center; background: #f8f9fa; border: 3px solid #dee2e6; border-radius: 14px; padding: 8px; transition: background .2s; }
.slot.ok { background: #d3f9d8; border-color: #51cf66; } .slot .num-input { width: 80px; } .times { font-size: 1.6rem; font-weight: 900; }

@media (max-width: 600px) {
  .progress-summary { grid-template-columns: 1fr 1fr 1fr; gap: 6px; } .big-stat b { font-size: 1.3rem; }
  .progress-row { grid-template-columns: 1fr; gap: 2px; }
  .grade-head h2 { font-size: 1.4rem; }
}

/* ---------- Course page */
.topic-card { position: relative; }
.topic-card.mastered { background: linear-gradient(180deg, #fff9db, #fff); }
.topic-card .badge { position: absolute; top: 8px; right: 10px; font-size: 1.3rem; }
.level-pips { display: flex; gap: 4px; }
.level-pips i { width: 12px; height: 12px; border-radius: 50%; background: #e9ecef; display: block; }
.level-pips i.tried { background: #ffe066; } .level-pips i.done { background: #51cf66; }
.level-pips i.m { border-radius: 3px; } .level-pips i.m.done { background: #fab005; }
.course-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 16px; flex-wrap: wrap; }
.course-head h2 { margin: 0; font-size: 1.7rem; }
.topic-icon.big { font-size: 3.4rem; }
.mastered-pill { background: #fab005; color: #fff; font-weight: 900; border-radius: 999px; padding: 6px 14px; margin-left: auto; }
.course-path { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: s; }
.course-step { width: 100%; display: flex; align-items: center; gap: 12px; background: var(--card); border: 3px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; text-align: left; transition: transform .12s; }
.course-step:hover:not(:disabled) { transform: translateX(4px); }
.course-step.next { border-color: var(--accent); }
.course-step.done { background: #f4fce3; }
.course-step.locked { opacity: .55; cursor: not-allowed; }
.cs-num { width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, white); display: grid; place-items: center; font-weight: 900; flex: none; }
.course-step.done .cs-num { background: #51cf66; color: #fff; }
.cs-icon { font-size: 1.5rem; min-width: 52px; text-align: center; }
.cs-text { display: grid; flex: 1; } .cs-text small { color: var(--muted); }
.cs-score { font-weight: 800; color: var(--muted); white-space: nowrap; } .cs-go { font-weight: 900; color: var(--accent); white-space: nowrap; }

/* Lesson */
.lesson { display: grid; gap: 14px; }
.lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lesson-top h2 { margin: 0; }
.big-idea { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, white), #fff); border-radius: 20px; padding: 16px 20px; box-shadow: var(--shadow); }
.big-idea small { font-weight: 900; letter-spacing: 1px; color: var(--accent); }
.big-idea p { font-size: 1.3rem; margin: 6px 0 0; line-height: 1.5; }
.lesson-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; animation: pop .4s both; line-height: 1.55; }
.lesson-card h3 { margin: 0 0 8px; }
.lesson-card p { margin: 6px 0 0; }
.lesson-card.mistake { background: #fff4e6; } .lesson-card.real { background: #e7f5ff; } .lesson-card.words { background: #f8f0fc; }
.lesson-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.lesson-card dt { font-weight: 900; } .lesson-card dd { margin: 0; }
.lesson-visual { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0; overflow-x: auto; }
.auto-note { color: var(--muted); font-size: .85rem; text-align: center; }
.vis-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.vis-big { font-size: 1.8rem; }
.vis-box { background: #f1f3f5; border: 2px solid #ced4da; border-radius: 10px; padding: 4px 10px; font-weight: 800; }
.vis-box.red { background: #ffc9c9; border-color: #f03e3e; } .vis-box.blue { background: #a5d8ff; border-color: #1c7ed6; } .vis-box.green { background: #b2f2bb; border-color: #2f9e44; }
.vis-arrow { font-weight: 900; color: var(--accent); font-size: 1.2rem; }
.vis-frame { display: grid; grid-template-columns: repeat(5, 26px); grid-template-rows: repeat(2, 26px); border: 3px solid #495057; }
.vis-frame i { border: 1px solid #adb5bd; position: relative; }
.vis-frame i.r::after, .vis-frame i.b::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #ff6b6b; }
.vis-frame i.b::after { background: #4dabf7; }
.vis-bar { display: inline-flex; border: 2px solid var(--ink); height: 30px; width: min(300px, 70vw); }
.vis-bar i { flex: 1; border-right: 2px solid var(--ink); } .vis-bar i:last-child { border-right: 0; } .vis-bar i.on { background: var(--shade); }
.vis-ten { display: inline-block; width: 12px; height: 80px; background: repeating-linear-gradient(#51cf66 0 7px, #2f9e44 7px 8px); margin-right: 3px; }
.vis-one { display: inline-block; width: 12px; height: 12px; background: #fcc419; border: 1px solid #e67700; margin-right: 3px; }
.vis-array { display: grid; grid-template-columns: repeat(var(--c), 22px); gap: 5px; }
.vis-array i { width: 22px; height: 22px; border-radius: 50%; background: #f06595; }
.vis-array.sq i { border-radius: 3px; background: #b197fc; }
.vis-grid100 { display: grid; grid-template-columns: repeat(10, 16px); gap: 2px; }
.vis-grid100 i { width: 16px; height: 16px; background: #e9ecef; } .vis-grid100 i.on { background: #20c997; }
.vis-table { border-collapse: collapse; font-size: .95rem; }
.vis-table th, .vis-table td { border: 2px solid #dee2e6; padding: 5px 10px; text-align: center; } .vis-table th { background: #f8f9fa; }
.vis-dots { font-size: 1.1rem; }

/* Watch me */
.watch-panel { background: #f8f9fa; border-radius: 14px; padding: 12px 16px; margin-top: 8px; }
.watch-steps { margin: 8px 0; padding-left: 22px; line-height: 1.7; font-size: 1.1rem; }
.watch-steps li.pop-in { animation: pop .35s; }
.answer-reveal.big { font-size: 1.3rem; }
.player.mastery { border: 4px solid #fab005; }
.trophy-big { font-size: 5rem; animation: pop .6s; }
.grown-ups { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin: 20px 0; display: grid; gap: 10px; justify-items: start; }
.grown-ups h3 { margin: 0; } .toggle { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes drop { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes draw { from { stroke-dashoffset: 628; } to { stroke-dashoffset: 0; } }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

@media (max-width: 600px) {
  main { padding: 10px; }
  .player { padding: 12px; }
  .ai-status { display: none; }
  .tenframe { grid-template-columns: repeat(5, 44px); grid-template-rows: repeat(2, 44px); }
  .counter { width: 32px; height: 32px; }
  .array-grid { grid-template-columns: repeat(10, 26px); }
  .array-dot { width: 26px; height: 26px; }
  .pct-grid { grid-template-columns: repeat(10, 28px); }
  .pct-cell { width: 28px; height: 28px; }
  .emoji-item { width: 58px; height: 58px; font-size: 2.1rem; }
}

/* ================= Coding, Robots & AI ================= */
.vis-box.good { background: #d3f9d8; border-color: #2f9e44; } .vis-box.bad { background: #ffe3e3; border-color: #e03131; }
.vis-code { background: #1e1e2e; color: #e0def4; border-radius: 10px; padding: 10px 14px; font: 600 .9rem/1.5 ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; overflow-x: auto; text-align: left; margin: 0; white-space: pre; max-width: 100%; }
.code-box { background: #1e1e2e; color: #e0def4; border-radius: 12px; padding: 10px 0; font: 600 clamp(.85rem, 2.6vw, 1.05rem)/1.6 ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; text-align: left; overflow-x: auto; max-width: 100%; min-width: min(420px, 100%); }
.code-line { display: flex; white-space: pre; padding: 0 14px 0 0; }
.code-line .ln, .parsons-line .ln { color: #6e6a86; width: 2.4em; text-align: right; padding-right: 12px; user-select: none; flex: none; }
.c-kw { color: #c4a7e7; } .c-fn { color: #9ccfd8; } .c-str { color: #f6c177; } .c-num { color: #eb6f92; } .c-com { color: #6e6a86; font-style: italic; }
.block-box { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; }
.blk { padding: 7px 14px; border-radius: 8px; font-weight: 800; color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.18); font-size: 1.05rem; }
.blk.ctl { background: #f59f00; } .blk.look { background: #845ef7; } .blk.var { background: #fd7e14; } .blk.do { background: #339af0; }
.choices.text-choices .choice { font-size: 1.05rem; font-weight: 800; min-width: 0; padding: 12px 16px; max-width: 100%; }
.choices.text-choices.stack { flex-direction: column; align-items: stretch; width: min(560px, 100%); }
.choices.text-choices.stack .choice { text-align: left; }
.ethics-icon { font-size: 3rem; }

/* Robot extras */
.robot-grid.tappable .robot-cell { cursor: pointer; }
.robot-grid.tappable .robot-cell:hover { background: color-mix(in srgb, var(--accent) 10%, white); }
.robot-cell.picked { background: color-mix(in srgb, var(--accent) 30%, white); box-shadow: inset 0 0 0 3px var(--accent); }
.robot .heading { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-start; line-height: 1; font-size: .5em; color: #e03131; transform-origin: 50% 50%; z-index: 2; pointer-events: none; transition: transform .25s; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.program.readonly .code-block { cursor: default; }
.code-block.selected { outline: 3px solid var(--accent); background: #fff3bf; }

/* Teach the robot */
.ai-boxes { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.ai-box { border: 3px dashed; border-radius: 16px; padding: 10px 14px; min-width: 180px; }
.ai-box.yes { border-color: #51cf66; background: #ebfbee; } .ai-box.no { border-color: #ff8787; background: #fff5f5; }
.ai-items { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 64px; margin-top: 6px; }
.ai-item.sz-big { font-size: 2.6rem; } .ai-item.sz-small { font-size: 1.4rem; }
.ai-new { display: flex; gap: 10px; align-items: center; font-weight: 900; font-size: 1.3rem; background: #fff; border-radius: 14px; padding: 6px 16px; box-shadow: var(--shadow); }

/* Parsons */
.parsons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; text-align: left; }
.parsons-pool, .parsons-prog { display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.parsons-pool { background: #f1f3f5; border-radius: 12px; padding: 8px; }
.parsons-prog { padding: 8px; }
.parsons-line { display: flex; text-align: left; white-space: pre; background: #1e1e2e; color: #e0def4; border: 0; border-radius: 8px; padding: 6px 10px; font: 600 clamp(.78rem, 2.4vw, .95rem)/1.4 ui-monospace, Menlo, Consolas, monospace; overflow-x: auto; }
.parsons-line.in { background: #2a2a3e; padding-left: 0; }
.parsons-line:hover { outline: 2px solid var(--accent); }

/* Algorithms */
.bs-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bs-chip { min-width: 44px; padding: 8px 6px; border-radius: 10px; border: 2px solid #ced4da; background: #fff; font-weight: 900; font-size: 1.1rem; text-align: center; transition: opacity .2s, transform .2s; }
.bs-row.small .bs-chip { min-width: 34px; padding: 5px 3px; font-size: .9rem; }
.bs-chip.out { opacity: .25; } .bs-chip.tapped { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, white); }
.bs-chip.found { border-color: var(--good); background: #b2f2bb; transform: scale(1.12); }
.bs-chip.cmp { border-color: #f59f00; background: #fff3bf; transform: translateY(-4px); } .bs-chip.sorted { background: #d3f9d8; border-color: #8ce99a; }

/* Plots for AI */
.plot { width: min(420px, 100%); background: #fff; border-radius: 12px; }
.plot-bg { fill: #f8f9fa; } .plot-grid { stroke: #e9ecef; } .plot-tick { font-size: 10px; fill: #868e96; } .plot-label { font-size: 11px; font-weight: 700; fill: #495057; }
.knn-pt { font-size: 17px; } .knn-q { fill: #fff3bf; stroke: #f59f00; stroke-width: 2.5; } .knn-qt { font-size: 15px; }
.knn-link { stroke: #f59f00; stroke-width: 2; stroke-dasharray: 4 3; }
.knn-k { font-weight: 800; color: var(--muted); }
.train-wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; align-items: center; width: 100%; }
.train-side { display: flex; flex-direction: column; gap: 10px; min-width: 240px; max-width: 340px; flex: 1; }
.nn-region { fill: #a5d8ff; opacity: .45; } .nn-boundary { stroke: #1c7ed6; stroke-width: 3; }
.nn-pt text { font-size: 15px; } .nn-pt .ring { fill: none; stroke: none; } .nn-pt.bad .ring { stroke: #e03131; stroke-width: 3; }
.nn-slider { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; font-weight: 700; font-size: .9rem; }
.nn-slider input { width: 100%; accent-color: var(--accent); }
.nn-rule { background: #f3f0ff; border-radius: 10px; padding: 8px 10px; font-weight: 600; }
.neuron-svg { width: min(460px, 100%); }
.nn-node { stroke-width: 3; } .nn-node.in { fill: #e7f5ff; stroke: #339af0; } .nn-node.hid { fill: #f3f0ff; stroke: #845ef7; } .nn-node.out { fill: #fff3bf; stroke: #f59f00; }
.nn-val { font-weight: 900; font-size: 15px; } .nn-w { font-size: 12px; font-weight: 800; fill: #495057; }
.nn-edge { stroke-width: 3; } .nn-edge.pos { stroke: #74c0fc; } .nn-edge.neg { stroke: #ffa8a8; }
.nn-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-weight: 700; color: var(--muted); }
.formula-card { background: #f3f0ff; border-radius: 12px; padding: 10px 16px; font: 700 1.05rem/1.7 ui-monospace, Menlo, Consolas, monospace; text-align: left; }

/* Decision trees */
.dt-item { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 14px; padding: 8px 16px; box-shadow: var(--shadow); text-align: left; }
.dt-emoji { font-size: 2.4rem; }
.dt-wrap { width: 100%; overflow-x: auto; text-align: center; }
.dt-title { font-weight: 900; margin-bottom: 6px; }
.dt-node { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.dt-q { background: #fff3bf; border: 2px solid #f59f00; border-radius: 10px; padding: 6px 10px; font-weight: 800; font-size: .9rem; max-width: 220px; }
.dt-kids { display: flex; gap: 10px; align-items: flex-start; }
.dt-branch { display: flex; flex-direction: column; align-items: center; gap: 4px; border-top: 2px solid #adb5bd; padding-top: 4px; }
.dt-yes, .dt-no { font-size: .75rem; font-weight: 900; padding: 1px 8px; border-radius: 999px; }
.dt-yes { background: #d3f9d8; color: #2b8a3e; } .dt-no { background: #ffe3e3; color: #c92a2a; }
.dt-leaf { background: #e7f5ff; border: 2px solid #74c0fc; border-radius: 10px; padding: 6px 8px; font-weight: 800; font-size: .85rem; max-width: 150px; }

/* Binary bulbs */
.bulbs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.bulb { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #343a40; border: 0; border-radius: 14px; padding: 10px 12px; color: #fff; min-width: 58px; }
.bulb .bulb-glass { font-size: 2rem; filter: grayscale(1) brightness(.5); transition: filter .2s; }
.bulb.on .bulb-glass { filter: drop-shadow(0 0 10px #ffd43b); }
.bulb.on { background: #495057; } .bulb.fixed { cursor: default; }
.bulb b { font-size: 1.1rem; }

@media (max-width: 600px) {
  .parsons { grid-template-columns: 1fr; }
  .code-box { min-width: 0; width: 100%; }
}

/* Longer rounds and Practice more */
.set-dots.many { flex-wrap: wrap; gap: 3px; max-width: 360px; justify-content: flex-end; }
.set-dots.many i { width: 9px; height: 9px; }
.set-dots.big.many { max-width: 520px; margin-left: auto; margin-right: auto; justify-content: center; } .set-dots.big.many i { width: 14px; height: 14px; }
.practice-more { margin: 4px 0 0 auto; display: block; border: 0; background: transparent; color: var(--accent); font-weight: 800; font-size: .9rem; padding: 4px 10px; border-radius: 999px; }
.practice-more:hover { background: color-mix(in srgb, var(--accent) 12%, white); }
.grown-ups select { font: inherit; font-weight: 700; padding: 4px 8px; border-radius: 8px; border: 2px solid #dee2e6; }
.grown-ups small { color: var(--muted); }

/* Timed tests */
.chapter-test { margin-left: 8px; border: 0; border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: .85rem; background: #fff3bf; color: #8f5b00; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.chapter-test:hover { background: #ffe066; }
.test-setup { display: flex; flex-direction: column; gap: 14px; }
.test-rules { font-weight: 700; color: var(--muted); margin: 0; }
.test-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.test-level { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; background: var(--card); border: 3px solid #dee2e6; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.test-level:hover { border-color: var(--accent); }
.test-level b { font-size: 1.15rem; } .test-level span { font-weight: 800; font-size: 1.3rem; } .test-level small { color: var(--muted); font-weight: 700; }
.test-timer { font-weight: 900; font-size: 1.1rem; background: #f1f3f5; border-radius: 999px; padding: 4px 12px; font-variant-numeric: tabular-nums; }
.test-timer.low { background: #ffe3e3; color: #c92a2a; animation: pulse 1s infinite; }
.set-dots .dot-timeout { background: #ffa8a8; }

.knn-ring { fill: rgba(255, 212, 59, 0.15); stroke: #f59f00; stroke-width: 2; stroke-dasharray: 5 4; }
.pct-bar.many .pct-seg { font-size: .62rem; padding: 0; letter-spacing: -.02em; }

/* ---------------------------------------------------------------- Video lessons (js/video.js) */
.v-player { --spd: 1; width: min(760px, 100%); margin: 0 auto 14px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.v-screen { position: relative; background: linear-gradient(180deg, #fffdf6, #f3f7ff); }
.v-stage { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.v-chip { position: absolute; top: 10px; left: 10px; background: var(--accent); color: #fff; font-weight: 800; font-size: .8rem; padding: 4px 10px; border-radius: 999px; }
.v-caption { min-height: 3.2em; padding: 10px 16px; font-size: 1.12rem; line-height: 1.4; font-weight: 600; background: #2b2d42; color: #fff; }
.v-caption b { color: #ffd43b; }
.v-progress { display: flex; gap: 3px; padding: 8px 12px 0; }
.v-seg { flex: 1; height: 8px; border: 0; padding: 0; border-radius: 4px; background: #e9ecef; cursor: pointer; }
.v-seg.q { background: #fff3bf; }
.v-seg.done { background: color-mix(in srgb, var(--accent) 55%, white); }
.v-seg.now { background: var(--accent); }
.v-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px 12px; }
.v-btn { border: 0; background: #f1f3f5; border-radius: 10px; min-width: 40px; height: 40px; padding: 0 10px; font-size: 1.05rem; font-weight: 800; cursor: pointer; }
.v-btn.main { background: var(--accent); color: #fff; min-width: 56px; }
.v-btn.on { background: color-mix(in srgb, var(--accent) 22%, white); }
.v-btn.speed { font-size: .85rem; }
.v-gap { flex: 1; }
.v-start { position: absolute; inset: 0; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-content: end; justify-content: center; column-gap: 12px; padding-bottom: 14px; border: 0; background: linear-gradient(to top, rgba(43,45,66,.85), rgba(43,45,66,0) 32%); color: #fff; cursor: pointer; font-size: 1.1rem; text-align: left; }
.v-start-icon { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 1.5rem; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.v-start b { align-self: end; }
.v-start small { max-width: 80%; opacity: .9; }
.v-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(255,255,255,.55); padding: 12px; }
.v-overlay.on { display: flex; }
.v-check { background: #fff; border-radius: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 14px 18px; max-width: 92%; text-align: center; border-top: 6px solid #fcc419; }
.v-check small { font-weight: 900; color: #e67700; letter-spacing: .05em; }
.v-check p { font-size: 1.2rem; font-weight: 800; margin: 6px 0 10px; }
.v-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.v-choice { border: 3px solid #dee2e6; background: #fff; border-radius: 12px; padding: 8px 16px; font-size: 1.15rem; font-weight: 800; cursor: pointer; min-width: 64px; }
.v-choice.right { border-color: #2f9e44; background: #d3f9d8; }
.v-choice.wrong { border-color: #e03131; background: #ffe3e3; }
.v-choice.go { background: var(--accent); color: #fff; border-color: var(--accent); }
.v-check-msg { margin-top: 10px; font-weight: 700; }
.v-check-msg.good { color: #2b8a3e; }
.v-check-msg.try { color: #c92a2a; }
.v-summary { border-top-color: #2f9e44; text-align: left; }
.v-summary small { color: #2b8a3e; }
.v-summary ul { margin: 8px 0 12px; padding-left: 20px; font-size: 1.05rem; line-height: 1.5; }
/* things on the stage */
.v-item { animation: vIn calc(500ms / var(--spd)) calc(var(--d) * 1ms / var(--spd)) both; transform-box: fill-box; transform-origin: center; }
.v-item .v-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: vDraw calc(700ms / var(--spd)) calc(var(--d) * 1ms / var(--spd)) forwards; }
.v-item.v-out { animation: vIn calc(500ms / var(--spd)) calc(var(--d) * 1ms / var(--spd)) both, vOut calc(400ms / var(--spd)) calc(var(--o) * 1ms / var(--spd)) forwards; }
.v-item.v-move { animation: vIn calc(500ms / var(--spd)) calc(var(--d) * 1ms / var(--spd)) both, vMove calc(700ms / var(--spd)) calc(var(--m) * 1ms / var(--spd)) forwards; }
.v-stage.instant .v-item, .v-stage.instant .v-item .v-draw { animation-duration: 0s !important; animation-delay: 0s !important; }
.v-player.paused .v-item, .v-player.paused .v-item .v-draw { animation-play-state: paused; }
@keyframes vIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes vOut { to { opacity: 0; } }
@keyframes vMove { to { transform: translate(var(--dx), var(--dy)); } }
@keyframes vDraw { to { stroke-dashoffset: 0; } }
.v-text { font-weight: 800; fill: #2b2d42; }
.v-text.big { font-weight: 900; }
.v-text.soft { font-weight: 600; fill: #495057; }
.v-text.accent { fill: #7048e8; }
.v-text.red { fill: #e03131; }
.v-text.blue { fill: #1c7ed6; }
.v-text.green { fill: #2b8a3e; }
.v-box { fill: #fff; stroke: #adb5bd; stroke-width: 2; }
.v-dot { fill: #fa5252; stroke: #c92a2a; stroke-width: 2; }
.v-dot.blue { fill: #4dabf7; stroke: #1971c2; }
.v-shape { fill: #fff3bf; stroke: #2b2d42; stroke-width: 3; stroke-linejoin: round; }
.v-line { stroke: #2b2d42; stroke-width: 4; stroke-linecap: round; }
.v-frame { fill: #fff; stroke: #2b2d42; stroke-width: 3; }
.v-frame-line { stroke: #2b2d42; stroke-width: 2; }
.v-gridline { stroke: rgba(0,0,0,.28); stroke-width: 1.2; }
.v-ring { fill: none; stroke: #fcc419; stroke-width: 5; animation: vPulse 1.2s infinite; }
@keyframes vPulse { 50% { stroke-opacity: .25; } }
.v-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
@media (max-width: 560px) { .v-caption { font-size: 1rem; } .v-btn { min-width: 36px; height: 36px; } }
.v-hl { fill: rgba(255, 212, 59, .28); stroke: #f59f00; stroke-width: 3; }
.v-mark { fill: none; stroke: #2b2d42; stroke-width: 2.5; }
.v-sq { stroke: #2b2d42; stroke-width: 2.5; stroke-linejoin: round; }
.v-ground { stroke: #8d6e63; stroke-width: 6; stroke-linecap: round; }
.v-wall { stroke: #868e96; stroke-width: 10; stroke-linecap: round; }
.v-ladder { stroke: #e8590c; stroke-width: 7; stroke-linecap: round; }
.notes-head { margin: 18px 0 6px; }
.v-chip:empty { display: none; }
.v-outline { fill: none; }
.v-voice { height: 40px; max-width: 170px; border: 0; background: #f1f3f5; border-radius: 10px; padding: 0 8px; font-weight: 700; font-size: .85rem; cursor: pointer; }
@media (max-width: 560px) { .v-voice { max-width: 120px; height: 36px; } }
.v-block { fill: #74c0fc; stroke: #1864ab; stroke-width: 1.5; }
.v-block.one { fill: #ffd43b; stroke: #e67700; }
.v-block.hundred { fill: #b2f2bb; stroke: #2b8a3e; }
.v-block-line { stroke: rgba(0,0,0,.35); stroke-width: 1; }
.v-line.thin { stroke-width: 2.5; }
.v-line.hopline { stroke: #7048e8; stroke-width: 3; }
.v-line.red { stroke: #e03131; }
.v-line.green { stroke: #2b8a3e; }
.v-line.blue { stroke: #1c7ed6; }
.v-text.white { fill: #fff; }
.v-text.mono { font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", monospace; font-weight: 700; }
.v-coin { stroke: #868e96; stroke-width: 2.5; }
.v-dot.plain { stroke: rgba(0,0,0,.35); }
.v-line.tick { stroke-width: 1.5; }
.v-clock { fill: #fff; stroke: #2b2d42; stroke-width: 4; }
.v-clock-hr { stroke: #2b2d42; stroke-width: 2.5; }
.v-clock-min { stroke: #adb5bd; stroke-width: 1.2; }
.v-hand { stroke-linecap: round; }
.v-hand.hour { stroke: #e03131; stroke-width: 8; }
.v-hand.minute { stroke: #1c7ed6; stroke-width: 5; }

/* ---------- website footer and privacy page */
.site-footer { text-align: center; font-size: .85rem; color: #6c6c80; padding: 18px 16px 28px; }
.site-footer a { color: inherit; }
.legal { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; line-height: 1.6; }
.legal h2 { margin-top: 8px; }
.legal h3 { margin: 24px 0 6px; }
.legal ul { padding-left: 22px; }
.legal-lead { font-size: 1.1rem; }
.legal-date { color: #6c6c80; font-size: .9rem; }
a.icon-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- parent account */
.acct-btn { background: rgba(255,255,255,.25); border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 700; color: inherit; cursor: pointer; white-space: nowrap; }
.acct-title { max-width: 560px; margin: 20px auto 10px; padding: 0 16px; }
.acct-card { max-width: 560px; margin: 0 auto 30px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 20px; box-sizing: border-box; }
@media (max-width: 600px) { .acct-card { margin: 0 16px 30px; padding: 16px; } }
.acct-lead { margin-top: 0; line-height: 1.5; }
.acct-form { display: grid; gap: 14px; }
.acct-field { display: grid; gap: 6px; font-weight: 700; }
.acct-field input { font: inherit; font-weight: 400; padding: 12px; border: 2px solid #dcdcec; border-radius: 12px; min-height: 48px; box-sizing: border-box; width: 100%; }
.acct-field input:focus { outline: none; border-color: var(--accent, #7950f2); }
.acct-check { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; line-height: 1.45; cursor: pointer; margin: 6px 0; }
.acct-check input { width: 22px; height: 22px; margin: 2px 0 0; }
.acct-msg { padding: 10px 14px; border-radius: 12px; background: #f1f3f5; line-height: 1.45; }
.acct-msg.ok { background: #ebfbee; color: #2b8a3e; }
.acct-msg.error { background: #fff5f5; color: #c92a2a; }
.acct-small { color: #6c6c80; font-size: .9rem; }
.acct-links { margin: 14px 0 0; }
.linkish { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--accent, #7950f2); text-decoration: underline; cursor: pointer; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.acct-danger { margin-top: 24px; padding-top: 16px; border-top: 1px solid #eee; }
.btn.danger { color: #c92a2a; }
@media (max-width: 420px) { .acct-btn { padding: 6px 9px; font-size: .9rem; } }

/* ---------- v1.1: brand, founding banner, class picker, gates, feedback */
.byline { font-size: .95rem; color: #6c6c80; margin-bottom: 2px; }
.byline a, .site-footer a { color: inherit; }
.founding { max-width: 1000px; margin: 6px auto 14px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, #fff3bf, #ffe8cc); color: #5c3c00; line-height: 1.45; box-sizing: border-box; }
@media (max-width: 1032px) { .founding { margin-left: 16px; margin-right: 16px; } }
.acct-card .founding, .acct-title .founding { margin: 0 0 14px; }
.founding-left { font-weight: 800; color: #d9480f; }
.grade-card.mine { outline: 3px solid var(--c); outline-offset: 2px; }
.grade-mine { font-size: .8rem; font-weight: 800; color: var(--c); }
.topic-card.locked { opacity: .72; }
.sample-pill { position: absolute; top: 8px; left: 8px; font-size: .72rem; font-weight: 800; background: #2f9e44; color: #fff; padding: 2px 8px; border-radius: 999px; }
.topic-card { position: relative; }
.acct-code { font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; }
.acct-class { margin: 14px 0 6px; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-top: 8px; }
.class-btn { min-height: 52px; border: 0; border-radius: 14px; background: var(--c); color: #fff; font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.class-btn.on { outline: 3px solid #212529; outline-offset: 2px; cursor: default; }
.class-btn.armed { outline: 3px dashed #212529; outline-offset: 2px; }
.class-btn:disabled { opacity: 1; }
.fb-stars { display: flex; gap: 6px; }
.fb-stars button { font-size: 2rem; line-height: 1; background: none; border: 0; color: #ced4da; cursor: pointer; padding: 4px; min-width: 44px; min-height: 44px; }
.fb-stars button.on { color: #fab005; }
.acct-form textarea { font: inherit; padding: 12px; border: 2px solid #dcdcec; border-radius: 12px; width: 100%; box-sizing: border-box; resize: vertical; }
.acct-form .acct-field > span { font-weight: 700; }
