:root {
  --bg: #fff8ee;
  --card: #ffffff;
  --ink: #2b2140;
  --muted: #7a7090;
  --brand: #7c3aed;
  --brand2: #f59e0b;
  --good: #16a34a;
  --bad: #dc2626;
  --line: #eadfce;
  --wood: #8b4513;
  --wood2: #a0522d;
  --bead: #ef4444;
  --bead2: #b91c1c;
  --bead-on: #f59e0b;
  --bead-on2: #c2410c;
  --bh: 34px;
  --bw: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17131f; --card: #231d2e; --ink: #f4efff; --muted: #b3a8c9; --line: #3a3149;
  }
}
:root[data-theme="dark"] {
  --bg: #17131f; --card: #231d2e; --ink: #f4efff; --muted: #b3a8c9; --line: #3a3149;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Baloo 2', 'Segoe UI', system-ui, sans-serif; font-size: 17px;
}
button { font-family: inherit; cursor: pointer; }
h1 { margin: 0 0 6px; line-height: 1.15; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 2px solid var(--line);
}
.logo { font-size: 26px; font-weight: 800; color: var(--ink); text-decoration: none; }
.logo span { color: var(--brand); }
.who { display: flex; gap: 14px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }

main { max-width: 1040px; margin: 0 auto; padding: 18px 16px 40px; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { transform: translateY(6px); } }

.card { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 18px; }

.btn {
  border: 0; border-radius: 14px; padding: 10px 20px; font-size: 18px; font-weight: 800;
  background: var(--line); color: var(--ink);
}
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 4px 0 #5b21b6; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #5b21b6; }
.btn.ghost { background: transparent; border: 2px solid var(--line); }
.btn.small { font-size: 15px; padding: 6px 12px; }

/* Welcome */
.welcome { max-width: 460px; margin: 30px auto; text-align: center; }
.big-emoji { font-size: 64px; }
.welcome p { color: var(--muted); }
.welcome form { display: flex; flex-direction: column; gap: 12px; }
.welcome input {
  font: inherit; font-size: 22px; padding: 10px 14px; border-radius: 14px; text-align: center;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink);
}

/* Level map */
.hello { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.stats { display: flex; gap: 10px; }
.stats div { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 6px 14px; color: var(--muted); }
.stats b { color: var(--ink); font-size: 20px; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.level {
  text-align: left; color: var(--ink); background: var(--card); border: 2px solid var(--line);
  border-top: 8px solid var(--c); border-radius: 20px; padding: 14px; transition: transform .15s;
}
.level:hover { transform: translateY(-3px); }
.level.locked { opacity: .55; filter: grayscale(.6); }
.lv-top { display: flex; justify-content: space-between; font-size: 26px; }
.lv-num { font-size: 14px; font-weight: 800; color: var(--c); text-transform: uppercase; letter-spacing: .5px; }
.lv-title { font-size: 21px; font-weight: 800; }
.lv-sub { font-size: 14px; color: var(--muted); min-height: 40px; }
.lv-foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--muted); }
.lv-stars { color: var(--brand2); font-size: 20px; letter-spacing: 2px; }
.lv-stars .off { color: var(--line); }

/* Practice */
.round-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.round-title { font-weight: 800; font-size: 20px; flex: 1; }
.round-meta { font-weight: 700; color: var(--muted); }
.progress { height: 10px; background: var(--line); border-radius: 10px; margin: 10px 0 14px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand2)); transition: width .3s; }

.practice-layout {
  display: grid; gap: 14px;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "q ab" "a ab";
}
@media (min-width: 1000px) {
  .practice-layout { grid-template-columns: 1fr auto 1fr; grid-template-areas: "q ab a"; }
}
.abacus-card { display: flex; flex-direction: column; justify-content: center; }
.question-card { grid-area: q; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 230px; }
.answer-card { grid-area: a; }
.abacus-card { grid-area: ab; }

