/* ============================================================
   English Game — style.css  v7
   Warm palette redesign — Manrope, cream, indigo-night dark
   ============================================================ */

/* ============================================================
   FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&display=swap');

/* ============================================================
   1. CSS VARIABLES — LIGHT MODE
   ============================================================ */
:root {
  /* Backgrounds — тёплые, кремовые */
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --surface-2: #F4F1EA;
  --surface-3: #ECE7DD;
  --surface-hover: #F0EBE0;

  /* Borders — тёплый бежевый */
  --border: #E0DACE;
  --border-strong: #C9C2B3;

  /* Text — тёплый */
  --text: #1C1610;
  --text-muted: #6B6358;
  --text-dim: #9A9285;

  /* Primary — индиго */
  --primary: #4F4ED8;
  --primary-strong: #3D3DC0;
  --primary-soft: #ECECFA;
  --primary-glow: rgba(79, 78, 216, 0.18);

  /* Accent — зелёный сдержанный */
  --accent: #2F8F3E;
  --accent-strong: #25742F;
  --accent-soft: #E5F3E8;

  /* Семантика — терракота */
  --tr-red: #C8463A;
  --danger: #C8463A;
  --danger-soft: #FBE8E5;
  --warning: #D69917;
  --warning-soft: #FBF1D6;

  /* Semantic tones */
  --teal: #2A8C8C;
  --purple: #7E4DBF;

  /* Level badges */
  --level-A0: #6E7C7C;
  --level-A1: #2F8F3E;
  --level-A2: #4F4ED8;
  --level-B1: #D69917;
  --level-B2: #C8463A;

  --level-A0-soft: #EAEDED;
  --level-A1-soft: #E5F3E8;
  --level-A2-soft: #ECECFA;
  --level-B1-soft: #FBF1D6;

  /* Radius — крупнее */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 30px;
  --radius-full: 9999px;

  /* Shadows — многослойные с тёплым тоном */
  --shadow-xs: 0 1px 2px rgba(28,22,14,.04);
  --shadow-sm: 0 1px 2px rgba(28,22,14,.05), 0 1px 1px rgba(28,22,14,.04);
  --shadow: 0 4px 12px -2px rgba(28,22,14,.10), 0 2px 4px rgba(28,22,14,.05);
  --shadow-md: 0 12px 32px -8px rgba(28,22,14,.12), 0 4px 8px rgba(28,22,14,.04);
  --shadow-lg: 0 24px 48px -12px rgba(28,22,14,.18), 0 8px 16px rgba(28,22,14,.06);
  --shadow-xl: 0 32px 64px -16px rgba(28,22,14,.22);
  --shadow-glow: 0 0 0 4px rgba(79,78,216,.18);
  --shadow-glow-green: 0 0 0 3px rgba(47,143,62,.18);

  /* Typography */
  --font-ui: "Manrope", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Transitions */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   2. DARK MODE — индиго-ночь
   ============================================================ */
[data-theme="dark"] {
  --bg: #0F0E1A;
  --surface: #1B1932;
  --surface-2: #25223C;
  --surface-3: #2F2C46;
  --surface-hover: #2A2740;

  --border: #3A3754;
  --border-strong: #4D4970;

  --text: #F2EFE6;
  --text-muted: #B5B0A0;
  --text-dim: #807A6A;

  --primary: #8B89FF;
  --primary-strong: #6F6CF0;
  --primary-soft: #2C2A55;
  --primary-glow: rgba(139, 137, 255, 0.22);

  --accent: #4FC75E;
  --accent-strong: #3DAA4B;
  --accent-soft: #1F3823;

  --tr-red: #E66B5E;
  --danger: #E66B5E;
  --danger-soft: #3A1E1A;
  --warning: #E6B53D;
  --warning-soft: #3A2E14;

  --teal: #3AADAD;
  --purple: #A97EDF;

  --level-A0: #9CA3AF;
  --level-A1: #4FC75E;
  --level-A2: #8B89FF;
  --level-B1: #E6B53D;
  --level-B2: #E66B5E;

  --level-A0-soft: #222430;
  --level-A1-soft: #1F3823;
  --level-A2-soft: #2C2A55;
  --level-B1-soft: #3A2E14;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 4px 12px -2px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 12px 32px -8px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 24px 48px -12px rgba(0,0,0,0.7), 0 8px 16px rgba(0,0,0,0.3);
  --shadow-xl: 0 32px 64px -16px rgba(0,0,0,0.8);
  --shadow-glow: 0 0 0 4px rgba(139,137,255,.22);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0F0E1A; --surface: #1B1932; --surface-2: #25223C; --surface-3: #2F2C46; --surface-hover: #2A2740;
    --border: #3A3754; --border-strong: #4D4970;
    --text: #F2EFE6; --text-muted: #B5B0A0; --text-dim: #807A6A;
    --primary: #8B89FF; --primary-strong: #6F6CF0; --primary-soft: #2C2A55; --primary-glow: rgba(139,137,255,.22);
    --accent: #4FC75E; --accent-strong: #3DAA4B; --accent-soft: #1F3823;
    --tr-red: #E66B5E; --danger: #E66B5E; --danger-soft: #3A1E1A;
    --warning: #E6B53D; --warning-soft: #3A2E14;
    --level-A0: #9CA3AF; --level-A1: #4FC75E; --level-A2: #8B89FF; --level-B1: #E6B53D; --level-B2: #E66B5E;
    --level-A0-soft: #222430; --level-A1-soft: #1F3823; --level-A2-soft: #2C2A55; --level-B1-soft: #3A2E14;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.6), 0 10px 10px -5px rgba(0,0,0,0.3);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.8);
  }
}

