/* =====================================================
   LexFizz — Global Design System
   File: css/global.css
   ===================================================== */

/* --------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------- */
:root {
  /* Colors — Neon Arcade brand palette */
  --color-primary:        #7c3aed;  /* Violet */
  --color-primary-dark:   #6d28d9;
  --color-primary-light:  #c4b5fd;
  --color-secondary:      #ec4899;  /* Magenta */
  --color-accent:         #22d3ee;  /* Cyan */
  --color-powerup:        #fbbf24;  /* Ownable gold: XP/streak/score/achievement/featured */
  --color-success:        #22c55e;
  --color-error:          #ef4444;
  --color-warning:        #f59e0b;

  /* Arcade ink (deep backgrounds for dark theme / hero) */
  --arcade-ink:           #15122e;
  --arcade-ink-2:         #0d0b1f;

  --color-bg:             #f8fafc;
  --color-surface:        #ffffff;
  --color-surface-raised: #ffffff;
  --color-border:         #e2e8f0;
  --color-border-focus:   #7c3aed;

  --color-text:           #1e293b;
  --color-text-muted:     #64748b;
  --color-text-subtle:    #94a3b8;
  --color-text-inverse:   #ffffff;

  /* Category colors — raised saturation, names kept */
  --cat-drag:     #0ea5e9;   /* sky */
  --cat-memory:   #ec4899;   /* magenta */
  --cat-arcade:   #ff2d6e;   /* hot pink-red */
  --cat-word:     #a855f7;   /* purple */
  --cat-quiz:     #7c3aed;   /* violet */
  --cat-reading:  #10b981;   /* emerald */
  --cat-listen:   #22d3ee;   /* cyan */

  /* Neon-glow tokens */
  --glow-violet:  0 0 14px rgba(124,58,237,.55), 0 0 30px rgba(124,58,237,.28);
  --glow-magenta: 0 0 14px rgba(236,72,153,.55), 0 0 30px rgba(236,72,153,.28);
  --glow-cyan:    0 0 14px rgba(34,211,238,.55), 0 0 30px rgba(34,211,238,.28);
  --glow-gold:    0 0 14px rgba(251,191,36,.55), 0 0 30px rgba(251,191,36,.28);

  /* Typography */
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Poppins', 'Inter', sans-serif;  /* TODO: swap to Space Grotesk when woff2 added */
  --font-accent:  'Poppins', 'Inter', sans-serif;

  /* Spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border radius */
  --radius-sm:   0.375rem;
  --radius-md:   0.75rem;
  --radius-lg:   1.25rem;
  --radius-xl:   1.75rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl:  0 20px 50px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.08);
  --shadow-color: 0 8px 24px rgba(99,102,241,.25);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Typography scale */
  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-md:   1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.25rem;
  --font-size-2xl:  1.5rem;
  --font-size-3xl:  clamp(1.5rem, 3vw, 1.875rem);
  --font-size-4xl:  clamp(1.75rem, 4vw, 2.25rem);
  --font-size-5xl:  clamp(2rem, 5vw, 3rem);
  --font-size-hero: clamp(2.2rem, 5vw, 3.5rem);

  /* Line heights */
  --lh-tight:  1.2;
  --lh-snug:   1.4;
  --lh-base:   1.6;
  --lh-relaxed:1.75;

  /* Letter spacing */
  --ls-tight:  -0.02em;
  --ls-normal:  0;
  --ls-wide:    0.04em;
  --ls-wider:   0.08em;

  /* Z-index system */
  --z-below:    -1;
  --z-base:      0;
  --z-raised:   10;
  --z-dropdown: 50;
  --z-sticky:  100;
  --z-modal:   200;
  --z-toast:   300;
  --z-tooltip: 400;

  /* Neutral palette */
  --color-neutral-50:  #f8fafc;
  --color-neutral-100: #f1f5f9;
  --color-neutral-200: #e2e8f0;
  --color-neutral-300: #cbd5e1;
  --color-neutral-400: #94a3b8;
  --color-neutral-500: #64748b;
  --color-neutral-600: #475569;
  --color-neutral-700: #334155;
  --color-neutral-800: #1e293b;
  --color-neutral-900: #0f172a;

  /* Semantic state colors */
  --color-success-light: #dcfce7;
  --color-success-dark:  #166534;
  --color-warning-light: #fef9c3;
  --color-warning-dark:  #854d0e;
  --color-danger:        #ef4444;
  --color-danger-light:  #fee2e2;
  --color-danger-dark:   #991b1b;
  --color-info:          #22d3ee;
  --color-info-light:    #ecfeff;
  --color-info-dark:     #164e63;

  /* Layout */
  --container-max:  1280px;
  --container-wide: 1440px;
  --nav-height:     68px;

  /* ====================================================
     1b. UNIFICATION TOKENS (additive — Ф1/Ф2 architecture)
     Single source of truth replacing legacy hardcoded
     indigo neutrals + per-page --hero-a/b/c in inline HTML.
     See TODO/design/TODO_architecture.md §2/§3, BRAND_IDENTITY §2.
     ==================================================== */

  /* (a) Semantic INDIGO-tinted neutral ramp.
     Covers the legacy indigo neutrals hardcoded across HTML
     (#eef2ff #e0e7ff #c7d2fe #a5b4fc #4338ca #1e40af #3730a3
      #312e81 #1e1b4b #e2e8f0 #1e293b). WCAG AA preserved:
     900/800/700 on white ≥ 8:1; 50/100/200 as surfaces with
     --neutral-700+ text. Distinct from slate --color-neutral-*. */
  --neutral-50:  #eef2ff;  /* legacy #eef2ff — lightest indigo surface */
  --neutral-100: #e0e7ff;  /* legacy #e0e7ff / #e2e8f0 */
  --neutral-200: #c7d2fe;  /* legacy #c7d2fe — borders/dividers */
  --neutral-300: #a5b4fc;  /* legacy #a5b4fc */
  --neutral-400: #818cf8;
  --neutral-500: #6366f1;
  --neutral-600: #4338ca;  /* legacy #4338ca / #1e40af */
  --neutral-700: #3730a3;  /* legacy #3730a3 */
  --neutral-800: #312e81;  /* legacy #312e81 */
  --neutral-900: #1e1b4b;  /* legacy #1e1b4b / #1e293b — deepest ink/text */

  /* Semantic aliases (reuse ramp; fill gaps only) */
  --surface-2:  var(--neutral-50);          /* tinted alt surface */
  --text-muted: var(--color-text-muted);    /* reuse existing #64748b (AA) */
  --border:     var(--color-border);        /* reuse existing #e2e8f0 */

  /* (b) Category GRADIENT tokens — replace per-page --hero-a/b/c.
     Each built from existing --cat-*/brand tokens (no raw hex).
     landing hero → background: var(--grad-<category>). */
  --grad-grammar: linear-gradient(160deg, var(--color-primary), var(--color-secondary));
  --grad-vocab:   linear-gradient(160deg, var(--cat-word), var(--color-primary));
  --grad-quiz:    linear-gradient(160deg, var(--cat-quiz), var(--color-secondary));
  --grad-reading: linear-gradient(160deg, var(--cat-reading), var(--color-accent));
  --grad-listen:  linear-gradient(160deg, var(--cat-listen), var(--color-primary));
  --grad-arcade:  linear-gradient(160deg, var(--cat-arcade), var(--color-secondary));
  --grad-word:    linear-gradient(160deg, var(--cat-word), var(--color-accent));
  --grad-memory:  linear-gradient(160deg, var(--cat-memory), var(--color-primary));
  --grad-drag:    linear-gradient(160deg, var(--cat-drag), var(--color-accent));
}

