:root {
  --bg-1: #140a3a;
  --bg-2: #2a1470;
  --bg-3: #0b0720;
  --card: #fffaf3;
  --ink: #1c1448;
  --muted: #5c5488;
  --gold: #ffd24a;
  --gold-dim: #e8c56a;
  --pink: #ff6b9d;
  --cyan: #3ee0c9;
  --lime: #8be86a;
  --orange: #ff9f43;
  --blue: #4d9fff;
  --violet: #8b6cff;
  --shadow: 0 14px 34px rgba(12, 6, 40, 0.35);
  --radius: 22px;
  --fp-lp: #ff5d73;
  --fp-lr: #ff9f43;
  --fp-lm: #ffd93d;
  --fp-li: #6bcb77;
  --fp-th: #c084fc;
  --fp-ri: #4d9fff;
  --fp-rm: #2ee0c5;
  --fp-rr: #a78bfa;
  --fp-rp: #ff6ad5;
  font-size: 18px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 20% -10%, #4a1d9a 0%, transparent 50%),
              radial-gradient(900px 600px at 100% 10%, #1c4ea8 0%, transparent 45%),
              linear-gradient(180deg, var(--bg-2), var(--bg-1) 40%, var(--bg-3));
  color: #fff;
  font-family: "Segoe UI", "Trebuchet MS", "Arial Rounded MT Bold", "Chalkboard SE", "Comic Sans MS", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

#stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 28% 72%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 24%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 63% 14%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 81% 38%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 91% 78%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 88%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 52% 90%, #fff7 50%, transparent 51%);
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 18px;
  max-width: 1280px;
  margin: 0 auto;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: fadeIn 0.35s ease;
}

.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.icon-btn {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 5;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 10, 50, 0.55);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  border: 2px solid rgba(255,255,255,0.45);
}
.icon-btn:hover { background: rgba(20, 10, 50, 0.8); }
.icon-btn.muted { opacity: 0.7; }

.brand-logo {
  display: block;
  height: 270px;
  width: auto;
  max-width: min(420px, 78vw);
  object-fit: contain;
  margin: 0 auto 2px;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.4));
}

