/* ============================================================
   EnglishPath — global styles
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --ink: #0f172a;
  --body: #334155;
  --muted: #64748b;
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);

  /* theme-aware surfaces */
  --nav-bg: rgba(248, 250, 252, 0.85);
  --flash-front: linear-gradient(160deg, #ffffff 0%, #f4f7ff 100%);
  --flash-back: linear-gradient(160deg, #f4f7ff 0%, #e8edff 100%);

  /* CEFR level colours */
  --a1: #10b981;
  --a2: #14b8a6;
  --b1: #3b82f6;
  --b2: #8b5cf6;
  --c1: #f59e0b;
  --c2: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--body);
  background: var(--bg);
  line-height: 1.6;
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

.container { width: min(1120px, 92%); margin-inline: auto; }

.section { padding: 84px 0; }
.section-alt { background: var(--card); border-block: 1px solid var(--line); }

/* ---------- section heads ---------- */
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); margin-bottom: 10px; }
.section-head p { color: var(--muted); }
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ---------- nav ---------- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.logo-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; border-radius: 10px;
  font-size: 0.85rem;
}
.logo-accent { color: var(--primary); }
.logo-dark { color: #f1f5f9; }
.logo-dark .logo-accent { color: #a5b4fc; }

.nav-links { display: flex; align-items: center; gap: 26px; list-style: none; }
.nav-links a { color: var(--body); font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover, .nav-links .active { color: var(--primary); }
.nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 999px;
}
.nav-cta:hover { background: var(--primary-dark); }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; transition: 0.25s; }

/* dark / light theme toggle */
.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  margin-left: 10px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--body);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); transform: translateY(-1px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-2px); }
.btn-ghost { background: var(--card); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn-lg { padding: 15px 34px; font-size: 1.05rem; }
.btn-sm { padding: 7px 16px; font-size: 0.85rem; }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(124, 58, 237, 0.14), transparent 60%),
    radial-gradient(900px 420px at 10% 110%, rgba(79, 70, 229, 0.12), transparent 60%);
  padding: 76px 0 56px;
}
.hero-inner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; }

.hero-badge {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.hero h1 { font-size: clamp(2.4rem, 5.5vw, 3.6rem); font-weight: 900; margin-bottom: 18px; }
.grad-text {
  background: linear-gradient(90deg, var(--primary), #7c3aed, #db2777);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { max-width: 520px; font-size: 1.08rem; color: var(--muted); margin-bottom: 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* CEFR ladder */
.ladder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 18px;
  box-shadow: var(--shadow);
}
.ladder-step {
  display: flex; flex-direction: column; align-items: center;
  min-width: 66px;
}
.ladder-let {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}
.ladder-name { margin-top: 8px; font-size: 0.72rem; font-weight: 700; color: var(--ink); text-align: center; }
.ladder-arrow { color: var(--muted); font-size: 1.1rem; font-weight: 700; }

.step-a1 .ladder-let { background: var(--a1); }
.step-a2 .ladder-let { background: var(--a2); }
.step-b1 .ladder-let { background: var(--b1); }
.step-b2 .ladder-let { background: var(--b2); }
.step-c1 .ladder-let { background: var(--c1); }
.step-c2 .ladder-let { background: var(--c2); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 52px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat strong { display: block; font-size: 1.7rem; font-weight: 900; color: var(--primary); }
.stat span { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* ---------- level cards ---------- */
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 24px; }

.level-card {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  box-shadow: var(--shadow-sm);
  color: var(--body);
  transition: transform 0.2s, box-shadow 0.25s;
}
.level-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); color: var(--body); }

.level-a1 { border-top-color: var(--a1); } .level-a1 .level-badge { background: var(--a1); }
.level-a2 { border-top-color: var(--a2); } .level-a2 .level-badge { background: var(--a2); }
.level-b1 { border-top-color: var(--b1); } .level-b1 .level-badge { background: var(--b1); }
.level-b2 { border-top-color: var(--b2); } .level-b2 .level-badge { background: var(--b2); }
.level-c1 { border-top-color: var(--c1); } .level-c1 .level-badge { background: var(--c1); }
.level-c2 { border-top-color: var(--c2); } .level-c2 .level-badge { background: var(--c2); }

.level-badge {
  display: inline-block;
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.level-card h3 { font-size: 1.35rem; margin-bottom: 8px; }
.level-card p { font-size: 0.95rem; color: var(--muted); margin-bottom: 16px; }
.level-card ul { list-style: none; margin-bottom: 20px; font-size: 0.9rem; }
.level-card li { padding: 3px 0 3px 20px; position: relative; }
.level-card li::before { content: "•"; position: absolute; left: 4px; color: var(--primary); font-weight: 900; }
.card-link { font-weight: 800; font-size: 0.95rem; }

/* ---------- features ---------- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
.feature {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}
.feature-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  font-size: 1.4rem;
  background: var(--primary-soft);
  border-radius: 14px;
  margin-bottom: 16px;
}
.feature h3 { font-size: 1.12rem; margin-bottom: 8px; }
.feature p { font-size: 0.93rem; color: var(--muted); }

/* ---------- steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 24px; box-shadow: var(--shadow-sm); }
.step-num {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 900; font-size: 1.1rem;
  margin-bottom: 16px;
}
.step h3 { margin-bottom: 8px; font-size: 1.1rem; }
.step p { color: var(--muted); font-size: 0.93rem; }

/* ---------- games promo ---------- */
.games-promo { padding: 74px 0; background: var(--card); border-bottom: 1px solid var(--line); }
.games-promo-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 26px; flex-wrap: wrap;
}
.games-promo h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 10px 0 8px; }
.games-promo p { color: var(--muted); max-width: 520px; }