/* ============================================================
   3. RESET + BASE
   ============================================================ */
*, ::before, ::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

/* ============================================================
   4. APP LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 252px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   5. SIDEBAR
   ============================================================ */
.sidebar {
  width: 252px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  transition: transform 0.28s var(--ease-smooth);
  z-index: 200;
  overflow-x: hidden;
}

/* Тонкая линия-акцент сверху сайдбара */
.sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--purple) 50%, var(--pink) 100%);
  flex-shrink: 0;
}

/* ============================================================
   6. BRAND
   ============================================================ */
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 14px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.sidebar .brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--tr-red) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,78,216,.25);
  flex-shrink: 0;
}

.sidebar .brand-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.2px;
  line-height: 1.1;
}

.sidebar .brand-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ============================================================
   7. NAV SCROLL
   ============================================================ */
.nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 8px;
}

/* ============================================================
   8. NAV SECTION LABEL
   ============================================================ */
.nav-section-label {
  padding: 14px 14px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ============================================================
   9. NAV LINK — pill style
   ============================================================ */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 1px 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  transition: background 0.14s var(--ease-smooth), color 0.14s var(--ease-smooth);
  position: relative;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  position: relative;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

[data-theme="dark"] .nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-link .nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  opacity: 0.85;
}

.nav-link.active .nav-icon {
  opacity: 1;
}

/* ============================================================
   10. MAIN SHELL
   ============================================================ */
.main-shell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  min-width: 0;
}

/* ============================================================
   11. TOPBAR
   ============================================================ */
.topbar {
  height: 56px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(250, 248, 244, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

[data-theme="dark"] .topbar {
  background: rgba(15, 14, 26, 0.80);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .topbar {
    background: rgba(15, 14, 26, 0.80);
  }
}

.crumbs {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
}

.crumbs b {
  color: var(--text);
  font-weight: 700;
}

.topbar-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 19px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: background 0.14s, color 0.14s;
  flex-shrink: 0;
}

.burger:hover {
  background: var(--surface-2);
  color: var(--text);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.stat-pill.streak {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--tr-red);
}

.stat-pill.xp {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}

[data-theme="dark"] .stat-pill.xp { color: #FFD66B; }

.stat-pill.gems {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

/* ============================================================
   12. VIEW
   ============================================================ */
.view {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ============================================================
   13. MOBILE TABS
   ============================================================ */
.mobile-tabs { display: none; }

.mtab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  gap: 2px;
  transition: color 0.14s;
}

.mtab .mtab-icon,
.mtab > :first-child:not(span) { font-size: 20px; }
.mtab span { font-size: 10px; }
.mtab.active { color: var(--primary); }

/* ============================================================
   14. AI FAB
   ============================================================ */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
  color: white;
  font-size: 22px;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg), 0 0 0 0 var(--primary-glow);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
}

.ai-fab:hover {
  transform: scale(1.10);
  box-shadow: var(--shadow-xl), 0 0 20px var(--primary-glow);
}

.ai-fab:active { transform: scale(0.95); }

/* ============================================================
   15. AI CHAT OVERLAY
   ============================================================ */
.ai-chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-panel {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 440px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: scaleIn 0.18s var(--ease-smooth);
}

.ai-chat-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.ai-chat-header button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s, color 0.14s;
}

