/* Classroom: the Games Hub arcade look (starfield, neon grid, Bungee/Inter),
   with larger, high-contrast reading text for lessons. */
:root {
  --bg: #090617;
  --text: #eef0fb;
  --muted: #a9afcf;
  --accent: #6ea8fe;
  --accent-2: #b388ff;
  --hot: #ff4fa3;
  --gold: #ffd86b;
  --yellow: #ffe23a;
  --orange: #ff7a1f;
  --good: #5be39a;
  --bad: #ff6b81;
  --badge: var(--gold);
  --font-display: "Bungee", "Impact", "Arial Black", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 75% -12%, #2a1a63 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 10%, #13265a 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Background */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(460px 460px at 12% 22%, rgba(110, 168, 254, 0.2), transparent 70%),
    radial-gradient(520px 520px at 90% 30%, rgba(255, 79, 163, 0.14), transparent 70%),
    radial-gradient(560px 560px at 60% 95%, rgba(179, 136, 255, 0.18), transparent 70%);
  animation: orb-drift 18s ease-in-out infinite alternate;
}
.bg-orbs::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 22% 38%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 37% 8%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 63% 14%, rgba(255, 226, 58, 0.8), transparent),
    radial-gradient(1px 1px at 71% 44%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 84% 9%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(2px 2px at 15% 56%, rgba(179, 136, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 78% 60%, rgba(110, 168, 254, 0.8), transparent);
  animation: twinkle 6s ease-in-out infinite alternate;
}
.bg-grid {
  position: fixed;
  right: -50%;
  bottom: 0;
  left: -50%;
  z-index: -1;
  height: 38vh;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(179, 136, 255, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(179, 136, 255, 0.24) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 85%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 85%);
  animation: grid-scroll 3.5s linear infinite;
}
@keyframes orb-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-2%, 3%, 0) scale(1.06); } }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes grid-scroll { from { background-position: 0 0; } to { background-position: 0 56px; } }