/* ---------- CTA ---------- */
.cta {
  padding: 84px 0;
  background: linear-gradient(120deg, var(--primary-dark), #6d28d9 60%, #9333ea);
  text-align: center;
}
.cta-inner h2 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: 12px; }
.cta-inner p { color: #dcd7ff; margin-bottom: 28px; max-width: 480px; margin-inline: auto; }
.cta .btn-primary { background: #fff; color: var(--primary-dark); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25); }
.cta .btn-primary:hover { background: #f3f4ff; transform: translateY(-2px); }

/* ---------- footer ---------- */
.footer { background: #0f172a; color: #94a3b8; padding: 48px 0 28px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-note { font-size: 0.9rem; margin-top: 10px; }
.footer-links { display: flex; list-style: none; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: #cbd5e1; font-weight: 700; }
.footer-links a:hover { color: #fff; }
.footer-copy { width: 100%; text-align: center; border-top: 1px solid #1e293b; padding-top: 20px; margin-top: 8px; font-size: 0.85rem; }

/* ============================================================
   LEVEL PAGES
   ============================================================ */
/* level hero */
.level-hero { padding: 64px 0 40px; }
.level-hero .left { max-width: 640px; }
.level-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.level-chip { color: #fff; font-weight: 900; padding: 6px 16px; border-radius: 999px; letter-spacing: 0.05em; }
.chip-a1 { background: var(--a1); } .chip-a2 { background: var(--a2); } .chip-b1 { background: var(--b1); }
.chip-b2 { background: var(--b2); } .chip-c1 { background: var(--c1); } .chip-c2 { background: var(--c2); }
.level-hero h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); margin-bottom: 12px; }
.level-hero .lead { color: var(--muted); font-size: 1.06rem; margin-bottom: 26px; max-width: 560px; }

.progress-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  max-width: 560px;
}
.progress-top { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.9rem; color: var(--ink); margin-bottom: 10px; }
.progress-track { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7c3aed); transition: width 0.4s ease; }

.objectives { margin-top: 34px; display: grid; gap: 10px; max-width: 560px; }
.objective { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 0.95rem; box-shadow: var(--shadow-sm); }
.objective::before { content: "✓"; color: var(--a1); font-weight: 900; }

/* prev / next nav */
.level-page-nav { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.level-page-nav a { font-weight: 700; }

/* grammar lessons */
.grammar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.lesson-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.lesson-card .lesson-idx {
  font-size: 0.75rem; font-weight: 800; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.lesson-card h3 { font-size: 1.2rem; margin: 6px 0 10px; }
.lesson-card .lesson-desc { font-size: 0.95rem; margin-bottom: 14px; }
.ex {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.ex em { color: var(--primary-dark); font-style: normal; font-weight: 700; }
.tip {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
}
.tip b { color: #a16207; }

.done-btn {
  position: absolute;
  top: 18px; right: 18px;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
}
.done-btn:hover { border-color: var(--a1); color: var(--a1); }
.done-btn.is-done { background: var(--a1); border-color: var(--a1); color: #fff; }

/* vocabulary */
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.vocab-item {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}
.vocab-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.vocab-word { font-weight: 800; color: var(--ink); }
.vocab-meaning { display: block; font-size: 0.88rem; color: var(--muted); margin-top: 2px; }
.vocab-hint { display: block; font-size: 0.78rem; color: var(--primary); margin-top: 4px; font-weight: 600; }

.flash-btn { margin-top: 28px; }

/* ---------- quiz ---------- */
.quiz-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.quiz-title-bar { padding: 22px 26px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.quiz-title-bar h3 { font-size: 1.15rem; }
.quiz-score { font-weight: 800; color: var(--primary); }

.q-card { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.q-card:last-of-type { border-bottom: 0; }
.q-text { font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.q-text .q-tag { color: var(--muted); font-weight: 700; margin-right: 8px; }

.opt { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 16px; font-size: 0.95rem; cursor: pointer; color: var(--body); margin-bottom: 8px; transition: 0.15s; }
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt .opt-letter { font-weight: 900; color: var(--primary); min-width: 18px; }
.opt.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt.correct { border-color: var(--a1); background: #ecfdf5; }
.opt.wrong { border-color: var(--c2); background: #fef2f2; }
.opt:disabled { cursor: default; opacity: 1; }

.opt-fill { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.opt-fill input {
  flex: 1; min-width: 220px;
  padding: 11px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--body);
}
.opt-fill input::placeholder { color: var(--muted); opacity: 0.7; }
.opt-fill input:focus { outline: none; border-color: var(--primary); }
.opt-fill input.ok { border-color: var(--a1); background: #ecfdf5; }
.opt-fill input.bad { border-color: var(--c2); background: #fef2f2; }

.feedback { display: none; margin-top: 12px; font-size: 0.9rem; border-radius: 10px; padding: 10px 14px; }
.feedback.show { display: block; }
.feedback.good { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.feedback.fail { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.feedback b { display: block; margin-bottom: 2px; }

.quiz-actions { padding: 20px 26px; border-top: 1px solid var(--line); display: flex; gap: 12px; flex-wrap: wrap; }

.result-panel { padding: 34px 26px; text-align: center; }
.result-panel .result-big { font-size: 3rem; font-weight: 900; }
.result-panel .result-msg { color: var(--muted); margin: 8px 0 20px; }
.result-bar { max-width: 420px; margin: 0 auto 24px; }

/* ---------- flashcard modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  perspective: 1400px;
}
.modal-overlay.open { display: flex; animation: overlayFade 0.3s ease; }
@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card); width: min(520px, 100%);
  border-radius: var(--radius);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(28px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.05rem; }
.modal-close { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--c2); }

/* 3D flip card */
.flash-stage { padding: 22px 26px 6px; perspective: 1300px; }

.flash-card {
  position: relative;
  height: 270px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out;
  will-change: transform;
}
/* soft shine that follows the cursor */
.flash-card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 20px;
  background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 20%),
    rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 65%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}
.flash-card:hover::before { opacity: 0.8; }

.flash-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.flash-inner.is-flipped { transform: rotateY(180deg); }

.flash-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 24px 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--flash-front);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.14);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flash-back {
  transform: rotateY(180deg);
  background: var(--flash-back);
}

/* entrance animation for each new card (plays on the face content) */
.flash-face.card-in > * { animation: flashPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.flash-face.card-in > *:nth-child(2) { animation-delay: 0.07s; }
.flash-face.card-in > *:nth-child(3) { animation-delay: 0.14s; }
@keyframes flashPop {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}

.flash-word {
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.flash-meaning { font-size: 1.08rem; color: var(--ink); margin-bottom: 10px; font-weight: 700; }
.flash-example { font-style: italic; color: var(--muted); font-size: 0.95rem; max-width: 90%; }
.flash-hint { margin-top: 14px; font-size: 0.8rem; color: var(--primary); font-weight: 700; }

.flash-progress { margin: 16px 4px 0; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.flash-progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7c3aed); transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

.flash-actions { display: flex; gap: 10px; padding: 16px 22px 20px; }
.flash-actions .btn { flex: 1; text-align: center; }
.flash-count { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 12px; }

@media (max-width: 480px) {
  .flash-card { height: 240px; }
}

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ============================================================
   GAMES PAGE
   ============================================================ */
.games-hero { padding: 64px 0 10px; }

.picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); }
.picker-label { font-weight: 800; font-size: 0.85rem; color: var(--ink); text-transform: uppercase; letter-spacing: 0.08em; }
.level-pills, .game-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.pill, .game-tab {
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--body);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.pill:hover, .game-tab:hover { border-color: var(--primary); color: var(--primary); }
.pill.is-active, .game-tab.is-active { color: #fff; border-color: transparent; background: var(--primary); }
.pill-a1.is-active { background: var(--a1); }
.pill-a2.is-active { background: var(--a2); }
.pill-b1.is-active { background: var(--b1); }
.pill-b2.is-active { background: var(--b2); }
.pill-c1.is-active { background: var(--c1); }
.pill-c2.is-active { background: var(--c2); }

.game-hint { color: var(--muted); margin: 6px 0 22px; font-size: 0.95rem; }
.best-line { text-align: center; margin-top: 22px; font-weight: 700; color: var(--primary); font-size: 0.95rem; }

/* shell */
.game-shell { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.game-head { padding: 20px 26px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.game-head h3 { font-size: 1.2rem; }
.game-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill { background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; }
.game-blurb { color: var(--muted); font-size: 0.92rem; padding: 14px 26px 0; }
.game-body { padding: 26px; }
.game-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ------- word match ------- */
.mm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mc {
  position: relative;
  min-height: 108px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  padding: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
  color: var(--ink);
}
.mc:hover:not(.matched) { border-color: var(--primary); transform: translateY(-2px); }
.mc .mc-q { font-size: 1.6rem; font-weight: 900; color: var(--primary); }
.mc .mc-t { display: none; font-weight: 700; line-height: 1.35; }
.mc.flip { border-color: var(--primary); background: var(--primary-soft); box-shadow: var(--shadow-sm); }
.mc.flip .mc-q { display: none; }
.mc.flip .mc-t { display: block; }
.mc.matched { border-color: var(--a1); background: #ecfdf5; cursor: default; }
.mc.matched .mc-q { display: none; }
.mc.matched .mc-t { display: block; }

/* ------- word scramble ------- */
.sc-panel { max-width: 560px; margin: 0 auto; }
.sc-word {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--ink);
  text-align: center;
  margin-bottom: 6px;
}
.sc-scrambled { text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--primary); letter-spacing: 0.1em; margin-bottom: 4px; }
.sc-mean { text-align: center; color: var(--muted); margin-bottom: 18px; font-size: 0.95rem; }
.sc-panel .opt-fill { justify-content: center; }
.sc-panel input { text-align: center; font-weight: 800; letter-spacing: 0.05em; }
.sc-panel .game-actions { justify-content: center; }
.sc-panel .feedback { margin-top: 16px; }

/* ------- hangman ------- */
.hg-layout { display: grid; grid-template-columns: 260px 1fr; gap: 26px; align-items: start; }
.hg-svg { width: 100%; max-width: 240px; }
.hg-gallows { stroke: #334155; stroke-width: 4; stroke-linecap: round; }
.hg-draw { stroke: var(--c2); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 300; stroke-dashoffset: 0; }
.hg-right { min-width: 0; }
.hg-word {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--ink);
  margin-bottom: 6px;
}
.hg-word.hg-won { color: var(--a1); }
.hg-word.hg-lost { color: var(--c2); }
.hg-loss-msg { margin-top: 8px; font-size: 0.95rem; color: var(--c2); font-weight: 800; }
.hg-mean { color: var(--muted); margin-bottom: 18px; font-size: 0.95rem; }
.hg-letters { display: flex; flex-wrap: wrap; gap: 7px; }
.hg-letter {
  width: 38px; height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: 0.15s;
}
.hg-letter:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.hg-letter:disabled { cursor: default; }
.hg-letter.in { background: #ecfdf5; border-color: var(--a1); color: var(--a1); }
.hg-letter.out { background: #fef2f2; border-color: var(--c2); color: var(--c2); }

/* ------- game over ------- */
.game-over { text-align: center; padding: 30px 10px; }
.game-over-emoji { font-size: 3.2rem; }
.game-over h3 { margin: 8px 0; font-size: 1.4rem; }
.game-over p { color: var(--muted); margin-bottom: 18px; }

/* responsive tweaks */
@media (max-width: 640px) {
  .mm-grid { grid-template-columns: repeat(2, 1fr); }
  .mc { min-height: 92px; }
  .hg-layout { grid-template-columns: 1fr; }
  .hg-svgcol { display: flex; justify-content: center; }
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 4px;
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 14px 6%; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 10px 8px; border-radius: 8px; }
  .nav-cta { text-align: center; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 60px 0; }
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  color-scheme: dark;

  --primary: #818cf8;
  --primary-dark: #a5b4fc;
  --primary-soft: #1c2547;

  --ink: #f1f5f9;
  --body: #cbd5e1;
  --muted: #94a3b8;

  --bg: #0a1120;
  --card: #121c33;
  --line: #223049;

  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);

  --nav-bg: rgba(10, 17, 32, 0.82);
  --flash-front: linear-gradient(160deg, #16203a 0%, #1c2750 100%);
  --flash-back: linear-gradient(160deg, #1c2750 0%, #232f62 100%);
}

/* tinted feedback / match states */
[data-theme="dark"] .tip { background: #241d0a; border-color: #6b5411; }
[data-theme="dark"] .tip b { color: #fbbf24; }

[data-theme="dark"] .opt.correct,
[data-theme="dark"] .opt-fill input.ok,
[data-theme="dark"] .mc.matched,
[data-theme="dark"] .hg-letter.in { background: #0d2f23; }

[data-theme="dark"] .opt.wrong,
[data-theme="dark"] .opt-fill input.bad,
[data-theme="dark"] .hg-letter.out { background: #391420; }

[data-theme="dark"] .feedback.good { background: #0d2f23; color: #6ee7b7; border-color: #0f5132; }
[data-theme="dark"] .feedback.fail { background: #391420; color: #fda4af; border-color: #7f1d1d; }

[data-theme="dark"] .hg-gallows { stroke: #94a3b8; }

/* ============================================================
   GALAXY BACKGROUND (dark mode)
   ============================================================ */
.galaxy-bg {
  position: fixed; inset: 0;
  z-index: -1;
  overflow: hidden;
  display: none;
  pointer-events: none;
}
[data-theme="dark"] .galaxy-bg { display: block; }
.galaxy-bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }

/* drifting nebula glows */
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.nebula-a {
  width: 62vmax; height: 62vmax; left: -14vmax; top: -16vmax;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.32), rgba(124, 58, 237, 0.16) 45%, transparent 70%);
  animation: neb-drift-a 32s ease-in-out infinite alternate;
}
.nebula-b {
  width: 54vmax; height: 54vmax; right: -16vmax; bottom: -14vmax;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.26), rgba(88, 28, 135, 0.14) 45%, transparent 70%);
  animation: neb-drift-b 40s ease-in-out infinite alternate;
}
.nebula-c {
  width: 36vmax; height: 36vmax; left: 28%; top: 42%;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.16), transparent 70%);
  animation: neb-drift-c 27s ease-in-out infinite alternate;
}

@keyframes neb-drift-a {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(6vmax, 4vmax, 0) rotate(16deg); }
}
@keyframes neb-drift-b {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(-5vmax, -3vmax, 0) rotate(-14deg); }
}
@keyframes neb-drift-c {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3vmax, -2vmax, 0) scale(1.18); }
}

/* let the galaxy glow through the big full-width bands */
[data-theme="dark"] .hero {
  background:
    radial-gradient(1100px 460px at 82% -12%, rgba(124, 58, 237, 0.3), transparent 60%),
    radial-gradient(850px 400px at 8% 112%, rgba(79, 70, 229, 0.22), transparent 60%);
}
[data-theme="dark"] .section-alt { background: rgba(18, 28, 51, 0.45); }
[data-theme="dark"] .games-promo { background: rgba(18, 28, 51, 0.45); }

@media (prefers-reduced-motion: reduce) {
  .nebula { animation: none; }
}

/* ============================================================
   SKY BACKGROUND (light mode)
   ============================================================ */
.sky-bg {
  position: fixed; inset: 0;
  z-index: -1;
  overflow: hidden;
  display: block;
  pointer-events: none;
  background: linear-gradient(180deg, #b7d8ff 0%, #dcecff 48%, #f5fbff 100%);
}
[data-theme="dark"] .sky-bg { display: none; }

/* glowing sun */
.sun {
  position: absolute;
  top: 10%; right: 7%;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, #fff8d6 0%, #ffe58a 45%, #ffd166 72%, rgba(255, 209, 102, 0) 74%);
  box-shadow:
    0 0 60px 18px rgba(255, 209, 102, 0.5),
    0 0 150px 70px rgba(255, 200, 90, 0.28);
  animation: sun-breathe 7s ease-in-out infinite;
}
.sun::before {
  content: '';
  position: absolute; inset: -80px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 210, 100, 0) 0deg 14deg, rgba(255, 210, 100, 0.35) 14deg 18deg);
  -webkit-mask: radial-gradient(circle, transparent 44%, #000 46%, #000 60%, transparent 64%);
  mask: radial-gradient(circle, transparent 44%, #000 46%, #000 60%, transparent 64%);
  animation: sun-rays 60s linear infinite;
}
@keyframes sun-breathe {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50%      { transform: scale(1.06); opacity: 1; }
}
@keyframes sun-rays { to { transform: rotate(360deg); } }

/* clouds */
.cloud {
  position: absolute;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 14px 28px rgba(71, 101, 160, 0.16);
  will-change: transform;
  animation: cloud-drift linear infinite;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
}
@keyframes cloud-drift {
  0%   { transform: translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateX(175vw); opacity: 0; }
}

.cloud-1 { width: 150px; height: 46px; left: 12%; top: 11%; opacity: 0.9;  animation-duration: 58s; animation-delay: -12s; }
.cloud-1::before { width: 60px; height: 60px; top: -28px; left: 26px; }
.cloud-1::after  { width: 84px; height: 84px; top: -42px; left: 68px; }

.cloud-2 { width: 108px; height: 34px; left: 42%; top: 24%; opacity: 0.75; animation-duration: 82s; animation-delay: -45s; }
.cloud-2::before { width: 44px; height: 44px; top: -20px; left: 16px; }
.cloud-2::after  { width: 60px; height: 60px; top: -30px; left: 50px; }

.cloud-3 { width: 190px; height: 56px; left: 6%;  top: 42%; opacity: 0.85; animation-duration: 66s; animation-delay: -28s; }
.cloud-3::before { width: 76px; height: 76px; top: -34px; left: 32px; }
.cloud-3::after  { width: 102px; height: 102px; top: -52px; left: 88px; }

.cloud-4 { width: 130px; height: 42px; left: 58%; top: 60%; opacity: 0.6;  animation-duration: 96s; animation-delay: -64s; }
.cloud-4::before { width: 54px; height: 54px; top: -24px; left: 22px; }
.cloud-4::after  { width: 70px; height: 70px; top: -36px; left: 60px; }

.cloud-5 { width: 100px; height: 32px; left: 30%; top: 76%; opacity: 0.7;  animation-duration: 74s; animation-delay: -8s; }
.cloud-5::before { width: 40px; height: 40px; top: -18px; left: 14px; }
.cloud-5::after  { width: 54px; height: 54px; top: -28px; left: 46px; }

/* let the sky glow through the big full-width bands */
[data-theme="light"] .section-alt,
[data-theme="light"] .games-promo { background: rgba(255, 255, 255, 0.55); }

@media (prefers-reduced-motion: reduce) {
  .sun, .sun::before { animation: none; }
  .cloud { animation: none; }
}

/* ============================================================
   STREAK (daily learning streak)
   ============================================================ */
.streak-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 10px;
  background: linear-gradient(135deg, #ff9a3d, #f43f5e);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
  padding: 8px 13px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}
.streak-badge[hidden] { display: none; }

.streak-section { padding-top: 0; }
.streak-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: var(--shadow-sm);
}
.streak-big { display: flex; align-items: center; gap: 18px; }
.streak-flame { font-size: 3rem; line-height: 1; }
.streak-num { font-size: 1.15rem; color: var(--ink); font-weight: 700; }
.streak-num b { font-size: 2.4rem; color: var(--c2); font-weight: 900; }
.streak-msg { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.streak-side { text-align: right; }
.streak-grid { display: flex; gap: 8px; justify-content: flex-end; }
.streak-day {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8rem;
}
.streak-day.is-on {
  background: linear-gradient(135deg, #ff9a3d, #f43f5e);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}
.streak-tip { font-size: 0.82rem; color: var(--muted); max-width: 320px; margin-top: 10px; }

[data-theme="dark"] .streak-panel {
  background: linear-gradient(135deg, #231a0e 0%, #2a1420 100%);
  border-color: #5c4414;
}

@media (max-width: 640px) {
  .streak-side { text-align: left; }
  .streak-grid { justify-content: flex-start; }
}