/* --------------------------------------------------
   2. Reset & Base
   -------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

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

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

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------
   3. Typography Utilities
   -------------------------------------------------- */
.text-xs    { font-size: 0.75rem; }
.text-sm    { font-size: 0.875rem; }
.text-base  { font-size: 1rem; }
.text-lg    { font-size: 1.125rem; }
.text-xl    { font-size: 1.25rem; }
.text-2xl   { font-size: 1.5rem; }
.text-3xl   { font-size: 1.875rem; }
.text-4xl   { font-size: 2.25rem; }
.text-5xl   { font-size: 3rem; }

.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-display { font-family: var(--font-display); }

.text-muted   { color: var(--color-text-muted); }
.text-subtle  { color: var(--color-text-subtle); }
.text-center  { text-align: center; }
.text-primary { color: var(--color-primary); }

/* --------------------------------------------------
   4. Layout Utilities
   -------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
}

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.wrap   { flex-wrap: wrap; }

/* --------------------------------------------------
   5b. New Navbar Component (.navbar)
   -------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-height, 64px);
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-max, 1200px);
  margin-inline: auto;
  padding-inline: var(--space-6, 1.5rem);
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  text-decoration: none;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.navbar-logo:hover { opacity: 0.85; text-decoration: none; }
.navbar-logo-text { font-family: var(--font-display); font-weight: 700; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-1, 0.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-link {
  display: block;
  padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
  border-radius: var(--radius-full, 9999px);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.navbar-link:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.navbar-link-active {
  background: #eef2ff;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  font-weight: 700;
  box-shadow: 0 2px 0 var(--color-primary);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
}

/* Hamburger button */
.navbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-md, 8px);
  transition: background 0.15s;
}
.navbar-hamburger:hover { background: var(--color-surface); }
.navbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.navbar-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-hamburger.open span:nth-child(2) { opacity: 0; }
.navbar-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Drawer */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--color-surface, #fff);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  padding: var(--space-5, 1.25rem) var(--space-6, 1.5rem);
  overflow-y: auto;
  max-width: 320px;
  left: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,.12);
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6, 1.5rem);
}

.nav-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--color-bg);
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.nav-drawer-close:hover { background: var(--color-border); color: var(--color-text); }

.nav-drawer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1, 0.25rem);
}

.nav-drawer-link {
  display: block;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border-radius: var(--radius-md, 8px);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s;
}
.nav-drawer-link:hover { background: var(--color-bg); text-decoration: none; }

/* Overlay */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 299;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.nav-overlay.open { display: block; }

/* Dark mode navbar */
[data-theme="dark"] .navbar {
  background: rgba(15,23,42,.92);
}
[data-theme="dark"] .nav-drawer {
  background: var(--color-surface);
}
[data-theme="dark"] .navbar-link:hover { background: var(--color-surface-raised, #1e293b); }
[data-theme="dark"] .navbar-link-active {
  background: #1e1b4b;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  font-weight: 700;
  box-shadow: 0 2px 0 var(--color-primary);
}

/* Responsive: show hamburger, hide links */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .navbar-hamburger { display: flex; }
}

/* --------------------------------------------------
   6. Buttons
   -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none !important;
  user-select: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-color);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(124,58,237,.4), var(--glow-violet);
}

.btn-primary:focus-visible {
  box-shadow: var(--glow-violet);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--color-primary-light);
  background: #f5f3ff;
  color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-success {
  background: var(--color-success);
  color: white;
  box-shadow: 0 4px 12px rgba(34,197,94,.25);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1.05rem;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.85rem;
}

/* --------------------------------------------------
   7. Badge / Category Pill
   -------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.badge-drag    { background: #fff7ed; color: var(--cat-drag); }
.badge-memory  { background: #fdf2f8; color: var(--cat-memory); }
.badge-arcade  { background: #fef2f2; color: var(--cat-arcade); }
.badge-word    { background: #f5f3ff; color: var(--cat-word); }
.badge-quiz    { background: #eef2ff; color: var(--cat-quiz); }
.badge-reading { background: #f0fdf4; color: var(--cat-reading); }
.badge-listen  { background: #ecfeff; color: var(--cat-listen); }

/* --------------------------------------------------
   8. Card
   -------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------
   9. Exercise Card (Portal Grid)
   -------------------------------------------------- */
.exercise-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  display: flex;
  flex-direction: column;
  text-decoration: none !important;
  color: var(--color-text);
}

.exercise-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary-light);
  text-decoration: none;
}

.exercise-card-icon {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  position: relative;
  overflow: hidden;
  transition: background var(--transition-base);
}

.exercise-card-icon svg,
.exercise-card-icon img {
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
  will-change: transform;
}

.exercise-card:hover .exercise-card-icon {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.exercise-card:hover .exercise-card-icon svg,
.exercise-card:hover .exercise-card-icon img {
  transform: scale(1.12) rotate(-3deg);
}

.exercise-card-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(99,102,241,.07));
  transition: opacity var(--transition-base);
}

.exercise-card:hover .exercise-card-icon::after {
  opacity: 0.4;
}

.exercise-card-body {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.exercise-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  line-height: 1.3;
}

.exercise-card-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
}

.exercise-card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exercise-card-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
}

.exercise-card-arrow {
  font-size: 1rem;
  color: var(--color-primary);
  transition: transform var(--transition-fast);
}

.exercise-card:hover .exercise-card-arrow {
  transform: translateX(4px);
}

/* Coming soon state */
.exercise-card.coming-soon {
  opacity: 0.65;
  pointer-events: none;
}

.exercise-card.coming-soon .exercise-card-icon {
  background: #f1f5f9;
}

/* --------------------------------------------------
   10. Progress Bar
   -------------------------------------------------- */
.progress-bar-wrap {
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* --------------------------------------------------
   11. Modal / Result Overlay
   -------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.60);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  transform: scale(0.92) translateY(20px);
  transition: transform var(--transition-base);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

.modal-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  display: block;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.modal-score {
  font-size: 3.5rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--color-primary);
  margin: var(--space-4) 0;
  line-height: 1;
}