.glass {
  background: linear-gradient(160deg, rgba(40, 26, 84, 0.72), rgba(12, 8, 26, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 255, 255, 0.12);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { font-size: 28px; filter: drop-shadow(0 0 10px rgba(179, 136, 255, 0.6)); }
.brand-text { font-family: var(--font-display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}
#player-name { overflow: hidden; max-width: 160px; text-overflow: ellipsis; white-space: nowrap; }
.chip-badges { color: var(--gold); white-space: nowrap; }

.container { max-width: 1080px; margin: 0 auto; padding: 4px 20px 64px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-family: var(--font-display); font-size: clamp(24px, 4.2vw, 36px); font-weight: 400; letter-spacing: 0.3px; }
h1:focus { outline: none; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 10px; }
.section-title { margin: 28px 4px 12px; font-family: var(--font-display); font-size: 20px; font-weight: 400; color: var(--yellow); }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.loading { padding: 60px 0; color: var(--muted); font-size: 20px; text-align: center; }
.panel { margin-top: 18px; padding: 22px; }
.back { display: inline-block; margin: 6px 0 12px; color: var(--muted); font-weight: 700; text-decoration: none; }
.back:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn:focus-visible, .option:focus-visible, .link:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.btn.primary { border-color: transparent; background: linear-gradient(135deg, var(--hot), var(--orange)); color: #fff; box-shadow: 0 8px 24px rgba(255, 79, 163, 0.35); }
.btn.primary:hover { background: linear-gradient(135deg, #ff66b1, #ff8c3a); }
.btn.big { min-height: 52px; padding: 12px 24px; font-size: 18px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.ghost { background: transparent; }
.link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Badges: one colour per topic */
.b-g4m-01 { --badge: #6ea8fe; } .b-g4m-02 { --badge: #5be39a; } .b-g4m-03 { --badge: #ff7a1f; } .b-g4m-04 { --badge: #ff4fa3; }
.b-g4m-05 { --badge: #ffd86b; } .b-g4m-06 { --badge: #b388ff; } .b-g4m-07 { --badge: #ff6b6b; } .b-g4m-08 { --badge: #4dd9e8; }
.b-g4m-09 { --badge: #f78fb3; } .b-g4m-10 { --badge: #d19a6a; } .b-g4m-11 { --badge: #7bed9f; } .b-g4m-12 { --badge: #ffe23a; }
.b-g4m-13 { --badge: #70a1ff; } .b-g4m-14 { --badge: #a29bfe; } .b-g4m-15 { --badge: #fd9644; } .b-g4m-16 { --badge: #45aaf2; }

.medal {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 3px dashed rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  font-size: 26px;
  filter: grayscale(0.7);
  opacity: 0.8;
}
.medal.earned {
  border: 3px solid var(--badge);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 60%), var(--badge);
  box-shadow: 0 0 22px var(--badge);
  filter: none;
  opacity: 1;
}
.medal.huge { width: 96px; height: 96px; font-size: 46px; }

/* Home */
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 26px; }
.hero-text { flex: 1 1 420px; }
.hero-text p:last-child { margin: 0; color: var(--muted); }
.hero-score { text-align: center; }
.big-number { font-family: var(--font-display); font-size: 56px; line-height: 1; color: var(--gold); text-shadow: 0 0 24px rgba(255, 216, 107, 0.5); }
.of { display: block; margin-top: 4px; color: var(--muted); font-weight: 700; }
.milestones { display: flex; gap: 8px; justify-content: center; margin: 12px 0 0; padding: 0; list-style: none; }
.milestones li {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.milestones li.reached { border-color: var(--gold); background: rgba(255, 216, 107, 0.18); color: var(--gold); }

.join { margin-top: 18px; padding: 22px; border-color: rgba(255, 216, 107, 0.45); }
.join h2 { color: var(--gold); font-family: var(--font-display); font-weight: 400; }
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 216, 107, 0.4);
  border-radius: 14px;
  background: rgba(255, 216, 107, 0.08);
  font-size: 15px;
}
.flash {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 107, 129, 0.18);
  color: #ffd1d8;
  font-weight: 700;
}

.up-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 20px 22px;
  border-color: var(--badge);
  color: inherit;
  text-decoration: none;
}
.up-next .medal { width: 72px; height: 72px; font-size: 34px; border-color: var(--badge); filter: none; opacity: 1; }
.up-next-text { flex: 1 1 300px; }
.up-next-text > strong { display: block; font-size: 22px; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px 14px;
  color: inherit;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.topic-card:hover { transform: translateY(-4px); border-color: var(--badge); }
.topic-num { position: absolute; top: 8px; left: 12px; color: var(--muted); font-family: var(--font-display); font-size: 14px; }
.topic-name { font-weight: 800; line-height: 1.25; }
.topic-status { color: var(--muted); font-size: 13px; font-weight: 700; }
.status-mastered { border-color: var(--badge); }
.status-mastered .topic-status { color: var(--gold); }
.status-in-progress .topic-status { color: var(--accent); }
.footnote { margin-top: 28px; color: var(--muted); font-size: 14px; text-align: center; }

/* Mastery meter */
.stars { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.star { color: rgba(255, 255, 255, 0.18); font-size: 30px; line-height: 1; }
.star.on { color: var(--gold); text-shadow: 0 0 12px rgba(255, 216, 107, 0.7); }
.mastery.compact .star { font-size: 22px; }
.mastery-rule { color: var(--muted); }
.skill-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; padding: 0; list-style: none; }
.skill-checks li { padding: 4px 10px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 700; }
.skill-checks li.done { border-color: var(--good); color: var(--good); }
.mastery.compact .mastery-rule.small, .mastery.compact .skill-checks { display: none; }
.mastery-done { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.mastery-done p { margin: 0; }

/* Lesson progress */
.lesson-dots { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; padding: 0; list-style: none; }
.lesson-dots li { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.22); border-radius: 50%; }
.lesson-dots li.on { border-color: var(--good); background: var(--good); box-shadow: 0 0 8px rgba(91, 227, 154, 0.6); }
.round-bar .lesson-dots { flex: 1 1 200px; margin: 0; }
.chip-count { margin-left: 4px; color: var(--accent); font-size: 12px; }
.section-note { margin: -4px 4px 12px; color: var(--muted); font-size: 15px; }
.skill-main { flex: 1 1 280px; min-width: 0; }
.skill-card.complete { border-color: rgba(91, 227, 154, 0.55); }
.unlocks { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; background: rgba(255, 216, 107, 0.1); font-size: 14px; list-style: none; }
.unlocks li { margin: 2px 0; }
.unlocks li::before { content: "🎁 "; }
.celebrate-card .unlocks { margin: 10px 0 14px; text-align: left; }

/* Topic page */
.topic-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; padding: 24px; border-color: var(--badge); }
.topic-hero > div { flex: 1 1 360px; }
.topic-hero p:last-child { margin: 0; color: var(--muted); }
.topic-hero .medal { border-color: var(--badge); filter: none; opacity: 1; }
.panel .btn.big { margin-top: 8px; }
.skill-list { display: grid; gap: 12px; }
.skill-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; }
.skill-card p { margin: 0; }
.read-mark { color: var(--good); font-weight: 800; }

/* Lesson page */
.lesson { max-width: 820px; padding: clamp(18px, 4vw, 34px); font-size: 19px; line-height: 1.65; }
.lesson h1 { margin-bottom: 18px; }
.lesson h3 { font-size: 19px; }
.block-text { margin: 0 0 16px; }
.block-vocab, .block-example, .block-check { margin: 18px 0; padding: 16px 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); }
.block-vocab h3 { color: var(--yellow); }
.block-vocab dl { display: grid; gap: 10px; margin: 0; }
.block-vocab dt { color: var(--accent); font-weight: 800; }
.block-vocab dd { margin: 0; }
.block-example { border-left: 5px solid var(--accent); }
.block-check { border-left: 5px solid var(--good); }
.tag { display: inline-block; margin-right: 6px; padding: 2px 8px; border-radius: 8px; background: rgba(110, 168, 254, 0.2); color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; vertical-align: 2px; }
.block-check .tag { background: rgba(91, 227, 154, 0.18); color: var(--good); }
.problem { font-weight: 700; }
details { margin-top: 8px; }
summary { display: inline-block; padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); font-weight: 800; cursor: pointer; }
details[open] summary { margin-bottom: 10px; }
.steps { margin: 0 0 10px; padding-left: 26px; }
.steps li { margin-bottom: 6px; }
.example-answer, .check-answer { margin: 0; color: var(--gold); font-weight: 800; }
.check-why { margin: 6px 0 0; color: var(--muted); }
.block-callout { display: flex; gap: 12px; margin: 18px 0; padding: 14px 16px; border-radius: 16px; }
.block-callout p { margin: 0; }
.block-callout.tip { background: rgba(255, 226, 58, 0.1); }
.block-callout.mistake { background: rgba(255, 107, 129, 0.12); }
.callout-icon { font-size: 22px; }
.lesson-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.12); }

/* Visuals */
.visual { margin: 18px 0; overflow-x: auto; }
.visual svg { display: block; width: 100%; max-width: 620px; height: auto; margin: 0 auto; }
.visual-angle svg, .visual-array svg { max-width: 380px; }
.visual-text { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); color: var(--muted); }
.visual svg text { fill: var(--text); font-family: inherit; font-size: 18px; font-weight: 700; text-anchor: middle; }
.visual svg .axis, .visual svg .tick, .visual svg .ray { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.visual svg .tick { stroke-width: 2; }
.visual svg .tick-label { fill: var(--muted); font-size: 15px; }
.visual svg .mark { fill: var(--hot); }
.visual svg .mark-label { fill: var(--hot); }
.visual svg .dim-label { fill: var(--accent); }
.visual svg .cell { stroke: var(--bg); stroke-width: 3; }
.visual svg .cell-0 { fill: rgba(110, 168, 254, 0.45); }
.visual svg .cell-1 { fill: rgba(179, 136, 255, 0.45); }
.visual svg .cell-2 { fill: rgba(255, 79, 163, 0.4); }
.visual svg .cell-3 { fill: rgba(91, 227, 154, 0.4); }
.visual svg .cell-label { font-size: 20px; }
.visual svg .dot { fill: var(--accent); }
.visual svg .part { fill: rgba(255, 255, 255, 0.06); stroke: var(--text); stroke-width: 2; }
.visual svg .part.shaded { fill: var(--accent-2); }
.visual svg .fraction-label { fill: var(--gold); font-size: 22px; }
.visual svg .x-mark { fill: var(--gold); font-size: 26px; }
.visual svg .plot-title { font-size: 18px; }
.visual svg .unit-label { fill: var(--muted); font-size: 14px; }
.visual svg .angle-arc { fill: none; stroke: var(--gold); stroke-width: 3; }
.visual svg .angle-label { fill: var(--gold); text-anchor: start; }
.visual svg .vertex { fill: var(--text); }
table { width: 100%; border-collapse: collapse; font-size: 17px; }
.data-table th, .data-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); text-align: left; }
.data-table th { color: var(--accent); }
.pv-chart { table-layout: fixed; text-align: center; }
.pv-chart th { padding: 8px 4px; border-radius: 10px 10px 0 0; font-size: 12px; line-height: 1.2; }
.pv-chart td { padding: 10px 4px; font-family: var(--font-display); font-size: 30px; }
.pv-chart .pv-0 { background: rgba(110, 168, 254, 0.25); } .pv-chart .pv-1 { background: rgba(179, 136, 255, 0.25); }
.pv-chart .pv-2 { background: rgba(255, 79, 163, 0.22); } .pv-chart .pv-3 { background: rgba(255, 122, 31, 0.22); }
.pv-chart .pv-4 { background: rgba(255, 226, 58, 0.2); } .pv-chart .pv-5 { background: rgba(91, 227, 154, 0.22); }

