@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Nunito:wght@500;600;700;800&display=swap');

:root {
  --ink: #17233b;
  --muted: #68738a;
  --cream: #fffaf1;
  --paper: rgba(255, 255, 255, 0.92);
  --purple: #7758e8;
  --purple-dark: #5438bd;
  --blue: #4088f4;
  --green: #29b889;
  --orange: #ff8a55;
  --yellow: #ffd45f;
  --pink: #f06aa7;
  --line: rgba(23, 35, 59, 0.10);
  --shadow: 0 24px 70px rgba(51, 43, 99, 0.13);
  --shadow-sm: 0 10px 30px rgba(51, 43, 99, 0.10);
  --radius-lg: 32px;
  --radius-md: 22px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 212, 95, .30), transparent 25rem),
    radial-gradient(circle at 100% 18%, rgba(119, 88, 232, .16), transparent 30rem),
    #f8f6ff !important;
  font-family: "Nunito", sans-serif !important;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .34;
  background-image: radial-gradient(rgba(119, 88, 232, .22) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

h1, h2, h3, .brand, button, .btn {
  font-family: "Baloo 2", sans-serif !important;
}

a, button, input, textarea { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 4px solid rgba(255, 212, 95, .75) !important;
  outline-offset: 3px;
}

.site-nav {
  width: min(1160px, calc(100% - 32px));
  height: 76px;
  margin: 18px auto 0;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 24px;
  background: rgba(255, 255, 255, .80);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.34rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 14px 14px 14px 5px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 8px 16px rgba(119, 88, 232, .25);
  transform: rotate(-4deg);
}

.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 14px;
  transition: .2s ease;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--purple-dark);
  background: #f0ecff;
}

.nav-pill {
  color: #fff !important;
  background: var(--ink) !important;
}

.universal-nav { z-index: 100; }
.universal-nav .nav-links { position: relative; }
.universal-nav .nav-primary-link.active {
  color: #fff !important;
  background: var(--ink) !important;
}
.universal-nav .nav-battle-link {
  color: #315f55;
  background: #e2f7ef;
}
.universal-nav .nav-more { position: relative; }
.universal-nav .nav-more summary {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
  transition: .2s ease;
}
.universal-nav .nav-more summary::-webkit-details-marker { display: none; }
.universal-nav .nav-more summary:hover,
.universal-nav .nav-more[open] summary,
.universal-nav .nav-more.active summary {
  color: var(--purple-dark);
  background: #f0ecff;
}
.universal-nav .nav-more[open] summary span:last-child { transform: rotate(180deg); }
.nav-mobile-label { display: none; }
.nav-dropdown {
  width: min(690px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 115px));
  padding: 18px;
  display: grid;
  grid-template-columns: 1.35fr .75fr;
  gap: 14px;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 22px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 24px 70px rgba(23,35,59,.22);
}
.nav-dropdown section:first-of-type { grid-row: span 2; }
.nav-dropdown section > p {
  margin: 0 0 7px;
  color: #8a93a7;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-menu-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; }
.nav-dropdown section:not(:first-of-type) .nav-menu-grid { grid-template-columns: 1fr; }
.nav-dropdown a {
  min-width: 0;
  padding: 9px 10px !important;
  display: flex !important;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
  border-radius: 11px !important;
  background: transparent !important;
  font-size: .88rem;
  text-decoration: none;
}
.nav-dropdown a:hover,
.nav-dropdown a.current {
  color: var(--purple-dark) !important;
  background: #f0ecff !important;
}
.nav-dropdown a span { flex: 0 0 auto; font-size: 1.15rem; }
.nav-dropdown a b { min-width: 0; overflow-wrap: anywhere; }
.nav-mobile-shortcuts { display: none; }
.has-universal-nav header .back-link { display: none !important; }

.hero {
  width: min(1160px, calc(100% - 32px));
  margin: 48px auto 34px;
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  align-items: center;
  gap: 44px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 15px;
  padding: 8px 13px;
  color: var(--purple-dark);
  background: #eee9ff;
  border: 1px solid #ded5ff;
  border-radius: 99px;
  font-weight: 800;
  font-size: .84rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(41, 184, 137, .14);
}

.hero h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(3.1rem, 6.4vw, 5.8rem);
  line-height: .94;
  letter-spacing: -.055em;
}