.modal-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

/* --------------------------------------------------
   12. Score Display
   -------------------------------------------------- */
.score-display {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: #eef2ff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-primary);
}

/* --------------------------------------------------
   13. Timer
   -------------------------------------------------- */
.timer-display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: center;
}

.timer-display.danger {
  color: var(--color-error);
  animation: pulse-timer 0.8s ease infinite;
}

@keyframes pulse-timer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --------------------------------------------------
   14. Toast Notification
   -------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--color-text);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--transition-base) forwards;
  white-space: nowrap;
}

.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-error); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------
   15. Exercise Page Layout
   -------------------------------------------------- */
.exercise-layout {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.exercise-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) 0;
}

.exercise-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.back-link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.exercise-title-area {
  flex: 1;
}

.exercise-title-area h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.exercise-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.exercise-main {
  flex: 1;
  padding: var(--space-8) 0;
}

.exercise-footer-bar {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------
   16. Feedback States
   -------------------------------------------------- */
.feedback-correct {
  background-color: #dcfce7 !important;
  border-color: var(--color-success) !important;
  color: #166534 !important;
}

.feedback-incorrect {
  background-color: #fee2e2 !important;
  border-color: var(--color-error) !important;
  color: #991b1b !important;
}

.feedback-correct  { animation: pop-in 0.3s ease; }
.feedback-incorrect { animation: shake 0.4s ease; }

@keyframes pop-in {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* --------------------------------------------------
   17. Site Footer
   -------------------------------------------------- */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: var(--space-16) 0 var(--space-8);
  margin-top: var(--space-20);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand p {
  font-size: 0.9rem;
  line-height: 1.7;
  margin-top: var(--space-3);
  max-width: 300px;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.footer-col h4 {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.footer-col a {
  display: block;
  color: #94a3b8;
  font-size: 0.875rem;
  margin-bottom: var(--space-2);
  transition: color var(--transition-fast);
  text-decoration: none;
}

.footer-col a:hover {
  color: white;
}

/* .footer-nav — alternate footer nav column using ul/li */
.footer-nav h4 {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav ul li { margin-bottom: var(--space-2); }

.footer-nav ul a {
  color: #94a3b8;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-nav ul a:hover { color: white; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-6);
  border-top: 1px solid #1e293b;
  font-size: 0.825rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* --------------------------------------------------
   17b. Exercise Page Components
        (.hero-title, .hero-subtitle, .hero-badges,
         .badge-level/type/free, .game-section, .game-card,
         .content-section, .content-grid, .content-main,
         .content-sidebar, .sidebar-card, .sidebar-links)
   -------------------------------------------------- */

/* Hero title / subtitle (used on exercise hero sections) */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 580px;
  margin-inline: auto;
  line-height: 1.7;
}

/* Breadcrumb for exercise/blog pages (nav > ol > li) */
.breadcrumb ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.breadcrumb ol li:not(:last-child)::after {
  content: '/';
  margin-left: var(--space-1);
  color: var(--color-text-subtle, #cbd5e1);
}
.breadcrumb ol a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumb ol a:hover { color: var(--color-primary); }

/* Exercise hero badge pills */
.hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.badge-level {
  background: #eef2ff;
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.badge-type {
  background: #f0fdf4;
  color: #16a34a;
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-free {
  background: #fff7ed;
  color: #d97706;
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Exercise hero icon (64px, injected by common.js into .exercise-hero) */
.exercise-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  margin: 0 auto var(--space-4, 1rem);
  animation: heroIconIn 0.45s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes heroIconIn {
  from { opacity: 0; transform: scale(0.6) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Game section wrapper */
.game-section {
  background: var(--color-bg);
  padding: var(--space-10) 0;
}

[data-theme="dark"] .game-section { background: #0a0a18; }

.game-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .game-card { background: #131325; border-color: #2d2d4a; }

/* Content section (SEO article + sidebar) */
.content-section {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) 0 var(--space-16);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-10);
  align-items: start;
}

@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
}

.content-main h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--color-text);
}
.content-main h2:first-child { margin-top: 0; }
.content-main h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; margin-top: var(--space-6); margin-bottom: var(--space-2); }
.content-main p { color: var(--color-text-muted); line-height: 1.8; margin-bottom: var(--space-4); }
.content-main ul, .content-main ol { padding-left: 1.5rem; margin-bottom: var(--space-4); }
.content-main li { color: var(--color-text-muted); line-height: 1.8; margin-bottom: var(--space-2); }
.content-main a { color: var(--color-primary); text-decoration: none; }
.content-main a:hover { text-decoration: underline; }
.content-main strong { color: var(--color-text); }

/* Sidebar */
.content-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.sidebar-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
[data-theme="dark"] .sidebar-card { background: #1a1a2e; border-color: #2d2d4a; }

.sidebar-card h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--space-3);
  color: var(--color-primary);
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-links li { list-style: none; }

.sidebar-links a {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}
.sidebar-links a:hover { background: var(--color-primary); color: #fff; text-decoration: none; }

/* Non-link sidebar items */
.sidebar-links li:not(:has(a)) {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
}

/* --------------------------------------------------
   18. Hero Section
   -------------------------------------------------- */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  text-align: center;
  background: linear-gradient(160deg, #f0f4ff 0%, #faf5ff 50%, #f0fdfe 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(99,102,241,.10) 0%, transparent 65%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: #eef2ff;
  color: var(--color-primary);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-6);
  letter-spacing: .01em;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-text);
  max-width: 800px;
  margin-inline: auto;
  margin-bottom: var(--space-5);
  letter-spacing: -.02em;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 560px;
  margin-inline: auto;
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-10);
}

.hero-stats {
  display: flex;
  gap: var(--space-8);
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
}

.hero-stat span {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------
   19. Section
   -------------------------------------------------- */
.section {
  padding: var(--space-16) 0;
}

.section-header {
  margin-bottom: var(--space-10);
}

.section-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: var(--space-3);
}

.section-sub {
  font-size: 1rem;
  color: var(--color-text-muted);
  max-width: 600px;
  line-height: 1.7;
}

/* --------------------------------------------------
   20. Exercise Grid
   -------------------------------------------------- */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-5);
}

@media (max-width: 480px) {
  .exercise-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}

/* --------------------------------------------------
   21. Category Filter Bar
   -------------------------------------------------- */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--color-primary);
  background: #eef2ff;
  color: var(--color-primary);
}

.filter-btn.active {
  font-weight: 600;
  box-shadow: var(--glow-violet);
}

/* --------------------------------------------------
   22. Search Box
   -------------------------------------------------- */
.search-wrap {
  position: relative;
  max-width: 440px;
  margin-bottom: var(--space-6);
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-5) var(--space-3) var(--space-10);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: 0.95rem;
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  pointer-events: none;
  font-size: 1rem;
}