.title {
  margin: 0;
  text-align: center;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.02em;
  text-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

.hello, .lead {
  text-align: center;
  font-size: 1.35rem;
  color: #efe8ff;
  margin: 8px 0 22px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.big-btn, .game-card, .speed-btn, .back-btn, .parent-btn, .lesson-card {
  font-family: inherit;
  cursor: pointer;
}

.big-btn {
  border: 0;
  min-width: 200px;
  padding: 18px 28px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 6px 0 #c9b8e0, var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.big-btn:hover { transform: translateY(-2px); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #c9b8e0; }
.btn-lessons { background: linear-gradient(#fffdf7, #ffe8a3); }
.btn-games { background: linear-gradient(#f4fffd, #9af3e4); }
.btn-stars { background: linear-gradient(#fff6fb, #ffc1dd); }

.home-footer {
  margin-top: auto;
  padding-top: 18px;
  text-align: center;
}
.home-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.home-credit {
  display: inline-block;
  margin-top: 14px;
  background: none;
  border: 0;
  padding: 4px 8px;
  color: #c6bedf;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.8;
}
.home-credit:hover { color: #fff; opacity: 1; }

.chip {
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.topbar h2 {
  margin: 0;
  font-size: 1.6rem;
  flex: 1;
}
.back-btn {
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
}
.back-btn:hover { background: rgba(255,255,255,0.28); }
.spacer { width: 80px; }
.live-stats {
  display: flex;
  gap: 14px;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.12);
  padding: 8px 14px;
  border-radius: 999px;
}

.lesson-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 8px 4px 20px;
}
.chapter-title {
  grid-column: 1 / -1;
  margin: 10px 2px 0;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #d7cfff;
}

.lesson-card {
  text-align: left;
  border: 0;
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lesson-card .num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--violet);
}
.lesson-card h3 {
  margin: 0;
  font-size: 1.15rem;
}
.lesson-card .stars { font-size: 1.25rem; letter-spacing: 2px; color: #e6a800; }
.lesson-card.locked {
  background: rgba(255,255,255,0.12);
  color: #ddd6ff;
  box-shadow: none;
  cursor: not-allowed;
}
.lesson-card.locked .stars { color: #d7cfff; }
.lesson-card:not(.locked):hover { transform: translateY(-2px); }

.intro {
  text-align: center;
  margin: 0 0 6px;
  color: #efe8ff;
  font-size: 1.05rem;
}

.now-box {
  align-self: center;
  background: var(--card);
  color: var(--ink);
  border-radius: 24px;
  min-width: 180px;
  padding: 8px 28px 12px;
  text-align: center;
  box-shadow: 0 8px 0 #d7c4ff, var(--shadow);
  margin: 4px 0 10px;
}
.now-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.now-char {
  font-size: 5.2rem;
  font-weight: 800;
  line-height: 1;
  min-height: 5.2rem;
  letter-spacing: 0.02em;
}
.now-char.space-char {
  font-size: 2.4rem;
  padding: 18px 0 8px;
}
.now-char.flash-ok { animation: okPop 0.22s ease; }
.now-char.flash-bad { animation: badShake 0.28s ease; }

@keyframes okPop {
  50% { transform: scale(1.12); color: #1f9d55; }
}
@keyframes badShake {
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.prompt {
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.7;
  padding: 6px 10px 8px;
  min-height: 3.2em;
  word-break: break-word;
}
.prompt .ch {
  display: inline-block;
  min-width: 0.7em;
  border-bottom: 3px solid transparent;
  color: #cbbfff;
}
.prompt .ch.done { color: #8be86a; }
.prompt .ch.current {
  color: var(--ink);
  background: var(--gold);
  border-radius: 8px;
  padding: 0 4px;
  border-bottom-color: #e09a00;
  transform: translateY(-2px);
}
.prompt .ch.space { min-width: 0.85em; }
.prompt .ch.space.current { min-width: 1.2em; }

.finger-hint {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  min-height: 1.4em;
  margin: 2px 0 6px;
}
.praise {
  text-align: center;
  min-height: 1.4em;
  font-size: 1.15rem;
  color: #ffe47a;
  font-weight: 800;
}
.caps-warn {
  text-align: center;
  background: #ffd24a;
  color: var(--ink);
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 12px;
  margin: 0 auto 8px;
}
.hidden { display: none !important; }

.hands {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 4px 0 8px;
  flex-shrink: 0;
}
.hand {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.hand.right { flex-direction: row-reverse; }
.finger {
  width: 34px;
  border-radius: 16px 16px 10px 10px;
  background: var(--c, #ccc);
  height: 58px;
  opacity: 0.45;
  position: relative;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.12);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.finger.thumb {
  height: 38px;
  width: 40px;
  border-radius: 20px;
  align-self: flex-start;
  margin-top: 28px;
}
.finger.lp, .finger.rp { height: 48px; }
.finger.lr, .finger.rr { height: 58px; }
.finger.lm, .finger.rm { height: 66px; }
.finger.li, .finger.ri { height: 60px; }
.finger.active {
  opacity: 1;
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.55), 0 8px 16px rgba(0,0,0,0.25);
}
.finger::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
}

.keyboard {
  margin-top: auto;
  background: rgba(12, 8, 30, 0.55);
  border-radius: 18px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.keyboard.compact { transform-origin: bottom center; }
.kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.key {
  --w: 1;
  flex: var(--w) 1 0;
  min-width: 0;
  max-width: calc(var(--w) * 62px);
  height: 46px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--kc, #889) 55%, #1a1433);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.12);
  position: relative;
  text-transform: uppercase;
}
.key.wide { font-size: 0.7rem; }
.key.home-bump::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.7);
}
.key.target {
  background: var(--gold);
  color: var(--ink);
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,210,74,0.45), 0 0 18px rgba(255,210,74,0.6);
  animation: keyPulse 0.9s ease-in-out infinite;
  z-index: 1;
}
.key.shift-target {
  background: #ffe9a8;
  color: var(--ink);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,210,74,0.4);
}
.key.pressed-ok {
  background: var(--lime);
  color: var(--ink);
}
.key.pressed-bad {
  background: #ff8fa3;
  color: var(--ink);
}
@keyframes keyPulse {
  50% { transform: translateY(-2px) scale(1.06); }
}

.complete-card {
  margin: auto;
  background: var(--card);
  color: var(--ink);
  border-radius: 28px;
  padding: 32px 36px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 640px;
  width: 100%;
}
.complete-card .hello { color: var(--ink); font-size: 2rem; font-weight: 800; margin: 0 0 8px; }
.mascot-complete {
  display: block;
  height: 150px;
  width: auto;
  margin: -4px auto 6px;
  filter: drop-shadow(0 8px 10px rgba(28, 20, 72, 0.2));
}
.big-stars { font-size: 3.4rem; letter-spacing: 8px; min-height: 1.2em; }
.big-stars .star { display: inline-block; opacity: 0.28; transform: scale(0.6); color: #c9c0e0; }
.big-stars .star.on {
  opacity: 1;
  color: #ffc107;
  text-shadow: 0 3px 0 #d49b00, 0 0 14px rgba(255, 196, 0, 0.55);
  animation: starIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes starIn {
  from { transform: scale(0.2) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.unlock {
  background: #8be86a;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
}
.complete-stats {
  display: flex;
  justify-content: space-around;
  margin: 18px 0 24px;
  gap: 8px;
}
.complete-stats div span { display: block; color: var(--muted); font-size: 0.9rem; }
.complete-stats div strong { font-size: 1.35rem; }

.speed-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.speed-btn {
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 1rem;
}
.speed-btn.active {
  background: var(--gold);
  color: var(--ink);
}

.game-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
.game-card {
  border: 0;
  background: var(--card);
  color: var(--ink);
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.game-card:hover { transform: translateY(-3px); }
.game-emoji { font-size: 3.2rem; }
.game-card h3 { margin: 6px 0 8px; font-size: 1.5rem; }
.game-card p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.pop-sky {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(#7ad7ff, #c6f0ff 55%, #fff6c2);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.35);
}
.bubble {
  position: absolute;
  width: 86px;
  height: 86px;
  margin-left: -43px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--ink);
  background: radial-gradient(circle at 30% 28%, #fff, var(--bc, #ffd24a) 55%, color-mix(in srgb, var(--bc, #ffd24a) 70%, #000));
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.08), 0 8px 16px rgba(0,0,0,0.15);
  border: 3px solid rgba(255,255,255,0.7);
  text-transform: uppercase;
  pointer-events: none;
}
.bubble.popping {
  animation: bubblePop 0.28s ease forwards;
}
@keyframes bubblePop {
  60% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.2); opacity: 0; }
}

.track-wrap {
  background: linear-gradient(#1b1148, #2a1a6c);
  border-radius: 20px;
  padding: 16px 18px 10px;
  margin: 8px 0 16px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.12);
}
.track {
  position: relative;
  height: 100px;
  background: repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(255,255,255,0.08) 28px, rgba(255,255,255,0.08) 30px);
  border-bottom: 4px dashed rgba(255,255,255,0.25);
}
.racer {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translateX(0);
  transition: transform 0.28s ease;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.2));
  line-height: 0;
}
.racer img {
  height: 96px;
  width: auto;
  display: block;
  pointer-events: none;
}
.finish {
  position: absolute;
  right: 6px;
  top: 0;
  font-size: 2.2rem;
}

.race-word {
  text-align: center;
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  min-height: 1.3em;
}
.race-word .ok { color: #8be86a; }
.race-word .cur {
  color: var(--ink);
  background: var(--gold);
  border-radius: 10px;
  padding: 0 6px;
}
.race-word .wait { color: #d7cfff; }
.race-typed { text-align: center; min-height: 1.2em; color: #cbbfff; }

.game-result {
  position: absolute;
  inset: 70px 20px 20px;
  background: rgba(20, 10, 50, 0.82);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 3;
  backdrop-filter: blur(6px);
}
.game-result h3 { font-size: 2.2rem; margin: 0 0 8px; }
.game-result .mascot-result {
  height: 120px;
  width: auto;
  margin-bottom: 6px;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.35));
}
.game-result p { font-size: 1.25rem; margin: 6px 0 18px; }
#screen-pop, #screen-race { position: relative; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 14px;
  text-align: center;
}
.stat-card span { display: block; color: #d7cfff; font-size: 0.9rem; }
.stat-card strong { font-size: 1.45rem; }

.lesson-list.compact { max-height: 34vh; }

.parent-area {
  margin-top: auto;
  padding-top: 16px;
  text-align: center;
  color: #cbbfff;
  font-size: 0.95rem;
}
.parent-btn {
  position: relative;
  overflow: hidden;
  border: 0;
  margin-top: 8px;
  padding: 12px 22px;
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
  color: #efe8ff;
  font-weight: 700;
  font-size: 1rem;
  min-width: 260px;
}
#parent-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #ff6b9d, #ffd24a);
  opacity: 0.55;
}
.parent-label { position: relative; z-index: 1; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 24, 0.72);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--card);
  color: var(--ink);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal-card p { font-size: 1.3rem; font-weight: 800; margin: 0 0 20px; }

.confetti-bit {
  position: fixed;
  width: 10px;
  height: 16px;
  top: -20px;
  z-index: 30;
  pointer-events: none;
  animation: fall 1.2s ease-in forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(420deg); opacity: 0.2; }
}

@media (max-height: 860px) {
  .brand-logo { height: 210px; }
  .mascot-complete { height: 120px; }
}
@media (max-height: 800px) {
  .brand-logo { height: 170px; }
  .now-char { font-size: 3.6rem; min-height: 3.6rem; }
  .key { height: 38px; }
  .finger { transform: scale(0.86); }
  .title { font-size: 2.1rem; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.name-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
#name-input, #parent-name-input {
  width: 100%;
  max-width: 420px;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  padding: 14px 16px;
  border-radius: 16px;
  border: 3px solid rgba(255,255,255,0.55);
  background: var(--card);
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
  outline: none;
}
#name-input:focus, #parent-name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.35);
}
.name-error { color: #ffd24a; font-weight: 800; margin: 0; }
.name-note {
  text-align: center;
  color: #d7cfff;
  margin-top: auto;
  padding-top: 24px;
  font-size: 0.95rem;
}
.parent-card { text-align: left; }
.parent-card > p:first-child { text-align: center; }
.parent-field-label {
  display: block;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
}
.name-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.name-row input { flex: 1; min-width: 160px; font-size: 1.15rem; text-align: left; }
.name-row .big-btn { min-width: 0; padding: 12px 18px; font-size: 1.05rem; }
.parent-msg { min-height: 1.2em; margin: 8px 0 16px; font-weight: 700; color: #1f9d55; }
.parent-actions { justify-content: center; }

#screen-about { overflow: auto; }
.about-card {
  margin: 8px auto 20px;
  background: var(--card);
  color: var(--ink);
  border-radius: 28px;
  padding: 22px 26px 26px;
  text-align: center;
  max-width: 640px;
  width: 100%;
  box-shadow: var(--shadow);
}
.about-logo {
  display: block;
  height: 130px;
  width: auto;
  margin: 0 auto 6px;
}
.about-card h3 {
  margin: 6px 0 8px;
  font-size: 1.55rem;
}
.about-credit {
  font-weight: 800;
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.about-pitch {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 1.05rem;
}
.about-qr {
  display: block;
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  margin: 0 auto;
  box-shadow: 0 6px 16px rgba(28, 20, 72, 0.12);
}
.about-scan {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 8px 0 16px;
}
.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
a.about-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  color: var(--ink);
}

/* ---- v2 layout, license, audio, new features ---- */
.top-controls {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 6;
  display: flex;
  gap: 8px;
}
.top-controls .icon-btn { position: static; }
.brand-logo.compact { height: 118px; max-width: min(240px, 50vw); }
.btn-daily { background: linear-gradient(#fffdf7, #ffd7a0); }
.btn-map { background: linear-gradient(#f3fff6, #b6f0c0); }
.btn-shop { background: linear-gradient(#f6f0ff, #d9c7ff); }
.license-line {
  margin: 10px 0 0;
  font-weight: 800;
  color: #ffe08a;
  cursor: pointer;
}
.license-line.trial { color: #ffd24a; text-decoration: underline; }
.credit-line, .home-credit, .about-credit, #cert-credit, #report-credit, #unlock-credit, #name-credit {
  color: inherit;
}
.credit-line a, .home-credit a, .about-credit a {
  color: #c45c10;
  font-weight: 800;
  text-decoration: underline;
}
.home-credit { color: #c6bedf; }
.home-credit a { color: #ffd24a; }
.about-credit a { color: #7a3e00; }

#screen-lessons, #screen-about, #screen-unlock, #screen-pricing, #screen-settings,
#screen-games, #screen-stats, #screen-daily, #screen-badges,
#screen-shop, #screen-cert, #screen-heatmap, #screen-story,
#screen-report, #screen-challenge, #screen-spelling, #screen-home {
  overflow: auto;
}
#parent-modal .parent-card { max-height: 86vh; overflow: auto; }
#unlock-key, #spelling-list, #unlock-name, #p1-name, #p2-name, #parent-bday {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: 14px;
  border: 3px solid #d7cfff;
  background: #fff;
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
  margin-bottom: 10px;
}
#unlock-key { font-family: Consolas, "Courier New", monospace; letter-spacing: 0.04em; min-height: 90px; }
.device-box {
  margin: 16px 0;
  background: #f4efff;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.95rem;
}
.device-box strong { display: inline-block; margin: 6px 10px 6px 0; letter-spacing: 0.08em; font-size: 1.15rem; }
.settings-card, .unlock-card { max-width: 680px; margin: 0 auto 20px; background: var(--card); color: var(--ink); border-radius: 24px; padding: 20px 22px 24px; box-shadow: var(--shadow); }
.settings-card h3 { margin: 18px 0 8px; }
.setting-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.setting-row input[type=range] { flex: 1; }
.check { font-weight: 800; display: flex; gap: 8px; align-items: center; min-width: 160px; }
.hint { color: var(--muted); font-size: 0.95rem; }
.about-license { font-weight: 800; color: #5c3d00; }

.lesson-card.paid-lock { cursor: pointer; opacity: 1; }
.lesson-card .lock-badge { font-size: 0.85rem; color: #6b4bb1; font-weight: 800; }
.lesson-card.boss-card { border: 3px solid #ffd24a; background: linear-gradient(#fffdf7, #ffe8a3); }
.game-card.locked, .big-btn.locked { position: relative; }
.lock-pill {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.8rem;
  background: #3b2178;
  color: #ffe08a;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 800;
}

.mascot-buddy-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 4px;
}
.mascot-buddy, .mascot-buddy-wrap .mascot {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.35));
}
.mascot-complete-wrap { width: 180px; height: 180px; }
.mascot-hat-layer, .mascot-outfit-layer {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  font-size: 2.2rem;
  line-height: 1;
}
.mascot-hat-layer { top: -8px; }
.mascot-outfit-layer { bottom: 10px; font-size: 1.8rem; }
.mascot-buddy-wrap.talking .mascot-buddy,
.mascot-buddy-wrap.talking .mascot { animation: talk 0.28s ease-in-out infinite alternate; }
.mascot-buddy-wrap.jump .mascot-buddy,
.mascot-buddy-wrap.jump .mascot { animation: jump 0.55s ease; }
@keyframes talk {
  from { transform: scale(1, 1); }
  to { transform: scale(1.04, 0.96); }
}
@keyframes jump {
  0% { transform: translateY(0); }
  40% { transform: translateY(-22px) rotate(-6deg); }
  70% { transform: translateY(-6px) rotate(4deg); }
  100% { transform: translateY(0); }
}
.big-stars .star.fly-in { animation: flyIn 0.55s cubic-bezier(.2,1.4,.3,1) both; }
@keyframes flyIn {
  from { transform: translateY(-40px) scale(0.2) rotate(-20deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sticker-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 560px;
  margin: 0 auto 20px;
}
.sticker-cell, .sticker-dow {
  text-align: center;
  border-radius: 10px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.12);
  min-height: 52px;
  font-weight: 800;
}
.sticker-dow { min-height: 0; background: none; color: #d7cfff; font-size: 0.8rem; }
.sticker-cell.today { outline: 2px solid var(--gold); }
.sticker-cell .sticker { font-size: 1.3rem; display: block; }
.badge-grid, .shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding-bottom: 20px;
}
.badge-card, .shop-item {
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.badge-card.locked { opacity: 0.45; filter: grayscale(0.7); }
.badge-card .emoji { font-size: 2rem; }
.shop-item .price { font-weight: 800; color: #8a5a00; }
.shop-item.equipped { outline: 3px solid #1f9d55; }

.meteor-sky {
  position: relative;
  flex: 1;
  min-height: 280px;
  overflow: hidden;
  background: linear-gradient(#071226, #1a1048);
  border-radius: 18px;
}
.meteor {
  position: absolute;
  padding: 8px 12px;
  border-radius: 40px 16px 16px 40px;
  background: linear-gradient(#ffb347, #ff5d2a);
  color: #2a1000;
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: 0 0 16px #ff8a3a;
  white-space: nowrap;
}
.meteor-ground {
  text-align: center;
  padding: 8px;
  font-weight: 800;
  background: #2a1a0a;
  border-radius: 0 0 16px 16px;
  margin-bottom: 8px;
}
.boss-arena { text-align: center; flex: 1; }
.boss-sprite { font-size: 6rem; animation: talk 0.6s ease-in-out infinite alternate; }
.hp-bar { width: min(420px, 90%); height: 18px; margin: 8px auto 16px; background: #3a1040; border-radius: 10px; overflow: hidden; }
#boss-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5d73, #ffd24a); transition: width 0.2s; }

.story-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 8px 0 24px;
}
.island {
  background: rgba(255,255,255,0.12);
  border: 0;
  border-radius: 20px;
  padding: 16px 12px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  min-height: 140px;
  position: relative;
}
.island.current { outline: 3px solid var(--gold); }
.island.locked { opacity: 0.5; cursor: pointer; }
.island .traveler { font-size: 2rem; position: absolute; top: -12px; right: 8px; }
.island h3 { margin: 8px 0 4px; }

.cert-page, .report-page {
  background: #fffdf7;
  color: #1c1448;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 760px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow);
  border: 8px double #d4a017;
  text-align: center;
}
.cert-logo { height: 110px; }
.cert-name { font-size: 2.2rem; font-weight: 900; margin: 8px 0; color: #6b3fa0; }
.cert-stats { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin: 16px 0; font-weight: 800; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  padding: 8px;
  background: #f6f0ff;
  border-radius: 12px;
  margin: 0 auto 16px;
  max-width: 640px;
}
.chart .bar { flex: 1; background: linear-gradient(#8b6cff, #4d9fff); border-radius: 4px 4px 0 0; min-width: 6px; position: relative; }
.weak-letters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.weak-letters span { background: #ffe0e0; color: #7a1020; padding: 6px 10px; border-radius: 10px; font-weight: 800; }
.high-scores { background: rgba(255,255,255,0.1); border-radius: 14px; padding: 8px 14px 16px; margin-bottom: 20px; }
.high-scores div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.15); font-weight: 700; }
.extra-links { margin: 8px 0 16px; }
.extra-links .big-btn { min-width: 140px; padding: 12px 16px; font-size: 1.05rem; }

.key.heat-ok { box-shadow: inset 0 0 0 3px #6bcb77; }
.key.heat-mid { box-shadow: inset 0 0 0 3px #ffd24a; }
.key.heat-bad { box-shadow: inset 0 0 0 3px #ff5d73; }

/* Seasonal themes */
body[data-theme="christmas"] {
  --bg-1: #1a0a12;
  --bg-2: #3b0f18;
  --bg-3: #0c1a12;
}
body[data-theme="halloween"] {
  --bg-1: #1a0d05;
  --bg-2: #3a1608;
  --bg-3: #0c0804;
}
body[data-theme="birthday"] {
  --bg-1: #2a1050;
  --bg-2: #5a1d8a;
  --bg-3: #1a0830;
}
#season-fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.flake, .bat, .balloon {
  position: absolute;
  top: -20px;
  animation: fall linear infinite;
  font-size: 1.2rem;
  opacity: 0.85;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(240deg); }
}

@media print {
  body, html { background: #fff !important; overflow: auto !important; height: auto !important; }
  #stars-bg, #season-fx, .top-controls, .no-print, .topbar.no-print, #btn-settings, #btn-mute { display: none !important; }
  .screen { display: none !important; }
  #screen-cert.active, #screen-report.active, #screen-cert.active .cert-page, #screen-report.active .report-page {
    display: block !important;
    box-shadow: none;
    color: #000;
    background: #fff;
  }
  #app { max-width: none; height: auto; }
}

.unlock-card .lead, .about-card .lead, .settings-card .hint { color: #3b2e6e; }
.parent-card .speed-btn, .settings-card .speed-btn {
  background: #efe8ff;
  color: var(--ink);
  border: 2px solid #c9b8e0;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
}
.parent-card .speed-btn.active, .settings-card .speed-btn.active {
  background: linear-gradient(#fffdf7, #ffe8a3);
  border-color: #e6a800;
}

/* ---- v2.1 player profiles ---- */
#screen-profiles, #screen-profile { overflow: auto; }
.profile-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 820px;
  margin: 8px auto 18px;
}
.switcher-card {
  background: var(--card);
  color: var(--ink);
  border: 0;
  border-radius: 20px;
  padding: 16px 12px 18px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow);
}
.switcher-card:hover { transform: translateY(-2px); }
.switcher-card .mini-stats { font-size: 0.9rem; color: var(--muted); font-weight: 700; margin-top: 8px; }
.switcher-card h3 { margin: 10px 0 0; }
#btn-add-profile { display: block; margin: 0 auto 18px; }

.profile-card-wrap { max-width: 560px; margin: 0 auto 24px; }
.profile-card {
  background: var(--card);
  color: var(--ink);
  border-radius: 24px;
  padding: 22px 22px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.profile-card input[type=text] {
  width: min(100%, 320px);
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 3px solid #d7cfff;
  color: var(--ink);
  background: #fff;
  -webkit-user-select: text;
  user-select: text;
  margin: 8px auto;
  display: block;
}
.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.profile-stats .chip {
  background: #efe8ff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
}
.profile-top-badges { min-height: 2em; margin: 6px 0 14px; font-size: 1.4rem; }
.profile-hint { color: #6b4bb1; font-weight: 800; margin: 8px 0; }

.avatar-frame {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: visible;
  border: 4px solid #d7cfff;
  background: #f4efff;
  box-shadow: 0 6px 16px rgba(28, 20, 72, 0.16);
}
.avatar-frame.small { width: 72px; height: 72px; border-width: 3px; display: inline-block; vertical-align: middle; }
.avatar-frame img, .avatar-frame .avatar-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
}
.avatar-frame .avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  background: #efe8ff;
}
.avatar-frame.small .avatar-fallback { font-size: 1.6rem; }
.avatar-frame.has-photo .avatar-fallback { display: none; }
.avatar-crown, .avatar-sparkles { display: none; }
.avatar-frame.gold {
  border-color: #ffd24a;
  box-shadow: 0 0 0 3px #b8860b, 0 0 22px rgba(255, 210, 74, 0.85), 0 8px 16px rgba(28, 20, 72, 0.2);
  background: radial-gradient(circle at 30% 20%, #fff6c8, #ffe08a 55%, #f5c400);
}
.avatar-frame.gold .avatar-crown {
  display: block;
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35));
  z-index: 2;
}
.avatar-frame.small.gold .avatar-crown { font-size: 1rem; top: -12px; }
.avatar-frame.gold .avatar-sparkles { display: block; position: absolute; inset: -12px; pointer-events: none; }
.avatar-frame.gold .sparkle {
  position: absolute;
  animation: twinkle 1.6s ease-in-out infinite;
  font-size: 1rem;
}
.avatar-frame.gold .sparkle:nth-child(1) { top: 6%; left: 8%; animation-delay: 0s; }
.avatar-frame.gold .sparkle:nth-child(2) { top: 0; right: 12%; animation-delay: 0.4s; }
.avatar-frame.gold .sparkle:nth-child(3) { bottom: 8%; left: 0; animation-delay: 0.8s; }
.avatar-frame.gold .sparkle:nth-child(4) { bottom: 4%; right: 2%; animation-delay: 1.1s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.25) rotate(18deg); }
}
.avatar-frame.celebrating {
  animation: framePop 0.7s ease;
}
@keyframes framePop {
  0% { transform: scale(0.6) rotate(-8deg); }
  60% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1); }
}

.home-profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 6px;
  background: rgba(255,255,255,0.12);
  border: 0;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
}
.home-profile-chip:hover { background: rgba(255,255,255,0.2); }
.cert-page .avatar-frame { margin: 8px auto 10px; width: 128px; height: 128px; }
.racer img.photo-racer {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffd24a;
  background: #fff;
}
.race-photo-opt { justify-content: center; margin: 6px auto; color: #efe8ff; }
.photo-card { text-align: center; max-width: 420px; }
.crop-stage {
  width: 256px;
  height: 256px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  background: #1c1448;
  position: relative;
}
#crop-canvas, #cam-video {
  width: 256px;
  height: 256px;
  object-fit: cover;
  border-radius: 50%;
  background: #1c1448;
}
#cam-video:not(.hidden) { display: block; }

/* ---- v2.2 pricing & contact ---- */
#screen-pricing { overflow: auto; }
.pricing-wrap {
  margin: 8px auto 24px;
  max-width: 1080px;
  width: 100%;
  text-align: center;
  color: #efe8ff;
  padding: 0 16px 20px;
}
.pricing-lead {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 4px 0 18px;
  color: #fff6d8;
}
.pricing-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 auto 16px;
  max-width: 920px;
}
.plan-card {
  position: relative;
  background: var(--card);
  color: var(--ink);
  border-radius: 22px;
  padding: 20px 18px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 3px solid #e4d8ff;
  min-height: 168px;
}
.plan-card.promo { border-color: #ff9a4a; background: linear-gradient(#fffef8, #ffe7c4); }
.plan-card.best { border-color: #e6b422; background: linear-gradient(#fffdf4, #ffe9a0); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(180, 120, 0, 0.25); }
.plan-card.school { border-color: #7ec8ff; background: linear-gradient(#f7fbff, #d9ecff); }
.plan-card h3 {
  margin: 8px 0 4px;
  font-size: 1.2rem;
}
.plan-price {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 2px 0;
  color: #4b2ea8;
}
.plan-card.best .plan-price { color: #8a5a00; }
.plan-card.promo .plan-price { color: #c45c10; }
.plan-per {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.98rem;
}
.plan-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: #efe8ff;
  color: #4b2ea8;
}
.plan-card.promo .plan-badge { background: #ff7a1a; color: #fff; }
.plan-card.best .plan-badge { background: #e6b422; color: #3b2a00; }
.plan-card.school .plan-badge { background: #1f7ae0; color: #fff; }
.pricing-note {
  max-width: 760px;
  margin: 8px auto 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff6d8;
  line-height: 1.4;
}
.pricing-referral {
  display: inline-block;
  margin: 0 auto 18px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(#fff4b0, #ffd24a);
  color: #3b2a00;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.pricing-contact {
  background: var(--card);
  color: var(--ink);
  border-radius: 24px;
  padding: 18px 20px 16px;
  max-width: 720px;
  margin: 8px auto 16px;
  box-shadow: var(--shadow);
}
.pricing-contact h3 { margin: 0 0 6px; }
.pricing-contact-hint { color: var(--muted); margin: 0 0 14px; font-weight: 700; }
.pricing-qr { width: 150px; height: 150px; margin-top: 14px; }
#btn-pricing-unlock, #btn-about-pricing, #btn-unlock-pricing {
  margin: 8px auto 10px;
  max-width: 360px;
  display: block;
}
#btn-unlock-pricing { margin: 4px auto 18px; }
.pricing-thanks {
  background: linear-gradient(#fffdf4, #ffe9a0);
  color: var(--ink);
  border: 3px solid #e6b422;
  border-radius: 24px;
  padding: 22px 24px;
  max-width: 640px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow);
}
.thanks-badge { font-size: 2.4rem; }
.pricing-thanks h3 { margin: 4px 0 8px; font-size: 1.8rem; color: #8a5a00; }
#pricing-thanks-license { font-weight: 800; margin: 0; }
#pricing-credit { margin-top: 8px; color: #c6bedf; }
#pricing-credit a { color: #ffd24a; font-weight: 800; }
#about-email-link, #pricing-email-link { min-width: 140px; }
@media (max-width: 760px) {
  .pricing-plans { grid-template-columns: 1fr; }
}

/* ===== Math Adventure additions ===== */
.problem-stage {
  background: linear-gradient(#fffdf7, #efe7ff);
  border-radius: 22px;
  padding: 18px 18px 16px;
  box-shadow: 0 8px 0 rgba(80, 50, 140, 0.12);
  margin: 8px auto 14px;
  max-width: 820px;
  text-align: center;
}
.problem-prompt {
  font-size: 1.15rem;
  font-weight: 700;
  color: #3b2a78;
  margin: 0 0 10px;
}
.problem-visual {
  min-height: 88px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 8px 0 12px;
  font-size: 2rem;
}
.problem-visual .icon-bit {
  font-size: 1.85rem;
  line-height: 1;
  animation: pop-in .25s ease;
}
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.numeral-hero {
  font-size: 5.2rem;
  font-weight: 900;
  color: #2a1470;
  line-height: 1;
  text-shadow: 3px 3px 0 #ffd24a;
}
.expression-hero {
  font-size: 3.1rem;
  font-weight: 900;
  color: #1c1448;
  letter-spacing: .04em;
  margin: 6px 0 4px;
}
.answer-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 8px auto 6px;
  max-width: 420px;
}
#answer-input {
  flex: 1;
  min-width: 160px;
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 3px solid #c9b8e0;
  color: #1c1448;
  background: #fff;
  letter-spacing: .06em;
}
#answer-input.ok-flash { border-color: #1f9d55; background: #e8fff2; }
#answer-input.bad-flash { border-color: #c0392b; background: #ffecec; animation: shake .28s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 340px;
  margin: 10px auto 0;
}
.numpad button {
  font-family: inherit;
  font-weight: 900;
  font-size: 1.45rem;
  border: 0;
  border-radius: 14px;
  padding: 12px 0;
  cursor: pointer;
  background: linear-gradient(#fffdf7, #ffe8a3);
  color: #1c1448;
  box-shadow: 0 4px 0 #c9b8e0;
}
.numpad button:active { transform: translateY(2px); box-shadow: 0 2px 0 #c9b8e0; }
.numpad .pad-wide { grid-column: span 2; }
.numpad .pad-enter { background: linear-gradient(#f4fffd, #9af3e4); }
.numpad .pad-del { background: linear-gradient(#fff0f0, #ffc9c9); }
.numpad-extra {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 8px auto 0;
  flex-wrap: wrap;
}
.numpad-extra button {
  font-family: inherit;
  font-weight: 900;
  font-size: 1.3rem;
  min-width: 72px;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  background: linear-gradient(#f3e8ff, #d9c6ff);
  color: #1c1448;
  box-shadow: 0 4px 0 #c9b8e0;
}
.lesson-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 4px 0 8px;
}
.lesson-progress .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #d7cfff;
}
.lesson-progress .dot.done { background: #1f9d55; }
.lesson-progress .dot.now { background: #ffd24a; box-shadow: 0 0 0 3px rgba(255,210,74,.4); }
.lesson-progress .dot.miss { background: #e07a7a; }

/* shapes */
.shape-preview {
  width: 160px; height: 160px;
  display: flex; align-items: center; justify-content: center;
  margin: 8px auto;
  filter: drop-shadow(0 6px 0 rgba(40,20,80,.15));
}
.shape-circle { width: 130px; height: 130px; border-radius: 50%; background: #ff9aa2; }
.shape-square { width: 120px; height: 120px; background: #a0e7e5; border-radius: 8px; }
.shape-triangle {
  width: 0; height: 0;
  border-left: 75px solid transparent;
  border-right: 75px solid transparent;
  border-bottom: 130px solid #ffd24a;
  background: transparent !important;
}
.shape-rectangle { width: 160px; height: 90px; background: #c7ceea; border-radius: 8px; }
.shape-star { font-size: 8rem; color: #ffd24a; line-height: 1; }
.shape-heart { font-size: 8rem; color: #ff6b9d; line-height: 1; }
.shape-oval { width: 150px; height: 100px; border-radius: 50%; background: #b5ead7; }
.shape-diamond {
  width: 110px; height: 110px;
  background: #c084fc;
  transform: rotate(45deg);
  border-radius: 12px;
}
.shape-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.shape-choices button {
  font-family: inherit; font-weight: 800; border: 0; border-radius: 12px;
  padding: 8px 14px; cursor: pointer;
  background: linear-gradient(#fffdf7, #e8deff);
  color: #1c1448; box-shadow: 0 3px 0 #c9b8e0;
}

/* money */
.money-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.peso-chip {
  min-width: 72px;
  border-radius: 14px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 900;
  color: #1c1448;
  box-shadow: 0 3px 0 rgba(40,20,80,.15);
}
.peso-chip.coin { background: radial-gradient(circle at 30% 30%, #fff3b0, #e6b422); border: 3px solid #c49212; }
.peso-chip.bill { background: linear-gradient(#e8fff2, #9adfbb); border: 3px dashed #1f7a4d; min-width: 100px; }
.peso-chip .val { font-size: 1.15rem; display: block; }
.peso-chip .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }

/* clock */
.clock-face {
  width: 200px; height: 200px; border-radius: 50%;
  margin: 8px auto;
  background: radial-gradient(circle at 40% 35%, #fff, #f3e8ff);
  border: 8px solid #2a1470;
  position: relative;
  box-shadow: inset 0 0 0 6px #ffd24a, 0 8px 0 rgba(40,20,80,.15);
}
.clock-face .hand {
  position: absolute; left: 50%; bottom: 50%;
  transform-origin: 50% 100%;
  border-radius: 4px;
}
.clock-face .hand.hour { width: 8px; height: 52px; background: #1c1448; margin-left: -4px; }
.clock-face .hand.minute { width: 5px; height: 74px; background: #c0392b; margin-left: -2.5px; }
.clock-face .hub {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  margin: -7px 0 0 -7px; border-radius: 50%; background: #1c1448;
}
.clock-face .tick {
  position: absolute; left: 50%; top: 10px; width: 3px; height: 10px;
  background: #1c1448; margin-left: -1.5px; transform-origin: 50% 82px;
}

/* place value */
.place-boxes { display: flex; gap: 16px; justify-content: center; margin: 8px 0; }
.place-box {
  background: #fff; border-radius: 14px; padding: 10px 16px; min-width: 110px;
  box-shadow: 0 4px 0 #c9b8e0; text-align: center;
}
.place-box .lab { font-size: .8rem; text-transform: uppercase; color: #5c5488; font-weight: 700; }
.place-box .num { font-size: 2.2rem; font-weight: 900; color: #2a1470; }

/* Meteor Math */
.meteor-stage {
  position: relative; height: 420px; overflow: hidden;
  background: linear-gradient(#140a3a, #2a1470 60%, #3a2060);
  border-radius: 18px; margin: 8px auto; max-width: 900px;
  border: 4px solid #ffd24a;
}
.meteor-bit {
  position: absolute; width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe8a3, #d35400 70%, #6b2a00);
  color: #1c1448; font-weight: 900; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 8px; box-sizing: border-box;
  box-shadow: 0 0 12px rgba(255,160,40,.5);
  transform: translate(-50%, -50%);
}
.meteor-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 36px;
  background: linear-gradient(#6b8f3a, #3d5a1f); z-index: 2;
}
.meteor-hud { display: flex; justify-content: space-between; gap: 10px; margin: 6px auto; max-width: 900px; font-weight: 800; }

/* Number Race */
.race-track {
  position: relative; height: 180px; background: linear-gradient(#9ad0f5, #b5ead7);
  border-radius: 18px; overflow: hidden; margin: 10px 0;
  border: 4px solid #2a1470;
}
.racer {
  position: absolute; bottom: 18px; width: 88px; height: 88px;
  transition: left .25s ease;
  display: flex; align-items: center; justify-content: center;
}
.racer img, .racer .racer-fallback {
  width: 80px; height: 80px; border-radius: 50%; object-fit: cover;
  border: 4px solid #ffd24a; background: #2a1470;
}
.racer-label { position: absolute; top: -18px; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.race-finish {
  position: absolute; right: 16px; top: 0; bottom: 0; width: 8px;
  background: repeating-linear-gradient(#fff, #fff 8px, #111 8px, #111 16px);
}

/* Sari-sari */
.store-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; max-width: 980px; margin: 0 auto; }
@media (max-width: 800px) { .store-layout { grid-template-columns: 1fr; } }
.store-shelf, .store-cart {
  background: #fffaf3; border-radius: 18px; padding: 14px;
  box-shadow: 0 8px 0 rgba(80,50,140,.1);
}
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.shelf-item, .cart-line {
  background: #fff; border-radius: 14px; padding: 8px; text-align: center;
  box-shadow: 0 3px 0 #e6d9ff; border: 0; cursor: pointer; font-family: inherit;
}
.shelf-item .em { font-size: 2rem; display: block; }
.shelf-item h4, .cart-line { margin: 4px 0; font-size: .95rem; }
.change-box { margin-top: 10px; }
.change-box .big { font-size: 1.4rem; font-weight: 900; }

/* Facts map */
.facts-grid {
  display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px;
  max-width: 640px; margin: 10px auto;
}
.facts-grid .cell {
  aspect-ratio: 1; border-radius: 6px; font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  background: #eee8ff; color: #1c1448;
}
.facts-grid .cell.head { background: #2a1470; color: #ffd24a; }
.facts-grid .cell.good { background: #8be86a; }
.facts-grid .cell.ok { background: #ffd24a; }
.facts-grid .cell.weak { background: #ff9aa2; }
.facts-grid .cell.empty { background: #f4f0ff; }

.skill-bars { display: grid; gap: 8px; margin: 10px 0; }
.skill-bar { display: grid; grid-template-columns: 140px 1fr 60px; gap: 8px; align-items: center; font-weight: 700; }
.skill-bar .track { background: #eee8ff; border-radius: 99px; height: 12px; overflow: hidden; }
.skill-bar .fill { height: 100%; background: linear-gradient(90deg, #8be86a, #3ee0c9); border-radius: 99px; }

.weak-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.weak-facts span {
  background: #fff0f0; border-radius: 99px; padding: 4px 10px; font-weight: 800; color: #9b1c1c;
}

.bundle-note {
  background: linear-gradient(#f4fffd, #d4fff4);
  border: 2px solid #3ee0c9;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  color: #145c4e;
  margin: 8px 0 14px;
}
.live-stats .hide-wpm { display: none; }

.story-map .island { position: relative; }
.cert-card { /* alias used by Math Adventure markup */
  background: #fffdf7;
  color: #1c1448;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 760px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow);
  border: 8px double #d4a017;
  text-align: center;
}
.report-card {
  background: #fffdf7;
  color: #1c1448;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 760px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow);
  border: 4px solid #c9b8e0;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 520px;
  margin: 8px auto 16px;
}
.calendar .day, .calendar .dow {
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  min-height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .85rem;
}
.calendar .dow { background: transparent; min-height: auto; opacity: .8; }
.calendar .day.today { outline: 2px solid var(--gold); }
.calendar .day.has { background: #ffe9a0; color: #1c1448; }
.shop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.shop-card {
  background: rgba(255,255,255,0.12);
  border: 0;
  border-radius: 16px;
  padding: 14px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}
.shop-card .em { font-size: 2.2rem; display: block; }
.shop-card.owned { outline: 2px solid #8be86a; }
.shop-card.equipped { outline: 3px solid var(--gold); }
.badge-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.badge-card {
  background: rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}
.badge-card.locked { opacity: .45; }
.badge-card .em { font-size: 2.4rem; display: block; }
.parent-hold-wrap { margin: 16px auto; max-width: 420px; text-align: center; }
.parent-hold-bar { height: 8px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; margin-top: 6px; }
#parent-fill { height: 100%; width: 0; background: var(--gold); }
.game-card.locked { opacity: .7; }
.lock-pill { margin-left: 8px; }
#racer-you-fallback { display: none; width: 80px; height: 80px; border-radius: 50%; background: #2a1470; color: #ffd24a; font-weight: 900; font-size: 1.6rem; align-items: center; justify-content: center; border: 4px solid #ffd24a; }
#racer-you-fallback.show { display: flex; }
#racer-you img[src=""], #racer-you img:not([src]) { display: none; }

/* ===== Math Adventure visual fixes ===== */
.meteor-stage {
  width: 100%;
  max-width: 900px;
  align-self: stretch;
  flex: 1 1 auto;
  min-height: 320px;
  margin-left: auto;
  margin-right: auto;
}
.meteor-hud, .race-track, .store-layout {
  width: 100%;
}
.race-track { height: 210px; }
#racer-you { top: 10px; bottom: auto !important; }
#racer-cpu { bottom: 10px; top: auto; }
.racer-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -22px;
  color: #1c1448;
  font-weight: 800;
  font-size: .8rem;
  white-space: nowrap;
  background: rgba(255,255,255,.85);
  border-radius: 8px;
  padding: 0 6px;
  z-index: 2;
}
.problem-stage, .store-shelf, .store-cart, .shelf-item, .cart-line, .cert-card, .report-card {
  color: #1c1448;
}
.shelf-item h4, .shelf-item p, .cart-line, .store-cart p, .store-cart h3, .store-shelf h3 {
  color: #1c1448;
}
.shelf-item p { margin: 0; font-weight: 800; color: #4b2ea8; }
.change-box label { color: #1c1448; font-weight: 700; }
.skill-bar { color: #1c1448; }
.answer-row input,
#meteor-input, #race-input, #boss-input, #store-change, #daily-input, #unlock-key {
  flex: 1;
  min-width: 140px;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 3px solid #c9b8e0;
  color: #1c1448;
  background: #fff;
  letter-spacing: .04em;
  font-family: inherit;
}
.plan-card { min-height: 0; padding: 14px 16px 12px; }
.plan-price { font-size: 1.7rem; }
.pricing-lead { margin-bottom: 10px; }
.pricing-plans { margin-bottom: 8px; gap: 10px; }
.pricing-note { margin: 4px auto 6px; }
.pricing-referral { margin-bottom: 10px; }
.pricing-contact { padding: 12px 16px 12px; margin-bottom: 8px; }
.pricing-qr { width: 110px; height: 110px; margin-top: 8px; }
.pricing-contact .btn-row, .pricing-contact .contact-row {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}

/* Light-card buttons were inheriting white body text */
.profile-card .speed-btn,
.store-cart .speed-btn,
.store-shelf .speed-btn,
.cert-card .speed-btn,
.report-card .speed-btn,
.problem-stage .speed-btn {
  background: #efe8ff;
  color: #1c1448;
}
.profile-card .speed-btn:hover,
.store-cart .speed-btn:hover {
  background: #ffd24a;
}

.screen.active { overflow-y: auto; }
#screen-pricing .pricing-wrap,
#screen-report .report-card,
#screen-cert .cert-card { padding-bottom: 12px; }

.race-track { overflow: visible; padding: 28px 8px 8px; box-sizing: border-box; }
.racer-label {
  top: auto;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
}
#racer-you .racer-label { bottom: auto; top: -22px; }

/* ===== Yeezy Brix Learning Pack shared additions ===== */
.answer-input {
  flex: 1; min-width: 160px; font-size: 1.7rem; font-weight: 800; text-align: center;
  padding: 10px 14px; border-radius: 14px; border: 3px solid #c9b8e0; color: #1c1448; background: #fff;
  letter-spacing: .06em; font-family: inherit;
}
.answer-input.ok-flash { border-color: #1f9d55; background: #e8fff2; }
.answer-input.bad-flash { border-color: #c0392b; background: #ffecec; animation: shake .28s ease; }
.answer-row.hidden { display: none; }
.hear-btn {
  font-family: inherit; font-weight: 800; font-size: 1.05rem; border: 0; border-radius: 999px;
  padding: 8px 18px; margin: 2px auto 8px; cursor: pointer; color: #1c1448;
  background: linear-gradient(#fff7d6, #ffd24a); box-shadow: 0 4px 0 #c49212;
}
.hear-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #c49212; }
.hear-btn.hidden { display: none; }
.big-emoji { font-size: 4.2rem; line-height: 1.1; }
.problem-visual .icon-bit.big-emoji { font-size: 4.6rem; }
.vis-caption { width: 100%; font-size: 1.5rem; font-weight: 900; color: #2a1470; margin-top: 4px; }
.word-hero {
  font-size: 4rem; font-weight: 900; color: #2a1470; letter-spacing: .04em; line-height: 1.1;
  text-shadow: 3px 3px 0 #ffd24a; padding: 0 12px;
}
.letter-tiles { display: flex; gap: 10px; justify-content: center; width: 100%; margin-top: 6px; }
.letter-tile {
  width: 74px; height: 84px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; font-weight: 900; color: #1c1448; background: linear-gradient(#fffdf7, #ffe8a3);
  box-shadow: 0 5px 0 #c9b8e0; animation: pop-in .3s ease both;
}
.letter-tile.blank { background: linear-gradient(#f3e8ff, #d9c6ff); color: #6b4bb1; }
.listen-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.listen-ear { font-weight: 900; color: #6b4bb1; font-size: 1.1rem; }
.sentence-card {
  background: #fff; border-radius: 18px; padding: 14px 20px; box-shadow: 0 5px 0 #e6d9ff; max-width: 640px; text-align: left;
}
.sentence-card .big-emoji { text-align: center; font-size: 3rem; }
.sentence-line { font-size: 1.55rem; font-weight: 800; color: #1c1448; margin: 4px 0; line-height: 1.35; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 10px auto 4px; max-width: 760px; }
.choice-grid:empty { display: none; }
.choice-btn {
  font-family: inherit; font-weight: 900; font-size: 1.35rem; color: #1c1448; cursor: pointer;
  border: 3px solid transparent; border-radius: 18px; padding: 12px 20px; min-width: 120px;
  background: linear-gradient(#fffdf7, #e8deff); box-shadow: 0 5px 0 #c9b8e0;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .08s ease;
}
.choice-btn:hover { transform: translateY(-2px); }
.choice-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #c9b8e0; }
.choice-btn.bad { border-color: #c0392b; background: #ffecec; animation: shake .28s ease; }
.choice-btn.good { border-color: #1f9d55; background: #e8fff2; }
.choice-emoji { font-size: 2rem; line-height: 1; }
.choice-btn.emoji-only { min-width: 120px; min-height: 110px; }
.choice-btn.emoji-only .choice-emoji { font-size: 3.6rem; }
.choice-grid.big-letters .choice-btn { font-size: 2.2rem; min-width: 110px; }
.choice-grid.words .choice-btn { font-size: 1.7rem; min-width: 140px; }
.choice-grid.pictures .choice-btn { min-width: 128px; }
.tile-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 8px auto; }
.tile-row:empty { display: none; }
.tile-btn {
  font-family: inherit; font-weight: 900; font-size: 2rem; width: 66px; height: 70px; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(#fffdf7, #ffe8a3); color: #1c1448; box-shadow: 0 5px 0 #c9b8e0;
}
.tile-btn.used, .tile-btn:disabled { opacity: .35; cursor: default; }
.tile-btn.tile-clear { width: auto; padding: 0 14px; font-size: 1rem; background: linear-gradient(#fff0f0, #ffc9c9); }
.letter-pad { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; max-width: 640px; margin: 10px auto 0; }
.letter-pad:empty { display: none; }
.letter-pad button {
  font-family: inherit; font-weight: 900; font-size: 1.3rem; border: 0; border-radius: 12px; padding: 10px 0; cursor: pointer;
  background: linear-gradient(#fffdf7, #ffe8a3); color: #1c1448; box-shadow: 0 4px 0 #c9b8e0;
}
.letter-pad .pad-del { background: linear-gradient(#fff0f0, #ffc9c9); grid-column: span 2; }
.letter-pad .pad-enter { background: linear-gradient(#f4fffd, #9af3e4); grid-column: span 2; }
.praise.ok { color: #1f9d55; }
.praise.bad { color: #b45309; }
.lesson-tag {
  display: inline-block; font-size: .72rem; font-weight: 900; vertical-align: middle; margin-left: 6px;
  padding: 2px 8px; border-radius: 999px; background: #ffd24a; color: #2a1470;
}
.hint.center { text-align: center; color: #e9e2ff; }
/* Bubble game */
.bubble-stage { background: linear-gradient(#0e3a6e, #1e6fb0 60%, #46a3d9); }
.meteor-bit.bubble-bit {
  border: 3px solid rgba(255,255,255,.85); cursor: pointer; font-family: inherit; flex-direction: column; gap: 2px;
  background: radial-gradient(circle at 30% 25%, #ffffff, #cfefff 35%, #7cc8f5 70%, #3b8fd0);
  color: #0b2a4a; font-size: 1.25rem; width: 120px; height: 120px; box-shadow: 0 0 16px rgba(160,220,255,.6);
}
.bubble-bit .bubble-emoji { font-size: 2.6rem; line-height: 1; }
.bubble-bit.wrong { background: radial-gradient(circle at 30% 25%, #fff, #ffd1d1 40%, #ff8a8a); animation: shake .3s ease; }
.bubble-bit.popped { transform: translate(-50%, -50%) scale(1.5); opacity: 0; transition: all .25s ease; pointer-events: none; }
.meteor-target { font-size: 1.3rem; font-weight: 900; color: #ffd24a; }
/* Boss */
.boss-arena { text-align: center; }
.boss-face { font-size: 5rem; display: inline-block; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
.boss-face.hit { animation: boss-hit .35s ease; }
@keyframes boss-hit { 0%{transform:scale(1)} 30%{transform:scale(.85) rotate(-8deg)} 60%{transform:scale(1.08) rotate(6deg)} 100%{transform:scale(1)} }
.boss-bar { max-width: 640px; margin: 6px auto; }
/* Story / card tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; max-width: 980px; margin: 10px auto; }
.story-tile {
  font-family: inherit; border: 0; border-radius: 20px; padding: 14px; cursor: pointer; text-align: center; color: #1c1448;
  background: linear-gradient(#fffdf7, #efe7ff); box-shadow: 0 6px 0 rgba(80,50,140,.18);
}
.story-tile .em { font-size: 3rem; display: block; }
.story-tile h3 { margin: 6px 0 4px; font-size: 1.15rem; }
.story-tile p { margin: 0; color: #5c5488; font-weight: 700; }
.story-tile.locked { opacity: .6; }
.story-tile.done { box-shadow: 0 6px 0 #8be86a; }
.reader-card { background: #fffdf7; color: #1c1448; border-radius: 22px; padding: 18px 24px; max-width: 760px; margin: 8px auto; box-shadow: var(--shadow); text-align: left; }
.reader-card .big-emoji { text-align: center; }
.reader-line { font-size: 1.7rem; font-weight: 800; line-height: 1.45; margin: 6px 0; padding: 4px 10px; border-radius: 12px; cursor: pointer; }
.reader-line.now { background: #fff1b3; box-shadow: inset 0 0 0 3px #ffd24a; }
.reader-line.read { color: #5c5488; }
.reader-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
/* Word / topic grid map */
.facts-grid.word-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-width: 980px; gap: 6px; }
.facts-grid.word-grid .cell { aspect-ratio: auto; padding: 10px 4px; font-size: .95rem; color: #1c1448; }
.map-legend { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; font-weight: 800; }
.map-legend span { padding: 3px 10px; border-radius: 999px; color: #1c1448; }
/* Illustrated question card */
.q-card {
  width: min(420px, 92%); border-radius: 22px; padding: 12px 16px 14px; color: #1c1448; text-align: center;
  box-shadow: 0 8px 0 rgba(40,20,80,.18); border: 4px solid rgba(255,255,255,.7); animation: pop-in .3s ease;
}
.q-card-top { display: flex; justify-content: space-between; font-weight: 900; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.q-card-art { font-size: 5rem; line-height: 1.15; margin: 4px 0; }
.q-card-cap { font-weight: 800; font-size: 1.05rem; }
.topic-animals { background: linear-gradient(135deg, #fff3c4, #ffc98b); }
.topic-plants { background: linear-gradient(135deg, #e3ffd6, #9be38a); }
.topic-space { background: linear-gradient(135deg, #d9d4ff, #8f86ff); }
.topic-body { background: linear-gradient(135deg, #ffe0ea, #ff9fbc); }
.topic-weather { background: linear-gradient(135deg, #dff4ff, #8fd0ff); }
.topic-matter { background: linear-gradient(135deg, #f1e4ff, #c7a4ff); }
.topic-general { background: linear-gradient(135deg, #fffdf7, #efe7ff); }
/* Forms (lists) */
.panel-card { background: #fffdf7; color: #1c1448; border-radius: 22px; padding: 16px 20px; max-width: 860px; margin: 10px auto; box-shadow: var(--shadow); text-align: left; }
.panel-card h3 { margin: 4px 0 10px; }
.panel-card textarea, .panel-card input[type=text], .panel-card select {
  width: 100%; font-family: inherit; font-size: 1.05rem; padding: 10px 12px; border-radius: 12px; border: 3px solid #c9b8e0; color: #1c1448; background: #fff;
}
.panel-card textarea { min-height: 120px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.list-row { color: #1c1448; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: #f4f0ff; margin: 8px 0; flex-wrap: wrap; }
.list-row h4 { margin: 0; flex: 1; min-width: 160px; }
.list-row small { color: #5c5488; font-weight: 700; }
.word-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.word-chips span { background: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 800; box-shadow: 0 2px 0 #e6d9ff; }
.word-chips span.miss { background: #ffe0e0; }
.fact-card {
  border-radius: 20px; padding: 16px; color: #1c1448; min-height: 170px; cursor: pointer; text-align: center;
  box-shadow: 0 6px 0 rgba(40,20,80,.18); border: 0; font-family: inherit;
}
.fact-card .em { font-size: 3rem; display: block; }
.fact-card h4 { margin: 6px 0; font-size: 1.05rem; }
.fact-card p { margin: 0; font-weight: 700; font-size: 1rem; }
.fact-card.locked { filter: grayscale(.8); opacity: .65; }
.grade-select { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
@media print { .hear-btn, .letter-pad, .choice-grid { display: none !important; } }
.parent-select { font: inherit; font-weight: 800; font-size: 1.05rem; padding: 10px 14px; border-radius: 14px; border: 3px solid #d9cffc; background: #fff; color: #1c1448; margin: 4px 0 10px; min-width: 220px; }
.bundle-note .packs-title { margin: 18px 0 4px; font-size: 1.5rem; }
.bundle-note .packs-lead { margin: 0 0 10px; font-weight: 800; }
.bundle-note .packs-upgrade { margin: 12px auto 0; font-weight: 800; max-width: 760px; }
.plan-was { font-size: .55em; opacity: .7; margin-left: 4px; }

/* wave-5 shared extras (question-bank apps) */
.choice-grid.long-answers { grid-template-columns: 1fr 1fr; max-width: 900px; }
.choice-grid.long-answers .choice-btn { font-size: 1.15rem; min-height: 72px; padding: 10px 14px; line-height: 1.25; }
#funfact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; max-width: 1100px; margin: 12px auto; }
#funfact-grid .fact-card { position: relative; color: #1c1448; }
#funfact-grid .fact-card .hear-btn { position: absolute; top: 8px; right: 8px; padding: 4px 10px; font-size: 1rem; }
#funfact-grid .fact-card small { font-weight: 700; opacity: .8; }
#funfact-filter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px auto; }
.topic-map { display: grid; grid-template-columns: 1fr; gap: 8px; max-width: 900px; margin: 0 auto; }
.tm-row { display: grid; grid-template-columns: 1.4fr repeat(var(--bands, 3), 1fr); gap: 8px; align-items: stretch; }
.tm-head span { font-weight: 900; text-align: center; }
.tm-topic { font-weight: 900; background: #fffdf7; color: #1c1448; border-radius: 14px; padding: 12px; display: flex; align-items: center; }
.topic-map .cell { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px; padding: 10px; min-height: 64px; color: #1c1448; }
.topic-map .cell strong { font-size: 1.3rem; }
.topic-map .cell small { font-weight: 700; }
.q-card .q-card-cap { font-size: 1.5rem; line-height: 1.3; margin-top: 8px; }
.facts-grid.topic-map .cell, .facts-grid.topic-map .cell strong, .facts-grid.topic-map .cell small { color: #1c1448; }
.facts-grid.topic-map .tm-head span { color: #fff; }
.w5-panel { background: #fffdf7; color: #1c1448; border-radius: 22px; padding: 18px 22px; max-width: 1000px; margin: 12px auto; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.w5-panel h3 { margin: 0 0 8px; }
.w5-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; max-width: 1100px; margin: 12px auto; }
.w5-card { background: #fffdf7; color: #1c1448; border: 0; border-radius: 20px; padding: 14px; text-align: left; font: inherit; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.16); position: relative; }
.w5-card .em { font-size: 3rem; display: block; }
.w5-card h4 { margin: 6px 0; font-size: 1.1rem; }
.w5-card p { margin: 0; font-weight: 700; font-size: .95rem; }
.w5-card.locked { filter: grayscale(.7); opacity: .7; }
.w5-card.done::after { content: "✅"; position: absolute; top: 8px; right: 10px; font-size: 1.4rem; }
.w5-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; margin: 10px auto; }

/* wave-6 (apps #41-52): Yeezy Brix blue theme + Explorer Cards + Memory Match */
:root { --bg-1: #0a2a6b; --bg-2: #1456c4; --bg-3: #061638; }
body[data-theme="default"], body:not([data-theme]) { --bg-1: #0a2a6b; --bg-2: #1456c4; --bg-3: #061638; }
.q-card-img { height: 150px; width: auto; object-fit: contain; max-width: 230px; border-radius: 10px; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); background: #fff; }
#explore-filter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px auto; }
#explore-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-width: 1150px; margin: 12px auto; }
.x-card { text-align: center; padding: 10px; }
.x-card .em { font-size: 2.8rem; }
.x-card h4 { font-size: 1rem; margin: 6px 0 2px; }
.x-card.seen { outline: 3px solid #7fe0c4; }
.x-img { max-width: 100%; height: 72px; object-fit: contain; border-radius: 6px; border: 1px solid #ccd; background: #fff; }
#explore-detail { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
#explore-detail.hidden { display: none; }
.x-detail-art .em { font-size: 6rem; }
.x-big { height: 180px; width: auto; max-width: 320px; object-fit: contain; border-radius: 10px; border: 2px solid #ccd; background: #fff; }
.x-detail-body { flex: 1; min-width: 260px; }
.x-detail-body p { font-weight: 700; font-size: 1.1rem; }
#match-levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 900px; margin: 12px auto; }
.x-level { text-align: center; }
#match-board { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(110px, 160px)); gap: 12px; justify-content: center; margin: 14px auto; }
.x-tile { position: relative; height: 120px; border: 0; border-radius: 16px; cursor: pointer; font: inherit; background: linear-gradient(#4d9fff, #1456c4); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.x-tile .x-face { display: none; }
.x-tile .x-back { font-size: 2.6rem; }
.x-tile.up, .x-tile.found { background: #fffdf7; color: #1c1448; }
.x-tile.up .x-face, .x-tile.found .x-face { display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; height: 100%; padding: 6px; }
.x-tile.up .x-back, .x-tile.found .x-back { display: none; }
.x-tile.found { outline: 4px solid #3ccf7a; }
.x-tile .em { font-size: 3rem; }
.x-tile b { font-size: 1.05rem; line-height: 1.2; }
.x-tile .x-img { height: 80px; }
#match-msg { text-align: center; font-weight: 800; min-height: 1.4em; }
#screen-explore .live-stats, #screen-match .live-stats, #screen-matchplay .live-stats { margin-right: 110px; }
.x-tile small { font-size: .78rem; font-weight: 700; line-height: 1.1; }

