/* =========================================================
   oku balam Kids — shared design system
   ========================================================= */

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

:root {
  /* palette — soft & relaxing, with a tech-gradient accent */
  --sky: #eaf6ff;
  --cream: #fff8ec;
  --mint: #e8fbf1;
  --ink: #26314d;
  --ink-soft: #5b6478;
  --white: #ffffff;

  --purple: #6c5ce7;
  --teal: #00c2cb;
  --pink: #ff6fa5;
  --yellow: #ffc93c;
  --green: #35d08a;
  --blue: #4ea1ff;
  --orange: #ff9448;

  --grad-tech: linear-gradient(135deg, var(--purple) 0%, var(--teal) 100%);
  --grad-warm: linear-gradient(135deg, var(--pink) 0%, var(--yellow) 100%);
  --grad-cool: linear-gradient(135deg, var(--blue) 0%, var(--green) 100%);

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-soft: 0 10px 30px rgba(38, 49, 77, 0.08);
  --shadow-pop: 0 16px 40px rgba(108, 92, 231, 0.18);

  --font-head: 'Baloo 2', 'Noto Naskh Arabic', system-ui, sans-serif;
  --font-body: 'Poppins', 'Noto Sans Arabic', system-ui, sans-serif;

  /* Uyghur uses the Arabic script, so an Arabic-script webfont is what
     actually matters here — Noto Naskh Arabic is the default because its
     open, geometric letterforms read clearly for kids and it covers the
     extra Uyghur letters (ئ ھ ۋ ې ژ ...) that plain system fonts often
     render as boxes or the wrong shape.
     To switch to a dedicated Uyghur typeface later (e.g. a self-hosted
     UKIJ or Alkatip font), add an @font-face below and change ONLY this
     one line — every Uyghur/Arabic-script element on the site reads it. */
  --font-uyghur: 'Noto Naskh Arabic', 'Noto Sans Arabic', 'Scheherazade New', 'Arial Unicode MS', sans-serif;
}

/* Example — uncomment and point at your own font files to use a
   dedicated Uyghur typeface instead of Noto:
   @font-face {
     font-family: 'UKIJ Tuz';
     src: url('../fonts/ukij-tuz.woff2') format('woff2');
     font-display: swap;
   }
   Then set: --font-uyghur: 'UKIJ Tuz', 'Noto Naskh Arabic', sans-serif;
*/

/* Any element tagged lang="ug" (Uyghur) or lang="ar" (Arabic) automatically
   gets the Arabic-script font, right-to-left flow, and roomier line-height
   Arabic-script text needs — no per-page CSS required. */
[lang="ug"], [lang="ar"], .lang-rtl {
  font-family: var(--font-uyghur);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 2;
  letter-spacing: normal;
}

* { box-sizing: border-box; }

/* Elements toggled via `.hidden = true`/`hidden` must actually stay
   hidden even when a class on the same element (e.g. .topic-grid's
   display:grid) would otherwise out-rank the browser's default
   [hidden] rule. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sky);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  margin: 0 0 .5em;
  line-height: 1.15;
}

p { line-height: 1.65; color: var(--ink-soft); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

.container {
  width: min(1180px, 92%);
  margin: 0 auto;
}

/* =========================== NAVBAR =========================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(38, 49, 77, 0.06);
}

.nav {
  width: min(1180px, 92%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--ink);
  flex-shrink: 0;
}

.brand .logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--grad-tech);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: var(--shadow-pop);
}

.brand .brand-sub {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .68rem;
  color: var(--ink-soft);
  margin-top: -2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  flex: 1;
  justify-content: center;
}

.nav-links a {
  font-weight: 600;
  font-size: .96rem;
  color: var(--ink-soft);
  padding: 8px 4px;
  position: relative;
  transition: color .2s ease;
}

.nav-lang {
  font-family: var(--font-uyghur);
  background: var(--sky);
  padding: 6px 14px !important;
  border-radius: 999px;
  font-size: .88rem !important;
  margin-inline-start: 4px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--purple);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad-tech);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-user {
  display: none;
  align-items: center;
  gap: 10px;
}

.nav-auth.logged-in [data-auth="guest"] { display: none !important; }
.nav-auth:not(.logged-in) [data-auth="user"] { display: none !important; }
.nav-auth.logged-in .nav-user { display: flex; }

.nav-user .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-warm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--ink);
}

/* =========================== BUTTONS =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
  border: none;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(.98); }

.btn-primary {
  background: var(--grad-tech);
  color: #fff;
  box-shadow: var(--shadow-pop);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 34px rgba(108,92,231,.26); }

.btn-outline {
  background: #fff;
  color: var(--purple);
  border: 2px solid rgba(108, 92, 231, .25);
}
.btn-outline:hover { border-color: var(--purple); transform: translateY(-2px); }

.btn-warm {
  background: var(--grad-warm);
  color: #fff;
  box-shadow: 0 12px 26px rgba(255, 111, 165, .3);
}
.btn-warm:hover { transform: translateY(-2px); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .82rem; }
.btn-lg { padding: 15px 30px; font-size: 1.02rem; }

.btn-social {
  background: #fff;
  color: var(--ink);
  border: 2px solid rgba(38,49,77,.1);
  font-weight: 600;
}
.btn-social:hover { border-color: rgba(38,49,77,.25); transform: translateY(-2px); }

/* =========================== HERO =========================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 70px 0 90px;
  background: linear-gradient(180deg, var(--sky) 0%, var(--cream) 100%);
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .55;
  animation: float 9s ease-in-out infinite;
}
.blob-1 { width: 220px; height: 220px; background: var(--grad-warm); top: -60px; left: -60px; animation-delay: 0s; }
.blob-2 { width: 160px; height: 160px; background: var(--grad-cool); top: 60px; right: 6%; animation-delay: 1.5s; }
.blob-3 { width: 130px; height: 130px; background: var(--grad-tech); bottom: -40px; left: 30%; animation-delay: 3s; opacity: .35; }

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-22px) translateX(14px); }
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 40px;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .82rem;
  color: var(--purple);
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  color: var(--ink);
}

.hero h1 span {
  background: var(--grad-tech);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  font-size: 1.08rem;
  max-width: 46ch;
  margin-bottom: 28px;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.hero-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.hero-stats div strong {
  display: block;
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--ink);
}
.hero-stats div span { font-size: .82rem; color: var(--ink-soft); }

.hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-art .art-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 30px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  position: relative;
}

.hero-art .art-emoji {
  font-size: 5rem;
  animation: bob 3.5s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}

.floating-chip {
  position: absolute;
  background: #fff;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow-soft);
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: float 6s ease-in-out infinite;
}
.chip-1 { top: 6%; left: -8%; }
.chip-2 { bottom: 8%; right: -10%; animation-delay: 2s; }

/* =========================== SECTIONS =========================== */
.section {
  padding: 74px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 46px;
}