/* --------------------------------------------------
   23. Feature / Benefits Section
   -------------------------------------------------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-6);
}

.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: var(--space-4);
}

.feature-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.feature-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* --------------------------------------------------
   24. Responsive helpers
   -------------------------------------------------- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero { padding: var(--space-12) 0 var(--space-10); }
  .section { padding: var(--space-10) 0; }
  .site-footer { margin-top: var(--space-12); }
}

@media (max-width: 480px) {
  .hero-stats { gap: var(--space-5); }
  .modal { padding: var(--space-8) var(--space-6); }
}

/* --------------------------------------------------
   25. Breadcrumb
   -------------------------------------------------- */
.breadcrumb-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2) 0;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  list-style: none;
}

.breadcrumb-list a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-list a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--color-text-subtle);
  margin: 0 2px;
}

/* --------------------------------------------------
   26. Related Exercises
   -------------------------------------------------- */
.related-section {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-10) 0;
}

.related-section .section-header {
  margin-bottom: var(--space-6);
  text-align: center;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  max-width: 900px;
  margin-inline: auto;
}

.related-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.related-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.related-card-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.related-card-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.related-card-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* --------------------------------------------------
   27. Form Components
   -------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 0.95rem;
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.form-input.error,
.form-textarea.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.form-error {
  font-size: 0.8rem;
  color: var(--color-error);
  display: none;
}

.form-error.visible { display: block; }

.form-textarea {
  resize: vertical;
  min-height: 140px;
}

/* --------------------------------------------------
   28. FAQ Accordion
   -------------------------------------------------- */
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-5) 0;
}

.faq-item:first-child { border-top: 1px solid var(--color-border); }

.faq-q {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.faq-q::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.faq-item.open .faq-q::after {
  transform: rotate(45deg);
}

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.faq-item.open .faq-a {
  /* WW.initFaqAuto() (js/common.js) sets the exact pixel max-height per
     answer so long answers never clip. This 2000px value is only a
     non-clipping fallback when JS has not run. Transition stays smooth. */
  max-height: 2000px;
  padding-top: var(--space-3);
}

/* --------------------------------------------------
   28b. Neon Arcade Components
   -------------------------------------------------- */

/* Chunky arcade button (cabinet style) */
.btn-arcade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .02em;
  color: var(--color-text-inverse);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border: 3px solid var(--color-primary-dark);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 0 var(--color-primary-dark), var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-arcade:hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 var(--color-primary-dark), var(--glow-violet);
}
.btn-arcade:active {
  transform: translateY(0);
  box-shadow: 0 3px 0 var(--color-primary-dark), var(--shadow-sm);
}
.btn-arcade:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  box-shadow: 0 6px 0 var(--color-primary-dark), var(--glow-violet);
}

/* Arcade "cabinet" card */
.arcade-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), var(--shadow-md);
  padding: var(--space-6);
  overflow: hidden;
  color: var(--cat-quiz); /* default accent for ::before bar */
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.arcade-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}
.arcade-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
/* Optional explicit top neon bar element */
.arcade-card__bar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

/* CEFR level badges */
.level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  line-height: 1.4;
  color: #fff;
}
.level-a1 { background: #15803d; }              /* green */
.level-a2 { background: #0d9488; }              /* teal */
.level-b1 { background: #0369a1; }              /* blue */
.level-b2 { background: #6d28d9; }              /* violet-blue */
.level-c1 { background: #7c3aed; }              /* violet */
.level-c2 { background: #581c87; }              /* deep violet */

/* Gold power-up chips */
.xp-chip,
.streak-chip,
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: #4a3000;
  background: var(--color-powerup);
  border: 2px solid #d99e00;
  box-shadow: var(--glow-gold);
}
.xp-chip.is-pop,
.streak-chip.is-pop,
.score-chip.is-pop { animation: pixel-pop .35s ease both; }

/* How-to-play callout card */
.how-to-play {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 2px solid transparent;
  background-image:
    linear-gradient(var(--color-surface), var(--color-surface)),
    linear-gradient(135deg, var(--color-primary), var(--color-accent));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: var(--shadow-md);
}
.how-to-play ol { margin: var(--space-3) 0 0 1.2em; }
.how-to-play li { margin-bottom: var(--space-2); }
.how-to-play__dismiss {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

/* Arcade hero title */
.arcade-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(124,58,237,.45);
}

/* CRT / pixel grid background utility */
.arcade-grid-bg {
  position: relative;
}
.arcade-grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .08;
  background-image:
    repeating-linear-gradient(0deg, rgba(124,58,237,.6) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(34,211,238,.6) 0 1px, transparent 1px 24px);
}

/* Breadcrumb pills */
.breadcrumb-level,
.breadcrumb-category {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.breadcrumb-level {
  color: #fff;
  background: var(--color-primary);
}
.breadcrumb-category {
  color: var(--color-primary);
  background: rgba(124,58,237,.12);
  border: 1px solid rgba(124,58,237,.3);
}

/* Mega-nav dropdown */
.mega-nav { position: relative; }
.mega-nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.mega-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 520px;
  display: none;
  gap: var(--space-6);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}
.mega-nav.open > .mega-panel,
.mega-panel.open { display: grid; grid-auto-flow: column; }
.mega-col { min-width: 150px; }
.mega-col-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-2);
}
.mega-link {
  display: block;
  padding: var(--space-1) 0;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
}
.mega-link:hover { color: var(--color-primary); }

/* --------------------------------------------------
   29. Animations Library
   -------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes bounce {
  0%, 20%, 53%, 100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  70% { transform: translateY(-6px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.anim-fade-in     { animation: fadeIn 0.4s ease both; }
.anim-fade-in-up  { animation: fadeInUp 0.4s ease both; }
.anim-fade-in-down{ animation: fadeInDown 0.4s ease both; }
.anim-scale-in    { animation: scaleIn 0.3s ease both; }
.anim-bounce      { animation: bounce 0.6s ease; }
.anim-pulse       { animation: pulse 0.4s ease; }

/* Neon Arcade keyframes (gated under prefers-reduced-motion below) */
@keyframes arcade-flicker {
  0%, 100% { opacity: 1; }
  41%      { opacity: 1; }
  42%      { opacity: .55; }
  43%      { opacity: 1; }
  45%      { opacity: .7; }
  46%      { opacity: 1; }
}

@keyframes pixel-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(.92); }
  100% { transform: scale(1); }
}

@keyframes scanline-flash {
  0%   { transform: translateY(-100%); opacity: 0; }
  10%  { opacity: .5; }
  100% { transform: translateY(100%); opacity: 0; }
}

.is-pop { animation: pixel-pop .35s ease both; }