.ai-chat-header button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-chat-input-row {
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-chat-input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.ai-chat-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.msg-user, .msg-ai {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  max-width: 85%;
  font-size: 13.5px;
  line-height: 1.55;
}

.msg-user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-ai {
  background: var(--surface-2);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

/* ============================================================
   16. PAYWALL MODAL
   ============================================================ */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paywall-modal {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: 36px 28px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: scaleIn 0.2s var(--ease-smooth);
}

.paywall-icon { font-size: 52px; margin-bottom: 18px; }
.paywall-title { font-size: 21px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.03em; }
.paywall-desc { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; line-height: 1.55; }
.paywall-modal .btn { width: 100%; }
.paywall-modal .btn + .btn { margin-top: 8px; }

/* ============================================================
   17. BUTTONS
   ============================================================ */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.1s, box-shadow 0.14s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(91,95,239,.3);
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-good {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-good:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-back {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding-left: 8px;
}

.btn-back:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: transparent;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}

/* ============================================================
   18. CHIPS / BADGES
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chip.level-A0 { background: var(--level-A0-soft); color: var(--level-A0); }
.chip.level-A1 { background: var(--level-A1-soft); color: var(--level-A1); }
.chip.level-A2 { background: var(--level-A2-soft); color: var(--level-A2); }
.chip.level-B1 { background: var(--level-B1-soft); color: var(--level-B1); }
.chip.level-B2 { background: var(--danger-soft); color: var(--level-B2); }
.chip.primary  { background: var(--primary-soft); color: var(--primary); }
.chip.success  { background: var(--accent-soft); color: var(--accent); }
.chip.danger   { background: var(--danger-soft); color: var(--danger); }
.chip.warning  { background: var(--warning-soft); color: var(--warning); }
.chip.muted-chip { background: var(--surface-3); color: var(--text-muted); }

/* ============================================================
   19. CARDS — base
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}

.card:hover { box-shadow: var(--shadow); }

/* ============================================================
   20. MODULE CARD — главная страница
   ============================================================ */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.module-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  text-decoration: none;
  color: var(--text);
  transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.module-card .badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.module-card.green .badge { background: linear-gradient(135deg,#2F8F3E,#25742F); }
.module-card.blue .badge  { background: linear-gradient(135deg,#4F4ED8,#3D3DC0); }
.module-card.purple .badge{ background: linear-gradient(135deg,#7E4DBF,#6B3FB0); }
.module-card.red .badge   { background: linear-gradient(135deg,#C8463A,#A0382E); }
.module-card.yellow .badge{ background: linear-gradient(135deg,#D69917,#B07A0E); }
.module-card.teal .badge  { background: linear-gradient(135deg,#2A8C8C,#1F6B6B); }

.module-card .title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.2px;
  color: var(--text);
  margin-bottom: 6px;
}

.module-card .desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.module-card .open-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.module-locked .open-link { color: var(--warning); }

.module-locked {
  opacity: .65;
  position: relative;
}

.module-locked:hover { opacity: 1; }

/* Legacy compat */
.module-badge { display: none; }
.module-title { display: none; }
.module-meta  { display: none; }

/* ============================================================
   21. HOME PAGE — top grid, continue-card, goal-card
   ============================================================ */

.home-top-grid {
  display: grid;
  grid-template-columns: minmax(0,2fr) minmax(0,1fr);
  gap: 16px;
  margin-bottom: 20px;
}

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

.continue-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 28px 32px;
  border-radius: var(--radius-2xl);
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg,#4F4ED8 0%,#7766EE 50%,#C8463A 130%);
  box-shadow: 0 14px 36px -10px rgba(79,78,216,.35), 0 4px 10px rgba(79,78,216,.15);
  transition: transform .18s, box-shadow .18s;
  overflow: hidden;
  border: none;
  text-align: left;
}

.continue-card::after {
  content: '';
  position: absolute;
  top: -60px; right: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
  pointer-events: none;
}

.continue-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 48px -12px rgba(79,78,216,.45), 0 6px 14px rgba(79,78,216,.18);
}

[data-theme="dark"] .continue-card {
  background: linear-gradient(135deg,#4F4ED8 0%,#6B58D8 60%,#9B3F33 130%);
}

.continue-card .ico {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 38px;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18);
  flex-shrink: 0;
}

.continue-card .info { flex: 1; min-width: 0; }

.continue-card .label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  opacity: .82;
  margin-bottom: 4px;
}

.continue-card .title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.6px;
  line-height: 1.1;
  margin-bottom: 6px;
  color: #fff;
}

.continue-card .sub {
  font-size: 13px;
  opacity: .88;
  line-height: 1.4;
}

.continue-card .arrow {
  font-size: 26px;
  font-weight: 800;
  opacity: .9;
}

/* Goal card */
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 24px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.goal-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.goal-ring {
  --pct: 0deg;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--pct), var(--surface-3) 0);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.goal-ring-inner {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
}

.goal-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.goal-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Streak row */
.streak-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 22px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.streak-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.streak-row-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: var(--text-muted);
}

.streak-row-counter {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 99px;
}

.streak-grid {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 10px;
}

.streak-day {
  height: 92px;
  background: var(--surface-2);
  border-radius: 14px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all .15s;
}

.streak-day.done {
  background: linear-gradient(135deg, var(--tr-red), #A0382E);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 10px rgba(200,70,58,.25);
}

.streak-day.today {
  border: 2px dashed var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

@media (max-width: 600px) {
  .streak-day { height: 60px; font-size: 11px; }
}

/* Hello block */
.hello-block { margin: 0 0 24px; }

.hello-title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 8px;
}

.hello-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 600px) {
  .hello-title { font-size: 32px; }
}

/* stats-row is now obsolete, hide gracefully */
.stats-row { display: none; }
.daily-goal-card { display: none; }

/* ============================================================
   22. HOME PAGE (legacy compat)
   ============================================================ */

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  flex: 1;
  min-width: 130px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s, box-shadow 0.18s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.stat-card .stat-value,
.stat-card .stat-val {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.progress-ring {
  display: flex;
  align-items: center;
  justify-content: center;
}

.streak-days {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.streak-day {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.streak-day.done {
  background: var(--danger);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(239,68,68,.35);
}

/* ============================================================
   23. FLASHCARDS
   ============================================================ */
.flashcard-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 520px;
  margin: 0 auto;
}

.flashcard {
  width: 100%;
  min-height: 220px;
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
  user-select: none;
  position: relative;
  overflow: hidden;
}

/* Декоративный градиент в углу */
.flashcard::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  pointer-events: none;
}

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

.flashcard:active { transform: scale(0.99); }

.fc-word {
  font-size: 38px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fc-ipa {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.fc-answer {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.fc-example {
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  line-height: 1.55;
}

.fc-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}

.fc-btn {
  flex: 1;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.14s var(--ease-spring), filter 0.14s;
  letter-spacing: -0.01em;
}

.fc-btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.fc-btn:active { transform: scale(0.96); }

.fc-btn.wrong {
  background: var(--danger-soft);
  color: var(--danger);
}

.fc-btn.right {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.fc-progress {
  width: 100%;
  height: 5px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.fc-progress-bar {
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  border-radius: var(--radius-full);
  transition: width 0.35s var(--ease-smooth);
}

.fc-deck-info {
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
}

/* ============================================================
   23b. FLASHCARDS — HOME & STUDY (new architecture)
   ============================================================ */

/* ---- Home page ---- */
.fc-home-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fc-home-hero {
  padding: 12px 0 4px;
}

/* ---- SRS button ---- */
.fc-srs-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s;
  box-shadow: 0 4px 20px var(--primary-glow);
  text-align: left;
}
.fc-srs-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--primary-glow); }
.fc-srs-btn:active { transform: scale(0.98); }

.fc-srs-icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
}

.fc-srs-text { flex: 1; }

.fc-srs-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fc-srs-sub {
  font-size: 12.5px;
  opacity: 0.82;
  margin-top: 2px;
}

.fc-srs-arrow {
  font-size: 24px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ---- Section label ---- */
.fc-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 4px 0 0;
}

/* ---- Level row ---- */
.fc-levels-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.fc-level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 12px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.14s var(--ease-spring), box-shadow 0.14s, border-color 0.14s;
  text-align: center;
}
.fc-level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--lvl-color, var(--primary));
}
.fc-level-card:active { transform: scale(0.97); }

.fc-level-badge {
  font-size: 15px;
  font-weight: 800;
  color: var(--lvl-color, var(--primary));
  letter-spacing: -0.02em;
}

.fc-level-count {
  font-size: 11px;
  color: var(--text-muted);
}

.fc-level-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.fc-level-bar {
  height: 4px;
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-smooth);
}

.fc-level-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ---- Topics grid ---- */
.fc-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.fc-topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 12px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: transform 0.14s var(--ease-spring), box-shadow 0.14s, border-color 0.14s;
  text-align: center;
}
.fc-topic-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.fc-topic-card:active { transform: scale(0.97); }

.fc-topic-emoji {
  font-size: 26px;
  line-height: 1;
}

.fc-topic-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.fc-topic-count {
  font-size: 11px;
  color: var(--text-dim);
}

.fc-topic-progress {
  width: 100%;
  height: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 2px;
}

.fc-topic-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-smooth);
}

.fc-topic-pct {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ---- Study page ---- */
.fc-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  min-height: 0;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.fc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 12px;
  gap: 8px;
  flex-shrink: 0;
}

.fc-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0;
  transition: color 0.14s;
  white-space: nowrap;
}
.fc-back-btn:hover { color: var(--primary); }