.eyebrow {
  display: inline-block;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 10px;
}

.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }

/* =========================== CATEGORY CARDS =========================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.category-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  box-shadow: var(--shadow-soft);
  transition: transform .22s ease, box-shadow .22s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: var(--card-accent, var(--grad-tech));
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-pop);
}

.category-icon {
  width: 58px; height: 58px;
  border-radius: 18px;
  background: var(--card-accent, var(--grad-tech));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.category-card h3 { font-size: 1.15rem; }
.category-card p { font-size: .9rem; margin-bottom: 6px; }

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 14px;
}
.category-tags span {
  background: var(--sky);
  color: var(--ink-soft);
  font-size: .74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.card-link {
  margin-top: auto;
  font-weight: 700;
  color: var(--purple);
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* =========================== GENERIC CARD GRID (topics/games) =========================== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.topic-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  text-align: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.topic-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-pop); }

.topic-flag, .topic-emoji {
  font-size: 2.6rem;
  margin-bottom: 10px;
}

.topic-card h4 { font-size: 1.05rem; margin-bottom: 4px; }
.topic-card p { font-size: .85rem; margin-bottom: 14px; }

.topic-progress {
  height: 8px;
  background: var(--sky);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.topic-progress > span {
  display: block;
  height: 100%;
  background: var(--grad-cool);
  border-radius: 999px;
}

.method-card-primary {
  background: var(--grad-tech);
  color: #fff;
}
.method-card-primary h4 { color: #fff; }

.lang-nav-wrap { max-width: 320px; margin: 0 auto 36px; }

.topic-link { display: block; color: inherit; text-decoration: none; }
.topic-link:hover .topic-flag { transform: scale(1.08); }
.topic-flag { transition: transform .15s ease; }

.lang-level-card {
  border: 2px solid transparent;
  background: #fff;
  width: 100%;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.lang-level-card.lang-level-active { border-color: var(--purple, #6c5ce7); }
#methodGrid .topic-card { text-decoration: none; display: block; }
#methodGrid .topic-card h4 { margin-bottom: 0; }
.lang-nav-back {
  display: inline-block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 14px;
}
.lang-nav-card { margin: 0 auto; }
.lang-nav-current { opacity: .55; cursor: default; }

.badge-soon {
  display: inline-block;
  background: var(--yellow);
  color: #7a5200;
  font-size: .7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

/* =========================== WHY / FEATURES STRIP =========================== */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.feature-item {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.feature-item .fi-icon { font-size: 1.8rem; margin-bottom: 8px; }
.feature-item h4 { font-size: .98rem; margin-bottom: 4px; }
.feature-item p { font-size: .82rem; margin: 0; }

/* =========================== QUIZ / COMPETE BAND =========================== */
.quiz-band {
  background: var(--grad-tech);
  border-radius: var(--radius-lg);
  padding: 46px;
  color: #fff;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 30px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.quiz-band h2 { color: #fff; }
.quiz-band p { color: rgba(255,255,255,.85); }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.mode-card {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-sm);
  padding: 16px;
  backdrop-filter: blur(6px);
}
.mode-card .mi { font-size: 1.4rem; margin-bottom: 6px; }
.mode-card h4 { color: #fff; font-size: .92rem; margin-bottom: 2px; }
.mode-card p { color: rgba(255,255,255,.78); font-size: .78rem; margin: 0; }

/* =========================== FOOTER =========================== */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,.7);
  padding: 54px 0 26px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 34px;
}
.footer h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; }
.footer a { color: rgba(255,255,255,.65); font-size: .88rem; display: block; margin-bottom: 9px; transition: color .15s; }
.footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .8rem;
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand strong { color: #fff; font-family: var(--font-head); font-size: 1.15rem; }

/* =========================== AUTH PAGES (login/signup) =========================== */
.auth-wrap {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: linear-gradient(160deg, var(--sky) 0%, var(--cream) 60%, var(--mint) 100%);
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 42px;
  width: 100%;
  max-width: 440px;
}

.auth-card .auth-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--grad-tech);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 16px;
}