/* --------------------------------------------------
   30. Reduced Motion
   -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Explicitly neutralise Neon Arcade motion effects */
  .is-pop,
  .arcade-title,
  .arcade-grid-bg::after {
    animation: none !important;
  }
  .arcade-grid-bg::after { display: none !important; }
}

/* --------------------------------------------------
   31. Selection & Scrollbar
   -------------------------------------------------- */
::selection {
  background: rgba(99,102,241,.18);
  color: var(--color-text);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-neutral-100);
}

::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-neutral-100);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-neutral-400);
}

/* --------------------------------------------------
   32. Dark Theme
   -------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg:             var(--arcade-ink);
    --color-surface:        #1e1b3a;
    --color-surface-raised: #272148;
    --color-border:         #334155;
    --color-border-focus:   #a78bfa;
    --color-text:           #f1f5f9;
    --color-text-muted:     #94a3b8;
    --color-text-subtle:    #64748b;
    --color-text-inverse:   #0f172a;
    --color-neutral-50:     #1e293b;
    --color-neutral-100:    #273548;
    --color-neutral-200:    #334155;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
    --shadow-md:  0 4px 12px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.2);
    --shadow-lg:  0 10px 30px rgba(0,0,0,.5), 0 4px 8px rgba(0,0,0,.3);
    --shadow-xl:  0 20px 50px rgba(0,0,0,.6), 0 8px 16px rgba(0,0,0,.4);
    /* 1b unification: tinted alt surface on dark ink (aliases
       --text-muted/--border auto-track via reused tokens above) */
    --surface-2:            #1e1b3a;
  }
}

[data-theme="dark"] {
  --color-bg:             var(--arcade-ink);
  --color-surface:        #1e1b3a;
  --color-surface-raised: #272148;
  --color-border:         #334155;
  --color-border-focus:   #a78bfa;
  --color-text:           #f1f5f9;
  --color-text-muted:     #94a3b8;
  --color-text-subtle:    #64748b;
  --color-text-inverse:   #0f172a;
  --color-neutral-50:     #1e293b;
  --color-neutral-100:    #273548;
  --color-neutral-200:    #334155;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:  0 4px 12px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.2);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.5), 0 4px 8px rgba(0,0,0,.3);
  --shadow-xl:  0 20px 50px rgba(0,0,0,.6), 0 8px 16px rgba(0,0,0,.4);
  /* 1b unification: tinted alt surface on dark ink */
  --surface-2:            #1e1b3a;
}

[data-theme="dark"] .hero {
  background: linear-gradient(160deg, #131c2e 0%, #1a1030 50%, #0d1e2e 100%);
}

[data-theme="dark"] .exercise-card-icon {
  background: linear-gradient(135deg, #1e293b, #1e1b4b);
}

[data-theme="dark"] .site-footer {
  background: var(--arcade-ink-2);
}

/* Signature Neon Arcade dark glow */
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-arcade:hover {
  box-shadow: var(--glow-violet);
}
[data-theme="dark"] .exercise-card:hover {
  box-shadow: var(--shadow-lg), var(--glow-violet);
}
[data-theme="dark"] h1,
[data-theme="dark"] .section-title,
[data-theme="dark"] .arcade-title {
  text-shadow: 0 0 12px rgba(124,58,237,.4);
}

/* Dark theme toggle button */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #eef2ff;
}

[data-theme="dark"] .theme-toggle:hover {
  background: #1e1b4b;
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* --------------------------------------------------
   33. Extended Animation Library
   -------------------------------------------------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shakeFeedback {
  0%        { transform: translateX(0); }
  15%       { transform: translateX(-8px) rotate(-1deg); }
  30%       { transform: translateX(8px) rotate(1deg); }
  45%       { transform: translateX(-6px); }
  60%       { transform: translateX(6px); }
  75%       { transform: translateX(-3px); }
  90%       { transform: translateX(3px); }
  100%      { transform: translateX(0); }
}

@keyframes glowCorrect {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
  50%      { box-shadow: 0 0 0 8px rgba(34,197,94,.25), 0 0 20px rgba(34,197,94,.15); }
}

@keyframes scoreFlyUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-40px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.9); }
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}

@keyframes skeletonShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25%       { transform: scale(1.25); }
  50%       { transform: scale(0.95); }
  75%       { transform: scale(1.15); }
}

@keyframes streakPop {
  0%   { transform: scale(0.6) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.anim-slide-up    { animation: slideUp 0.4s ease both; }
.anim-slide-down  { animation: slideDown 0.4s ease both; }
.anim-slide-left  { animation: slideLeft 0.4s ease both; }
.anim-slide-right { animation: slideRight 0.4s ease both; }
.anim-shake       { animation: shakeFeedback 0.5s ease; }

/* --------------------------------------------------
   34. Enhanced Game Feedback Styles
   -------------------------------------------------- */
.feedback-correct {
  background-color: var(--color-success-light) !important;
  border-color: var(--color-success) !important;
  color: var(--color-success-dark) !important;
  animation: pop-in 0.3s ease, glowCorrect 0.6s ease 0.1s;
}

.feedback-incorrect {
  background-color: var(--color-danger-light) !important;
  border-color: var(--color-danger) !important;
  color: var(--color-danger-dark) !important;
  animation: shakeFeedback 0.5s ease;
}

/* Score pop-up (+10 fly-up) */
.score-popup {
  position: fixed;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-success);
  pointer-events: none;
  z-index: var(--z-toast);
  text-shadow: 0 2px 8px rgba(34,197,94,.35);
  animation: scoreFlyUp 0.8s ease forwards;
}

.score-popup.negative {
  color: var(--color-danger);
  text-shadow: 0 2px 8px rgba(239,68,68,.35);
}

/* Drag & Drop styles */
.draggable {
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  user-select: none;
}

.draggable:active,
.draggable.dragging {
  cursor: grabbing;
  transform: scale(1.05) rotate(1.5deg);
  box-shadow: var(--shadow-xl);
  opacity: 0.85;
  z-index: var(--z-raised);
}

.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
  transform: scale(1.02);
}

.drop-zone.drop-valid {
  border-color: var(--color-success);
  background: var(--color-success-light);
}

.drop-zone.drop-invalid {
  border-color: var(--color-danger);
  background: var(--color-danger-light);
}

/* Timer bar (green → yellow → red) */
.timer-bar-wrap {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-success);
  transition: width 1s linear, background-color 0.5s ease;
}

.timer-bar-fill.warning { background: var(--color-warning); }
.timer-bar-fill.danger  { background: var(--color-danger); }

/* --------------------------------------------------
   35. Mobile Hamburger Menu
   -------------------------------------------------- */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.nav-hamburger:hover {
  background: var(--color-neutral-100);
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition-base), opacity var(--transition-base), width var(--transition-base);
}

.nav-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
  width: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------
   36. Custom Checkbox & Radio
   -------------------------------------------------- */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  min-height: 44px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-check input[type="checkbox"] {
  border-radius: 5px;
}