.hero h1 .pop {
  display: inline-block;
  color: var(--purple);
  position: relative;
}

.hero h1 .pop::after {
  content: "";
  height: 10px;
  position: absolute;
  left: 2%;
  right: 1%;
  bottom: 3px;
  z-index: -1;
  border-radius: 99px;
  background: var(--yellow);
  transform: rotate(-1deg);
}

.hero-copy {
  max-width: 620px;
  margin: 22px 0 28px;
  color: var(--muted);
  font-size: 1.16rem;
  line-height: 1.75;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.primary-cta, .secondary-cta {
  min-height: 52px;
  padding: 0 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 17px;
  text-decoration: none;
  font-weight: 800;
  transition: transform .2s, box-shadow .2s;
}
.primary-cta {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  box-shadow: 0 12px 24px rgba(119, 88, 232, .26);
}
.secondary-cta { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.primary-cta:hover, .secondary-cta:hover { transform: translateY(-3px); }

.hero-world {
  min-height: 410px;
  position: relative;
  display: grid;
  place-items: center;
}

.orbit {
  width: min(420px, 90vw);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,255,255,.98) 0 28%, transparent 29%),
    radial-gradient(circle, transparent 0 49%, rgba(119,88,232,.11) 50% 50.8%, transparent 52%),
    radial-gradient(circle, transparent 0 72%, rgba(119,88,232,.08) 73% 73.8%, transparent 75%);
}

.mascot {
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 2;
  color: white;
  font-size: 5.3rem;
  border-radius: 46% 54% 45% 55%;
  background: linear-gradient(145deg, var(--purple), #a56ee9);
  box-shadow: 0 28px 50px rgba(91, 62, 184, .28), inset 0 3px rgba(255,255,255,.3);
  animation: float 4s ease-in-out infinite;
}

.orbit-chip {
  position: absolute;
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  font-size: 2rem;
  background: #fff;
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow-sm);
  animation: float 4s ease-in-out infinite;
}
.orbit-chip:nth-child(2) { top: 7%; left: 11%; transform: rotate(-8deg); }
.orbit-chip:nth-child(3) { top: 12%; right: 4%; animation-delay: -.8s; }
.orbit-chip:nth-child(4) { bottom: 8%; left: 4%; animation-delay: -1.6s; }
.orbit-chip:nth-child(5) { bottom: 2%; right: 15%; animation-delay: -2.4s; }

@keyframes float { 50% { transform: translateY(-10px) rotate(2deg); } }

