/* =========================================================
   Fun with Multiplication! — shared styles
   Aesthetic: bright "sticker book" — thick ink outlines,
   offset shadows, candy colours on warm cream paper.
   ========================================================= */

:root {
  --cream: #FFF6E5;
  --paper: #FFFDF7;
  --ink: #2B2140;
  --ink-soft: #5A4E73;
  --sun: #FFD23F;
  --coral: #FF6B6B;
  --sky: #4ECDC4;
  --grape: #9B6BFF;
  --lime: #8FD96C;
  --tangerine: #FF9F1C;
  --pink: #FF7EB6;
  --blue: #4D9DE0;

  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --display: 'Fredoka', 'Baloo 2', 'Comic Sans MS', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;

  /* per-number colours, used by table chips, chart, episodes */
  --n1: #FF6B6B; --n2: #FF9F1C; --n3: #FFD23F; --n4: #8FD96C; --n5: #4ECDC4;
  --n6: #4D9DE0; --n7: #9B6BFF; --n8: #FF7EB6; --n9: #F45B69; --n10: #2EC4B6;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(rgba(255, 159, 28, .22) 2.2px, transparent 2.6px),
    radial-gradient(rgba(78, 205, 196, .20) 2.2px, transparent 2.6px);
  background-size: 34px 34px, 34px 34px;
  background-position: 0 0, 17px 17px;
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.1; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.section { padding: 3.5rem 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.eyebrow {
  display: inline-block; font-family: var(--display); font-weight: 600; font-size: .95rem;
  letter-spacing: .06em; text-transform: uppercase; background: var(--ink); color: var(--sun);
  padding: .25rem .8rem; border-radius: 999px; transform: rotate(-2deg); margin-bottom: .6rem;
}
.lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 3px solid var(--ink); }
.nav-inner { max-width: 1180px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1rem; position: relative; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.35rem; display: flex; align-items: center; gap: .6rem; }
.brand-badge {
  width: 44px; height: 44px; border-radius: 14px; background: var(--coral); border: 3px solid var(--ink);
  display: grid; place-items: center; font-size: 1.5rem; color: #fff; box-shadow: var(--shadow-sm);
  transform: rotate(-8deg); transition: transform .3s;
}
.brand:hover .brand-badge { transform: rotate(8deg) scale(1.05); }
.nav-links { display: flex; gap: .3rem; margin-inline-start: auto; list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; }
.nav-links a {
  font-family: var(--display); font-weight: 600; font-size: 1.02rem; padding: .45rem .95rem; border-radius: 999px;
  border: 3px solid transparent; display: flex; align-items: center; gap: .4rem; transition: all .15s;
}
.nav-links a:hover { background: var(--paper); border-color: var(--ink); transform: translate(-2px, -2px); box-shadow: var(--shadow-sm); }
.nav-links a.active { background: var(--sun); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.nav-toggle {
  display: none; width: 46px; height: 46px; border-radius: 12px; border: 3px solid var(--ink);
  background: var(--sun); box-shadow: var(--shadow-sm); font-size: 1.4rem; place-items: center;
}
@media (max-width: 960px) {
  .nav-toggle { display: grid; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: .5rem;
    background: var(--paper); border-bottom: 3px solid var(--ink); padding: 1rem 1.25rem 1.25rem; margin: 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a { border-color: var(--ink); background: #fff; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--display); font-weight: 600; font-size: 1.1rem; padding: .8rem 1.5rem;
  border-radius: 999px; border: 3px solid var(--ink); background: var(--sun); color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; text-decoration: none; user-select: none;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn-coral { background: var(--coral); color: #fff; }
.btn-sky { background: var(--sky); }
.btn-grape { background: var(--grape); color: #fff; }
.btn-lime { background: var(--lime); }
.btn-white { background: #fff; }
.btn-lg { font-size: 1.35rem; padding: 1rem 2rem; }
.btn-sm { font-size: .95rem; padding: .45rem 1rem; box-shadow: 2px 2px 0 var(--ink); }
.btn-icon { width: 48px; height: 48px; padding: 0; border-radius: 14px; font-size: 1.3rem; }

/* ---------- Sticker cards ---------- */
.sticker {
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.6rem; position: relative;
}
.sticker.tilt-l { transform: rotate(-1.5deg); }
.sticker.tilt-r { transform: rotate(1.5deg); }
.sticker-link { transition: transform .2s, box-shadow .2s; display: block; }
.sticker-link:hover { transform: translate(-4px, -4px) rotate(0); box-shadow: 10px 10px 0 var(--ink); }
.sticker .tag {
  position: absolute; top: -14px; inset-inline-end: 18px; background: var(--coral); color: #fff; font-family: var(--display);
  font-weight: 600; padding: .2rem .8rem; border: 3px solid var(--ink); border-radius: 999px; transform: rotate(4deg);
  box-shadow: 2px 2px 0 var(--ink);
}
.card-icon {
  width: 84px; height: 84px; border-radius: 22px; border: 3px solid var(--ink); display: grid; place-items: center;
  font-size: 2.6rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); background: var(--sun);
}
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }

/* ---------- Table picker chips ---------- */
.table-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 1rem; }
.table-chip {
  aspect-ratio: 1; border-radius: 26px; border: 3px solid var(--ink); box-shadow: var(--shadow);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 2.4rem; color: var(--ink);
  transition: transform .15s, box-shadow .15s; position: relative; text-decoration: none;
}
.table-chip small { position: absolute; bottom: 8px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; opacity: .75; }
.table-chip:hover { transform: translate(-3px, -3px) rotate(-3deg); box-shadow: 9px 9px 0 var(--ink); }
.table-chip:nth-child(1) { background: var(--n1); color: #fff; }
.table-chip:nth-child(2) { background: var(--n2); }
.table-chip:nth-child(3) { background: var(--n3); }
.table-chip:nth-child(4) { background: var(--n4); }
.table-chip:nth-child(5) { background: var(--n5); }
.table-chip:nth-child(6) { background: var(--n6); color: #fff; }
.table-chip:nth-child(7) { background: var(--n7); color: #fff; }
.table-chip:nth-child(8) { background: var(--n8); }
.table-chip:nth-child(9) { background: var(--n9); color: #fff; }
.table-chip:nth-child(10) { background: var(--n10); }

/* ---------- Toggle chips (checkbox-like) ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem; min-width: 46px; height: 46px; padding: 0 .9rem;
  border-radius: 999px; border: 3px solid var(--ink); background: #fff; box-shadow: 2px 2px 0 var(--ink);
  transition: all .12s; display: inline-flex; align-items: center; justify-content: center;
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sun); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label, .field-label { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.field select, .field input[type="text"], .field input[type="number"] {
  padding: .65rem .9rem; border-radius: 14px; border: 3px solid var(--ink); background: #fff; box-shadow: 2px 2px 0 var(--ink);
}
.check { display: flex; align-items: center; gap: .6rem; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 3.5rem 0 3rem; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center; }
.hero h1 .wobble { display: inline-block; color: var(--coral); transform: rotate(-4deg); text-shadow: 4px 4px 0 var(--ink); }
.hero h1 .swing { display: inline-block; color: var(--sky); transform: rotate(3deg); text-shadow: 4px 4px 0 var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.hero-art { position: relative; min-height: 380px; display: grid; place-items: center; }
.mascot { width: min(320px, 80%); filter: drop-shadow(8px 8px 0 rgba(43, 33, 64, .18)); }
.float-chip {
  position: absolute; font-family: var(--display); font-weight: 700; font-size: 1.6rem; padding: .35rem .9rem;
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow-sm); animation: floaty 4s ease-in-out infinite;
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { min-height: 300px; order: -1; }
}

/* ---------- Big banner ---------- */
.banner {
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; background: var(--grape); color: #fff;
}
.banner h2 { color: #fff; }
.banner .btn { margin-inline-start: auto; }

/* ---------- Footer ---------- */
.footer { margin-top: 4rem; border-top: 3px solid var(--ink); background: var(--ink); color: var(--cream); padding: 2.5rem 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.footer a { color: var(--sun); font-weight: 700; }
.footer .nums { font-family: var(--display); font-size: 1.1rem; letter-spacing: .3em; opacity: .6; }

/* ---------- Game surfaces ---------- */
.game-tabs { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.5rem; }
.game-tab {
  font-family: var(--display); font-weight: 600; font-size: 1.15rem; padding: .7rem 1.3rem; border-radius: 18px;
  border: 3px solid var(--ink); background: #fff; box-shadow: var(--shadow-sm); display: inline-flex; gap: .5rem; align-items: center;
}
.game-tab[aria-selected="true"] { background: var(--ink); color: var(--sun); }
.game-panel { display: none; }
.game-panel.active { display: block; animation: rise .4s ease both; }

.question-big {
  font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 9vw, 5rem); text-align: center; letter-spacing: .02em;
  padding: 1rem; line-height: 1;
}
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; max-width: 560px; margin: 0 auto; }
.option {
  font-family: var(--display); font-weight: 700; font-size: 2rem; padding: 1rem; border-radius: 20px; border: 3px solid var(--ink);
  background: #fff; box-shadow: var(--shadow); transition: transform .1s, box-shadow .1s, background .15s;
}
.option:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.option.correct { background: var(--lime); animation: pop .35s; }
.option.wrong { background: var(--coral); color: #fff; animation: shake .4s; }
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin: 1rem 0; }
.stat {
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow-sm); padding: .5rem 1.1rem;
  font-family: var(--display); font-weight: 600; min-width: 110px; text-align: center;
}
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.track { position: relative; height: 26px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; overflow: visible; margin: 1.2rem 0; }
.track-fill { height: 100%; border-radius: 999px; background: repeating-linear-gradient(45deg, var(--sky) 0 12px, var(--lime) 12px 24px); transition: width .4s; }
.track-rocket { position: absolute; top: -18px; font-size: 2rem; transition: left .4s; transform: translateX(-50%); }
.timer-bar { height: 14px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.timer-fill { height: 100%; background: var(--coral); transition: width 1s linear; }

.bingo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; max-width: 520px; margin: 0 auto; }
.bingo-cell {
  aspect-ratio: 1; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 4vw, 1.8rem);
  border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 3px 3px 0 var(--ink); transition: all .12s;
}
.bingo-cell:hover { transform: translate(-1px, -1px); }
.bingo-cell.marked { background: var(--sun); transform: rotate(-4deg) scale(.96); }
.bingo-cell.free { background: var(--grape); color: #fff; font-size: 1rem; }
.bingo-cell.win { background: var(--lime); animation: pop .4s; }
.bingo-cell.wrong { animation: shake .4s; background: var(--coral); color: #fff; }
.caller {
  text-align: center; font-family: var(--display); font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 700; background: #fff;
  border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); padding: 1rem; max-width: 520px; margin: 0 auto 1.2rem;
}

.hearts { font-size: 1.6rem; letter-spacing: .1em; }
.puzzle-type {
  display: inline-block; font-family: var(--display); font-weight: 600; background: var(--sky); border: 3px solid var(--ink); border-radius: 999px;
  padding: .2rem .9rem; box-shadow: 2px 2px 0 var(--ink); margin-bottom: .6rem;
}

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(43, 33, 64, .55); display: none; place-items: center; z-index: 100; padding: 1rem; }
.modal-back.open { display: grid; }
.modal { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: 10px 10px 0 var(--ink); padding: 2rem; max-width: 520px; width: 100%; text-align: center; animation: pop .35s; }
.modal .big-emoji { font-size: 4rem; line-height: 1; margin-bottom: .5rem; }

/* ---------- Video player ---------- */
.player { border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; overflow: hidden; }
.player-stage {
  position: relative; min-height: 420px; padding: 2.4rem 1.5rem 1.5rem; display: grid; grid-template-rows: auto 1fr auto; gap: .8rem;
  background: linear-gradient(180deg, #E9F9FF 0%, #FFF9E8 100%);
}
.stage-eq { font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 7vw, 4rem); text-align: center; line-height: 1; }
.stage-eq .ans { color: var(--coral); text-shadow: 3px 3px 0 var(--ink); }
.stage-rows { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 200px; }
.stage-row { display: flex; gap: .3rem; }
.stage-item { font-size: clamp(1.3rem, 3.4vw, 2rem); line-height: 1; animation: pop .35s both; }
.stage-caption {
  font-family: var(--display); font-weight: 600; font-size: 1.2rem; text-align: center; background: var(--ink); color: #fff;
  border-radius: 14px; padding: .6rem 1rem; min-height: 3.2rem;
}
.stage-title { position: absolute; top: 12px; inset-inline-start: 14px; font-family: var(--display); font-weight: 600; font-size: .95rem; background: rgba(255,255,255,.85); border: 2px solid var(--ink); border-radius: 999px; padding: .15rem .7rem; }
.stage-done { display: grid; place-items: center; text-align: center; gap: .5rem; }
.player-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .9rem 1.2rem; border-top: 3px solid var(--ink); background: var(--paper); }
.player-controls .spacer { flex: 1; }
.progress { height: 12px; background: #eee; border-top: 3px solid var(--ink); position: relative; cursor: pointer; }
.progress-fill { height: 100%; background: var(--coral); transition: width .3s; }
.skip-strip { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.skip-strip span {
  font-family: var(--display); font-weight: 700; min-width: 42px; padding: .2rem .5rem; text-align: center; border: 2px solid var(--ink);
  border-radius: 10px; background: #fff; opacity: .35; transition: all .25s;
}
.skip-strip span.on { opacity: 1; background: var(--sun); transform: translateY(-3px); }
.episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.episode {
  border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow-sm); background: #fff; padding: .9rem; cursor: pointer;
  text-align: start; transition: transform .15s, box-shadow .15s; font-family: var(--display);
}
.episode:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.episode.playing { outline: 4px solid var(--sun); outline-offset: 2px; }
.episode .thumb { font-size: 2.2rem; height: 64px; border-radius: 12px; border: 2px solid var(--ink); display: grid; place-items: center; margin-bottom: .5rem; }
.episode b { display: block; font-size: 1.05rem; }
.episode small { color: var(--ink-soft); }
.trick-box { border: 3px dashed var(--ink); border-radius: 18px; padding: 1rem 1.2rem; background: #FFF3C4; margin-top: 1rem; }

/* ---------- Multiplication chart ---------- */
.mchart { width: 100%; border-collapse: separate; border-spacing: 4px; font-family: var(--display); font-weight: 600; }
.mchart td, .mchart th { text-align: center; padding: 0; height: 44px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; font-size: clamp(.8rem, 2vw, 1.1rem); }
.mchart th { background: var(--ink); color: var(--sun); }
.mchart td { cursor: pointer; transition: background .15s, transform .15s; }
.mchart td.hl { background: #FFF3C4; }
.mchart td.focus { background: var(--sun); transform: scale(1.15); z-index: 2; position: relative; box-shadow: 3px 3px 0 var(--ink); }
.mchart td.diag { background: #EAF7E6; }
.chart-readout { text-align: center; font-family: var(--display); font-size: 1.6rem; font-weight: 700; margin-top: 1rem; min-height: 2.2rem; }

/* ---------- Worksheets ---------- */
.ws-layout { display: grid; grid-template-columns: 360px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 960px) { .ws-layout { grid-template-columns: 1fr; } }
.sheet {
  background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow); padding: 2.2rem 2.4rem; min-height: 600px;
  font-family: var(--body); color: #000;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; border-bottom: 3px solid #000; padding-bottom: .6rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.sheet-head h2 { margin: 0; font-size: 1.8rem; }
.sheet-meta { font-family: var(--body); font-size: .95rem; display: flex; gap: 1.5rem; }
.sheet-meta span { border-bottom: 2px solid #000; min-width: 140px; display: inline-block; }
.prob-grid { display: grid; gap: .9rem 1.2rem; }
.prob-grid.h { grid-template-columns: repeat(3, 1fr); }
.prob-grid.h .prob { font-family: var(--display); font-size: 1.45rem; display: flex; align-items: center; gap: .4rem; }
.prob-grid.h .prob .blank { display: inline-block; width: 64px; border-bottom: 2px solid #000; height: 1.6rem; }
.prob-grid.v { grid-template-columns: repeat(5, 1fr); }
.prob-grid.v .prob { font-family: var(--display); font-size: 1.5rem; text-align: right; width: 70px; margin: 0 auto; line-height: 1.25; }
.prob-grid.v .prob .op { display: block; border-bottom: 3px solid #000; padding-bottom: .1rem; }
.prob-grid.v .prob .op::before { content: '×'; float: left; }
.prob-grid.v .prob .space { display: block; height: 1.8rem; }
.prob-grid .ans-inline { color: #C0392B; font-weight: 800; }
.sheet-chart { width: 100%; border-collapse: collapse; font-family: var(--display); }
.sheet-chart td, .sheet-chart th { border: 2px solid #000; text-align: center; height: 40px; font-size: 1.1rem; }
.sheet-chart th { background: #eee; }
.sheet-footer { margin-top: 2rem; font-size: .9rem; color: #555; display: flex; justify-content: space-between; }
.page-break { page-break-before: always; break-before: page; margin-top: 2rem; }
.sheet .stars { font-size: 1.6rem; letter-spacing: .2em; }

@media print {
  @page { margin: 1.4cm; }
  body { background: #fff; font-size: 12pt; }
  .no-print { display: none !important; }
  .ws-layout { display: block; }
  .sheet { border: none; box-shadow: none; padding: 0; min-height: 0; }
  .prob-grid.v .prob .space { height: 2.2rem; }
}

/* ---------- Parents page ---------- */
.tip-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.tip-list li { display: flex; gap: 1rem; align-items: flex-start; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 1rem 1.2rem; box-shadow: var(--shadow-sm); }
.tip-list .num { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--sun); border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 700; }
.order-steps { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.order-step { font-family: var(--display); font-weight: 600; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: .6rem 1rem; box-shadow: var(--shadow-sm); }
.order-arrow { font-size: 1.5rem; }
.tricks-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.tricks-table th, .tricks-table td { padding: .8rem 1rem; text-align: start; border-bottom: 2px solid #eee; vertical-align: top; }
.tricks-table th { background: var(--ink); color: var(--sun); font-family: var(--display); }
.tricks-table tr:last-child td { border-bottom: none; }
.tricks-table td:first-child { font-family: var(--display); font-weight: 700; font-size: 1.2rem; white-space: nowrap; }
details.faq { background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow-sm); padding: .9rem 1.2rem; margin-bottom: .8rem; }
details.faq summary { font-family: var(--display); font-weight: 600; font-size: 1.1rem; cursor: pointer; }
.progress-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.mastery { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.mastery div { border: 3px solid var(--ink); border-radius: 12px; padding: .5rem; text-align: center; font-family: var(--display); font-weight: 600; background: #fff; }
.mastery small { display: block; font-size: .75rem; opacity: .7; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-14px) rotate(var(--r, 0deg)); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes confetti-fall { 0% { transform: translateY(-10vh) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
.reveal { opacity: 0; animation: rise .7s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: var(--d, 0s); }
.wiggle:hover { animation: wiggle .5s ease-in-out; }
.confetti-piece { position: fixed; top: 0; width: 12px; height: 18px; z-index: 200; pointer-events: none; animation: confetti-fall 2.8s ease-in forwards; border: 2px solid var(--ink); border-radius: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; }
}

/* ---------- Video page layout ---------- */
.player-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .9fr); gap: 2rem; align-items: start; }
@media (max-width: 900px) {
  .player-layout { grid-template-columns: 1fr; }
  .episodes { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .episode .thumb { height: 52px; font-size: 1.8rem; }
}

/* ---------- Language toggle ---------- */
.lang-toggle {
  font-family: var(--display); font-weight: 700; font-size: 1rem; padding: 0 .9rem; height: 46px; border-radius: 12px;
  border: 3px solid var(--ink); background: var(--sky); box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s;
}
.lang-toggle:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
@media (max-width: 960px) { .lang-toggle { margin-inline-start: auto; } }

/* ---------- Arabic / RTL ----------
   Layout mirrors automatically (flex/grid + logical properties). What needs care:
   1. Fonts: Fredoka/Nunito have no Arabic glyphs, so swap to rounded Arabic faces.
   2. letter-spacing breaks connected Arabic script; zero it.
   3. Maths must stay left-to-right (3 × 4 = 12), so every equation is isolated as LTR. */
:root[dir="rtl"] {
  --display: 'Baloo Bhaijaan 2', 'Fredoka', 'Segoe UI', Tahoma, sans-serif;
  --body: 'Cairo', 'Nunito', 'Segoe UI', Tahoma, sans-serif;
}
[dir="rtl"] body { line-height: 1.75; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { line-height: 1.35; letter-spacing: 0; }
[dir="rtl"] .eyebrow, [dir="rtl"] .stat span, [dir="rtl"] .table-chip small { letter-spacing: 0; }
[dir="rtl"] .eyebrow { transform: rotate(2deg); }
[dir="rtl"] .sticker .tag { transform: rotate(-4deg); }
[dir="rtl"] .hero h1 .wobble { transform: rotate(3deg); }
[dir="rtl"] .hero h1 .swing { transform: rotate(-3deg); }

/* Everything mathematical is forced LTR and bidi-isolated */
.math,
[dir="rtl"] .question-big:not(.prose), [dir="rtl"] .option, [dir="rtl"] .caller, [dir="rtl"] .bingo-cell:not(.free),
[dir="rtl"] .stage-eq, [dir="rtl"] .skip-strip, [dir="rtl"] .mchart, [dir="rtl"] .float-chip, [dir="rtl"] .table-chip,
[dir="rtl"] .stat b, [dir="rtl"] .footer .nums, [dir="rtl"] .brand-badge, [dir="rtl"] .puzzle-type,
[dir="rtl"] .prob, [dir="rtl"] .sheet-chart, [dir="rtl"] .trouble .chip,
[dir="rtl"] .progress, [dir="rtl"] .timer-bar, [dir="rtl"] .track {
  direction: ltr; unicode-bidi: isolate;
}
[dir="rtl"] .table-chip small { direction: rtl; }
[dir="rtl"] .prob-grid.h .prob { justify-content: flex-start; }
[dir="rtl"] .tricks-table td:first-child { direction: ltr; text-align: end; }

/* ---------- Who's playing card ---------- */
.who {
  display: grid; grid-template-columns: 150px 1fr; gap: 1.5rem; align-items: center;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.8rem;
  background-image: linear-gradient(120deg, #FFF3C4 0%, #E3F8F6 100%);
}
.who-mascot .mascot { width: 140px; }
.who h2 { margin-bottom: .4rem; }
.who-row { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: .4rem; }
.who-row input {
  flex: 1 1 220px; font-family: var(--display); font-size: 1.3rem; padding: .6rem 1rem; border-radius: 16px; border: 3px solid var(--ink);
  background: #fff; box-shadow: 3px 3px 0 var(--ink);
}
.who-row input:focus { outline: 3px solid var(--sun); outline-offset: 2px; }
.who-stats { display: flex; gap: .8rem; flex-wrap: wrap; margin: .4rem 0 .6rem; }
.who-stats .stat { min-width: 120px; }
.who-next { font-family: var(--display); font-weight: 600; color: var(--ink-soft); margin: 0 0 .8rem; }
@media (max-width: 640px) { .who { grid-template-columns: 1fr; text-align: center; } .who-mascot { display: flex; justify-content: center; } .who-stats { justify-content: center; } }

/* ---------- Star chip in nav ---------- */
.star-chip {
  font-family: var(--display); font-weight: 700; font-size: 1rem; padding: 0 .8rem; height: 46px; border-radius: 12px; display: inline-flex; align-items: center;
  border: 3px solid var(--ink); background: var(--sun); box-shadow: var(--shadow-sm); white-space: nowrap; transition: transform .12s, box-shadow .12s;
}
.star-chip:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
@media (max-width: 960px) { .star-chip { margin-inline-start: auto; } .lang-toggle { margin-inline-start: 0; } }
@media (max-width: 480px) { .star-chip { font-size: .9rem; padding: 0 .5rem; } }

/* ---------- Prize popup ---------- */
.prize-back { position: fixed; inset: 0; background: rgba(43, 33, 64, .6); display: grid; place-items: center; z-index: 150; padding: 1rem; animation: rise .3s; }
.prize-card {
  position: relative; overflow: hidden; text-align: center; background: var(--paper); border: 4px solid var(--ink); border-radius: 32px;
  box-shadow: 12px 12px 0 var(--ink); padding: 2.4rem 2rem 2rem; max-width: 480px; width: 100%; animation: pop .5s;
}
.prize-rays {
  position: absolute; inset: -60%; background: repeating-conic-gradient(from 0deg, #FFE28A 0deg 12deg, #FFF6D6 12deg 24deg);
  animation: spin 24s linear infinite; z-index: 0; opacity: .8;
}
.prize-card > * { position: relative; z-index: 1; }
.prize-emoji { font-size: 6rem; line-height: 1; margin-bottom: .6rem; animation: bounce 1.2s ease-in-out infinite; filter: drop-shadow(6px 6px 0 rgba(43,33,64,.2)); }
.prize-card h2 { font-size: 2rem; }
.prize-card p { font-size: 1.2rem; margin-bottom: 1.2rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }

/* ---------- Prize box ---------- */
.prize-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .8rem; margin-top: 1rem; }
.prize-slot {
  aspect-ratio: 1; display: grid; place-content: center; text-align: center; gap: .2rem; border: 3px solid var(--ink); border-radius: 18px;
  background: #fff; box-shadow: var(--shadow-sm); font-family: var(--display); font-weight: 600; opacity: .55; transition: transform .15s;
}
.prize-slot small { font-size: .72rem; line-height: 1.1; }
.prize-slot-emoji { font-size: 2.2rem; line-height: 1; }
.prize-slot.earned { opacity: 1; background: linear-gradient(160deg, #fff 0%, #FFF3C4 100%); }
.prize-slot.earned:hover { transform: translate(-2px, -2px) rotate(-4deg); }

/* ---------- Memory Match ---------- */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; max-width: 520px; margin: 0 auto; }
.mcard { aspect-ratio: 1; background: none; border: none; padding: 0; perspective: 800px; cursor: pointer; }
.mcard-inner { position: relative; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.mcard.flipped .mcard-inner, .mcard.matched .mcard-inner { transform: rotateY(180deg); }
.mcard-front, .mcard-back {
  position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 3px solid var(--ink); border-radius: 18px; box-shadow: 3px 3px 0 var(--ink); font-family: var(--display); font-weight: 700;
  font-size: clamp(1.1rem, 4vw, 1.7rem); direction: ltr;
}
.mcard-front { background: var(--grape); color: #fff; font-size: 2rem; background-image: radial-gradient(rgba(255,255,255,.25) 2px, transparent 2.5px); background-size: 14px 14px; }
.mcard-back { transform: rotateY(180deg); background: #fff; }
.mcard-back.a { background: #FFF3C4; }
.mcard.matched .mcard-back { background: var(--lime); animation: pop .4s; }
.mcard:hover .mcard-inner { transform: translateY(-3px); }
.mcard.flipped:hover .mcard-inner, .mcard.matched:hover .mcard-inner { transform: rotateY(180deg); }

/* ---------- Balloon Pop ---------- */
.arena {
  position: relative; height: 380px; overflow: hidden; border: 3px solid var(--ink); border-radius: 22px;
  background: linear-gradient(180deg, #CDEFFF 0%, #EAF9FF 60%, #FFF9E8 100%); direction: ltr;
}
.arena-clouds { position: absolute; top: 14px; left: 8%; right: 8%; display: flex; justify-content: space-between; font-size: 1.6rem; opacity: .7; pointer-events: none; }
.balloon {
  position: absolute; bottom: -120px; width: 88px; height: 106px; border: 3px solid var(--ink); color: var(--ink);
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.7rem;
  box-shadow: inset -8px -8px 0 rgba(0,0,0,.08), 3px 3px 0 var(--ink); cursor: pointer; animation: float-up linear forwards; will-change: transform;
}
.balloon::after { content: ''; position: absolute; top: 100%; left: 50%; width: 3px; height: 40px; background: var(--ink); transform: translateX(-50%); }
.balloon:hover { filter: brightness(1.07); }
.balloon.pop { animation: balloon-pop .45s forwards !important; }
.balloon.wobble { animation-play-state: paused; }
.balloon.wobble::before { content: '✖'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 2.2rem; background: rgba(255,107,107,.75); border-radius: inherit; animation: shake .4s; }
.balloon.escaped { opacity: 0; }
@keyframes float-up { from { transform: translateY(0); } to { transform: translateY(-680px); } }
@keyframes balloon-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); opacity: 1; } 100% { transform: scale(0); opacity: 0; } }
@media (max-width: 600px) { .arena { height: 320px; } .balloon { width: 72px; height: 88px; font-size: 1.4rem; } }

/* ---------- Number Hunt ---------- */
.hunt-target { text-align: center; font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 1rem 0; }
.hunt-target b { display: inline-block; font-size: 2.4rem; background: var(--sun); border: 3px solid var(--ink); border-radius: 16px; padding: 0 .9rem; box-shadow: var(--shadow-sm); margin-inline-start: .4rem; line-height: 1.3; }
.hunt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; max-width: 620px; margin: 0 auto; }
.hunt-tile {
  font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 4vw, 1.6rem); padding: 1rem .4rem; border-radius: 16px; border: 3px solid var(--ink);
  background: #fff; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, background .15s; direction: ltr;
}
.hunt-tile:hover { transform: translate(-2px, -2px); }
.hunt-tile.hit { background: var(--lime); transform: rotate(-3deg) scale(.96); animation: pop .35s; }
.hunt-tile.miss { background: var(--coral); color: #fff; animation: shake .4s; }
@media (max-width: 480px) { .hunt-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Trophies ---------- */
.badge-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; margin-top: 1rem; }
.badge-slot {
  position: relative; display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; gap: .1rem .8rem; align-items: center;
  border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); padding: .9rem 1rem .9rem .9rem;
  font-family: var(--display); transition: transform .15s;
}
.badge-slot .badge-emoji { grid-row: 1 / 3; font-size: 2.4rem; line-height: 1; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; border: 2px solid var(--ink); background: #FFF3C4; }
.badge-slot b { font-size: 1rem; line-height: 1.2; }
.badge-slot small { font-family: var(--body); font-weight: 600; font-size: .78rem; line-height: 1.3; color: var(--ink-soft); }
.badge-slot .badge-progress { grid-column: 2; font-size: .78rem; font-weight: 700; background: var(--ink); color: var(--sun); border-radius: 999px; padding: .05rem .6rem; justify-self: start; margin-top: .25rem; }
.badge-slot.locked { opacity: .7; background: #FAF7F2; }
.badge-slot.locked .badge-emoji { background: #eee; filter: grayscale(1); }
.badge-slot.earned { background: linear-gradient(160deg, #fff 0%, #FFF3C4 100%); }
.badge-slot.earned:hover { transform: translate(-2px, -2px) rotate(-1.5deg); }
.badge-slot.hard { border-color: #E4572E; }
.badge-slot.earned.hard { background: linear-gradient(160deg, #fff 0%, #FFE4DA 100%); }
.badge-hard {
  position: absolute; top: -12px; inset-inline-end: 12px; font-size: .7rem; font-weight: 700; letter-spacing: 0;
  background: #E4572E; color: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: .05rem .55rem; box-shadow: 2px 2px 0 var(--ink);
}
.prize-card.badge .prize-rays { background: repeating-conic-gradient(from 0deg, #FFD0C2 0deg 12deg, #FFF0EA 12deg 24deg); }

/* ---------- Phone-width fixes ---------- */
@media (max-width: 960px) { .ws-layout { grid-template-columns: minmax(0, 1fr); } .sheet { overflow-x: auto; } }
@media (max-width: 520px) {
  .nav-inner { gap: .45rem; padding-inline: .8rem; }
  .brand { font-size: 1.02rem; gap: .45rem; }
  .brand-badge { width: 36px; height: 36px; font-size: 1.2rem; }
  .star-chip, .lang-toggle, .nav-toggle { height: 40px; }
  .nav-toggle { width: 40px; font-size: 1.2rem; }
  .lang-toggle { padding: 0 .6rem; font-size: .9rem; }
  .sheet { padding: 1.2rem 1rem; }
  .prob-grid.h { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Sister-site link (nav + banner) ---------- */
.nav-links a.sister-link { background: var(--sky); color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.nav-links a.sister-link:hover { background: var(--sky); }
.banner.sister { background: var(--sky); color: var(--ink); }
.banner.sister h2 { color: var(--ink); }