.form-check input[type="radio"] {
  border-radius: 50%;
}

.form-check input[type="checkbox"]:checked,
.form-check input[type="radio"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.form-check input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

.form-check input[type="radio"]:checked::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.form-check input:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}

.form-check input:hover:not(:checked) {
  border-color: var(--color-primary-light);
}

.form-check-label {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  line-height: var(--lh-snug);
}

/* --------------------------------------------------
   37. Skeleton Loader
   -------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-neutral-100) 25%,
    var(--color-neutral-200) 50%,
    var(--color-neutral-100) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: var(--radius-sm);
}

.skeleton-text.w-full  { width: 100%; }
.skeleton-text.w-3-4   { width: 75%; }
.skeleton-text.w-1-2   { width: 50%; }
.skeleton-text.w-1-4   { width: 25%; }

.skeleton-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: var(--space-5);
}

.skeleton-icon {
  width: 100%;
  height: 120px;
  border-radius: 0;
  margin: calc(-1 * var(--space-5));
  margin-bottom: var(--space-5);
  width: calc(100% + 2 * var(--space-5));
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------
   38. Tooltip
   -------------------------------------------------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-800);
  color: white;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform: translateX(-50%) translateY(4px);
  z-index: var(--z-tooltip);
  max-width: 240px;
  white-space: normal;
  text-align: center;
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-neutral-800);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tooltip-pos="bottom"]::before {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 3px);
  border-top-color: transparent;
  border-bottom-color: var(--color-neutral-800);
}

[data-tooltip-pos="bottom"]:hover::before {
  transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------
   39. Snackbar / Notification & Confirmation Dialog
   -------------------------------------------------- */
.snackbar-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 360px;
}

@media (max-width: 480px) {
  .snackbar-container {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
  }
}

.snackbar {
  background: var(--color-neutral-800);
  color: white;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: all;
  animation: slideLeft 0.35s ease both;
  line-height: var(--lh-snug);
}

.snackbar.snackbar-success { background: var(--color-success); }
.snackbar.snackbar-error   { background: var(--color-danger); }
.snackbar.snackbar-warning { background: var(--color-warning); color: var(--color-neutral-900); }
.snackbar.snackbar-info    { background: var(--color-info); }

.snackbar-icon { font-size: 1.1rem; flex-shrink: 0; }

.snackbar-action {
  margin-left: auto;
  background: rgba(255,255,255,.2);
  border: none;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.snackbar-action:hover { background: rgba(255,255,255,.3); }

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spinnerRotate 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.loading-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.loading-overlay .spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
  border-color: rgba(255,255,255,.2);
  border-top-color: white;
}

/* Confirmation Dialog */
.confirm-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  text-align: center;
  animation: scaleIn 0.25s ease;
}

.confirm-dialog-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
}

.confirm-dialog-title {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.confirm-dialog-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-6);
}

.confirm-dialog-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* --------------------------------------------------
   40. Game UI Components
   -------------------------------------------------- */

/* Hearts / Lives indicator */
.lives-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.live-heart {
  font-size: 1.4rem;
  transition: all var(--transition-fast);
  filter: drop-shadow(0 1px 2px rgba(239,68,68,.3));
}

.live-heart.lost {
  opacity: 0.25;
  filter: grayscale(1);
  animation: heartBeat 0.4s ease;
}

/* Streak counter */
.streak-display {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border: 1.5px solid #fde68a;
  color: #92400e;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: var(--font-size-sm);
}

.streak-display.active {
  animation: streakPop 0.5s ease;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  border-color: #f59e0b;
  color: white;
}

.streak-count {
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  line-height: 1;
}

/* Combo multiplier */
.combo-display {
  position: fixed;
  top: 80px;
  right: var(--space-6);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--font-size-2xl);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-color);
  z-index: var(--z-raised);
  animation: streakPop 0.35s ease;
}

/* Star rating */
.star-rating {
  display: flex;
  gap: var(--space-1);
}

.star {
  font-size: 1.8rem;
  color: var(--color-neutral-300);
  transition: color var(--transition-fast), transform var(--transition-fast);
  cursor: default;
}

.star.filled {
  color: #f59e0b;
  filter: drop-shadow(0 1px 3px rgba(245,158,11,.4));
}

.star.earned {
  animation: heartBeat 0.4s ease;
}

/* Achievement badge */
.achievement {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border: 2px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-md);
  animation: scaleIn 0.35s cubic-bezier(.34,1.56,.64,1);
}

.achievement-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.achievement-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: #92400e;
}

.achievement-desc {
  font-size: 0.75rem;
  color: #a16207;
}

/* Leaderboard table */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-4);
  border-bottom: 2px solid var(--color-border);
}

.leaderboard tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.leaderboard tbody tr:hover {
  background: var(--color-neutral-50);
}

.leaderboard tbody tr.current-user {
  background: #eef2ff;
  font-weight: 600;
}

.leaderboard td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-muted);
  width: 40px;
}

.leaderboard-rank.top-1 { color: #f59e0b; }
.leaderboard-rank.top-2 { color: #94a3b8; }
.leaderboard-rank.top-3 { color: #b45309; }

.leaderboard-score {
  font-weight: 700;
  color: var(--color-primary);
  text-align: right;
}

/* Difficulty selector */
.difficulty-selector {
  display: flex;
  gap: var(--space-2);
}

.diff-btn {
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text-muted);
  min-height: 44px;
}

.diff-btn:hover { border-color: var(--color-primary-light); color: var(--color-primary); }
.diff-btn.active { border-color: transparent; color: white; }
.diff-btn.easy.active   { background: var(--color-success); }
.diff-btn.medium.active { background: var(--color-warning); color: #78350f; }
.diff-btn.hard.active   { background: var(--color-danger); }

/* --------------------------------------------------
   41. Tab Component
   -------------------------------------------------- */
.tabs {
  width: 100%;
}

.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-list::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: var(--space-3) var(--space-5);
  border: none;
  background: none;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color var(--transition-fast);
  min-height: 44px;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.tab-btn.active {
  color: var(--color-primary);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-btn:hover:not(.active) {
  color: var(--color-text);
}

.tab-panel {
  display: none;
  padding: var(--space-6) 0;
  animation: fadeIn 0.25s ease;
}

.tab-panel.active { display: block; }

/* --------------------------------------------------
   42. Expandable / Collapsible Card
   -------------------------------------------------- */
.expand-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
}

.expand-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
  min-height: 56px;
  gap: var(--space-3);
}

.expand-card-header:hover {
  background: var(--color-neutral-50);
}

.expand-card-title {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--color-text);
  flex: 1;
}

.expand-card-chevron {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.expand-card.open .expand-card-chevron {
  transform: rotate(180deg);
}

.expand-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.expand-card.open .expand-card-body {
  max-height: 1200px;
}

.expand-card-content {
  padding: 0 var(--space-6) var(--space-6);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-5);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--lh-relaxed);
}