.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card > p { margin-bottom: 24px; font-size: .92rem; }

.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-weight: 700;
  font-size: .84rem;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-row .hint { font-weight: 500; color: var(--ink-soft); font-size: .74rem; }

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(38,49,77,.1);
  font-family: inherit;
  font-size: .92rem;
  background: var(--sky);
  transition: border-color .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--purple);
  background: #fff;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-note {
  font-size: .76rem;
  color: var(--ink-soft);
  margin-top: 16px;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--ink-soft);
  font-size: .8rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(38,49,77,.12);
}

.social-row { display: flex; flex-direction: column; gap: 10px; }

.form-footer-link {
  text-align: center;
  margin-top: 22px;
  font-size: .88rem;
}
.form-footer-link a { color: var(--purple); font-weight: 700; }

.form-alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .84rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: none;
}
.form-alert.show { display: block; }
.form-alert.ok { background: #e6faf0; color: #14875a; }
.form-alert.err { background: #ffecec; color: #c23838; }

/* =========================== DASHBOARD (oku balam) =========================== */
.dash-hero {
  background: var(--grad-tech);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.dash-profile { display: flex; align-items: center; gap: 18px; }
.dash-avatar {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  border: 3px solid rgba(255,255,255,.5);
}
.dash-hero h1 { color: #fff; font-size: 1.5rem; margin-bottom: 2px; }
.dash-hero p { color: rgba(255,255,255,.85); margin: 0; }

.dash-xp {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}
.dash-xp div strong { display: block; font-family: var(--font-head); font-size: 1.6rem; }
.dash-xp div span { font-size: .78rem; color: rgba(255,255,255,.8); }

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

.panel {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
}
.panel h3 { font-size: 1.05rem; margin-bottom: 16px; }

.progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.progress-row .pr-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
  background: var(--sky);
}
.progress-row .pr-body { flex: 1; }
.progress-row .pr-body div.pr-top { display: flex; justify-content: space-between; font-size: .84rem; font-weight: 700; margin-bottom: 6px; }
.progress-row .pr-top span:last-child { color: var(--ink-soft); font-weight: 600; }

.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.badge-item {
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  background: var(--sky);
}
.badge-item.locked { opacity: .4; filter: grayscale(1); }
.badge-item .bi-emoji { font-size: 1.6rem; margin-bottom: 4px; }
.badge-item span { display: block; font-size: .68rem; font-weight: 700; }

.leader-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(38,49,77,.06);
  font-size: .88rem;
}
.leader-row:last-child { border-bottom: none; }
.leader-rank {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sky); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem; flex-shrink: 0;
}
.leader-row.me { background: var(--mint); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px -12px; border-bottom: none; }
.leader-name { flex: 1; font-weight: 600; }
.leader-score { font-weight: 800; color: var(--purple); }

/* =========================== QUIZ ENGINE =========================== */
.quiz-shell {
  max-width: 680px;
  margin: 0 auto;
}
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.quiz-progress-track {
  flex: 1;
  height: 10px;
  background: #fff;
  border-radius: 999px;
  margin: 0 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.quiz-progress-track > span {
  display: block; height: 100%;
  background: var(--grad-cool);
  border-radius: 999px;
  transition: width .3s ease;
}
.quiz-score-chip {
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.quiz-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 36px;
}
.quiz-card h2 { font-size: 1.3rem; margin-bottom: 22px; }

.quiz-options { display: grid; gap: 12px; }
.quiz-option {
  text-align: left;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(38,49,77,.1);
  background: var(--sky);
  font-weight: 600;
  font-size: .95rem;
  transition: all .15s ease;
}
.quiz-option:hover { border-color: var(--purple); transform: translateX(4px); }
.quiz-option.correct { background: #e6faf0; border-color: var(--green); color: #14875a; }
.quiz-option.wrong { background: #ffecec; border-color: #ff6f6f; color: #c23838; }
.quiz-option[disabled] { pointer-events: none; }

.quiz-feedback {
  margin-top: 18px;
  font-weight: 700;
  font-size: .92rem;
  min-height: 1.4em;
}
.quiz-actions { margin-top: 20px; text-align: right; }

.quiz-result {
  text-align: center;
  padding: 20px 0;
}
.quiz-result .qr-emoji { font-size: 4rem; margin-bottom: 10px; }
.quiz-result h2 { font-size: 1.6rem; }
.quiz-result .qr-score {
  font-family: var(--font-head);
  font-size: 2.4rem;
  color: var(--purple);
  margin: 10px 0;
}

/* =========================== PRICING (subscribe) =========================== */
.pricing-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 40px;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  border: 3px solid transparent;
  background-image: linear-gradient(#fff,#fff), var(--grad-tech);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.pricing-card .price { font-family: var(--font-head); font-size: 2.6rem; margin: 10px 0; }
.pricing-card .price span { font-size: 1rem; color: var(--ink-soft); font-family: var(--font-body); }
.pricing-list { text-align: left; margin: 22px 0; }
.pricing-list li { padding: 8px 0; font-size: .92rem; display: flex; gap: 10px; align-items: flex-start; }

.demo-note {
  background: #fff7e0;
  border: 1px solid #ffe4a3;
  color: #8a6100;
  font-size: .8rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

/* =========================== MODAL =========================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(38,49,77,.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 34px;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-pop);
}
.modal-box .m-emoji { font-size: 3rem; margin-bottom: 12px; }
.modal-box h3 { margin-bottom: 8px; }
.modal-box p { margin-bottom: 20px; font-size: .9rem; }

/* =========================== CONTACT =========================== */
.contact-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 34px;
  align-items: start;
}
.contact-info-card {
  background: var(--grad-tech);
  border-radius: var(--radius-lg);
  padding: 34px;
  color: #fff;
}
.contact-info-card h3 { color: #fff; }
.contact-info-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.contact-info-row .ci-icon { font-size: 1.3rem; }
.contact-info-row strong { display: block; font-size: .9rem; }
.contact-info-row span { font-size: .82rem; color: rgba(255,255,255,.82); }
.contact-form-card { background: #fff; border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow-soft); }

/* =========================== READING =========================== */
.reading-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}
.reading-sidebar {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.reading-level-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.reading-level-tab {
  flex: 1;
  padding: 7px 10px; border-radius: 999px; font-weight: 700; font-size: .72rem;
  background: var(--sky); border: 2px solid transparent; color: var(--ink-soft);
  cursor: pointer; transition: transform .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.reading-level-tab:hover { transform: translateY(-1px); }
.reading-level-tab.active { background: var(--grad-tech); color: #fff; }
.reading-sidebar-title { font-size: .92rem; margin-bottom: 12px; }
.reading-sidebar-list { display: flex; flex-direction: column; gap: 6px; }
.reading-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .15s ease, border-color .15s ease;
}
[dir="rtl"] .reading-sidebar-item { text-align: right; }
.reading-sidebar-item:hover { background: var(--sky); }
.reading-sidebar-item.active { background: var(--sky); border-color: var(--purple); }
.reading-sidebar-item.is-read { background: var(--mint); }
.reading-sidebar-item.is-read.active { border-color: var(--green); }
.rsi-index {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--sky);
  color: var(--ink-soft);
  font-size: .68rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.reading-sidebar-item.active .rsi-index { background: var(--purple); color: #fff; }
.reading-sidebar-item.is-read .rsi-index { background: var(--green); color: #fff; }
.rsi-emoji { font-size: 1.2rem; flex: 0 0 auto; }
.rsi-title { flex: 1; font-size: .85rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.rsi-flags { font-size: .78rem; color: var(--orange); white-space: nowrap; }

.reading-main-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 40px;
  font-size: 1.08rem;
  line-height: 1.9;
}
.reading-main-card h2 { margin-top: 6px; }
.vocab-hint { font-size: .78rem; color: var(--ink-soft); margin-bottom: 18px; }
.reading-body { font-size: 1rem; }
.reading-song-wrap { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.reading-song-wrap .reading-song { flex: 1 1 260px; margin: 0; }
.reading-song { font-style: italic; }
.song-video { flex: 0 0 220px; }
.song-video iframe {
  width: 220px; height: 124px; border: none; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft); display: block;
}
.song-video-empty {
  width: 220px; height: 124px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--sky); border-radius: var(--radius-sm);
  font-size: .78rem; color: var(--ink-soft); padding: 10px; font-style: normal;
}
@media (max-width: 760px) {
  .song-video, .song-video iframe, .song-video-empty { width: 100%; }
}
.reading-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.reading-dialogue { display: flex; flex-direction: column; gap: 14px; }
.dialogue-line { display: flex; flex-direction: column; gap: 2px; }
.dialogue-speaker { font-size: .74rem; font-weight: 800; color: var(--purple); }
.dialogue-text {
  font-size: 1rem;
  background: var(--sky);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  align-self: flex-start;
  max-width: 90%;
}
[dir="rtl"] .dialogue-text { align-self: flex-end; }

.story-vocab {
  position: relative;
  color: var(--purple);
  font-weight: 800;
  background: var(--sky);
  padding: 1px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.vocab-meaning {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: min(260px, 80vw);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--sky);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: var(--shadow-pop);
  white-space: normal;
  text-align: center;
}
.vocab-meaning::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: #fff;
  border-left: 1px solid var(--sky);
  border-top: 1px solid var(--sky);
}
.story-vocab.expanded .vocab-meaning { display: block; }

.my-story-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sky);
  text-decoration: none;
  color: var(--ink);
}
.my-story-row:last-child { border-bottom: none; }
.msr-emoji { font-size: 1.15rem; }
.msr-title { flex: 1; font-size: .85rem; font-weight: 700; }
.msr-flags { font-size: .78rem; color: var(--orange); }

/* =========================== GAMES ============================ */
.game-card { position: relative; }
.game-card .play-btn { margin-top: 10px; }

.match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 460px;
  margin: 0 auto 20px;
}
.match-tile {
  aspect-ratio: 1;
  background: var(--grad-tech);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: transparent;
  border: none;
  transition: transform .15s ease;
  user-select: none;
}
.match-tile.flipped, .match-tile.matched { color: #fff; background: #fff; }
.match-tile.flipped { background: var(--grad-cool); }
.match-tile.matched { background: var(--green); }
.match-tile:active { transform: scale(.94); }

.game-meta {
  display: flex; justify-content: center; gap: 24px;
  margin-bottom: 16px; font-weight: 700; font-size: .9rem;
}

.wb-hint { font-size: 4rem; text-align: center; margin-bottom: 20px; }
.wb-word {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 32px;
}
.wb-blank {
  width: 46px; height: 54px; border-radius: var(--radius-sm);
  background: #fff; box-shadow: var(--shadow-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; color: var(--ink);
  border-bottom: 4px solid rgba(108, 92, 231, .2);
  text-transform: uppercase;
}
.wb-blank.filled { border-bottom-color: var(--green); }
.wb-letters {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  max-width: 420px; margin: 0 auto;
}
.wb-letter {
  width: 50px; height: 50px; border-radius: var(--radius-sm);
  background: var(--grad-tech); color: #fff; border: none;
  font-size: 1.3rem; font-weight: 800; text-transform: uppercase;
  cursor: pointer; transition: transform .15s ease, opacity .15s ease;
}
.wb-letter:active { transform: scale(.92); }
.wb-letter.used { opacity: 0; pointer-events: none; }
.wb-word.shake { animation: wbShake .35s ease; }
@keyframes wbShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ---- Color Memory (Simon-style pattern game) ---- */
.cm-board {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  max-width: 320px; margin: 0 auto 24px;
}
.cm-pad {
  aspect-ratio: 1; border: none; cursor: pointer;
  opacity: .8; transition: opacity .12s ease, transform .1s ease;
}
.cm-pad:active { transform: scale(.96); }
.cm-pad.lit { opacity: 1; box-shadow: 0 0 0 6px rgba(255, 255, 255, .55), 0 0 34px currentColor; }
.cm-pad.disabled { cursor: not-allowed; }
.cm-pad-green { background: var(--green); color: var(--green); border-radius: 22px 8px 8px 8px; }
.cm-pad-red { background: #ff5b5b; color: #ff5b5b; border-radius: 8px 22px 8px 8px; }
.cm-pad-yellow { background: var(--yellow); color: var(--yellow); border-radius: 8px 8px 8px 22px; }
.cm-pad-blue { background: var(--blue); color: var(--blue); border-radius: 8px 8px 22px 8px; }
.cm-status { text-align: center; font-weight: 700; font-size: 1rem; margin-bottom: 6px; min-height: 1.4em; }

/* ---- Bubble Pop ---- */
.bp-stage {
  position: relative; width: 100%; max-width: 420px; height: 460px;
  margin: 0 auto 20px; border-radius: var(--radius-md); overflow: hidden;
  background: linear-gradient(180deg, #eaf6ff, #cdeeff);
  box-shadow: var(--shadow-soft);
}
.bp-target {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: #fff; padding: 8px 18px; border-radius: 999px;
  font-weight: 800; font-size: .95rem; box-shadow: var(--shadow-soft); z-index: 2;
  white-space: nowrap;
}
.bp-bubble {
  position: absolute; bottom: -70px; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255, 255, 255, .88); border: none; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
  cursor: pointer; box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
  transition: bottom linear;
}
.bp-bubble.pop { animation: bpPop .22s ease forwards; pointer-events: none; }
@keyframes bpPop { to { transform: scale(1.7); opacity: 0; } }
.bp-end {
  position: absolute; inset: 0; background: rgba(255, 255, 255, .96);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; z-index: 3; text-align: center; padding: 20px;
}

/* ---- Chess Puzzle mini-game (reuses .chess-board/.chess-square/.chess-piece) ---- */
.pz-goal { text-align: center; font-weight: 700; font-size: 1.05rem; margin-bottom: 16px; }
.pz-board-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.pz-board-wrap .chess-board { flex-shrink: 0; }
.pz-hint {
  position: absolute; inset: 22%; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  z-index: 2; animation: pzPulse 1.3s ease-in-out infinite;
}
.pz-hint-move { background: rgba(53, 208, 138, .55); }
.pz-hint-capture { background: transparent; border: 4px solid rgba(255, 111, 111, .8); inset: 10%; }
@keyframes pzPulse { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.15); opacity: 1; } }
.chess-board.pz-flash-correct { box-shadow: 0 0 0 6px var(--green); }
.chess-board.pz-flash-wrong { box-shadow: 0 0 0 6px #ff6f6f; }
.pz-result { text-align: center; }
.pz-result .qr-emoji { font-size: 4rem; margin-bottom: 10px; }
.pz-result .qr-score { font-size: 2.2rem; font-weight: 800; color: var(--purple); margin: 6px 0 14px; }

/* ---- Scratch Sprint mini-game ---- */
.ss-timer-track {
  height: 10px; border-radius: 999px; background: var(--sky); overflow: hidden; margin-bottom: 18px;
}
.ss-timer-fill { display: block; height: 100%; background: var(--green); transition: width 1s linear, background .3s ease; }
.ss-timer-fill.warn { background: var(--yellow); }
.ss-timer-fill.danger { background: #ff6f6f; }
.ss-goal {
  text-align: center; font-weight: 700; margin-bottom: 6px; font-size: 1rem;
}
.ss-goal-row {
  display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.ss-goal-block {
  background: #fff; box-shadow: var(--shadow-soft); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 1.3rem;
}
.ss-goal-arrow { color: var(--ink-soft); font-weight: 700; }
.ss-slots {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 24px;
}
.ss-slot {
  width: 56px; height: 56px; border-radius: var(--radius-sm);
  background: #fff; border: 3px dashed rgba(108, 92, 231, .3);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.ss-slot.filled { border-style: solid; border-color: var(--green); background: #eafcf3; }
.ss-pool {
  display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; max-width: 520px; margin: 0 auto;
}
.ss-tile {
  min-width: 90px; padding: 14px 12px; border-radius: var(--radius-sm); border: none;
  color: #fff; font-weight: 700; font-size: .85rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .15s ease, opacity .15s ease;
}
.ss-tile .ss-tile-emoji { font-size: 1.6rem; }
.ss-tile:active { transform: scale(.94); }
.ss-tile.used { opacity: 0; pointer-events: none; }
.ss-tile.shake { animation: wbShake .35s ease; }
.ss-tile:nth-child(4n+1) { background: linear-gradient(135deg, #ff6f6f, #ff9448); }
.ss-tile:nth-child(4n+2) { background: linear-gradient(135deg, #4ea1ff, #6c5ce7); }
.ss-tile:nth-child(4n+3) { background: linear-gradient(135deg, #ffc93c, #ff9448); }
.ss-tile:nth-child(4n) { background: linear-gradient(135deg, #35d08a, #00c2cb); }
.ss-round-msg { text-align: center; font-weight: 700; min-height: 1.6em; margin-top: 18px; }

/* =========================== CHESS ============================ */
.chess-live-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.chess-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chess-status {
  text-align: center; font-weight: 700; font-size: .95rem;
  background: var(--sky); color: var(--ink); border-radius: 999px;
  padding: 10px 18px; margin: 0 auto 18px; max-width: 420px;
  transition: background .2s ease, color .2s ease;
}
.chess-status.status-check { background: #ffe1e1; color: #c0392b; }
.chess-status.status-thinking { background: var(--mint); }
.chess-status.status-win { background: var(--green); color: #fff; }
.chess-status.status-lose { background: #ffe1e1; color: #c0392b; }
.chess-status.status-draw { background: var(--cream); color: var(--ink-soft); }

.chess-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.chess-tray {
  display: flex; flex-wrap: wrap; gap: 2px; min-height: 26px;
  width: min(420px, 100%); justify-content: center;
}
.chess-tray .cp { font-size: 1.1rem; opacity: .7; }

.chess-board {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  border: 4px solid #6b4a30;
  touch-action: manipulation;
}
.chess-square { position: relative; display: flex; align-items: center; justify-content: center; }
.chess-square.light { background: #f0dcbd; }
.chess-square.dark { background: #a9713f; }
.chess-square.selected { box-shadow: inset 0 0 0 3px var(--teal); }
.chess-square.last-move { background-image: linear-gradient(rgba(255, 201, 60, .45), rgba(255, 201, 60, .45)); }
.chess-square.in-check { animation: chessCheckPulse .9s ease-in-out infinite; }
.chess-square .move-dot { width: 26%; height: 26%; border-radius: 50%; background: rgba(38, 49, 77, .35); pointer-events: none; }
.chess-square .capture-ring { position: absolute; inset: 6%; border-radius: 50%; border: 4px solid rgba(220, 60, 60, .55); pointer-events: none; }

.chess-piece {
  position: absolute;
  width: 12.5%; height: 12.5%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(1.5rem, 7vw, 2.3rem);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: left .22s ease, top .22s ease, transform .18s ease, opacity .18s ease;
  z-index: 2;
}
.chess-piece.white { color: #fdfdfd; text-shadow: -1px -1px 0 #26314d, 1px -1px 0 #26314d, -1px 1px 0 #26314d, 1px 1px 0 #26314d, 0 3px 5px rgba(0, 0, 0, .3); }
.chess-piece.black { color: #26314d; text-shadow: 0 3px 5px rgba(0, 0, 0, .35); }
.chess-piece.captured { opacity: 0; transform: scale(.3) rotate(20deg); z-index: 1; }
.chess-piece.dragging { cursor: grabbing; }

@keyframes chessCheckPulse {
  0%, 100% { box-shadow: inset 0 0 0 4px rgba(220, 60, 60, .75); }
  50% { box-shadow: inset 0 0 0 4px rgba(220, 60, 60, .15); }
}

.chess-result { text-align: center; margin-top: 18px; padding: 18px; border-radius: var(--radius-sm); background: var(--sky); }
.chess-result .cr-emoji { font-size: 2.2rem; margin-bottom: 6px; }

.chess-sound-toggle {
  background: none; border: none; font-size: 1.2rem; cursor: pointer; line-height: 1;
  padding: 8px 10px; border-radius: 999px;
}
.chess-sound-toggle:hover { background: var(--sky); }

/* =========================== WORD CARDS ============================ */
.words-levels { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.words-level-tab {
  padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: .85rem;
  background: #fff; border: 2px solid rgba(108, 92, 231, .18); color: var(--ink-soft);
  cursor: pointer; transition: transform .15s ease, border-color .15s ease;
}
.words-level-tab:hover { transform: translateY(-2px); }
.words-level-tab.active { background: var(--grad-tech); color: #fff; border-color: transparent; }

.words-round-bar {
  display: flex; justify-content: center; align-items: center; gap: 12px;
  margin-bottom: 22px; flex-wrap: wrap; font-weight: 700; font-size: .85rem; color: var(--ink-soft);
}
.words-focus-wrap {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 0 auto 20px;
}
.words-nav-arrow {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: #fff; box-shadow: var(--shadow-soft);
  font-size: 1.2rem; cursor: pointer; color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, opacity .15s ease;
}
.words-nav-arrow:hover:not(:disabled) { transform: scale(1.08); }
.words-nav-arrow:disabled { opacity: .3; cursor: not-allowed; }

.words-thumbs {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: 640px; margin: 0 auto 24px;
}
.words-thumb {
  width: 58px; height: 72px; border-radius: 10px; background: #fff;
  box-shadow: var(--shadow-soft); border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; text-align: center; padding: 4px;
  cursor: pointer; color: var(--ink); overflow: hidden; line-height: 1.15;
  transition: transform .12s ease, border-color .12s ease;
}
.words-thumb:hover { transform: translateY(-2px); }
.words-thumb.active { border-color: var(--purple); box-shadow: 0 0 0 2px rgba(108, 92, 231, .3); }
.words-thumb.mastered { border-color: var(--green); background: #eafcf3; }
.words-thumb.practicing { border-color: var(--yellow); background: #fffbea; }

.word-card { aspect-ratio: 3 / 4; position: relative; cursor: pointer; perspective: 1000px; }
.word-card-focus { width: 230px; }
.word-card-focus .word-card-word { font-size: 1.5rem; }
.word-card-focus .wc-translation { font-size: 1.3rem; }
.word-card-focus .word-card-hint { font-size: .8rem; }
.word-card-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .5s ease; transform-style: preserve-3d;
}
.word-card.flipped .word-card-inner { transform: rotateY(180deg); }
.word-card-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px; text-align: center; gap: 4px;
}
.word-card-front { background: #fff; }
.word-card-back { background: var(--grad-cool); color: #fff; transform: rotateY(180deg); }
.word-card.mastered .word-card-face { box-shadow: 0 0 0 3px var(--green), var(--shadow-soft); }
.word-card.practicing .word-card-face { box-shadow: 0 0 0 3px var(--yellow), var(--shadow-soft); }

.word-card-word { font-weight: 800; font-size: 1rem; color: var(--ink); line-height: 1.2; }
.word-card-hint { font-size: .68rem; color: var(--ink-soft); }
.word-card-back .wc-translation { font-weight: 800; font-size: 1.05rem; }
.word-card-back .wc-label { font-size: .65rem; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.wc-translation-block { margin-bottom: 6px; }
.wc-translation-block:last-of-type { margin-bottom: 0; }

.word-note-btn {
  position: absolute; left: 8px; bottom: 8px; z-index: 3;
  background: var(--sky); border: none; border-radius: 999px;
  width: 26px; height: 26px; font-size: .85rem; cursor: pointer; line-height: 1;
}
.word-sentence-panel {
  position: absolute; inset: 6px; background: rgba(255, 255, 255, .98);
  border-radius: 10px; padding: 10px; font-size: .72rem; line-height: 1.35; color: var(--ink);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; z-index: 2;
}
.word-card.showing-sentence .word-sentence-panel { display: flex; }
.wsp-original { font-weight: 700; }
.wsp-translated { color: var(--ink-soft); font-style: italic; }

.word-card-grade { display: flex; gap: 6px; margin-top: 4px; }
.word-card-grade button {
  font-size: .66rem; padding: 6px 9px; border-radius: 999px; border: none; cursor: pointer;
  font-weight: 700; white-space: nowrap;
}
.grade-know { background: #fff; color: var(--green); }
.grade-practice { background: rgba(255, 255, 255, .28); color: #fff; }

.words-empty, .words-locked { text-align: center; padding: 50px 20px; }
.words-empty .we-emoji, .words-locked .we-emoji { font-size: 2.4rem; margin-bottom: 10px; }
.words-level-done { text-align: center; padding: 30px 20px; background: var(--sky); border-radius: var(--radius-md); margin-bottom: 20px; }
.words-level-done .wld-emoji { font-size: 2.2rem; margin-bottom: 8px; }

/* =========================== UTIL =========================== */
.text-center { text-align: center; }
.mt-40 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sky);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: .76rem;
  padding: 5px 12px;
  border-radius: 999px;
}

.page-hero {
  padding: 50px 0 20px;
  text-align: center;
}
.page-hero .eyebrow { display: block; }

.menu-overlay {
  position: fixed; inset: 0;
  background: rgba(38,49,77,.4);
  z-index: 90;
}
.menu-overlay[hidden] { display: none; }

/* =========================== RESPONSIVE =========================== */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-strip { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .quiz-band { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-links {
    position: fixed;
    top: 74px; left: 0; right: 0;
    background: #fff;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 16px;
    box-shadow: var(--shadow-soft);
    transform: translateY(-130%);
    transition: transform .25s ease;
    z-index: 95;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-toggle { display: block; }
  .nav-auth .btn-outline { display: none; }
  .category-grid, .topic-grid, .feature-strip { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .match-grid { grid-template-columns: repeat(3, 1fr); }

  .reading-layout { grid-template-columns: 1fr; }
  .reading-sidebar { position: static; max-height: none; }
  .reading-main-card { padding: 24px; }

  .words-focus-wrap { gap: 8px; }
  .words-nav-arrow { width: 36px; height: 36px; font-size: 1rem; }
  .word-card-focus { width: 185px; }
  .word-card-focus .word-card-word { font-size: 1.25rem; }
  .word-card-focus .wc-translation { font-size: 1.1rem; }
  .word-card-back .wc-label { font-size: .7rem; }
  .word-sentence-panel { font-size: .8rem; }
  .word-note-btn { width: 32px; height: 32px; font-size: 1rem; }
  .word-card-grade button { font-size: .74rem; padding: 7px 10px; }
  .words-thumb { width: 48px; height: 60px; font-size: .6rem; }
}

/* =========================== CODING LESSONS =========================== */
.lesson-chapter-card { position: relative; text-align: left; }
.lesson-chapter-card .topic-emoji { text-align: center; }
.lesson-chapter-card h4 { text-align: center; }
.lesson-chapter-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--grad-cool);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lesson-chapter-done {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1.1rem;
}

.lesson-back {
  display: inline-block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 16px;
}

/* ---- "Try it for real" external tool callout (learn.html) ---- */
.lesson-external-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--grad-tech);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 28px;
  box-shadow: var(--shadow-pop);
}
.lesson-external-box .leb-emoji { font-size: 2rem; flex-shrink: 0; }
.lesson-external-box .leb-body { flex: 1; }
.lesson-external-box h4 { margin: 0 0 4px; color: #fff; }
.lesson-external-box p { margin: 0; font-size: .85rem; color: rgba(255, 255, 255, .88); }
.lesson-external-box .btn-primary { background: #fff; color: var(--purple); flex-shrink: 0; }
.lesson-external-box .btn-primary:hover { background: rgba(255, 255, 255, .9); }
@media (max-width: 560px) {
  .lesson-external-box { flex-direction: column; text-align: center; }
}

/* ---- Chapter concept diagram: one small "how it fits together"
   visual per chapter, built from emoji chips (no image assets) ---- */
.lesson-concept {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 20px 18px;
  margin-bottom: 18px;
  text-align: center;
}
.lc-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.lc-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--sky);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 72px;
}
.lc-node-emoji { font-size: 1.6rem; }
.lc-node-label { font-size: .68rem; font-weight: 700; color: var(--ink-soft); }
.lc-arrow { font-size: 1.3rem; color: var(--ink-soft); flex-shrink: 0; }
.lc-result { background: var(--grad-tech); }
.lc-result .lc-node-label { color: rgba(255, 255, 255, .85); }
.lesson-concept-caption { font-size: .85rem; color: var(--ink-soft); margin: 0; }

.lesson-tutorial-card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
  margin-bottom: 14px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.lesson-tutorial-card .lt-emoji { font-size: 1.8rem; flex-shrink: 0; }
.lesson-tutorial-card h4 { margin: 0 0 4px; font-size: 1rem; }
.lesson-tutorial-card p { margin: 0; font-size: .9rem; color: var(--ink-soft); }

/* ---- One-card-per-page tutorial flow (learn.html) ---- */
.lesson-page { text-align: center; max-width: 640px; margin: 0 auto; }
.lesson-page-tile {
  width: 92px; height: 92px; border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; margin: 0 auto 20px; color: #fff;
  box-shadow: var(--shadow-pop);
}
.lesson-page-tile[data-shape="0"] { background: linear-gradient(135deg, #ff6f6f, #ff9448); }
.lesson-page-tile[data-shape="1"] { background: linear-gradient(135deg, #4ea1ff, #6c5ce7); }
.lesson-page-tile[data-shape="2"] { background: linear-gradient(135deg, #ffc93c, #ff9448); }
.lesson-page-tile[data-shape="3"] { background: linear-gradient(135deg, #35d08a, #00c2cb); }
.lesson-page-title { font-size: 1.4rem; margin: 0 0 14px; }
.lesson-page-text {
  font-family: var(--font-body);
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--ink);
  max-width: 56ch;
  margin: 0 auto 24px;
}
.lt-highlight {
  background: rgba(255, 201, 60, .45);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}
.lesson-nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 520px; margin: 26px auto 0; gap: 12px;
}
.lesson-nav-counter { font-weight: 700; color: var(--ink-soft); font-size: .85rem; }
@media (max-width: 480px) {
  .lesson-nav-counter { order: 3; width: 100%; text-align: center; }
}

.lesson-quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.lesson-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow-soft);
}
.lesson-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.lesson-tile .lt-shape { font-size: 1.3rem; flex-shrink: 0; }
.lesson-tile[data-shape="0"] { background: linear-gradient(135deg, #ff6f6f, #ff9448); }
.lesson-tile[data-shape="1"] { background: linear-gradient(135deg, #4ea1ff, #6c5ce7); }
.lesson-tile[data-shape="2"] { background: linear-gradient(135deg, #ffc93c, #ff9448); }
.lesson-tile[data-shape="3"] { background: linear-gradient(135deg, #35d08a, #00c2cb); }
.lesson-tile.correct { outline: 4px solid #14875a; }
.lesson-tile.wrong { outline: 4px solid #c23838; opacity: .6; }
.lesson-tile[disabled] { pointer-events: none; }

@media (max-width: 640px) {
  .lesson-quiz-options { grid-template-columns: 1fr; }
}