.question .column { font-size: 40px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.question .sign { display: inline-block; width: 34px; color: var(--brand); }
.question .line { border-top: 4px solid var(--ink); margin-top: 6px; }
.question .inline { font-size: 52px; font-weight: 800; }
.flash { font-size: 96px; font-weight: 800; color: var(--brand); }
.flash.dim { color: var(--line); }
.flash-ask { font-size: 30px; font-weight: 800; color: var(--muted); }
.feedback { min-height: 32px; margin-top: 10px; font-size: 22px; font-weight: 800; text-align: center; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.answer-box {
  font-size: 46px; font-weight: 800; text-align: center; border: 3px dashed var(--line);
  border-radius: 16px; padding: 4px; margin-bottom: 12px; min-height: 76px; font-variant-numeric: tabular-nums;
}
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  font-size: 26px; font-weight: 800; padding: 8px 0; border-radius: 14px; border: 2px solid var(--line);
  background: var(--bg); color: var(--ink); box-shadow: 0 3px 0 var(--line);
}
.key:active { transform: translateY(2px); box-shadow: none; }
.key.check { background: var(--good); color: #fff; border-color: var(--good); box-shadow: 0 3px 0 #166534; }

/* Abacus */
#abacus { display: flex; justify-content: center; overflow-x: auto; }
.abacus-frame {
  display: flex; gap: 6px; padding: 12px 18px 6px;
  background: linear-gradient(180deg, var(--wood2), var(--wood)); border-radius: 18px;
  border: 6px solid #5c2d0c;
}
.rod { position: relative; width: var(--bw); display: flex; flex-direction: column; align-items: center; }
.deck { position: relative; width: 100%; }
.deck::before {
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; margin-left: -3px;
  background: linear-gradient(90deg, #d6c3a0, #8a7350); border-radius: 3px;
}
.upper { height: calc(var(--bh) * 2); }
.lower { height: calc(var(--bh) * 5); }
.beam { width: calc(100% + 12px); height: 12px; background: #3b1d08; position: relative; }
.beam .dot { position: absolute; left: 50%; top: 3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #fbbf24; }
.bead {
  position: absolute; left: 0; width: 100%; height: var(--bh); padding: 0; border: 0;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, #fca5a5, var(--bead) 45%, var(--bead2));
  transition: top .15s ease;
}
.bead.on { background: radial-gradient(ellipse at 50% 30%, #fde68a, var(--bead-on) 45%, var(--bead-on2)); }
.upper .bead { top: 0; }
.upper .bead.on { top: var(--bh); }
.lower .bead { top: calc((var(--b) + 1) * var(--bh)); }
.lower .bead.on { top: calc(var(--b) * var(--bh)); }
.place { color: #fde68a; font-size: 13px; font-weight: 800; margin-top: 4px; }

.abacus-tools { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.toggle { font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ab-value { font-size: 24px; font-weight: 800; color: var(--brand); min-width: 40px; visibility: hidden; }
.ab-value.visible { visibility: visible; }

/* Results */
.result { max-width: 640px; margin: 10px auto; text-align: center; }
.stars { font-size: 64px; letter-spacing: 8px; color: var(--line); }
.stars .on { color: var(--brand2); }
.res-stats { display: flex; justify-content: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.res-stats div { border: 2px solid var(--line); border-radius: 14px; padding: 8px 18px; color: var(--muted); display: flex; flex-direction: column; }
.res-stats b { font-size: 26px; color: var(--ink); }
.review { text-align: left; margin: 10px 0 18px; }
.review h3 { margin: 6px 0; }
.rev-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 12px; background: var(--bg); margin-bottom: 6px; }
.rev-row s { color: var(--bad); }
.rev-row b { color: var(--good); }
.perfect { color: var(--good); font-weight: 800; text-align: center; }
.res-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 14px; font-weight: 700;
  max-width: calc(100% - 32px); text-align: center;
}

#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: drop 2.8s linear forwards; }
@keyframes drop { to { transform: translateY(105vh) rotate(720deg); } }

@media (max-width: 720px) {
  :root { --bh: 26px; --bw: 48px; }
  .practice-layout { grid-template-columns: 1fr; grid-template-areas: "q" "ab" "a"; }
  .question-card { min-height: 170px; }
  .round-title { font-size: 17px; }
  .round-meta { width: 100%; text-align: center; }
  .question .column { font-size: 32px; }
  .flash { font-size: 72px; }
}

/* ---------- Step 2: login, admin, progress ---------- */
.who a { color: var(--brand); text-decoration: none; }
.tag { font-size: 14px; background: var(--brand); color: #fff; border-radius: 8px; padding: 1px 8px; vertical-align: middle; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack input, .stack select, .kids select {
  font: inherit; font-size: 18px; padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); width: 100%;
}
.row { display: flex; gap: 8px; align-items: center; }
.welcome .stack input { text-align: center; }
.hint { color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.small-link { color: var(--brand); font-weight: 700; text-decoration: none; font-size: 15px; display: inline-block; margin-top: 2px; }
h2 { margin: 0 0 10px; font-size: 22px; }

.admin-grid { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { border: 2px solid var(--line); background: transparent; color: var(--ink); border-radius: 12px; padding: 4px 12px; font-weight: 700; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 2px solid var(--line); }
.user-row > div:first-child { display: flex; flex-direction: column; }
.row-actions { display: flex; gap: 6px; }
.btn.danger { color: var(--bad); }
.kids { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 15px; color: var(--muted); margin-top: 4px; }
.kids select { width: auto; font-size: 15px; padding: 2px 8px; }
.chip { background: var(--bg); border: 2px solid var(--line); border-radius: 20px; padding: 0 4px 0 10px; color: var(--ink); }
.chip button { border: 0; background: none; color: var(--bad); }

.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.student-card { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); transition: transform .15s; }
.student-card:hover { transform: translateY(-3px); }
.student-card b { font-size: 20px; }
.mini-stats { display: flex; gap: 12px; font-weight: 700; margin: 4px 0; }

.lt-row { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr 1.2fr; gap: 8px; padding: 8px 0; border-top: 2px solid var(--line); align-items: center; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 6px 8px; border-top: 2px solid var(--line); }
.table th { color: var(--muted); font-size: 14px; }
.table td.good { color: var(--good); font-weight: 800; }
.table td.bad { color: var(--bad); font-weight: 800; }

.chart { width: 100%; height: auto; display: block; }
.chart .axis { font-size: 12px; fill: var(--muted); font-family: inherit; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .pass-line { stroke: var(--good); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .bar-good { fill: var(--good); }
.chart .bar-bad { fill: var(--brand2); }

@media (max-width: 720px) {
  .admin-grid { grid-template-columns: 1fr; }
  .lt-row { grid-template-columns: 1fr 1fr; }
  .table { font-size: 14px; }
}
.row .btn { white-space: nowrap; flex-shrink: 0; }
[hidden] { display: none !important; }

/* ---------- Step 3: classes and homework ---------- */
.input {
  font: inherit; font-size: 16px; padding: 6px 10px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); width: 100%;
}
.class-item {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left;
  background: var(--bg); color: var(--ink); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 8px;
}
.class-item.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.table-wrap { overflow-x: auto; }
.hw-form { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 10px; align-items: end; margin-bottom: 12px; }
.hw-form label { display: flex; flex-direction: column; font-size: 14px; font-weight: 700; color: var(--muted); gap: 2px; }
.hw-form .wide { grid-column: 1 / 3; }
.hw-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 2px solid var(--line); }
.pill { border: 2px solid var(--line); border-radius: 20px; padding: 0 10px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.pill.good { background: var(--good); border-color: var(--good); color: #fff; }
.pill.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.bad-text { color: var(--bad); }
.homework-box { margin-bottom: 14px; border-color: var(--brand2); }
.two-col { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; margin-bottom: 14px; }
.two-col .res-stats { justify-content: flex-start; margin: 0; }
@media (max-width: 720px) {
  .hw-form { grid-template-columns: 1fr 1fr; }
  .hw-form label:first-child, .hw-form .wide { grid-column: 1 / 3; }
  .two-col { grid-template-columns: 1fr; }
}
.admin-grid > * { min-width: 0; }
.table-wrap .table td, .table-wrap .table th { white-space: nowrap; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

/* ---------- Step 4: games ---------- */
.diff-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.game-card .lv-sub { min-height: 64px; }
.game-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.game-layout.no-pad { grid-template-columns: 1fr; }
.game-area { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 380px; text-align: center; }
.g-big { font-size: 60px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.g-big.mono { letter-spacing: 6px; word-break: break-all; }
.g-prompt { margin: 0; font-size: 20px; font-weight: 700; color: var(--muted); }
.off-heart { opacity: .25; }

.sky {
  position: relative; width: 100%; height: 380px; overflow: hidden; border-radius: 14px;
  background: linear-gradient(180deg, #1e1b4b, #4c1d95 70%, #7c2d12);
}
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: #57534e; border-top: 3px solid #a8a29e; }
.meteor {
  position: absolute; top: 0; padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  background: radial-gradient(circle at 30% 30%, #fdba74, #ea580c 60%, #7c2d12);
  color: #fff; font-weight: 800; font-size: 22px; box-shadow: 0 -10px 18px rgba(251, 146, 60, .55);
}
.meteor.boom { animation: boom .4s ease-out forwards; }
.meteor.crash { background: #57534e; animation: boom .4s ease-out forwards; }
@keyframes boom { to { opacity: 0; scale: 1.8; } }

@media (max-width: 720px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-area, .sky { min-height: 300px; height: auto; }
  .sky { height: 300px; }
  .g-big { font-size: 44px; }
}
.game-layout .answer-card { grid-area: auto; align-self: start; }

/* ---- Game animations ---- */
.game-card { animation: card-in .5s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(var(--i, 0) * 80ms); }
.game-card .g-icon { display: inline-block; font-size: 34px; }
.game-card:hover .g-icon { animation: wobble .6s ease-in-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.92); } }
@keyframes wobble { 25% { rotate: -14deg; scale: 1.2; } 50% { rotate: 12deg; scale: 1.25; } 75% { rotate: -6deg; } }

.round-title { display: flex; align-items: center; gap: 8px; }
.g-beady { width: 42px; height: auto; transform-origin: 50% 100%; }
.g-beady.happy { animation: beady-jump .45s ease-out; }
.g-beady.sad { animation: beady-sad .5s ease-in-out; }
@keyframes beady-sad { 20%, 60% { rotate: -10deg; translate: -3px 0; } 40%, 80% { rotate: 10deg; translate: 3px 0; } }

.game-area { position: relative; }
.game-area.fx-good { animation: glow-good .5s ease-out; }
.game-area.fx-shake { animation: shake .4s ease-in-out; }
@keyframes glow-good { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); border-color: #22c55e; } 100% { box-shadow: 0 0 0 18px rgba(34, 197, 94, 0); } }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -10px; } 40% { translate: 9px; } 60% { translate: -6px; } 80% { translate: 4px; } }
.q-in { animation: q-in .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes q-in { from { opacity: 0; scale: .6; translate: 0 14px; } }
.answer-box.tap { animation: tap .18s ease-out; }
@keyframes tap { 50% { scale: 1.06; border-color: var(--brand); } }
.score-num { display: inline-block; }
.score-num.bump { animation: bump .4s cubic-bezier(.3, 1.8, .5, 1); color: var(--brand2); }
@keyframes bump { 40% { scale: 1.6; } }
.combo-tag { display: inline-block; animation: flicker 1s ease-in-out infinite; }
@keyframes flicker { 50% { scale: 1.12; } }
.hurry { display: inline-block; animation: hurry .5s ease-in-out infinite alternate; }
@keyframes hurry { to { scale: 1.25; } }
#g-abacus.fx-glow .abacus-frame { animation: ab-glow .6s ease-out; }
@keyframes ab-glow { 0% { box-shadow: 0 0 0 0 #fde047; } 40% { box-shadow: 0 0 26px 10px #fde047; } 100% { box-shadow: 0 0 0 0 rgba(253, 224, 71, 0); } }

/* Floating "+12", sparkles, countdown and streak banner */
.fx-float {
  position: fixed; z-index: 20; pointer-events: none; translate: -50% 0;
  font-size: 34px; font-weight: 800; color: var(--good); text-shadow: 0 2px 0 #fff, 0 4px 10px rgba(0, 0, 0, .2);
  animation: float-up 1.1s ease-out forwards;
}
.fx-float.hot { color: #f97316; font-size: 42px; }
.fx-float.heart { font-size: 40px; }
@keyframes float-up { 0% { opacity: 0; transform: translateY(10px) scale(.6); } 20% { opacity: 1; transform: translateY(-10px) scale(1.15); } 100% { opacity: 0; transform: translateY(-90px) scale(1); } }
.fx-spark {
  position: fixed; z-index: 20; width: 10px; height: 10px; margin: -5px; border-radius: 50%; pointer-events: none;
  animation: spark .7s ease-out forwards;
}
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.countdown, .combo-pop {
  position: fixed; left: 50%; top: 42%; z-index: 30; translate: -50% -50%; pointer-events: none;
  font-weight: 800; white-space: nowrap; color: var(--brand); text-shadow: 0 4px 0 #fff, 0 8px 24px rgba(124, 58, 237, .35);
}
.countdown { font-size: 120px; }
.countdown.count-in { animation: count-in .6s ease-out; }
@keyframes count-in { 0% { scale: 2.4; opacity: 0; } 30% { scale: 1; opacity: 1; } 80% { scale: .95; opacity: 1; } 100% { scale: .6; opacity: 0; } }
.combo-pop { font-size: 48px; color: #f97316; }
.combo-pop.combo-in { animation: combo-in 1.3s ease-out forwards; }
@keyframes combo-in { 0% { scale: .2; rotate: -12deg; opacity: 0; } 20% { scale: 1.2; rotate: 4deg; opacity: 1; } 35% { scale: 1; rotate: 0deg; } 80% { opacity: 1; } 100% { opacity: 0; translate: -50% -90%; } }

/* Memory digits */
.digit { display: inline-block; animation: q-in .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.digit.hidden-digit { color: var(--muted); animation-name: flip-in; }
.digit.good-digit { color: var(--good); }
.digit.bad-digit { color: var(--bad); }
@keyframes flip-in { from { transform: rotateY(90deg); } }

/* Meteor sky */
.stars-bg {
  position: absolute; inset: 0; pointer-events: none; animation: twinkle 3s ease-in-out infinite alternate;
  background-image: radial-gradient(2px 2px at 10% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 30% 60%, #fff, transparent),
    radial-gradient(2px 2px at 55% 15%, #fde68a, transparent), radial-gradient(1.5px 1.5px at 75% 40%, #fff, transparent),
    radial-gradient(2px 2px at 90% 70%, #fff, transparent), radial-gradient(1.5px 1.5px at 45% 85%, #c4b5fd, transparent),
    radial-gradient(1.5px 1.5px at 20% 80%, #fff, transparent), radial-gradient(2px 2px at 65% 55%, #fff, transparent);
}
@keyframes twinkle { to { opacity: .4; } }
.meteor::after {
  content: ''; position: absolute; left: 50%; bottom: 100%; width: 60%; height: 40px; translate: -50% 0; z-index: -1;
  background: linear-gradient(0deg, rgba(251, 146, 60, .8), transparent); border-radius: 50% 50% 0 0; filter: blur(4px);
}
.meteor { animation: meteor-wobble 1.2s ease-in-out infinite; }
@keyframes meteor-wobble { 50% { rotate: 4deg; } }
.cannon { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; font-size: 34px; rotate: -45deg; }
.laser {
  position: absolute; height: 5px; margin-top: -2px; transform-origin: 0 50%; border-radius: 3px;
  background: linear-gradient(90deg, #67e8f9, #fff, #67e8f9); box-shadow: 0 0 12px #22d3ee; animation: laser .26s ease-out forwards;
}
@keyframes laser { to { opacity: 0; } }
.sky { isolation: isolate; }
.sky.fx-quake { animation: shake .45s ease-in-out; }

/* Game over */
.over-top { display: flex; justify-content: center; align-items: flex-end; gap: 8px; }
.over-top .mascot { width: 84px; }
.mascot.happy { animation: beady-jump .6s ease-in-out 2; }
.mascot.cheer { animation: beady-jump .6s ease-in-out 5; }
.big-emoji.spin-in { display: inline-block; animation: spin-in .7s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes spin-in { from { rotate: -360deg; scale: 0; } }

@media (max-width: 720px) {
  .countdown { font-size: 90px; }
  .combo-pop { font-size: 34px; }
  .g-beady { width: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-card, .combo-tag, .hurry, .stars-bg, .meteor, .digit { animation: none; }
}

/* ---- Action games: Sky Pilot and Space Blaster ---- */
.g-big.small-q { font-size: 44px; }
.g-hint { margin: 0; font-size: 15px; font-weight: 700; color: var(--muted); }
.flight, .space {
  position: relative; width: 100%; height: 400px; overflow: hidden; border-radius: 14px;
  isolation: isolate; cursor: pointer; user-select: none; touch-action: manipulation;
}

/* Sky Pilot */
.flight { background: linear-gradient(180deg, #38bdf8, #bae6fd 70%, #e0f2fe); }
.flight::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(transparent calc(33.3% - 1px), rgba(255, 255, 255, .55) calc(33.3% - 1px) 33.3%, transparent 33.3% calc(66.6% - 1px), rgba(255, 255, 255, .55) calc(66.6% - 1px) 66.6%, transparent 66.6%);
}
.flight .sun { position: absolute; right: 8%; top: 7%; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle, #fef08a, #f59e0b); box-shadow: 0 0 40px #fde047; }
.flight .clouds {
  position: absolute; inset: 0; opacity: .85;
  background-image: radial-gradient(ellipse 60px 22px at 100px 20%, #fff 98%, transparent), radial-gradient(ellipse 80px 26px at 380px 52%, #fff 98%, transparent),
    radial-gradient(ellipse 50px 18px at 240px 84%, #fff 98%, transparent);
  background-size: 600px 100%; animation: scroll-clouds 12s linear infinite;
}
@keyframes scroll-clouds { to { background-position: -600px 0; } }
.flight .hills {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44px;
  background: radial-gradient(ellipse 130px 44px at 120px 100%, #22c55e 98%, transparent) 0 0 / 240px 100% repeat-x;
  animation: scroll-hills 4s linear infinite;
}
@keyframes scroll-hills { to { background-position: -240px 0; } }
.plane { position: absolute; left: 10%; top: 50%; translate: -50% -50%; z-index: 2; font-size: 50px; line-height: 1; transition: top .25s ease-out; }
.plane span { display: inline-block; rotate: 45deg; animation: plane-bob 1s ease-in-out infinite; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .2)); }
@keyframes plane-bob { 50% { translate: 0 -5px; } }
.plane .trail {
  position: absolute; right: 70%; top: 50%; width: 70px; height: 8px; margin-top: -4px; border-radius: 4px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95)); animation: trail .3s ease-in-out infinite alternate;
}
@keyframes trail { to { width: 50px; opacity: .6; } }
.plane.tilt-up { animation: tilt-up .3s ease-out; }
.plane.tilt-down { animation: tilt-down .3s ease-out; }
@keyframes tilt-up { 50% { rotate: -18deg; } }
@keyframes tilt-down { 50% { rotate: 18deg; } }
.plane.crash { animation: crash .6s ease-in-out; }
@keyframes crash { 30% { rotate: 25deg; scale: .85; } 60% { rotate: -20deg; } }
.wave { position: absolute; left: 0; top: 0; bottom: 0; width: 76px; z-index: 1; }
.gate {
  position: absolute; left: 0; width: 76px; height: 56px; translate: 0 -50%;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: #0c4a6e;
  background: radial-gradient(circle at 35% 30%, #fff, #f0f9ff 60%, #bae6fd); border: 3px solid #fff; border-radius: 40px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, .35);
}
.gate.hit { background: #4ade80; color: #fff; animation: boom .5s ease-out forwards; }
.gate.miss { background: #f87171; color: #fff; animation: shake .4s ease-in-out; }
.gate.was-right { outline: 4px dashed #16a34a; outline-offset: 2px; }

/* Space Blaster */
.space { background: radial-gradient(ellipse at 50% 120%, #4c1d95, #0f172a 60%, #020617); }
.stars-bg.scroll { background-size: 300px 300px; animation: twinkle 3s ease-in-out infinite alternate, stars-fall 6s linear infinite; }
@keyframes stars-fall { to { background-position: 0 300px; } }
.ship { position: absolute; bottom: 10px; left: 50%; translate: -50% 0; z-index: 2; font-size: 46px; line-height: 1; transition: left .15s ease-out; }
.ship span { display: inline-block; rotate: -45deg; }
.ship .flame {
  position: absolute; left: 50%; top: 88%; width: 14px; height: 18px; margin-left: -7px; border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
  background: radial-gradient(circle at 50% 30%, #fef08a, #f97316 60%, transparent); animation: flame .12s ease-in-out infinite alternate;
}
@keyframes flame { to { height: 26px; opacity: .7; } }
.ship.recoil { animation: recoil .2s ease-out; }
@keyframes recoil { 50% { translate: -50% 6px; } }
.bullet {
  position: absolute; left: 0; top: 0; width: 6px; height: 22px; margin: -11px 0 0 -3px; border-radius: 3px; z-index: 1;
  background: linear-gradient(#fff, #22d3ee); box-shadow: 0 0 12px #22d3ee;
}
.alien { position: absolute; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; z-index: 1; animation: warp-in .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.alien span { font-size: 44px; line-height: 1; animation: alien-bob 1.4s ease-in-out infinite; }
.alien b { margin-top: -4px; padding: 0 12px; border-radius: 999px; background: #fff; color: #1e1b4b; font-size: 22px; border: 3px solid #a78bfa; }
@keyframes warp-in { from { scale: 0; opacity: 0; rotate: 180deg; } }
@keyframes alien-bob { 50% { rotate: -8deg; scale: 1.08; } }
.alien.blown { animation: boom .45s ease-out forwards; }
.alien.leave { animation: leave .6s ease-in forwards; }
@keyframes leave { to { translate: -50% -400px; opacity: 0; } }
.alien.shield b { animation: shield .45s ease-in-out; }
@keyframes shield { 30%, 70% { background: #f87171; color: #fff; border-color: #dc2626; scale: 1.2; } }

@media (max-width: 720px) {
  .flight, .space { height: 340px; }
  .g-big.small-q { font-size: 34px; }
  .plane, .ship { font-size: 40px; }
  .alien span { font-size: 36px; }
  .gate { width: 64px; height: 48px; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .flight .clouds, .flight .hills, .plane span, .plane .trail, .ship .flame, .alien, .alien span { animation: none; }
}

/* Sound and music buttons */
.sound-btns { display: inline-flex; gap: 4px; vertical-align: middle; }
.snd {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  font-size: 16px; line-height: 1; position: relative;
}
.snd.off { opacity: .45; }
.snd.off::after { content: ''; position: absolute; left: 5px; right: 5px; top: 50%; height: 3px; background: var(--bad); rotate: -40deg; border-radius: 2px; }

/* Beady's Bead Run */
.run-canvas { display: block; width: 100%; height: 380px; border-radius: 14px; cursor: pointer; touch-action: manipulation; user-select: none; }
.run-canvas.fx-quake { animation: shake .45s ease-in-out; }
@media (max-width: 720px) { .run-canvas { height: 320px; } }

/* ---- Flash & Listen trainer ---- */
.tr-setup h3 { margin: 18px 0 8px; }
.tr-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-mode, .tr-preset {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 3px solid var(--line); border-radius: 18px; background: var(--bg); color: var(--ink); padding: 12px 14px;
  transition: transform .15s, border-color .15s;
}
.tr-mode span { font-size: 34px; line-height: 1; }
.tr-mode b { font-size: 20px; }
.tr-mode small, .tr-preset small { color: var(--muted); }
.tr-mode:hover, .tr-preset:hover { transform: translateY(-2px); }
.tr-mode.active, .tr-preset.active { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.tr-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tr-preset b { font-size: 17px; }
.tr-form { margin-top: 10px; }
.tr-summary { margin: 16px 0 12px; padding: 10px 14px; border-radius: 14px; background: var(--bg); border: 2px dashed var(--line); }

.tr-play { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.tr-board {
  min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  background: radial-gradient(circle at 50% 40%, #312e81, #1e1b4b 70%); border-color: #4c1d95; color: #fff;
}
.tr-num { font-size: 120px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; min-height: 120px; }
.tr-num.c1 { color: #fde047; }
.tr-num.c2 { color: #67e8f9; }
.tr-num.ask { color: #fff; font-size: 90px; animation: pulse-ask 1s ease-in-out infinite alternate; }
.tr-num.right { color: #4ade80; }
.tr-num.wrong { color: #fca5a5; }
.tr-num.listening { animation: listen 0.8s ease-in-out infinite; }
@keyframes pulse-ask { to { scale: 1.08; } }
@keyframes listen { 50% { scale: 1.15; rotate: -6deg; } }
.tr-sub { font-size: 22px; font-weight: 700; color: #c4b5fd; min-height: 30px; }
.tr-teacher { flex-wrap: wrap; justify-content: center; }
.tr-play .answer-card { grid-area: auto; align-self: start; }
.tr-play.class-mode { grid-template-columns: 1fr; }
.tr-play.class-mode .tr-board { min-height: 460px; }
.tr-play.class-mode .tr-num { font-size: 180px; min-height: 180px; }
.tr-play.class-mode .answer-card { justify-self: center; }

@media (max-width: 720px) {
  .tr-play { grid-template-columns: 1fr; }
  .tr-board { min-height: 260px; }
  .tr-num { font-size: 84px; min-height: 84px; }
  .tr-play.class-mode .tr-num { font-size: 110px; min-height: 110px; }
  .tr-modes { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-num.ask, .tr-num.listening { animation: none; }
}

/* Weekly report card pop-up, weekly reports page and invite card */
.rc-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(20, 12, 40, .7); display: grid; place-items: center; padding: 16px; overflow: auto; }
.rc-box { background: var(--card); border-radius: 20px; padding: 14px; max-width: 520px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.rc-box img { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.rc-btns { flex-wrap: wrap; justify-content: center; }
.wr-tip { margin-bottom: 14px; background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.wr-row { margin-bottom: 12px; }
.wr-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.wr-name { font-size: 20px; }
.wr-note { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-weight: 700; color: var(--muted); }
.btn.done { opacity: .6; }
.btn.done::after { content: ' ✓'; }
.invite-card { margin-top: 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  border-color: #f59e0b; background: linear-gradient(120deg, color-mix(in srgb, #f59e0b 12%, var(--card)), var(--card)); }
.invite-art { font-size: 56px; animation: bob 3s ease-in-out infinite; }
.invite-text { flex: 1; min-width: 220px; }
.invite-text h2 { margin: 0 0 4px; }
.invite-text p { margin: 4px 0; }
.invite-link code { display: inline-block; background: var(--bg); border: 2px dashed var(--line); border-radius: 10px; padding: 2px 10px; font-size: 15px; word-break: break-all; }
.invite-btns { display: flex; gap: 8px; flex-wrap: wrap; }
#card-btn { margin-top: 6px; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* BeadIQ Olympiad */
.oly-new summary { cursor: pointer; font-size: 18px; }
.oly-new { margin-bottom: 14px; }
.oly-card { margin-bottom: 12px; border-width: 3px; }
.oly-card.live { border-color: var(--good); background: color-mix(in srgb, var(--good) 6%, var(--card)); }
.oly-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.oly-head h2 { margin: 0; }
.oly-actions { flex-wrap: wrap; margin-top: 10px; align-items: center; }
.oly-count, .oly-done { font-weight: 800; font-size: 18px; }
.oly-res { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding: 6px 12px; border-radius: 12px; background: var(--bg); }
.oly-practice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.oly-practice > div { flex: 1; display: flex; flex-direction: column; min-width: 200px; }
.oly-ico { font-size: 34px; }
.oly-group { margin-top: 14px; }
.oly-group h3 { margin: 0 0 6px; }
.ex-timer { font-size: 22px; font-weight: 800; }
.ex-dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.ex-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-weight: 800; padding: 0; }
.ex-dot.filled { background: var(--brand); border-color: var(--brand); color: #fff; }
.ex-dot.cur { outline: 3px solid var(--brand2); outline-offset: 2px; }
.ex-layout .question-card { grid-area: auto; min-height: 300px; }
.ex-layout .answer-card { grid-area: auto; }
.practice-layout.ex-layout { grid-template-areas: none; grid-template-columns: 1.4fr 1fr; }
.ex-qnum { font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.ex-nav { justify-content: space-between; margin: 10px 0; }
.btn.wide { width: 100%; }
.oly-soon { border-color: #f59e0b; }
@media (max-width: 720px) { .practice-layout.ex-layout { grid-template-columns: 1fr; } }

/* ---- Beady the mascot ---- */
.mascot { width: 96px; height: auto; flex: none; }
.mascot.bounce { animation: beady 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
.mascot.jump { animation: beady-jump .7s ease-in-out 3; }
@keyframes beady { 0%, 100% { translate: 0 0; rotate: 0deg; } 30% { translate: 0 -8px; rotate: -4deg; } 60% { translate: 0 0; rotate: 3deg; } }
@keyframes beady-jump { 0%, 100% { translate: 0 0; } 40% { translate: 0 -26px; } }
.say {
  position: relative; background: var(--bg); border: 2px solid var(--line); border-radius: 18px;
  padding: 10px 16px; font-size: 18px; line-height: 1.4;
}
.say::before {
  content: ''; position: absolute; left: -11px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  background: inherit; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); rotate: 45deg;
}
.say .btn { margin-left: 6px; vertical-align: middle; }
.mascot-card { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.mascot-card .say { flex: 1; }

/* ---- Level map (practice page) ---- */
.map-card { margin: 14px 0; overflow: hidden; }
.level-map { position: relative; padding: 6px 0 10px; }
.map-road { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map-road path { fill: none; stroke-linecap: round; }
.map-road .road { stroke: var(--line); stroke-width: 22px; }
.map-road .road-dash { stroke: var(--card); stroke-width: 3px; stroke-dasharray: 10 12; }
.map-road .road-done { stroke: var(--brand2); stroke-width: 10px; opacity: .85; }
.stop { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 6%; min-height: 104px; }
.stop.pos0 { justify-content: flex-start; }
.stop.pos1, .stop.pos3 { justify-content: center; }
.stop.pos2 { justify-content: flex-start; flex-direction: row-reverse; text-align: right; } /* row-reverse: flex-start is the right edge */
.stop.pos2 .stop-info { align-items: flex-end; }
.node {
  position: relative; flex: none; width: 82px; height: 82px; border-radius: 50%; border: 5px solid #fff;
  background: var(--c); color: #fff; display: grid; place-items: center; align-content: center;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), 0 10px 20px rgba(0, 0, 0, .15);
  transition: transform .15s;
}
.node:hover { transform: translateY(-3px) scale(1.04); }
.node span { font-size: 30px; line-height: 1; }
.node small { font-weight: 800; font-size: 14px; line-height: 1; margin-top: 2px; }
.stop.locked .node { background: #c9c2d3; box-shadow: 0 6px 0 #a39bb0; filter: grayscale(.4); }
.stop.open .node { background: var(--card); color: var(--c); border-color: var(--c); }
.stop.current .node { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 0 color-mix(in srgb, var(--c) 55%, transparent); }
  100% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 22px transparent; }
}
.node .here { position: absolute; width: 50px; top: -34px; right: -34px; animation: beady 2.6s ease-in-out infinite; }
.stop-info {
  display: flex; flex-direction: column; background: var(--card); border-radius: 14px; padding: 4px 10px;
  max-width: 240px; position: relative;
}
.stop-info b { font-size: 17px; line-height: 1.2; }
.stop-info small { color: var(--muted); font-weight: 700; }
.stop.locked .stop-info { opacity: .6; }
.stop.current .stop-info small { color: var(--brand); }
.cert-link { color: var(--brand); font-weight: 800; text-decoration: none; white-space: nowrap; }
.cert-link:hover { text-decoration: underline; }

/* ---- Badges ---- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  border: 2px dashed var(--line); border-radius: 16px; padding: 10px 8px; color: var(--muted);
}
.badge .badge-ic { font-size: 34px; filter: grayscale(1); opacity: .5; }
.badge small { font-size: 13px; line-height: 1.25; }
.badge.on {
  border-style: solid; border-color: var(--brand2); color: var(--ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand2) 14%, var(--card)), var(--card));
}
.badge.on .badge-ic { filter: none; opacity: 1; }
.badge.on small { color: var(--muted); }
.badge.pop { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { scale: .3; opacity: 0; } }

/* ---- Result screen extras ---- */
.res-cheer { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 6px; text-align: left; }
.res-cheer .mascot { width: 90px; }
.cert-cta {
  margin: 4px 0 14px; padding: 10px 14px; border-radius: 14px; font-size: 18px;
  background: color-mix(in srgb, var(--brand) 10%, var(--card)); border: 2px solid var(--brand);
}
.new-badges { margin: 0 0 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.new-badges h3 { width: 100%; margin: 0; }
.new-badges .badge { width: 160px; }

@media (max-width: 560px) {
  .mascot-card { gap: 10px; padding: 12px; }
  .mascot-card .mascot { width: 64px; }
  .say { font-size: 16px; }
  .stop { padding: 10px 2%; gap: 10px; }
  .stop.pos1, .stop.pos3 { justify-content: flex-start; padding-left: 22%; }
  .node { width: 66px; height: 66px; border-width: 4px; }
  .node span { font-size: 24px; }
  .stop-info b { font-size: 15px; }
  .res-cheer .mascot { width: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot.bounce, .mascot.jump, .stop.current .node, .node .here, .badge.pop { animation: none; }
}

/* Logo with the BeadIQ abacus mark (homepage, login) */
.logo { display: inline-flex; align-items: center; }
.logo-mark { width: 34px; height: 34px; margin-right: 8px; border-radius: 10px; box-shadow: 0 3px 8px rgba(109, 40, 217, .3); }

/* ---- Login page ---- */
.login-page main.login-wrap {
  max-width: 980px; display: grid; grid-template-columns: 1fr 1fr; gap: 0; align-items: stretch;
  margin: 36px auto; padding: 0; border-radius: 26px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(76, 29, 149, .18); background: var(--card);
}
.login-hero {
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  padding: 36px 28px; color: #fff;
  background: radial-gradient(circle at 85% 12%, rgba(255, 255, 255, .25), transparent 35%), linear-gradient(150deg, #6d28d9, #9333ea 55%, #f97316);
}
.login-hero .mascot { width: 150px; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .25)); }
.login-hero h2 { font-size: 32px; margin: 12px 0 8px; }
.login-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-weight: 700; font-size: 18px; text-align: left; }
.login-hero li { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 6px 14px; }
.login-cards { display: flex; align-items: center; justify-content: center; padding: 28px 22px; }
.login-cards .welcome { margin: 0; border: 0; width: 100%; }
.login-cards .welcome .hint { margin: 14px 0 0; }
@media (max-width: 760px) {
  .login-page main.login-wrap { grid-template-columns: 1fr; margin: 16px; }
  .login-hero { padding: 20px 16px; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
  .login-hero .mascot { width: 80px; }
  .login-hero h2 { font-size: 24px; margin: 0; flex: 1; min-width: 160px; text-align: left; }
  .login-hero ul { display: none; }
  .login-cards { padding: 16px 8px; }
}

/* ---- Install as an app (pwa.js) ---- */
.install-btn[hidden] { display: none !important; }
.ios-help {
  position: fixed; inset: 0; z-index: 50; background: rgba(23, 19, 31, .55);
  display: grid; place-items: end center; padding: 16px;
}
.ios-help .card { max-width: 420px; width: 100%; text-align: center; animation: fade .25s ease; }
.ios-help .mascot { width: 80px; }
.ios-help h2 { margin: 4px 0 8px; }
.ios-help ol { text-align: left; margin: 0 0 14px; padding-left: 22px; font-size: 18px; line-height: 1.5; }
.ios-share { display: inline-block; border: 2px solid var(--brand); color: var(--brand); border-radius: 6px; padding: 0 6px; font-weight: 800; }
.app-strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding: 12px 16px;
  border-radius: 16px; background: color-mix(in srgb, var(--brand) 10%, var(--card)); border: 2px solid color-mix(in srgb, var(--brand) 30%, transparent);
}
.app-strip img { width: 48px; height: 48px; border-radius: 12px; }
.app-strip div { flex: 1; min-width: 180px; }
.app-strip[hidden] { display: none; }

/* Notice boxes (settings, reminders, dashboard, fee bills) */
.warn-box, .ok-box { border-radius: 14px; padding: 10px 14px; font-weight: 700; margin-bottom: 10px; }
.warn-box { background: color-mix(in srgb, #f59e0b 14%, var(--card)); border: 2px solid color-mix(in srgb, #f59e0b 45%, transparent); }
.ok-box { background: color-mix(in srgb, var(--good) 12%, var(--card)); border: 2px solid color-mix(in srgb, var(--good) 40%, transparent); }
.warn-box[hidden], .ok-box[hidden] { display: none; }

/* Weekly challenge card on the practice page */
.challenge-card {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; text-decoration: none; color: #fff;
  background: linear-gradient(110deg, #f59e0b, #f97316 55%, #ec4899); border: 0; transition: transform .15s;
}
.challenge-card:hover { transform: translateY(-2px); }
.challenge-card[hidden] { display: none; }
.challenge-card > div { flex: 1; display: flex; flex-direction: column; }
.challenge-card .muted { color: rgba(255, 255, 255, .9); }
.cc-icon { font-size: 34px; }
.cc-rank { font-size: 28px; font-weight: 800; text-align: center; line-height: 1; background: rgba(255, 255, 255, .2); border-radius: 14px; padding: 6px 12px; }
.cc-rank small { display: block; font-size: 13px; }

/* Next live class card (students and parents) */
.next-class { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; border-color: var(--good); }
.next-class[hidden] { display: none; }
.next-class > div { flex: 1; display: flex; flex-direction: column; }
.next-class .btn { text-decoration: none; }
.nc-icon { font-size: 30px; }

/* ---------- A franchise's own colour (brand.js puts .brand-own on <html>) ---------- */
html.brand-own { --bar: var(--brand); --bar2: color-mix(in srgb, var(--brand) 75%, #fff); --brand-deep: color-mix(in srgb, var(--brand) 68%, #000); }
.brand-own .btn.primary, .brand-own .btn.primary:active { box-shadow: 0 4px 0 var(--brand-deep); }
.brand-own .welcome-banner, .brand-own .cta-inner, .brand-own .login-hero, .brand-own .stats-row {
  background: radial-gradient(circle at 90% 12%, rgba(255, 255, 255, .22), transparent 38%),
              linear-gradient(130deg, var(--brand-deep), var(--brand) 60%, color-mix(in srgb, var(--brand) 55%, #fff));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--brand) 28%, transparent);
}
.shell-logo[data-brand] { font-size: 17px; line-height: 1.15; padding: 0 12px; justify-content: flex-start; overflow: hidden; }
.shell-logo[data-brand] img { flex: none; }