/* --------------------------------------------------
   43. Carousel / Slider
   -------------------------------------------------- */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.carousel-track {
  display: flex;
  transition: transform var(--transition-slow) cubic-bezier(.4,0,.2,1);
}

.carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--color-text);
  transition: all var(--transition-fast);
  z-index: var(--z-raised);
}

.carousel-btn:hover {
  background: white;
  box-shadow: var(--shadow-lg);
  transform: translateY(-50%) scale(1.05);
}

.carousel-btn-prev { left: var(--space-3); }
.carousel-btn-next { right: var(--space-3); }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.carousel-dot.active {
  background: var(--color-primary);
  width: 24px;
}

/* --------------------------------------------------
   44. Prose / Blog Article Styles
   -------------------------------------------------- */
.prose {
  font-size: clamp(1rem, 1.5vw, 1.0625rem);
  line-height: var(--lh-relaxed);
  color: var(--color-text);
  max-width: 72ch;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-tight);
  color: var(--color-text);
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.prose h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); margin-top: 0; }
.prose h2 { font-size: clamp(1.35rem, 2.5vw, 1.75rem); }
.prose h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
.prose h4 { font-size: var(--font-size-lg); }

.prose p {
  margin-bottom: 1.5em;
}

.prose a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--color-primary-dark);
}

.prose ul,
.prose ol {
  margin-bottom: 1.5em;
  padding-left: 1.75em;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
  margin-bottom: 0.5em;
}

.prose strong {
  font-weight: 700;
  color: var(--color-text);
}

.prose em { font-style: italic; }