.fc-deck-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.fc-counter {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Top progress bar */
.fc-top-progress {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.fc-top-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  border-radius: var(--radius-full);
  transition: width 0.35s var(--ease-smooth);
}

/* ---- Card stage ---- */
.fc-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 0 0 8px;
}

.flashcard-flip {
  width: 100%;
  max-width: 480px;
  min-height: 280px;
  background: var(--surface);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
}
.flashcard-flip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.flashcard-flip::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  pointer-events: none;
}

.fc-front,
.fc-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 32px 24px;
  min-height: 280px;
  width: 100%;
  box-sizing: border-box;
}

.fc-back {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 100%);
}

.fc-level-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 11px;
  font-weight: 700;
}

.fc-tap-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* Nav arrows on card */
.fc-nav-btns {
  display: flex;
  gap: 8px;
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
}

.fc-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.fc-nav-btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.08);
}
.fc-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Translation on back */
.fc-translation-big {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Action row ---- */
.fc-action-row {
  display: flex;
  gap: 10px;
  padding: 12px 0 8px;
  flex-shrink: 0;
}

.fc-show-answer {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: background 0.14s, transform 0.1s, box-shadow 0.14s;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.fc-show-answer:hover {
  background: var(--primary-strong);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.fc-show-answer:active { transform: scale(0.98); }

/* Know / don't know buttons */
.fc-action-row .fc-btn.wrong {
  flex: 1;
  padding: 14px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.14s var(--ease-spring), filter 0.14s;
}
.fc-action-row .fc-btn.right {
  flex: 1;
  padding: 14px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.14s var(--ease-spring), filter 0.14s;
}
.fc-action-row .fc-btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.fc-action-row .fc-btn:active { transform: scale(0.96); }

/* ---- Bottom info ---- */
.fc-bottom-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.fc-restart-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: color 0.14s;
}
.fc-restart-link:hover { color: var(--primary); text-decoration: underline; }

/* ---- Finish screen ---- */
.fc-finish {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.fc-finish-icon {
  font-size: 56px;
  line-height: 1;
  animation: finishPop 0.5s var(--ease-spring) both;
}

@keyframes finishPop {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.fc-finish-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.fc-finish-sub {
  font-size: 14.5px;
  color: var(--text-muted);
}

.fc-finish-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .fc-levels-row { grid-template-columns: repeat(2, 1fr); }
  .fc-topics-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .fc-translation-big { font-size: 24px; }
  .fc-finish-title { font-size: 22px; }
  .fc-deck-badge { max-width: 140px; font-size: 11.5px; }
}

/* ============================================================
   24. STORIES
   ============================================================ */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.story-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.story-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border);
  transition: background 0.18s;
}

.story-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.story-card.level-A1::before { background: var(--level-A1); }
.story-card.level-A2::before { background: var(--level-A2); }
.story-card.level-B1::before { background: var(--level-B1); }
.story-card.level-B2::before { background: var(--level-B2); }

.story-emoji { font-size: 30px; margin-bottom: 10px; display: block; }

.story-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.story-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 5px;
  letter-spacing: -0.02em;
}