/* Practice */
.round-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 4px; }
.round-bar .back { margin: 0; }
.round-dots { display: flex; flex: 1 1 200px; gap: 6px; margin: 0; padding: 0; list-style: none; }
.round-dots li { flex: 1; height: 10px; max-width: 46px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); }
.round-dots li.current { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.round-dots li.right { background: var(--good); }
.round-dots li.wrong { background: var(--bad); }
.streak { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-weight: 800; }
.streak.hot { background: rgba(255, 122, 31, 0.25); color: var(--yellow); }
.question { margin-top: 14px; padding: clamp(18px, 4vw, 30px); border-color: var(--badge); }
.prompt { font-family: inherit; font-size: clamp(21px, 3.4vw, 28px); font-weight: 800; line-height: 1.35; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 18px 0 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 12px 16px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.option:hover:not(:disabled) { border-color: var(--accent); background: rgba(110, 168, 254, 0.14); transform: translateY(-2px); }
.option:disabled { cursor: default; }
.option .key { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(255, 255, 255, 0.12); font-family: var(--font-display); font-size: 15px; }
.option.right { border-color: var(--good); background: rgba(91, 227, 154, 0.2); }
.option.right .key { background: var(--good); color: #062b16; }
.option.wrong { border-color: var(--bad); background: rgba(255, 107, 129, 0.18); }
.option.dim { opacity: 0.5; }
.hint { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 226, 58, 0.1); }
.feedback { margin-top: 14px; padding: 16px 18px; border-radius: 16px; }
.feedback.right { background: rgba(91, 227, 154, 0.12); }
.feedback.wrong { background: rgba(255, 107, 129, 0.12); }
.feedback-title { font-size: 20px; font-weight: 800; }
.done .score { font-size: 20px; font-weight: 700; }
.done .score .big-number { font-size: 48px; }

/* Celebration */
.celebrate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(5, 3, 14, 0.72); }
.celebrate-card { position: relative; max-width: 460px; padding: 30px 26px; text-align: center; animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
.celebrate-card h2 { color: var(--gold); font-family: var(--font-display); font-size: 32px; font-weight: 400; }
.celebrate-card .medal { margin-bottom: 14px; }
.bonus { color: var(--yellow); font-weight: 800; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 2.6s linear infinite; }
.confetti i.c0 { background: var(--hot); } .confetti i.c1 { background: var(--gold); } .confetti i.c2 { background: var(--accent); }
.confetti i.c3 { background: var(--good); } .confetti i.c4 { background: var(--accent-2); } .confetti i.c5 { background: var(--orange); }
.confetti i:nth-child(4n + 1) { left: 8%; animation-delay: -0.3s; } .confetti i:nth-child(4n + 2) { left: 33%; animation-delay: -1.1s; }
.confetti i:nth-child(4n + 3) { left: 61%; animation-delay: -1.8s; } .confetti i:nth-child(4n + 4) { left: 86%; animation-delay: -0.7s; }
.confetti i:nth-child(3n) { margin-left: 7%; animation-duration: 3.1s; } .confetti i:nth-child(5n) { margin-left: -5%; animation-duration: 2.2s; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fall { from { transform: translateY(0) rotate(0); } to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .topbar { padding: 12px 16px; }
  .container { padding: 4px 16px 48px; }
  .brand-text { display: none; }
  #player-name { max-width: 96px; }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .lesson { font-size: 18px; }
  .pv-chart th { font-size: 10px; }
  .pv-chart td { font-size: 22px; }
}

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