@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Переменные ── */
:root {
  --bg: #080c14;
  --bg2: #0f1623;
  --surface: #141d2e;
  --surface2: #1a2540;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(139,92,246,0.4);
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139,92,246,0.35);
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --font: 'Inter', sans-serif;
  --radius: 12px;
  --radius-lg: 18px;
  --t: all 0.2s ease;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(139,92,246,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 90%, rgba(6,182,212,0.08) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ════════ Навигация ════════ */
.navbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 2rem; height: 64px;
  background: rgba(8,12,20,0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand {
  font-size: 1.2rem; font-weight: 800;
  display: flex; align-items: center; gap: 0.5rem;
  background: linear-gradient(135deg, #a78bfa, #67e8f9);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-tabs { display: flex; gap: 0.25rem; }
.nav-tab {
  background: transparent; border: none; color: var(--text2);
  font-size: 0.9rem; font-weight: 500; padding: 0.5rem 0.9rem;
  cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; gap: 0.4rem;
  position: relative; transition: var(--t);
}
.nav-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-tab.active { color: var(--text); background: rgba(139,92,246,0.15); }
.nav-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 20%; right: 20%;
  height: 2px; background: var(--primary); border-radius: 2px;
}
.tab-icon { font-size: 1rem; }
.tab-badge {
  background: var(--danger); color: white; font-size: 0.7rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 10px;
  position: absolute; top: 4px; right: 4px;
}
.nav-streak {
  display: flex; align-items: center; gap: 0.35rem;
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25);
  padding: 0.35rem 0.85rem; border-radius: 20px;
  font-size: 0.9rem; font-weight: 700; color: #fbbf24;
}

/* ════════ Экраны ════════ */
.screen { display: none; max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; animation: fadeUp 0.3s ease; }
.screen.active { display: block; }
.screen-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem;
}
.screen-header h1 { font-size: 1.6rem; font-weight: 700; }

/* ════════ Кнопки ════════ */
.btn {
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  padding: 0.6rem 1.2rem; border: none; border-radius: var(--radius);
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem;
  transition: var(--t); white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white; box-shadow: 0 4px 14px rgba(139,92,246,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(139,92,246,0.45); }
.btn-secondary {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-large { padding: 0.85rem 2rem; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-icon {
  background: var(--surface2); color: var(--text);
  width: 36px; height: 36px; border: none; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: var(--t);
}
.btn-icon:hover { background: rgba(255,255,255,0.12); }
.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-warning { background: linear-gradient(135deg,#f59e0b,#d97706); color: white; border: none; }
.btn-success { background: linear-gradient(135deg,#10b981,#059669); color: white; border: none; }
.btn-delete {
  background: transparent; border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; border-radius: 8px; padding: 0.3rem 0.6rem;
  font-size: 0.85rem; cursor: pointer; transition: var(--t);
}
.btn-delete:hover { background: rgba(239,68,68,0.12); }

/* ════════ Инпуты ════════ */
.input, .select {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 0.8rem 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; outline: none; font-family: var(--font); font-size: 0.95rem;
  transition: border-color 0.2s;
}
.input:focus, .select:focus { border-color: var(--primary); }
.textarea { resize: vertical; min-height: 150px; }
.select option { background: var(--bg2); }

/* ════════ Ридер ════════ */
.reader-actions { display: flex; gap: 0.6rem; }
.reader-empty {
  text-align: center; padding: 5rem 2rem;
  background: var(--surface);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.7; }
.reader-empty h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.reader-empty p { color: var(--text2); margin-bottom: 2rem; }
.empty-actions { margin-bottom: 2rem; }

.drop-zone {
  margin-top: 2rem; padding: 2.5rem;
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius); transition: var(--t);
}
.drop-zone.dragover { border-color: var(--primary); background: rgba(139,92,246,0.07); }
.drop-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.reader-content {
  background: #fafafa; color: #1e293b;
  border-radius: var(--radius-lg); padding: 0;
  font-size: 1.1rem; line-height: 1.85;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  overflow: hidden;
}
.reader-title-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 2rem;
  background: white; border-bottom: 1px solid #e2e8f0;
}
.reader-title-bar h2 { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.reader-title-bar .btn-ghost { color: #64748b; }
.reader-title-bar .btn-ghost:hover { color: #1e293b; background: #f1f5f9; }
.reader-text { padding: 2rem 2.5rem 3rem; }
.reader-text p { margin-bottom: 1.2rem; }
.reader-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem 1.5rem;
  background: white; border-top: 1px solid #e2e8f0;
}
.page-info { color: #64748b; font-size: 0.9rem; font-weight: 500; }

.clickable-word { cursor: pointer; border-radius: 3px; transition: 0.15s; padding: 0 1px; }
.clickable-word:hover { background: rgba(139,92,246,0.2); }
.clickable-word.status-new { border-bottom: 2px solid rgba(99,102,241,0.5); }
.clickable-word.status-learning { border-bottom: 2px solid rgba(245,158,11,0.6); }
.clickable-word.status-known { border-bottom: none; opacity: 0.7; }

/* ════════ Word Popup ════════ */
.word-popup {
  position: absolute;
  background: rgba(15,22,36,0.97);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 1.25rem; width: 400px;
  max-width: calc(100vw - 16px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.7), 0 0 0 1px rgba(139,92,246,0.1);
  z-index: 1000; color: var(--text);
  animation: popIn 0.15s ease;
}
.word-popup-header {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap;
}
.word-popup-header h3 { font-size: 1.3rem; font-weight: 700; margin-right: auto; }
.accent-toggle { display: flex; gap: 0.15rem; margin-left: auto; }
.accent-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text3);
  border-radius: 4px; padding: 0.1rem 0.5rem; font-size: 0.72rem; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: var(--t);
}
.accent-btn.active { background: rgba(139,92,246,0.2); border-color: var(--primary); color: #a78bfa; }
.popup-transcription { color: var(--text3); font-size: 0.85rem; font-family: monospace; }
/* Метаданные слова */
.popup-meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.6rem;
}
.meta-tag {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem; border-radius: 4px; white-space: nowrap;
}
/* CEFR уровни */
.meta-cefr.cefrA1 { background: rgba(16,185,129,0.15);  color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.meta-cefr.cefrA2 { background: rgba(6,182,212,0.15);   color: #67e8f9; border: 1px solid rgba(6,182,212,0.3); }
.meta-cefr.cefrB1 { background: rgba(139,92,246,0.15);  color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }
.meta-cefr.cefrB2 { background: rgba(245,158,11,0.15);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.meta-cefr.cefrC1 { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.meta-cefr.cefrC2 { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
/* Частота */
.meta-freq { background: rgba(255,255,255,0.07); color: var(--text3); border: 1px solid var(--border); }
/* Регистр/стиль */
.reg-neutral  { background: rgba(255,255,255,0.06); color: var(--text3); border: 1px solid var(--border); }
.reg-informal { background: rgba(16,185,129,0.12);  color: #6ee7b7; border: 1px solid rgba(16,185,129,0.25); }
.reg-formal   { background: rgba(59,130,246,0.12);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); }
.reg-slang    { background: rgba(249,115,22,0.12);  color: #fdba74; border: 1px solid rgba(249,115,22,0.25); }
.reg-archaic  { background: rgba(100,116,139,0.12); color: #94a3b8; border: 1px solid rgba(100,116,139,0.25); }
.reg-tech     { background: rgba(139,92,246,0.12);  color: #c4b5fd; border: 1px solid rgba(139,92,246,0.25); }

.popup-translations { margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.popup-trans-row { display: flex; align-items: flex-start; gap: 0.5rem; }
.trans-source {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 4px; padding: 0.15rem 0.45rem; white-space: nowrap; margin-top: 0.15rem; flex-shrink: 0;
}
.src-google   { background: rgba(66,133,244,0.15); color: #93c5fd; }
.src-mymemory { background: rgba(139,92,246,0.15); color: #a78bfa; }
.src-lingva   { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.src-deepl    { background: rgba(15,118,110,0.2);  color: #5eead4; }
.src-reverso  { background: rgba(249,115,22,0.15); color: #fdba74; }
.trans-value { font-size: 0.98rem; font-weight: 500; color: var(--text); }

/* Блок определения */
.popup-definition-block {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.7rem 0.85rem; margin-bottom: 0.75rem;
}
.popup-def-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.popup-def-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); }
.popup-def-lang-toggle { display: flex; gap: 0.2rem; }
.def-lang-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text3);
  border-radius: 4px; padding: 0.1rem 0.5rem; font-size: 0.72rem; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: var(--t);
}
.def-lang-btn.active { background: rgba(139,92,246,0.2); border-color: var(--primary); color: #a78bfa; }
.popup-def-text { font-size: 0.88rem; color: var(--text2); line-height: 1.5; font-style: italic; }
/* Reverso Context примеры */
.reverso-section { margin-bottom: 0.6rem; }
.reverso-toggle {
  width: 100%; background: rgba(249,115,22,0.07); border: 1px solid rgba(249,115,22,0.2);
  color: #fdba74; border-radius: 8px; padding: 0.45rem 0.85rem;
  font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: var(--font);
  display: flex; justify-content: space-between; align-items: center;
  transition: var(--t);
}
.reverso-toggle:hover { background: rgba(249,115,22,0.12); }
.reverso-toggle-arrow { font-size: 0.9rem; transition: var(--t); }
.reverso-examples {
  background: rgba(249,115,22,0.05); border: 1px solid rgba(249,115,22,0.15);
  border-top: none; border-radius: 0 0 8px 8px; padding: 0.65rem 0.85rem;
}
.reverso-example { margin-bottom: 0.55rem; }
.reverso-example:last-child { margin-bottom: 0; }
.rev-en { display: block; font-size: 0.85rem; color: var(--text); font-style: italic; }
.rev-ru { display: block; font-size: 0.82rem; color: var(--text2); margin-top: 0.1rem; }

/* Подсветка слова в контексте */
.ctx-highlight {
  background: rgba(139,92,246,0.3); color: #e9d5ff;
  border-radius: 3px; padding: 0 2px; font-style: normal; font-weight: 700;
}

.popup-context {
  background: rgba(255,255,255,0.04); padding: 0.7rem 0.9rem;
  border-radius: 8px; font-size: 0.88rem; color: var(--text2);
  font-style: italic; margin-bottom: 1rem; border-left: 3px solid var(--primary);
}
.popup-add-btn, .popup-known-btn { font-size: 0.85rem; padding: 0.55rem 0.9rem; }
.popup-close-btn { font-size: 0.85rem; margin-top: 0.25rem; }

/* ════════ Карточки ════════ */
.cards-meta { display: flex; align-items: center; gap: 1rem; }
.card-container { display: flex; flex-direction: column; align-items: center; margin-top: 2rem; perspective: 1200px; }
.flashcard { width: 100%; max-width: 580px; height: 360px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.55s cubic-bezier(0.4,0,0.2,1); transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateX(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 2rem; text-align: center;
}
.flashcard-front {
  background: var(--surface);
  border: 1px solid var(--border);
}
.flashcard-back {
  transform: rotateX(180deg);
  background: linear-gradient(135deg, #1e1040, #0f1e40);
  border: 1px solid rgba(139,92,246,0.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.card-label { color: var(--text3); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.75rem; display: block; }
.card-context { font-size: 1.15rem; font-style: italic; color: var(--text); margin-bottom: 0.75rem; line-height: 1.6; text-align: center; }
.card-gap { font-style: normal; font-weight: 800; color: var(--primary); border-bottom: 2px solid var(--primary); padding: 0 4px; }
.card-hint { color: var(--text3); font-size: 0.82rem; margin-top: auto; }
.card-mark { background: rgba(139,92,246,0.25); color: #e9d5ff; border-radius: 3px; padding: 0 3px; font-style: normal; font-weight: 700; }
.card-context-ru { font-size: 0.82rem; color: var(--text3); font-style: italic; margin-top: 0.4rem; text-align: center; }
.flashcard-back h3 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.3rem; }
.card-transcription { color: var(--text3); font-family: monospace; margin-bottom: 0.5rem; }
.card-translation { font-size: 1.4rem; color: #a78bfa; margin-bottom: 1rem; font-weight: 600; }
.card-context-back { font-size: 0.85rem; color: var(--text2); font-style: italic; margin-top: 0.5rem; }
.card-speak { margin-bottom: 0.25rem; }
.card-buttons {
  display: flex; gap: 0.75rem; margin-top: 1.5rem;
  opacity: 0; pointer-events: none; transition: 0.3s;
}
.flashcard.flipped + .card-buttons { opacity: 1; pointer-events: all; }
.card-buttons .btn {
  flex: 1; flex-direction: column; gap: 0.2rem;
  padding: 0.7rem 0.5rem; font-size: 0.9rem;
  border-radius: var(--radius);
}
.card-buttons small { opacity: 0.75; font-size: 0.72rem; font-weight: 400; }
.cards-done, .cards-empty { text-align: center; padding: 4rem 2rem; }

.word-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-top: 2rem; }
.word-set-card {
  background: var(--surface); padding: 1.5rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  transition: var(--t);
}
.word-set-card:hover { border-color: var(--primary); transform: translateY(-2px); }

/* ════════ Уроки ════════ */
.lessons-grid { display: block; }

/* Уровневые секции */
.level-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.level-header {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.level-pill {
  font-size: 1rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 0.35rem 0.85rem; border-radius: 8px;
  white-space: nowrap; flex-shrink: 0; margin-top: 0.1rem;
  background: rgba(139,92,246,0.15); color: #a78bfa;
}
.level-pill.A1 { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.level-pill.A2 { background: rgba(6,182,212,0.15); color: #67e8f9; border: 1px solid rgba(6,182,212,0.3); }
.level-pill.B1 { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }
.level-pill.B2 { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.level-pill.C1 { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.level-info { flex: 1; }
.level-info h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
.level-info p { color: var(--text2); font-size: 0.85rem; line-height: 1.4; }
.level-vocab {
  font-size: 0.78rem; color: var(--text3); white-space: nowrap;
  margin-top: 0.15rem; flex-shrink: 0;
}
.level-lessons { padding: 0.5rem 0; }
.lesson-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.5rem; cursor: pointer;
  transition: var(--t); border-bottom: 1px solid var(--border);
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: rgba(255,255,255,0.04); }
.lesson-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text3); flex-shrink: 0;
}
.lesson-item-info { flex: 1; }
.lesson-item-info strong { display: block; font-size: 0.95rem; font-weight: 600; }
.lesson-item-info span { display: block; font-size: 0.82rem; color: var(--text2); margin-top: 0.1rem; }
.lesson-arrow { color: var(--text3); font-size: 1rem; flex-shrink: 0; }
.lesson-item:hover .lesson-arrow { color: var(--primary); }

/* Старые карточки уроков (для обратной совместимости) */
.lesson-card {
  background: var(--surface); padding: 1.5rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  cursor: pointer; transition: var(--t);
}
.lesson-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139,92,246,0.15); }
.lesson-category {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  background: rgba(139,92,246,0.15); color: #a78bfa;
  padding: 0.25rem 0.65rem; border-radius: 6px; margin-bottom: 0.75rem; display: inline-block;
}
.lesson-content {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 2.5rem; border: 1px solid var(--border);
}
.lesson-header { margin-bottom: 2rem; }
.lesson-subtitle { color: var(--text2); font-size: 0.9rem; }
.grammar-examples {
  background: rgba(0,0,0,0.25); padding: 1.5rem;
  border-radius: var(--radius); margin: 1.5rem 0; border: 1px solid var(--border);
}
.example { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.example:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.example .en { font-weight: 600; color: var(--text); font-size: 1.05rem; display: block; margin-bottom: 0.2rem; }
.example .ru { color: var(--text2); font-size: 0.9rem; }
.markers {
  background: rgba(139,92,246,0.07); border: 1px dashed rgba(139,92,246,0.4);
  padding: 1rem; border-radius: 8px; color: #d8b4fe;
  font-family: monospace; font-size: 0.9rem;
}

/* ════════ Тренировки ════════ */
.training-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.training-mode-card {
  background: var(--surface); padding: 2rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  text-align: center; cursor: pointer; transition: var(--t);
}
.training-mode-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139,92,246,0.12); }
.mode-icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }
.training-session {
  background: var(--surface); padding: 2rem;
  border-radius: var(--radius-lg); max-width: 680px; margin: 0 auto;
  border: 1px solid var(--border);
}
.training-progress-bar {
  width: 100%; height: 6px; background: rgba(255,255,255,0.07);
  border-radius: 3px; overflow: hidden; margin-bottom: 1.25rem;
}
.training-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); width: 0%; transition: 0.4s; }
.training-meta { display: flex; justify-content: space-between; color: var(--text2); font-size: 0.88rem; margin-bottom: 1.5rem; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1.5rem; }
.quiz-option {
  background: var(--surface2); padding: 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); cursor: pointer; transition: var(--t); text-align: center;
}
.quiz-option:hover { border-color: var(--primary); background: rgba(139,92,246,0.1); }
.quiz-option.selected { border-color: var(--primary); background: rgba(139,92,246,0.15); }
.training-feedback {
  padding: 0.9rem 1.2rem; border-radius: var(--radius);
  font-weight: 600; text-align: center; margin: 1.25rem 0;
}
.training-feedback.correct { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.training-feedback.wrong { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
#train-input { font-size: 1.3rem; text-align: center; margin-bottom: 1rem; }

/* ════════ Прогресс ════════ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.stat-card {
  background: var(--surface); padding: 1.5rem;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.streak-card { border-color: rgba(245,158,11,0.25); background: linear-gradient(135deg, rgba(245,158,11,0.06), var(--surface)); }
.stat-value { font-size: 2.5rem; font-weight: 800; line-height: 1; margin-bottom: 0.5rem; }
.stat-label { color: var(--text2); font-size: 0.85rem; }
.vocab-section { background: var(--surface); border-radius: var(--radius-lg); padding: 1.5rem; border: 1px solid var(--border); }
.vocab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.vocab-count { color: var(--text2); font-size: 0.88rem; }
.vocab-filters { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); padding: 0.35rem 0.9rem; border-radius: 20px;
  cursor: pointer; font-size: 0.85rem; font-family: var(--font); transition: var(--t);
}
.filter-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-btn.active { background: rgba(139,92,246,0.15); border-color: var(--primary); color: var(--text); }
.vocab-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 0; border-bottom: 1px solid var(--border);
}
.vocab-item:last-child { border-bottom: none; }
.vocab-word { font-weight: 600; }
.vocab-trans { color: var(--text3); font-family: monospace; font-size: 0.85rem; margin-left: 0.5rem; }
.vocab-translation { color: var(--text2); font-size: 0.88rem; margin-top: 0.1rem; }
.vocab-status { font-size: 0.78rem; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 6px; }
.status-new { background: rgba(99,102,241,0.15); color: #818cf8; }
.status-learning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-mastered { background: rgba(16,185,129,0.15); color: #34d399; }

/* ════════ Модалки ════════ */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--bg2);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  width: 100%; max-width: 500px;
  height: min(640px, calc(100vh - 2rem));
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.06); border: none; color: var(--text2);
  width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: var(--t);
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.modal-body { padding: 1.25rem 1.5rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-wide { max-width: 680px; }

/* Вкладки библиотеки */
.lib-tabs {
  display: flex; gap: 0.25rem; padding: 0.75rem 1.5rem 0;
  flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.lib-tab {
  background: transparent; border: none; color: var(--text2);
  font-size: 0.88rem; font-weight: 500; padding: 0.5rem 1rem 0.65rem;
  cursor: pointer; border-radius: 8px 8px 0 0;
  transition: var(--t); position: relative; font-family: var(--font);
}
.lib-tab:hover { color: var(--text); }
.lib-tab.active { color: var(--text); }
.lib-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--primary); border-radius: 2px 2px 0 0;
}
.lib-panel {}

.lib-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 1rem; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 0.6rem; cursor: pointer; transition: var(--t);
}
.lib-item:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.12); }
.lib-item strong { display: block; font-size: 0.95rem; }
.lib-item small { display: block; color: var(--text2); font-size: 0.82rem; margin-top: 0.15rem; }

/* Каталог */
.catalog-filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.catalog-filters .select { flex: 1; margin: 0; }
.catalog-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1rem; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 0.6rem; transition: var(--t);
}
.catalog-item:hover { background: rgba(255,255,255,0.06); }
.catalog-item-info { flex: 1; min-width: 0; }
.catalog-item-info strong { display: block; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catalog-item-info small { color: var(--text2); font-size: 0.8rem; }
.level-badge {
  background: rgba(139,92,246,0.15); color: #a78bfa;
  border-radius: 6px; padding: 0.2rem 0.55rem;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.level-badge.A1 { background: rgba(16,185,129,0.15); color: #34d399; }
.level-badge.A2 { background: rgba(6,182,212,0.15); color: #67e8f9; }
.level-badge.B1 { background: rgba(139,92,246,0.15); color: #a78bfa; }
.level-badge.B2 { background: rgba(245,158,11,0.15); color: #fbbf24; }
.level-badge.C1 { background: rgba(239,68,68,0.15); color: #f87171; }

.my-book-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1rem; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 0.6rem; transition: var(--t);
}
.my-book-item:hover { background: rgba(255,255,255,0.06); }
.my-book-item-info { flex: 1; cursor: pointer; }
.my-book-item-info strong { display: block; font-size: 0.92rem; }
.my-book-item-info small { color: var(--text2); font-size: 0.8rem; }
.my-book-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ════════ TTS кнопка ════════ */
.selection-speak-btn { position: fixed; z-index: 9999; pointer-events: none; }
.selection-speak-btn button {
  pointer-events: all;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff; border: none; border-radius: 20px;
  padding: 0.45rem 1.1rem; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 20px rgba(109,40,217,0.5);
  transition: var(--t); white-space: nowrap; font-family: var(--font);
}
.selection-speak-btn button:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(109,40,217,0.65); }
.selection-speak-btn button.playing { background: linear-gradient(135deg, #059669, #047857); box-shadow: 0 4px 20px rgba(5,150,105,0.4); }

/* ════════ Анимации ════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ════════ Результаты тренировки ════════ */
.result-stats { display: flex; gap: 2rem; justify-content: center; margin: 1.5rem 0 2rem; }
.result-stat { text-align: center; }
.result-value { font-size: 2.5rem; font-weight: 800; display: block; }
.result-label { color: var(--text2); font-size: 0.85rem; }

/* ════════ МОБИЛЬНАЯ АДАПТАЦИЯ (≤ 640px) ════════ */
@media (max-width: 640px) {

  /* ── Навбар: скрываем вкладки, оставляем бренд + стрик ── */
  .navbar { padding: 0 1rem; height: 56px; }
  .nav-tabs { display: none; }

  /* ── Нижняя навигация ── */
  .bottom-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(8,12,20,0.95);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 0.4rem 0 calc(0.4rem + env(safe-area-inset-bottom));
  }
  .bottom-nav-btn {
    flex: 1; background: none; border: none; color: var(--text3);
    display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
    padding: 0.3rem 0.25rem; cursor: pointer; font-family: var(--font);
    font-size: 0.62rem; font-weight: 600; transition: color 0.2s;
    position: relative;
  }
  .bottom-nav-btn .bn-icon { font-size: 1.3rem; line-height: 1; }
  .bottom-nav-btn.active { color: var(--primary); }
  .bottom-nav-btn .tab-badge {
    top: -2px; right: calc(50% - 20px);
  }

  /* ── Экраны: отступ снизу под нижнюю панель ── */
  .screen { padding: 1rem 1rem 5rem; }

  /* ── Заголовок экрана ── */
  .screen-header { margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem; }
  .screen-header h1 { font-size: 1.3rem; }
  .reader-actions { gap: 0.4rem; flex-wrap: wrap; }
  .reader-actions .btn { font-size: 0.8rem; padding: 0.5rem 0.75rem; }

  /* ── Попап слова: bottom sheet ── */
  .word-popup {
    position: fixed !important;
    bottom: 60px; left: 0 !important; right: 0 !important; top: auto !important;
    width: 100% !important; max-width: 100% !important;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    max-height: 85vh; overflow-y: auto;
    animation: slideUp 0.2s ease;
  }

  /* ── Попап слова: drag handle ── */
  .word-popup::before {
    content: ''; display: block;
    width: 40px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.15);
    margin: 0 auto 0.75rem;
  }

  /* ── Модалки ── */
  .modal { max-width: 100% !important; height: min(90vh, 600px); border-radius: 20px 20px 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* ── Ридер ── */
  .reader-text { padding: 1.25rem 1rem 2rem; }
  .reader-title-bar { padding: 1rem; }
  .reader-pagination { padding: 0.75rem 1rem; }
  .reader-pagination .btn { font-size: 0.8rem; padding: 0.5rem 0.75rem; }

  /* ── Флэшкарты ── */
  .flashcard { height: 260px; }
  .flashcard-back h3 { font-size: 1.8rem; }
  .card-translation { font-size: 1.1rem; }
  .card-buttons { gap: 0.4rem; }
  .card-buttons .btn { font-size: 0.8rem; padding: 0.6rem 0.3rem; }

  /* ── Прогресс ── */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.8rem; }

  /* ── Уроки ── */
  .level-header { flex-wrap: wrap; gap: 0.6rem; }
  .level-vocab { width: 100%; }

  /* ── Тренировка ── */
  .quiz-options { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .quiz-option { padding: 0.75rem 0.5rem; font-size: 0.85rem; }

  /* ── Таблица каталога ── */
  .catalog-filters { flex-direction: column; }

  /* ── Акцент тоггл ── */
  .accent-toggle { margin-left: 0; }
}

/* ── Нижняя навигация скрыта на десктопе ── */
.bottom-nav { display: none; }