.story-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.story-progress {
  height: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.story-progress-bar {
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.3s var(--ease-smooth);
}

/* Story reader */
.story-body { padding: 0 4px; margin-top: 16px; }

.story-line {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 5px;
}

.story-line .tr { font-size: 15px; line-height: 1.65; }

.story-line .ru {
  font-size: 13.5px;
  color: var(--text-muted);
  display: none;
}

.story-line .ru.visible { display: block; }

.line-eye {
  cursor: pointer;
  color: var(--primary);
  font-size: 12.5px;
  background: none;
  border: none;
  font-family: inherit;
  font-weight: 600;
  padding: 0;
  transition: opacity 0.14s;
}

.line-eye:hover { opacity: 0.7; }

.word.has-gloss {
  cursor: pointer;
  border-bottom: 2px dotted var(--primary);
  color: var(--primary);
}

.word.has-gloss:hover { opacity: 0.75; }

/* Word popup */
.word-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
}

.word-popup {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: scaleIn 0.18s var(--ease-smooth);
}

.wp-tr { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 4px; letter-spacing: -0.03em; }
.wp-ru { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.wp-form { font-size: 13px; color: var(--text-muted); font-style: italic; }

.wp-actions { display: flex; gap: 8px; margin-top: 12px; }

.wp-ai {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.65;
  min-height: 40px;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ============================================================
   25. VERBS
   ============================================================ */
.tense-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.tense-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
  box-shadow: var(--shadow-xs);
}

.tense-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tense-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; letter-spacing: -0.01em; }
.tense-sample { font-family: var(--font-mono); font-size: 12px; color: var(--primary); }
.tense-en { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tense-stats { font-size: 12px; color: var(--accent); margin-top: 8px; font-weight: 600; }

.verbs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  margin-top: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.verbs-table th {
  padding: 10px 14px;
  text-align: left;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.verbs-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}

.verbs-table tr:last-child td { border-bottom: none; }

.verbs-table tr:hover td { background: var(--surface-hover); }

.verb-inf { font-weight: 600; color: var(--primary); }
.verb-ru { color: var(--text-muted); font-size: 13px; }

/* Verb drill card */
.verb-card {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: 28px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.verb-task { font-size: 13.5px; color: var(--text-muted); margin-bottom: 12px; }
.verb-inf-big { font-size: 36px; font-weight: 800; color: var(--primary); letter-spacing: -0.04em; }
.verb-ru-big { font-size: 17px; color: var(--text-muted); margin-top: 4px; }
.verb-question { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }

.select-clean {
  appearance: none;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text);
  width: 100%;
  cursor: pointer;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.select-clean:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.verb-input {
  width: 100%;
  padding: 11px 15px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  margin: 8px 0;
  outline: none;
  transition: border-color 0.14s, background 0.14s, box-shadow 0.14s;
}

.verb-input:focus { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.verb-input.ok  { border-color: var(--accent); background: var(--accent-soft); }
.verb-input.err { border-color: var(--danger); background: var(--danger-soft); }

.verb-feedback {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-top: 8px;
  font-weight: 500;
}

.verb-feedback.ok  { background: var(--accent-soft); color: var(--accent-strong); }
.verb-feedback.err { background: var(--danger-soft); color: var(--danger); }

.verb-ai {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.65;
  border: 1px solid var(--border);
}

.verb-progress {
  height: 5px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  margin: 16px 0;
  overflow: hidden;
}

.verb-progress-bar {
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  border-radius: var(--radius-full);
  transition: width 0.35s var(--ease-smooth);
}

/* ============================================================
   26. READING LAB
   ============================================================ */
.reading-textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  line-height: 1.65;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.reading-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.reading-tabs {
  display: flex;
  gap: 0;
  margin: 16px 0 0;
  border-bottom: 1px solid var(--border);
}

.reading-tabs .tab {
  padding: 9px 18px;
  background: none;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition: color 0.14s, border-color 0.14s;
}

.reading-tabs .tab:hover { color: var(--text); }

.reading-tabs .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.reading-panel { display: none; }
.reading-panel.active { display: block; padding-top: 16px; }

.reading-out { font-size: 14px; line-height: 1.8; color: var(--text); }

.reading-history { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }

.history-item {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.14s;
  border: 1px solid var(--border);
}

.history-item:hover { background: var(--surface-hover); }

.history-src { font-size: 11.5px; color: var(--text-dim); margin-bottom: 4px; }
.history-tr { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   27. LESSONS
   ============================================================ */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.lesson-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 18px;
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
}

.lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.lesson-card .lesson-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.lesson-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.lesson-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.lesson-done { color: var(--accent); margin-left: auto; font-size: 17px; }

.lesson-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }

/* Lesson body */
.lesson-body { margin-top: 24px; }
.lesson-block { margin-bottom: 20px; }

.lesson-rule {
  background: var(--primary-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  border-left: 3px solid var(--primary);
  font-size: 14px;
  line-height: 1.7;
}

[data-theme="dark"] .lesson-rule {
  background: rgba(124, 128, 245, 0.08);
}

.lesson-example {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 4px 0;
  color: var(--text);
  border: 1px solid var(--border);
}

.lesson-exercise {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.exercise-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.exercise-opt {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}

.exercise-opt:hover {
  background: var(--surface-2);
  border-color: var(--primary);
}

.exercise-opt.correct {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.exercise-opt.wrong {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================
   28. GRAMMAR
   ============================================================ */
.grammar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.grammar-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}

.grammar-card:not(.grammar-card--locked):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.grammar-icon { font-size: 28px; margin-bottom: 10px; display: block; }
.grammar-topic-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; letter-spacing: -0.02em; }
.grammar-summary { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.grammar-detail { max-width: 720px; }

.grammar-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.grammar-table th,
.grammar-table td {
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.grammar-table th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.grammar-table tr:last-child td { border-bottom: none; }

.grammar-rule {
  background: var(--primary-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 10px 0;
  border-left: 3px solid var(--primary);
  font-size: 14px;
  line-height: 1.7;
}

[data-theme="dark"] .grammar-rule {
  background: rgba(124, 128, 245, 0.08);
}

.common-mistake {
  background: var(--warning-soft);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 8px 0;
  border-left: 3px solid var(--warning);
  font-size: 13px;
  line-height: 1.6;
}

/* ============================================================
   29. GAMES (Quiz, Match, Hangman, Wheel)
   ============================================================ */

/* --- Quiz --- */
.quiz-wrap { max-width: 560px; margin: 0 auto; }

.quiz-question {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  text-align: center;
  line-height: 1.4;
  letter-spacing: -0.03em;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quiz-opt {
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.14s, background 0.14s, transform 0.1s, box-shadow 0.14s;
  line-height: 1.4;
  font-weight: 500;
}

.quiz-opt:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.quiz-opt.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.quiz-opt.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

/* --- Match pairs --- */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.match-item {
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
  line-height: 1.4;
}

.match-item:hover { border-color: var(--primary); transform: scale(1.02); }

.match-item.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-glow);
}

.match-item.matched {
  border-color: var(--accent);
  background: var(--accent-soft);
  opacity: 0.55;
  cursor: default;
  transform: none;
}

/* --- Hangman --- */
.hangman-word {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
  flex-wrap: wrap;
}

.hangman-letter {
  width: 36px;
  height: 42px;
  border-bottom: 2.5px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.hangman-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 400px;
  margin: 20px auto;
}

.hangman-key {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.hangman-key:hover:not([disabled]) {
  background: var(--surface-hover);
  transform: scale(1.07);
}

.hangman-key.used-correct {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  cursor: default;
}

.hangman-key.used-wrong {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
  cursor: default;
  opacity: 0.6;
}

/* --- Wheel of Fortune --- */
.wheel-wrap { max-width: 480px; margin: 0 auto; text-align: center; }

.wheel-board {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.wheel-cell {
  width: 40px;
  height: 48px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.14s, background 0.14s;
  box-shadow: var(--shadow-xs);
}

.wheel-cell.revealed {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.wheel-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

/* ============================================================
   30. THEME SWITCH
   ============================================================ */
.theme-switch {
  display: flex;
  gap: 2px;
  padding: 6px 12px 10px;
  margin: 0 8px 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
}

.theme-switch button {
  flex: 1;
  padding: 5px 8px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.14s;
  line-height: 1;
  color: var(--text-muted);
}

.theme-switch button:hover { background: var(--surface-3); }

.theme-switch button.active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

[data-theme="dark"] .theme-switch { background: var(--surface-3); }
[data-theme="dark"] .theme-switch button.active { background: var(--surface-2); }

/* ============================================================
   31. USER WIDGET
   ============================================================ */
.user-widget {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-md);
  margin: 2px 8px;
  cursor: pointer;
  transition: background 0.14s;
}

.user-widget:hover { background: var(--surface-2); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.user-plan { font-size: 11px; color: var(--text-dim); }

/* ============================================================
   32. MISC UTILITIES
   ============================================================ */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 6px 0;
  flex-shrink: 0;
}

.crumbs {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.crumbs a { color: var(--primary); font-weight: 500; }
.crumbs .sep { color: var(--text-dim); }

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
  line-height: 1.2;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.55;
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; display: block; }

/* Progress bar generic */
.progress-bar-wrap {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--purple));
  transition: width 0.4s var(--ease-smooth);
}

/* Divider */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ============================================================
   33. AUTH / GATE PAGES
   ============================================================ */
.gate-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.gate-card {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: slideUp 0.25s var(--ease-smooth);
}

.gate-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.gate-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.gate-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s, background 0.14s;
  margin-bottom: 16px;
}

.field-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--surface);
}

.gate-link {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 16px;
}

.gate-link a { color: var(--primary); font-weight: 600; }

.gate-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 16px;
}

/* ============================================================
   34. ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.view > * { animation: fadeIn 0.22s var(--ease-smooth); }

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

.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.skeleton {
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  animation: pulse 1.5s ease infinite;
}

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

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

.modal-enter { animation: scaleIn 0.2s var(--ease-smooth); }

/* Card stagger */
@keyframes cardAppear {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.home-grid .module-card,
.lessons-grid .lesson-card,
.stories-grid .story-card,
.grammar-grid .grammar-card {
  animation: cardAppear 0.3s var(--ease-smooth) both;
}

.home-grid .module-card:nth-child(1) { animation-delay: .03s; }
.home-grid .module-card:nth-child(2) { animation-delay: .06s; }
.home-grid .module-card:nth-child(3) { animation-delay: .09s; }
.home-grid .module-card:nth-child(4) { animation-delay: .12s; }
.home-grid .module-card:nth-child(5) { animation-delay: .15s; }
.home-grid .module-card:nth-child(6) { animation-delay: .18s; }
.home-grid .module-card:nth-child(7) { animation-delay: .21s; }
.home-grid .module-card:nth-child(8) { animation-delay: .24s; }
.home-grid .module-card:nth-child(9) { animation-delay: .27s; }
.home-grid .module-card:nth-child(10) { animation-delay: .30s; }

/* ============================================================
   35. MOBILE / RESPONSIVE (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {

  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }

  .burger { display: flex !important; }

  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
    backdrop-filter: blur(12px);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
    display: none;
  }

  .sidebar-overlay.show { display: block; }

  .view {
    padding: 16px;
    padding-bottom: 80px;
  }

  .ai-fab { bottom: 76px; right: 16px; }

  .ai-chat-overlay { align-items: flex-end; }

  .ai-chat-panel {
    width: 100%;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }

  .quiz-options { grid-template-columns: 1fr; }

  .stats-row { flex-wrap: wrap; }

  .stat-card { min-width: calc(50% - 6px); }

  .topbar { padding: 0 14px; }

  .section-title { font-size: 20px; }

  .fc-word { font-size: 30px; }
  .fc-answer { font-size: 22px; }

  .verb-card { max-width: 100%; }

  .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

/* ============================================================
   36. DESKTOP-ONLY
   ============================================================ */
@media (min-width: 769px) {
  .burger { display: none; }
  .mobile-tabs { display: none; }
  .sidebar-overlay { display: none !important; }
  .sidebar { transform: translateX(0) !important; position: sticky; }
}

/* ============================================================
   37. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================================
   38. FOCUS / ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   39. SELECTION
   ============================================================ */
::selection {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

/* ============================================================
   40. PRINT
   ============================================================ */
@media print {
  .sidebar,
  .topbar,
  .mobile-tabs,
  .ai-fab,
  .ai-chat-overlay,
  .paywall-overlay { display: none !important; }

  .app { display: block; height: auto; }
  .main-shell { height: auto; overflow: visible; }
  .view { overflow: visible; padding: 0; }
}

/* ============================================================
   41. COMPAT ALIASES
   ============================================================ */

/* btn-primary / btn-secondary used without base .btn class */
.btn-primary:not(.btn) {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  box-shadow: 0 1px 2px rgba(91,95,239,.3);
  transition: background 0.14s, border-color 0.14s, transform 0.1s, box-shadow 0.14s;
  letter-spacing: -0.01em;
}

.btn-primary:not(.btn):hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:not(.btn):active { transform: scale(0.97); }

.btn-secondary {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
  letter-spacing: -0.01em;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-secondary:active { transform: scale(0.97); }

/* Topbar login link */
.btn-topbar-login {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: background 0.14s;
  display: inline-flex;
  align-items: center;
}

.btn-topbar-login:hover { background: var(--primary-strong); }