.prose blockquote {
  border-left: 4px solid var(--color-primary);
  margin: 2em 0;
  padding: var(--space-4) var(--space-6);
  background: #eef2ff;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

.prose code {
  background: var(--color-neutral-100);
  color: var(--color-primary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'Courier New', monospace;
}

.prose pre {
  background: var(--color-neutral-900);
  color: #e2e8f0;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 2em 0;
  font-size: 0.875rem;
  line-height: 1.7;
}

.prose pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.prose hr {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: 2.5em 0;
}

.prose img {
  border-radius: var(--radius-lg);
  margin: 2em auto;
  box-shadow: var(--shadow-md);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: var(--font-size-sm);
}

.prose th {
  background: var(--color-neutral-100);
  font-weight: 700;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border: 1px solid var(--color-border);
}

.prose td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
}

.prose tr:nth-child(even) td {
  background: var(--color-neutral-50);
}

/* --------------------------------------------------
   45. Accessibility & Focus Indicators
   -------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 3px;
  border-radius: 3px;
}

.btn:focus-visible,
.navbar-link:focus-visible,
.filter-btn:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 9999;
  background: var(--color-primary);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-sm);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* --------------------------------------------------
   46. Responsive Breakpoints (mobile-first additions)
   -------------------------------------------------- */
@media (max-width: 1440px) {
  .container { max-width: 100%; }
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links     { display: none; }
  .nav-hamburger { display: flex; }
  .hero { padding: var(--space-12) 0 var(--space-10); }
  .section { padding: var(--space-10) 0; }
  .site-footer { margin-top: var(--space-12); }
  .difficulty-selector { gap: var(--space-1); }
  .diff-btn { padding: var(--space-2) var(--space-3); font-size: 0.8rem; }
  .combo-display { right: var(--space-3); font-size: var(--font-size-xl); }
}

@media (max-width: 480px) {
  .hero-stats { gap: var(--space-5); }
  .modal { padding: var(--space-8) var(--space-6); }
  .snackbar-container { bottom: var(--space-4); }
  .exercise-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
  .tab-btn { padding: var(--space-3) var(--space-4); }
}

@media (max-width: 320px) {
  .container { padding-inline: var(--space-3); }
  .btn { padding: var(--space-2) var(--space-4); font-size: 0.85rem; }
  .exercise-grid { grid-template-columns: 1fr; }
}

/* Touch-friendly interactive elements */
@media (pointer: coarse) {
  .btn,
  .tab-btn,
  .filter-btn,
  .diff-btn,
  .form-check,
  .carousel-btn {
    min-height: 44px;
  }
}

/* --------------------------------------------------
   47. Print Styles
   -------------------------------------------------- */
@media print {
  .navbar,
  .site-footer,
  .theme-toggle,
  .breadcrumb-bar,
  .btn,
  .exercise-controls,
  .filter-bar,
  .cat-links,
  .cat-chips,
  .cat-chips-label,
  .cta-banner,
  .exercise-nav,
  .cookie-consent,
  .search-wrap,
  .hero-actions,
  .snackbar-container,
  .loading-overlay {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: white;
  }

  .hero {
    padding: 1rem 0;
    background: white;
    text-align: left;
  }

  .hero h1 { font-size: 22pt; }
  .section-title { font-size: 16pt; }

  a { color: #000; text-decoration: none; }

  .exercise-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 0.5rem;
  }

  .exercise-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  @page {
    margin: 1.5cm;
  }
}

/* --------------------------------------------------
   33. High Contrast Mode
   -------------------------------------------------- */
@media (prefers-contrast: more) {
  :root {
    --color-border:       #000;
    --color-text-muted:   #1e293b;
    --color-text-subtle:  #334155;
  }

  .btn-primary  { background: #000; border: 2px solid #000; }
  .btn-secondary { border: 2px solid #000; color: #000; }
  .badge { border: 1px solid currentColor; }
  .card, .sidebar-card { border: 2px solid #000; }

  :focus-visible {
    outline: 3px solid #000 !important;
    outline-offset: 3px !important;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-border:       #fff;
    --color-text-muted:   #e2e8f0;
    --color-text-subtle:  #cbd5e1;
  }
  .card, .sidebar-card { border-color: #fff; }
  :focus-visible { outline-color: #fff !important; }
}

/* Windows High Contrast / Forced Colors */
@media (forced-colors: active) {
  .btn { forced-color-adjust: none; }
  .badge { forced-color-adjust: none; }
  .timer-bar-fill { background: Highlight; }
}

/* ================================================================
   COOKIE CONSENT BANNER (GDPR/UK) — injected by common.js
   ================================================================ */
.cookie-consent {
  position: fixed;
  left: 50%;
  bottom: var(--space-4, 1rem);
  transform: translate(-50%, 150%);
  width: min(680px, calc(100% - 2rem));
  z-index: var(--z-toast, 9000);
  display: flex;
  align-items: center;
  gap: var(--space-4, 1rem);
  flex-wrap: wrap;
  justify-content: space-between;
  padding: var(--space-4, 1rem) var(--space-5, 1.25rem);
  background: var(--color-bg-surface, #fff);
  color: var(--color-text-primary, #1e293b);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-xl, 0 20px 40px rgba(0, 0, 0, 0.18));
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.cookie-consent--show { transform: translate(-50%, 0); opacity: 1; }
.cookie-consent--hide { transform: translate(-50%, 150%); opacity: 0; }
.cookie-consent__text {
  margin: 0;
  flex: 1 1 320px;
  font-size: var(--font-size-sm, 0.9rem);
  line-height: var(--lh-base, 1.5);
}
.cookie-consent__text a { color: var(--color-primary, #7c3aed); text-decoration: underline; }
.cookie-consent__actions { display: flex; gap: var(--space-2, 0.5rem); flex-shrink: 0; }
@media (max-width: 480px) {
  .cookie-consent { flex-direction: column; align-items: stretch; text-align: center; }
  .cookie-consent__actions { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .cookie-consent { transition: opacity .2s ease; }
  .cookie-consent--show { transform: translate(-50%, 0); }
}

/* ================================================================
   PERFORMANCE: containment + off-screen rendering hints
   ================================================================ */
.exercise-card, .card, .ex-card { contain: layout style; }
.category-section, .site-footer, .features-section, .faq-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

/* ================================================================
   GAME BACKGROUND (CSS gradient pattern, no image files)
   ================================================================ */
.game-bg {
  background-color: var(--color-bg, #f8fafc);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.06) 0, transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(34, 211, 238, 0.06) 0, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(139, 92, 246, 0.05) 0, transparent 45%);
}

/* ================================================================
   BLOG CARD THUMBNAIL PLACEHOLDER (SVG-free gradient)
   ================================================================ */
.blog-thumb, .blog-card__thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md, 12px);
  background: linear-gradient(135deg, var(--color-primary, #7c3aed), var(--color-accent, #22d3ee));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}

/* ================================================================
   READING PROGRESS BAR (blog/article pages) — injected by common.js
   ================================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--color-primary, #7c3aed), var(--color-accent, #22d3ee));
  z-index: var(--z-sticky, 1000);
  transition: width .1s linear;
}

/* ================================================================
   SOCIAL SHARE BAR — populated by WW.renderShareBar()
   ================================================================ */
.ww-share-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.ww-share-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 9999px;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text-primary, #1e293b);
  background: var(--color-bg-surface, #fff);
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.ww-share-btn:hover { transform: translateY(-2px); border-color: var(--color-primary, #7c3aed); }
.social-link {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem; border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 9999px; text-decoration: none; font-size: .85rem; font-weight: 600;
  color: var(--color-text-primary, #1e293b);
}
.social-link:hover { border-color: var(--color-primary, #7c3aed); }

/* Auto article TOC + author bio (injected by common.js) */
.article-toc { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px solid var(--color-border, #e2e8f0); border-radius: var(--radius-md, 12px); background: var(--color-bg-surface, #fff); }
.article-toc strong { display: block; margin-bottom: .5rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-secondary, #64748b); }
.article-toc ol { margin: 0; padding-left: 1.1rem; }
.article-toc a { color: var(--color-primary, #7c3aed); text-decoration: none; }
.article-toc a:hover { text-decoration: underline; }
.article-author { margin-top: 2.5rem; padding: 1.25rem; display: flex; gap: 1rem; align-items: center; border-top: 1px solid var(--color-border, #e2e8f0); }
.article-author__avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, var(--color-primary, #7c3aed), var(--color-accent, #22d3ee)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.article-author__name { font-weight: 700; }
.article-author__bio { font-size: .9rem; color: var(--color-text-secondary, #64748b); margin: 0; }

/* ================================================================
   EMBED MODE (?embed=1) — strips site chrome for <iframe> embedding
   body.ww-embed is set by common.js when the embed query param is present
   ================================================================ */
body.ww-embed .navbar,
body.ww-embed .site-footer,
body.ww-embed .breadcrumb-bar,
body.ww-embed .exercise-nav,
body.ww-embed .cookie-consent,
body.ww-embed .exercise-footer-bar {
  display: none !important;
}
body.ww-embed { padding-top: 0 !important; }
body.ww-embed main { padding-top: var(--space-4, 1rem); }
/* small "powered by" link added by common.js in embed mode */
.ww-embed-credit {
  text-align: center;
  font-size: var(--font-size-xs, 0.75rem);
  padding: var(--space-3, 0.75rem);
  color: var(--color-text-secondary, #64748b);
}
.ww-embed-credit a { color: var(--color-primary, #7c3aed); text-decoration: none; font-weight: 600; }

/* ================================================================
   PREV / NEXT EXERCISE NAVIGATION — injected by common.js
   ================================================================ */
.exercise-nav {
  max-width: 900px;
  margin: var(--space-8, 2.5rem) auto;
  padding: 0 var(--space-5, 1.25rem);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-3, 0.75rem);
}
.exercise-nav__link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  text-decoration: none;
  color: var(--color-text-primary, #1e293b);
  transition: transform .15s, border-color .15s;
  max-width: 280px;
}
.exercise-nav__next { text-align: right; align-items: flex-end; }
.exercise-nav__link:hover { transform: translateY(-2px); border-color: var(--color-primary, #7c3aed); }
.exercise-nav__dir { font-size: var(--font-size-xs, 0.75rem); color: var(--color-text-secondary, #64748b); font-weight: 600; }
.exercise-nav__name { font-weight: 700; }
.exercise-nav__all {
  align-self: center;
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm, 0.9rem);
  font-weight: 600;
  text-decoration: none;
  color: var(--color-primary, #7c3aed);
  white-space: nowrap;
}
.exercise-nav__all:hover { text-decoration: underline; }
.exercise-nav__spacer { flex: 1 1 0; max-width: 280px; }
@media (max-width: 560px) {
  .exercise-nav__all { display: none; }
}

/* ================================================================
   EXERCISE COMPLETION PROGRESS — ✓ badge + "Your progress" widget
   (rendered by js/common.js renderProgressWidget())
   ================================================================ */
.exercise-card.ex-done { position: relative; }
.ex-done-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(34,197,94,0.45);
  z-index: 2;
  pointer-events: none;
}

.ww-progress {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin: 0 auto 1.75rem;
  max-width: 640px;
  box-shadow: var(--shadow-sm);
}
.ww-progress__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.ww-progress__title { font-family: var(--font-display); font-size: 1.05rem; color: var(--color-text); }
.ww-progress__count { font-weight: 800; color: var(--color-primary); white-space: nowrap; }
.ww-progress__count span { font-weight: 500; color: var(--color-text-muted); font-size: 0.85rem; }
.ww-progress__bar {
  height: 10px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.ww-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light, #a78bfa));
  border-radius: 999px;
  transition: width 0.5s ease;
}
.ww-progress__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.ww-progress__reset {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--transition-base), border-color var(--transition-base);
}
.ww-progress__reset:hover { color: var(--color-primary); border-color: var(--color-primary); }