.stat-row {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto 68px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border-radius: 26px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}
.stat { padding: 10px 18px; display: flex; align-items: center; gap: 13px; }
.stat + .stat { border-left: 1px solid rgba(255,255,255,.13); }
.stat-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--ink);
  background: var(--yellow);
  font-size: 1.25rem;
}
.stat strong { display: block; font-size: 1.08rem; }
.stat span { color: #bfc7d8; font-size: .88rem; }

.section {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto 84px;
}
.section-head {
  margin-bottom: 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  letter-spacing: -.035em;
  line-height: 1;
}
.section-head p { margin: 0; color: var(--muted); }

.subject-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.subject-card {
  min-height: 280px;
  padding: 26px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
}
.subject-card:hover { transform: translateY(-7px); box-shadow: var(--shadow); }
.subject-card:nth-child(n) { grid-column: span 4; min-height: 250px; }
.subject-card.add { background: #e9f3ff; }
.subject-card.subtract { background: #fff0e8; }
.subject-card.multiply { background: #e5f8f1; }
.subject-card.divide { background: #f2ecff; }
.subject-card.games { background: #fff5cf; }
.subject-card.jokes { background: #ffe9f2; }
.subject-card.algebra { background: #eee9ff; }
.subject-card.chemistry { background: #e2f7ef; }
.subject-card.physics { background: #fff0df; }
.subject-card.biology { background: #e4f3ff; }
.subject-card.astronomy { background: #fce7f2; }
.subject-card.internet { background: #e3f3ff; }
.subject-card.ai { background: #eee7ff; }
.subject-card.sports { background: #fff0e7; }
.subject-card.stem { color: #fff; background: linear-gradient(145deg, #273253, #17233b); }
.subject-card.stem p { color: #c5cee0; }
.subject-card.stem .card-action { color: #74f1d5; }
.subject-card.stem .subject-symbol { background: rgba(255,255,255,.12); }
.subject-card.battle {
  color: #fff;
  background:
    radial-gradient(circle at 90% 20%, rgba(255,212,95,.24), transparent 16rem),
    linear-gradient(145deg, #374d96, #151d3b);
}
.subject-card.battle p { color: #c8d2ec; }
.subject-card.battle .card-action { color: #74f1d5; }
.subject-card.battle .subject-symbol { background: rgba(255,255,255,.12); }
.subject-card.puzzle {
  min-height: 220px;
  grid-column: 1 / -1;
  color: #fff;
  background:
    radial-gradient(circle at 90% 20%, rgba(255,212,95,.25), transparent 18rem),
    linear-gradient(135deg, #16a77d, #087154);
}
.subject-card.puzzle p { color: #d7f3e9; }
.subject-card.puzzle .card-action { color: #fff2a9; }
.subject-card.puzzle .subject-symbol { background: rgba(255,255,255,.18); }
.subject-symbol {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-size: 2rem;
  background: rgba(255,255,255,.78);
  box-shadow: 0 8px 22px rgba(23,35,59,.08);
}
.subject-card h3 { margin: auto 0 2px; font-size: 2rem; line-height: 1; }
.subject-card p { margin: 8px 0 18px; max-width: 370px; color: var(--muted); line-height: 1.55; }
.card-action { font-weight: 900; color: var(--purple-dark); }
.card-bubble {
  width: 130px;
  height: 130px;
  position: absolute;
  right: -35px;
  top: -30px;
  border: 28px solid rgba(255,255,255,.34);
  border-radius: 50%;
}

.quote-card {
  padding: 40px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 25px;
  align-items: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--purple), #5a3cc7);
  color: #fff;
  box-shadow: var(--shadow);
}
.quote-card .emoji { font-size: 4.5rem; }
.quote-card h2 { margin: 0 0 6px; font-size: 2rem; }
.quote-card p { margin: 0; color: #e2dcff; font-size: 1.05rem; line-height: 1.65; }

.home-joke {
  padding: 38px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 30px;
  align-items: center;
  overflow: hidden;
  position: relative;
  border: 1px solid #ffd4e7;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, rgba(240,106,167,.18), transparent 28rem),
    #fff7fb;
  box-shadow: var(--shadow-sm);
}
.joke-orbit {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 38% 62% 55% 45%;
  background: linear-gradient(145deg, var(--pink), var(--orange));
  box-shadow: 0 16px 30px rgba(240,106,167,.23);
  font-size: 3.3rem;
  animation: float 4s ease-in-out infinite;
}
.home-joke h2 { margin: 2px 0 14px; font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.08; }
.home-joke details { margin-bottom: 14px; }
.home-joke summary {
  width: fit-content;
  padding: 10px 15px;
  cursor: pointer;
  color: #9a315f;
  border-radius: 13px;
  background: #ffe0ed;
  font-weight: 900;
}
.home-joke details p { margin: 14px 0 0; color: var(--ink); font-size: 1.08rem; font-weight: 800; }
.home-joke > div > a { color: var(--purple-dark); font-weight: 900; text-decoration: none; }

.academy-preview {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.academy-preview a {
  min-height: 190px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.academy-preview a:nth-child(1) { background: #f0ebff; }
.academy-preview a:nth-child(2) { background: #e8f8f3; }
.academy-preview a:nth-child(3) { background: #fff2dd; }
.academy-preview a:nth-child(4) { background: #ecf6ff; }
.academy-preview a:nth-child(5) { background: #fcebf5; }
.academy-preview a:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.academy-preview span { font-size: 2.5rem; }
.academy-preview strong { margin-top: auto; font: 800 1.35rem "Baloo 2", sans-serif; }
.academy-preview small { color: var(--muted); line-height: 1.4; }
.academy-cta {
  width: fit-content;
  margin: 18px auto 0;
  padding: 13px 18px;
  display: block;
  color: #fff;
  text-decoration: none;
  border-radius: 15px;
  background: var(--ink);
  font-weight: 900;
}
.academy-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.academy-actions .academy-cta { margin: 18px 0 0; }
.academy-actions .academy-play { color: var(--purple-dark); background: #eee9ff; }

body[data-page="jokes"] header {
  width: min(1160px, calc(100% - 32px));
  margin: 22px auto 0;
  padding: 28px 32px;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 28px;
  background:
    radial-gradient(circle at 90% 20%, rgba(255,212,95,.32), transparent 15rem),
    rgba(255,255,255,.9);
  box-shadow: var(--shadow-sm);
}
body[data-page="jokes"] header h1 { margin: 12px 0 4px; font-size: clamp(2.1rem, 5vw, 3.5rem); letter-spacing: -.04em; }
body[data-page="jokes"] header p { margin: 0; color: var(--muted); }
.jokes-main {
  width: min(980px, calc(100% - 32px));
  margin: 26px auto 70px;
}
.joke-intro {
  margin-bottom: 18px;
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 24px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow-sm);
}
.joke-intro h2 { margin: 2px 0 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.category-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.category-pill {
  min-height: 42px;
  padding: 7px 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font: 800 .9rem "Nunito", sans-serif !important;
  cursor: pointer;
}
.category-pill.active, .category-pill:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}
.joke-stage {
  min-height: 480px;
  padding: clamp(28px, 7vw, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid #ffe0bd;
  border-radius: 36px;
  background:
    radial-gradient(circle at 10% 10%, rgba(255,255,255,.75), transparent 12rem),
    linear-gradient(145deg, #fff2c7, #ffe4d6 70%, #f9ddf0);
  box-shadow: var(--shadow);
}
.joke-stage-top {
  width: 100%;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  color: #8e674f;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.joke-label { padding: 7px 11px; border-radius: 99px; background: rgba(255,255,255,.65); }
.joke-number { padding: 7px 0; }
.joke-face { font-size: clamp(4rem, 10vw, 6.5rem); filter: drop-shadow(0 12px 10px rgba(86,52,24,.12)); }
.joke-stage h2 {
  max-width: 720px;
  margin: 16px auto 22px;
  font-size: clamp(2rem, 5.8vw, 4rem);
  line-height: 1.02;
  letter-spacing: -.04em;
}
.joke-answer {
  max-width: 680px;
  margin: 0 auto 24px;
  padding: 18px 22px;
  color: #712c52;
  border: 2px dashed rgba(154,49,95,.26);
  border-radius: 18px;
  background: rgba(255,255,255,.67);
  font: 800 clamp(1.15rem, 3vw, 1.55rem) "Baloo 2", sans-serif;
}
.joke-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.joke-actions button {
  min-height: 50px;
  padding: 10px 18px;
  border: 0;
  border-radius: 15px;
  font-weight: 900;
  cursor: pointer;
}
.reveal-joke { color: #fff; background: linear-gradient(135deg, var(--pink), #c94683); }
.next-joke { color: var(--ink); background: #fff; border: 1px solid var(--line) !important; }

.site-footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer a {
  color: var(--purple-dark);
  text-decoration: none;
  font-weight: 900;
}
.site-footer a:hover { text-decoration: underline; }
.visitor-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 800;
}
.visitor-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border: 2px solid rgba(119, 88, 232, .30);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: visitor-spin .8s linear infinite;
}
.visitor-counter.is-ready .visitor-dot {
  border: 0;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(41, 184, 137, .14);
  animation: none;
}
.visitor-counter.is-unavailable .visitor-dot {
  border: 0;
  background: #aeb5c2;
  animation: none;
}
@keyframes visitor-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .visitor-dot { animation: none; }
}

/* Interior pages */
body[data-page="math"] header,
body[data-page="games"] header {
  width: min(1160px, calc(100% - 32px));
  margin: 22px auto 0;
  padding: 28px 32px !important;
  position: relative;
  z-index: 2;
  color: var(--ink) !important;
  text-align: left !important;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 28px !important;
  background: rgba(255,255,255,.88) !important;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm) !important;
}
body[data-page="math"] header h1,
body[data-page="games"] header h1 { margin: 12px 0 4px; font-size: clamp(2.1rem, 5vw, 3.5rem); letter-spacing: -.04em; }
body[data-page="math"] header p,
body[data-page="games"] header p { margin: 0; color: var(--muted); }
.back-link {
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  color: var(--purple-dark) !important;
  text-decoration: none !important;
  font-weight: 900;
}

body[data-page="math"] main {
  width: min(760px, calc(100% - 32px));
  max-width: none !important;
  margin: 24px auto 60px !important;
  padding: 30px !important;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 30px !important;
  background: var(--paper) !important;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow) !important;
}
.score-board {
  margin: 0 0 24px !important;
  padding: 15px 18px;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #f7f5ff;
  font-weight: 800;
}
.question-row {
  min-height: 90px;
  margin: 0 0 12px !important;
  padding: 16px;
  display: grid !important;
  grid-template-columns: 1fr auto;
  gap: 12px !important;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}
.question-row label {
  display: grid;
  grid-template-columns: 1fr 100px 44px;
  align-items: center;
  gap: 12px;
  font: 800 1.35rem "Baloo 2", sans-serif;
}
.answer-box {
  width: 100% !important;
  min-height: 48px;
  margin: 0 !important;
  padding: 8px !important;
  color: var(--ink);
  border: 2px solid #e1ddf0 !important;
  border-radius: 13px !important;
  background: #fbfaff;
  font: 800 1.12rem "Nunito", sans-serif !important;
}
.answer-box:focus { border-color: var(--purple) !important; }
.icon { margin: 0 !important; }
.skip-btn, #next-btn, .popup-content button {
  min-height: 46px;
  margin: 0 !important;
  padding: 8px 15px !important;
  border: 0 !important;
  border-radius: 14px !important;
  font-weight: 800;
}
.skip-btn { background: #fff2c7 !important; color: #8b6110 !important; }
#next-btn {
  margin: 22px auto 0 !important;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark)) !important;
  box-shadow: 0 10px 22px rgba(119,88,232,.24) !important;
}
.popup-overlay { backdrop-filter: blur(8px); }
.popup-content {
  width: min(430px, calc(100% - 32px)) !important;
  padding: 32px !important;
  border-radius: 28px !important;
  box-shadow: var(--shadow) !important;
}

body[data-page="games"] main {
  width: min(1160px, calc(100% - 32px));
  max-width: none !important;
  margin: 24px auto 60px !important;
  padding: 0 !important;
}
body[data-page="games"] footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 40px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.games-grid { gap: 18px !important; grid-template-columns: repeat(2, 1fr) !important; }
.game-card {
  padding: 26px !important;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 28px !important;
  background: rgba(255,255,255,.92) !important;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm) !important;
}
.game-card:hover { transform: translateY(-5px) !important; box-shadow: var(--shadow) !important; }
.game-card h2 { color: var(--ink) !important; font-size: 1.65rem !important; }
.game-card p { color: var(--muted) !important; }
.game-card button, .game-card .btn {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark)) !important;
  border-radius: 14px !important;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(119,88,232,.18);
}
.game-area {
  margin-top: 20px !important;
  padding: 18px !important;
  border: 1px solid var(--line);
  border-radius: 18px !important;
  background: #faf9ff !important;
}
input[type="text"], input[type="number"], textarea {
  color: var(--ink);
  border: 2px solid #e4e0f0 !important;
  border-radius: 13px !important;
  background: #fff;
}
.drawing-canvas { max-width: 100%; height: auto; touch-action: none; }

.arcade-card { position: relative; }
.game-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 6px 10px;
  color: var(--purple-dark);
  background: #eee9ff;
  border: 1px solid #ded5ff;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.mini-score {
  margin-bottom: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-around;
  gap: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: .88rem;
}
.mini-score strong { color: var(--ink); }
.game-status {
  min-height: 24px;
  margin: 10px 0 !important;
  color: var(--ink) !important;
  text-align: center;
  font-weight: 900;
}
.ttt-board {
  width: min(310px, 100%);
  margin: 12px auto 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ttt-cell {
  padding: 0 !important;
  aspect-ratio: 1;
  display: grid !important;
  place-items: center;
  color: var(--ink) !important;
  background: #fff !important;
  border: 2px solid #e5e0f4 !important;
  border-radius: 18px !important;
  box-shadow: none !important;
  font-size: clamp(2rem, 8vw, 3rem) !important;
}
.ttt-cell:hover:not(:disabled) { border-color: var(--purple) !important; transform: translateY(-2px); }
.ttt-cell.x { color: var(--purple) !important; }
.ttt-cell.o { color: var(--orange) !important; }
.ttt-cell.win { background: #fff1b9 !important; border-color: #ffc83d !important; animation: winPulse .7s ease-in-out infinite alternate; }
@keyframes winPulse { to { transform: scale(.94); } }

.maze-canvas {
  width: min(352px, 100%);
  height: auto;
  margin: 8px auto 14px;
  display: block;
  border: 5px solid #272052;
  border-radius: 18px;
  background: #100c2b;
  box-shadow: 0 12px 28px rgba(24, 17, 69, .22);
}
.d-pad {
  width: 158px;
  margin: 8px auto 16px;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(2, 48px);
  gap: 6px;
}
.d-pad button {
  min-width: 48px;
  min-height: 48px;
  padding: 0 !important;
  color: var(--ink) !important;
  background: #fff !important;
  border: 2px solid #e4dff4 !important;
  box-shadow: none !important;
  touch-action: manipulation;
}
.d-pad .up { grid-column: 2; }
.d-pad .left { grid-column: 1; grid-row: 2; }
.d-pad .down { grid-column: 2; grid-row: 2; }
.d-pad .right { grid-column: 3; grid-row: 2; }

.memory-board {
  width: min(390px, 100%);
  margin: 14px auto 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  perspective: 800px;
}
.memory-card {
  padding: 0 !important;
  aspect-ratio: 1;
  display: grid !important;
  place-items: center;
  position: relative;
  color: transparent !important;
  background: linear-gradient(145deg, var(--purple), #9b72ea) !important;
  border: 0 !important;
  border-radius: 16px !important;
  box-shadow: 0 6px 14px rgba(119,88,232,.20) !important;
  font-size: clamp(1.55rem, 7vw, 2.3rem) !important;
  transform-style: preserve-3d;
  transition: transform .25s, background .25s !important;
}
.memory-card::after {
  content: "?";
  position: absolute;
  color: rgba(255,255,255,.9);
  font-size: 1.6rem;
}
.memory-card.flipped, .memory-card.matched {
  color: var(--ink) !important;
  background: #fff !important;
  transform: rotateY(180deg);
}
.memory-card.flipped::after, .memory-card.matched::after { content: ""; }
.memory-card.matched {
  background: #e3f8ee !important;
  border: 2px solid #78d9b5 !important;
}

@media (max-width: 480px) {
  .memory-board { grid-template-columns: repeat(3, 1fr); }
  .game-badge { top: 18px; right: 18px; }
}

.spark {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  animation: spark .65s ease-out forwards;
}
@keyframes spark {
  to { transform: translate(var(--x), var(--y)) scale(.2) rotate(180deg); opacity: 0; }
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; margin-top: 38px; }
  .hero-world { min-height: 330px; }
  .orbit { width: 330px; }
  .mascot { width: 135px; height: 135px; font-size: 4.3rem; }
  .orbit-chip { width: 70px; height: 70px; border-radius: 21px; }
  .subject-card:nth-child(n) { grid-column: span 6; }
  .subject-card.puzzle { grid-column: 1 / -1; }
  .games-grid { grid-template-columns: 1fr !important; }
  .academy-preview { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .site-nav { height: auto; min-height: 68px; padding: 12px 15px; }
  .nav-links a:not(.nav-pill) { display: none; }
  .brand { font-size: 1.14rem; }
  .hero h1 { font-size: clamp(3rem, 15vw, 4.4rem); }
  .hero-world { min-height: 280px; }
  .orbit { width: 280px; }
  .orbit-chip { width: 62px; height: 62px; font-size: 1.55rem; }
  .mascot { width: 116px; height: 116px; font-size: 3.6rem; }
  .stat-row { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid rgba(255,255,255,.13); }
  .section-head { display: block; }
  .section-head p { margin-top: 8px; }
  .subject-card:nth-child(n) { grid-column: 1 / -1; min-height: 235px; }
  .quote-card { grid-template-columns: 1fr; padding: 28px; }
  .home-joke { grid-template-columns: 1fr; padding: 28px; }
  .joke-orbit { width: 88px; height: 88px; font-size: 2.6rem; }
  .joke-intro { display: block; }
  .category-pills { margin-top: 16px; justify-content: flex-start; }
  .joke-stage { min-height: 430px; padding: 28px 20px; }
  .quote-card .emoji { font-size: 3.2rem; }
  .site-footer { flex-direction: column; }
  body[data-page="math"] header,
  body[data-page="games"] header { padding: 22px !important; }
  body[data-page="math"] main { padding: 18px !important; }
  .question-row {
    grid-template-columns: 1fr !important;
    min-height: auto;
    padding: 13px;
  }
  .question-row label { grid-template-columns: 1fr 88px 34px; }
  .question-row .skip-btn { width: 100%; }
  .game-card { padding: 20px !important; }
  .academy-preview { grid-template-columns: 1fr; }
  .academy-preview a { min-height: 150px; }
}

@media (max-width: 760px) {
  .universal-nav { min-height: 68px; height: auto; padding: 11px 14px; }
  .universal-nav .brand { max-width: calc(100% - 92px); }
  .universal-nav .brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .universal-nav .nav-primary-link { display: none !important; }
  .universal-nav .nav-more summary {
    min-height: 44px;
    color: #fff;
    background: var(--ink);
  }
  .universal-nav .nav-more summary:hover,
  .universal-nav .nav-more[open] summary,
  .universal-nav .nav-more.active summary {
    color: #fff;
    background: var(--ink);
  }
  .nav-desktop-label { display: none; }
  .nav-mobile-label { display: inline; }
  .nav-dropdown {
    width: min(420px, calc(100vw - 32px));
    grid-template-columns: 1fr;
    right: -2px;
    top: calc(100% + 10px);
    padding: 14px;
  }
  .nav-dropdown section:first-of-type { grid-row: auto; }
  .nav-dropdown section:not(:first-of-type) .nav-menu-grid,
  .nav-menu-grid { grid-template-columns: repeat(2,1fr); }
  .nav-mobile-shortcuts {
    padding-bottom: 12px;
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 6px;
    border-bottom: 1px solid var(--line);
  }
  .nav-dropdown a { font-size: .83rem; }
}

@media (max-width: 420px) {
  .universal-nav .brand > span:last-child { max-width: 150px; }
  .nav-dropdown { right: -4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
