/* ============================================================
   Myriad Pro
   ============================================================ */
@font-face {
  font-family: 'MyriadPro';
  src: url('../fonts/MyriadPro-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MyriadPro';
  src: url('../fonts/MyriadPro-Light.otf') format('opentype');
  font-weight: 300 500;
  font-style: normal;
  font-display: swap;
}


/* ============================================================
   Variables — Light theme (default)
   ============================================================ */
:root {
  --bg:      #eff0e7;
  --bg2:     #ffffff;
  --bg3:     #f5f5ed;
  --border:  #e0e0d6;
  --text:    #1a1a18;
  --text2:   #6b7280;
  --text3:   #9ca3af;
  --accent:  #10b981;
  --accent2: #059669;
  --accent-glow: rgba(16, 185, 129, 0.15);
  --nav-active: #1a2e26;
  --teal-dark: #1c3a30;
  --green:   #10b981;
  --red:     #e05547;
  --yellow:  #c8d940;
  --blue:    #3b82f6;
  --purple:  #a855f7;
  --shadow:  0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --radius:  16px;
  --radius-sm: 10px;
  --transition: 0.18s ease;
}

/* Dark mode overrides */
body.dark {
  --bg:      #181d2a;
  --bg2:     #212638;
  --bg3:     #2b3048;
  --border:  #383d58;
  --text:    #e8eaf6;
  --text2:   #9095b8;
  --text3:   #6a6f90;
  --accent:  #818cf8;
  --accent2: #6366f1;
  --accent-glow: rgba(129, 140, 248, 0.2);
  --shadow:  0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Browsers apply a default (often black/square) outline on plain :focus,
   which can fire after an ordinary mouse click on buttons/tabs/chips — not
   just keyboard navigation. Suppress that, keep a real outline only for
   :focus-visible (genuine keyboard/AT focus), so nothing looks broken on
   click but keyboard users still see where focus is. */
button, .btn, a, input, select, textarea, [tabindex] { outline: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Fields that already have their own deliberate focus treatment (border-color
   change) would otherwise show that PLUS this generic ring — a double
   outline. Keep only their existing style on focus. */
.input:focus-visible, .select:focus-visible,
.typing-input:focus-visible, .yg-seek-input:focus-visible {
  outline: none;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.25s, color 0.25s;
  overflow-y: scroll;
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 62px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

body.dark .nav { border-bottom-color: var(--border); }

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

.nav-inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 40px;
}

.nav-logo { display: none; }

.nav-title { display: none; }

.nav-logo-text {
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.3px;
  user-select: none;
}

.logo-words {
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}

.logo-dot {
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}

.logo-expert {
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}

.nav-center {
  display: flex;
  gap: 2px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.nav-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
}

.nav-btn:hover { color: var(--text); background: var(--bg3); }
.nav-btn.active {
  background: var(--nav-active);
  color: #fff;
}

.nav-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-add-btn {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 10px;
  white-space: nowrap;
}

.lang-toggle {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  padding: 4px 11px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

.theme-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text2);
}

.theme-btn:hover { border-color: var(--accent); background: var(--accent-glow); }

.voice-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text2);
}

.voice-btn:hover { border-color: var(--accent); background: var(--accent-glow); }

.settings-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
}
.settings-btn:hover { border-color: var(--accent); background: var(--accent-glow); }

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

/* Voice popover */
.voice-popover {
  position: fixed;
  z-index: 500;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  width: 320px;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.15s ease;
}

.voice-popover.hidden { display: none; }

.voice-popover-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.voice-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
  width: 100%;
}

.voice-item:hover { background: var(--bg3); }

.voice-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.voice-quality { font-size: 13px; flex-shrink: 0; }

.voice-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-item.active .voice-name { color: var(--accent); }

.voice-lang {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
}

.voice-none { font-size: 13px; color: var(--text3); padding: 8px; }

/* ============================================================
   Main layout
   ============================================================ */
.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 40px;
}

.page { display: none; }
.page.active { display: block; }
.page-title { font-size: 28px; font-weight: 600; margin-bottom: 24px; color: var(--text); }

/* ============================================================
   Dashboard — new layout
   ============================================================ */

/* Hero row */
.dash-hero-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dash-hero-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 40px 36px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-hero-blob {
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  background: #d4e8a0;
  border-radius: 50% 40% 60% 40%;
  opacity: 0.55;
  pointer-events: none;
}

.dash-meta {
  font-size: 13px;
  color: var(--text3);
  font-weight: 500;
}

.dash-greeting h1 {
  font-size: clamp(30px, 3.5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--text);
  margin: 0;
}

.dash-name { color: var(--accent); }

.dash-hero-desc {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.6;
  max-width: 420px;
}

.dash-desc-link { color: var(--accent); }

/* Action buttons */
.dash-actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.dash-btn-primary {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
}
.dash-btn-primary:hover { opacity: 0.88; }

.dash-btn-outline {
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition);
}
.dash-btn-outline:hover { border-color: var(--text3); }

/* Word of the Day — dark card */
.dash-wotd-dark {
  background: var(--teal-dark);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  color: #fff;
  min-height: 280px;
}

.wotd-quote-label {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.6);
}

.wotd-quote-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.wotd-quote-icon {
  font-size: 40px;
  color: rgba(255,255,255,0.25);
  line-height: 1;
}

.wotd-quote-text {
  font-size: 20px;
  font-weight: 500;
  font-style: italic;
  line-height: 1.5;
  color: #fff;
  margin: 0;
}

.wotd-quote-author {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}


/* Progress cards */
.dash-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.dash-prog-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-prog-lbl {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
}

.dash-prog-top {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.dash-prog-val {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}

.dash-prog-goal {
  font-size: 15px;
  color: var(--text3);
  font-weight: 500;
}

.dash-prog-bar {
  height: 4px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
}

.dash-prog-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.dash-prog-fill-green { background: var(--green); }
.dash-prog-fill-blue  { background: var(--blue); }

/* Lower row: activity + quote */
.dash-lower-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.dash-activity-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.dash-activity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.dash-activity-sup {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  margin-bottom: 4px;
}

.dash-sessions-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.dash-activity-stats {
  display: flex;
  gap: 20px;
}

.dash-stat-item { text-align: right; }

.dash-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.dash-stat-lbl {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  display: block;
}

/* Heatmap legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text3);
}

.heatmap-legend-scale {
  display: flex;
  gap: 3px;
}

/* Streak badge (keep for compat) */
.dash-streak-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 12px;
  border-radius: 10px;
}

.dash-count-badge {
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 4px;
}

/* Word of the Day — old compat selectors */
#dash-wotd {
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  .dash-hero-row { grid-template-columns: 1fr; }
  .dash-lower-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-progress-grid { grid-template-columns: 1fr 1fr; }
  .dash-hero-card { padding: 24px 20px; }
}


/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg2);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

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

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

.btn-large { padding: 14px 32px; font-size: 16px; border-radius: var(--radius); }
.btn-sm    { padding: 6px 12px; font-size: 12px; }

/* ============================================================
   Learn card (new words presentation)
   ============================================================ */
.learn-card { align-items: flex-start; text-align: left; padding: 36px 40px; }

.learn-badge {
  background: rgba(16,185,129,0.12) !important;
  color: var(--green) !important;
}

.learn-remedial-badge {
  background: rgba(245,158,11,0.12) !important;
  color: #d97706 !important;
}

.learn-word {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}

.learn-meaning { width: 100%; margin-bottom: 4px; }

.learn-translation {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.learn-definition {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.5;
}

.learn-hint-def {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 18px;
}

.learn-actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  width: 100%;
  justify-content: center;
}

.learn-actions .btn-primary { background: linear-gradient(135deg, var(--green), #059669); min-width: 140px; }
.learn-actions .btn-secondary { min-width: 120px; }

/* Rep progress dots */
.learn-reps {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}
.learn-rep-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  transition: background 0.25s, border-color 0.25s;
}
.learn-rep-dot.done {
  background: var(--green);
  border-color: var(--green);
}

/* "Memorized!" badge */
.learn-done-badge {
  margin-top: 12px;
  color: var(--green);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  animation: fadeSlideDown 0.3s ease;
}

.learn-word-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.learn-result-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

/* ============================================================
   Learn — Word Selection Screen
   ============================================================ */
.learn-selection {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.learn-sel-status {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.learn-sel-card {
  width: 100%;
  background: var(--bg2);
  border-radius: var(--radius-lg, 10px);
  padding: 32px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sel-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sel-status-badge.sel-status-continue { color: #d97706; background: rgba(245,158,11,0.12); }
.sel-status-badge.sel-status-newmeaning { color: var(--accent); background: var(--accent-glow); }
.sel-status-note { font-size: 11px; color: var(--text3); margin-top: 4px; }

.test-personal-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text3); margin-top: 6px; }
.test-personal-badge { font-size: 11px; font-weight: 700; color: #d97706; background: rgba(245,158,11,0.12); padding: 2px 8px; border-radius: 6px; }

.test-deck-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.test-deck-badge { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-glow); padding: 2px 8px; border-radius: 6px; }

.test-meaning-status { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; }
.test-meaning-status.test-meaning-started { color: var(--accent); }
.test-meaning-status.test-meaning-pending { color: #d97706; }

.sel-card-word {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.sel-card-transcription {
  font-size: 16px;
  color: var(--text3);
}

.sel-card-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.sel-card-translation {
  font-size: 18px;
  color: var(--text2);
  margin-top: 8px;
}

.learn-sel-actions {
  width: 100%;
}

.learn-sel-actions .btn { width: 100%; }

.learn-sel-secondary {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.sel-card-meanings {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  text-align: left;
}

.sel-card-meaning {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.sel-card-pos {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.sel-card-trans {
  font-size: 16px;
  color: var(--text);
}

.sel-card-def {
  font-size: 14px;
  color: var(--text3);
  margin-top: 4px;
  margin-bottom: 4px;
  line-height: 1.4;
}

.sel-card-example {
  padding: 6px 0 2px 4px;
}

.sel-ex-en {
  font-size: 13px;
  color: var(--text2);
  font-style: italic;
}

.sel-ex-ru {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
  padding-left: 20px;
}

/* ============================================================
   Learn — Letter Picker
   ============================================================ */
.letter-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 24px 0 8px;
}

.letter-slot {
  width: 44px;
  height: 52px;
  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;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
}

.letter-slot.filled {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.letter-slot.filled:hover { border-color: var(--red); background: var(--red); }

.letter-slot.active {
  background: #fff;
}

.letter-slot.correct {
  border-color: transparent;
  background: #fff;
  color: var(--text);
}

.letter-slot.incorrect {
  border-color: var(--red);
  background: rgba(244,63,94,0.08);
  color: var(--red);
}

@keyframes flashRed {
  0%   { border-color: var(--red); background: rgba(244,63,94,0.25); }
  100% { border-color: var(--red); background: rgba(244,63,94,0.05); }
}

.letter-slot.flash-red {
  animation: flashRed 0.45s ease-out;
  border-color: var(--red) !important;
  background: rgba(244,63,94,0.2) !important;
}

.letter-slot-space {
  width: 20px;
  height: 52px;
}

.letter-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 8px;
}

.letter-tile {
  width: 44px;
  height: 52px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.letter-tile:hover { border-color: var(--accent); background: var(--accent-glow); }

.letter-tile.used {
  opacity: 0;
  pointer-events: none;
}

@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

.letter-tile.hint {
  border-color: var(--green);
  background: rgba(16,185,129,0.12);
  animation: hintPulse 0.9s ease infinite;
}

.letter-show-answer {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 8px;
  font-family: inherit;
}

.letter-show-answer:hover { color: var(--text2); }

/* Quick-action row on learn presentation card */
.learn-quick-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
  justify-content: center;
  align-items: center;
}

.learn-know-btn {
  background: var(--green) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px rgba(15,169,139,0.35) !important;
}
.learn-know-btn:hover {
  filter: brightness(1.05) !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(15,169,139,0.45) !important;
}

.learn-postpone-btn {
  background: var(--bg3) !important;
  color: var(--text2) !important;
  border: 0 !important;
  box-shadow: 0 8px 24px rgba(15,42,36,0.08) !important;
}
.learn-postpone-btn:hover {
  background: var(--bg2) !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(15,42,36,0.12) !important;
}

.learn-postpone-wrap { position: relative; }

.snooze-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 140px;
  z-index: 300;
  overflow: hidden;
}

.snooze-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

.snooze-option:hover { background: var(--bg3); }

/* ============================================================
   Study — Intro
   ============================================================ */
.study-intro {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.study-intro h2 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.study-intro p  { color: var(--text2); margin-bottom: 28px; font-size: 16px; }

.learn-filters { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; }
.learn-filters .testdict-chip-group,
.learn-filters .testdict-row { justify-content: center; }

.learn-custom-block { max-width: 420px; margin: 32px auto 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.learn-custom-title { font-weight: 700; font-size: 15px; }
.learn-custom-hint { font-size: 13px; color: var(--text3); text-align: center; }
/* .input.learn-custom-textarea (two classes) outranks theme-candy.css's
   `.input, .select { border-radius: 999px }` — same document-order cascade
   would otherwise let that "pill" radius win on a single-class selector,
   and it only looks right on short single-line inputs: on a resizable
   textarea the fixed 999px corner radius clamps to half of whichever side
   is smaller, so it gets visibly rounder the taller you drag it. */
.input.learn-custom-textarea { width: 100%; height: 72px; min-height: 60px; max-height: 240px; resize: vertical; font-family: inherit; border-radius: var(--radius-sm); }
.learn-custom-result { font-size: 13px; text-align: center; }
.learn-custom-ok { color: var(--accent); }
.learn-custom-miss { color: var(--red); }

.learn-decks-block { max-width: 420px; margin: 32px auto 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.learn-decks-list { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.learn-decks-empty { font-size: 13px; color: var(--text3); text-align: center; }
.learn-deck-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font: inherit; text-align: left;
  transition: border-color var(--transition);
}
.learn-deck-row:hover { border-color: var(--accent); }
.learn-deck-name { font-weight: 600; }
.learn-deck-count { font-size: 12px; color: var(--text3); }

.deck-editor-body { display: flex; flex-direction: column; gap: 10px; }
.deck-search-wrap { position: relative; }
.deck-search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin-top: 4px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 220px; overflow-y: auto;
}
.deck-search-result {
  display: block; width: 100%; text-align: left; padding: 8px 12px; background: none; border: none;
  cursor: pointer; color: var(--text); font: inherit;
}
.deck-search-result:hover { background: var(--bg3); }
.deck-search-empty { padding: 8px 12px; font-size: 13px; color: var(--text3); }
.deck-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.deck-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px;
  background: var(--accent-glow); color: var(--accent); border-radius: 20px; font-size: 13px; font-weight: 600;
}
.deck-chip button { background: none; border: none; cursor: pointer; color: inherit; opacity: .7; padding: 2px; display: flex; }
.deck-chip button:hover { opacity: 1; }

.mode-selector h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.mode-btn {
  padding: 16px 10px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.mode-btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }

.mode-btn.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(168,85,247,0.06));
  color: var(--accent);
}

/* ============================================================
   Study — Session
   ============================================================ */
.study-session { max-width: 1060px; margin: 0 auto; }

.session-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.session-layout .study-card {
  width: 100%;
}

.examples-sidebar {
  display: none;
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.session-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.session-progress { flex: 1; }

.progress-bar {
  height: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

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

.progress-text { font-size: 12px; color: var(--text3); font-weight: 600; }

/* Study Card */
.card-container { perspective: 1000px; }

.study-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 44px 40px;
  min-height: 370px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.study-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.study-card::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(168,85,247,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.card-mode-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 12px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-prompt {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-word {
  font-size: 36px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.2;
}

.card-transcription {
  font-size: 18px;
  color: var(--text3);
  margin-bottom: 12px;
}

.card-translation {
  font-size: 22px;
  color: var(--accent);
  margin-top: 16px;
  font-weight: 700;
}

.card-example {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
  max-width: 500px;
  width: 100%;
  text-align: left;
}

.card-example em { color: var(--text); font-style: normal; }

.card-tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

.card-tag {
  font-size: 11px;
  padding: 4px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text3);
  font-weight: 600;
}

/* Reveal button */
.btn-reveal {
  background: var(--bg3);
  border: 2px dashed var(--border);
  color: var(--text2);
  padding: 13px 30px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 20px;
}

.btn-reveal:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* Rating buttons */
.rating-buttons {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
  justify-content: center;
}

.rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 13px 22px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 700;
  font-size: 14px;
  min-width: 94px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.rating-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.18); }

.rating-btn .next-review { font-size: 10px; opacity: 0.75; font-weight: 400; }

.rating-key-hint {
  font-size: 10px;
  opacity: 0.6;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 2px;
}

.rating-btn.again { background: var(--red); color: #fff; }
.rating-btn.hard  { background: var(--yellow); color: #000; }
.rating-btn.good  { background: var(--green); color: #fff; }
.rating-btn.easy  { background: var(--blue); color: #fff; }

/* Typing mode */
.typing-input-wrap { width: 100%; max-width: 440px; margin-top: 20px; }

.typing-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 24px;
  text-align: center;
  font-weight: 700;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
  font-family: inherit;
}

.typing-input:focus { border-color: var(--accent); background: var(--bg2); }
.typing-input.correct  { border-color: var(--green); background: rgba(16,185,129,0.06); }
.typing-input.incorrect { border-color: var(--red); background: rgba(244,63,94,0.06); }

.typing-hint { font-size: 12px; color: var(--text3); margin-top: 8px; font-weight: 600; }

.typing-diff-wrap { display: block; box-sizing: border-box; }
.diff-wrong { color: var(--red); }

.answer-feedback {
  font-size: 20px;
  font-weight: 800;
  margin-top: 20px;
  padding: 12px 32px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  animation: fadeSlideDown 0.2s ease;
}

.answer-feedback.correct {
  color: var(--green);
  background: none;
  border: none;
  padding: 0;
  text-align: center;
}

.answer-feedback.incorrect {
  color: var(--red);
  background: rgba(244, 63, 94, 0.1);
  border: 1.5px solid rgba(244, 63, 94, 0.25);
}

.answer-feedback.warn {
  color: #d97706;
  background: none;
  border: none;
  padding: 0;
  text-align: center;
}

.typing-correct-answer {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  margin-top: 6px;
  animation: fadeSlideDown 0.2s ease;
}

/* Multiple choice */
.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin-top: 20px;
}

.choice-btn {
  padding: 16px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  line-height: 1.4;
  box-shadow: var(--shadow);
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(99,102,241,0.06);
  transform: translateY(-2px);
}

.choice-btn.correct { border-color: var(--green); background: rgba(16,185,129,0.1); color: var(--green); font-weight: 700; }
.choice-btn.wrong   { border-color: var(--red); background: rgba(244,63,94,0.1); color: var(--red); }
.choice-btn:disabled { cursor: default; }

/* Listening mode */
.listen-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border: none;
  font-size: 32px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
  margin: 16px auto;
  display: block;
  color: #fff;
}

.listen-btn:hover { transform: scale(1.08); box-shadow: 0 6px 30px var(--accent-glow); }
.listen-btn.playing { animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 0 0 22px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Results */
.study-results { max-width: 520px; margin: 0 auto; text-align: center; }
.study-results h2 { font-size: 32px; font-weight: 900; margin-bottom: 28px; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
  justify-content: center;
}

.results-grid:has(.result-item:only-child) {
  grid-template-columns: 1fr;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.result-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  box-shadow: var(--shadow);
}

.result-item.correct { border-top: 3px solid var(--green); }
.result-item.wrong   { border-top: 3px solid var(--red); }

.result-number { font-size: 40px; font-weight: 900; margin-bottom: 6px; color: var(--accent); }
.result-item.correct .result-number { color: var(--green); }
.result-item.wrong   .result-number { color: var(--red); }

.result-label { font-size: 12px; color: var(--text2); font-weight: 600; }
.results-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.res-details { margin: 24px 0 8px; text-align: left; }
.res-section-title { font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.res-error-word { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--bg2); margin-bottom: 6px; }
.res-error-word-text { font-size: 15px; font-weight: 600; color: var(--text); }
.res-error-count { font-size: 13px; color: var(--red); font-weight: 500; }

/* ============================================================
   Dictionary
   ============================================================ */
.dictionary-header { margin-bottom: 24px; }
.dictionary-header h1 { margin-bottom: 16px; }

.dictionary-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.search-box { flex: 1; min-width: 200px; }

.word-list { display: grid; gap: 10px; }

.word-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.word-item:hover { box-shadow: var(--shadow-lg); }
.word-item.expanded { border-color: var(--accent); box-shadow: var(--shadow-lg); }

.word-item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
}

/* Inline detail (accordion) */
.word-item-detail {
  display: none;
  border-top: 1px solid var(--border);
  padding: 20px 24px 24px;
  background: #F0F6FF;
  animation: fadeSlideDown 0.2s ease;
  text-align: left;
}

.word-item.expanded .word-item-detail { display: block; }

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

.word-item-en { font-size: 19px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.word-item-trans { font-size: 12px; color: var(--text3); margin-bottom: 4px; font-style: italic; }
.word-item-ru { font-size: 13px; color: var(--text2); }

.word-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.word-tag {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text3);
  font-weight: 600;
}

.word-level {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.level-new      { background: rgba(16,185,129,0.1);  color: var(--green); }
.level-learning { background: rgba(245,158,11,0.1);  color: var(--yellow); }
.level-review   { background: rgba(59,130,246,0.1);  color: var(--blue); }
.level-mature   { background: rgba(99,102,241,0.12); color: var(--accent); }

.word-due { font-size: 11px; color: var(--text3); font-weight: 500; }
.word-due.overdue { color: var(--red); font-weight: 700; }

.word-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.action-btn.delete:hover { background: var(--red); border-color: var(--red); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; font-weight: 700; }
.empty-state p  { color: var(--text2); margin-bottom: 24px; }

/* ============================================================
   Stats
   ============================================================ */
/* Stats tiles */
.stats-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-tile { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 20px; box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stats-tile-icon { font-size: 24px; line-height: 1; }
.stats-tile-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.stats-tile-label { font-size: 12px; color: var(--text3); font-weight: 500; }

/* Stats main grid */
.stats-main-grid { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.stats-main-left { display: flex; flex-direction: column; gap: 20px; }
.stats-main-right { display: flex; flex-direction: column; gap: 20px; }
.stats-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stats-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stats-section-half { min-width: 0; }
.stats-section-title { font-size: 11px; color: var(--text3); margin-bottom: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.stats-word-list { display: flex; flex-direction: column; gap: 6px; }
.stats-word-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--bg3); border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.stats-word-row:hover { border-color: var(--accent); }
.stats-word-row.has-lapse { border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.04); }
.stats-word-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats-word-text { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-word-sub { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-word-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stats-lapse-badge { font-size: 11px; font-weight: 600; color: #ef4444; background: rgba(239,68,68,0.1); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.stats-empty { color: var(--text3); font-size: 13px; padding: 4px 0; }
@media (max-width: 900px) { .stats-main-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .stats-tiles { grid-template-columns: 1fr 1fr; } .stats-charts-row { grid-template-columns: 1fr; } }

#test-dict-controls, #catalog-test-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.testdict-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.testdict-row .input, .testdict-row .select { width: auto; min-width: 0; }
.testdict-row .testdict-freq-input { width: 100px; }
.testdict-row .testdict-date-input { width: 130px; }
.testdict-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.testdict-chip-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.testdict-chip-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }
.testdict-chip { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer; transition: background var(--transition), color var(--transition), border-color var(--transition); }
.testdict-chip:hover { border-color: var(--accent); }
.testdict-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.testdict-count { font-size: 12px; color: var(--text3); margin-left: auto; white-space: nowrap; }
.testdict-reset { background: none; border: 1px solid var(--border); color: var(--text2); font-size: 12px; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.testdict-reset:hover { border-color: var(--accent); color: var(--accent); }

#test-dict-container, #catalog-test-container, #modal-word-card-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.test-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.test-sense { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; display: flex; flex-direction: column; gap: 4px; }
.test-sense-hidden { display: none; }
.test-example { background: var(--bg3); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 4px; }
.ex-carousel { background: transparent; border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 4px; }
.learn-card-examples { width: 100%; border-top: 1px solid var(--border); padding: 12px 0 4px; margin: 10px 0 16px; }
.learn-card-examples .ex-carousel { padding: 0; }
.ex-slide { display: block; }
.ex-slide.hidden { display: none; }
.ex-page { display: flex; align-items: stretch; gap: 12px; }
.ex-page.hidden { display: none; }
.ex-item { flex: 1 1 0; min-width: 0; }
.ex-item + .ex-item { border-left: 1px solid var(--border); padding-left: 12px; }
.ex-collocation { font-size: 11px; color: var(--text3); font-style: italic; margin-bottom: 2px; }
.ex-row { display: flex; align-items: flex-start; gap: 6px; }
.ex-en { color: var(--text2); flex: 1; font-size: 13px; line-height: 1.5; }
.ex-ru { color: var(--text3); font-size: 12px; margin-top: 2px; line-height: 1.5; }
.ex-speak-btn { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--text3); padding: 2px; display: flex; border-radius: 50%; transition: color var(--transition), background var(--transition); }
.ex-speak-btn:hover { color: var(--accent); background: var(--accent-glow); }
.ex-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.ex-nav-btn { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 9px; padding: 2px 4px; line-height: 1; transition: color var(--transition); }
.ex-nav-btn:hover { color: var(--accent); }
.ex-counter { font-size: 12px; color: var(--text3); min-width: 16px; text-align: center; }
@media (max-width: 640px) {
  .ex-page { flex-direction: column; }
  .ex-item + .ex-item { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 8px; }
}
.test-speak-btn { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--text3); padding: 3px; border-radius: 50%; display: flex; align-items: center; transition: color var(--transition), background var(--transition); }
.test-speak-btn:hover { color: var(--accent); background: var(--accent-glow); }
/* Нет сгенерированного mp3 — кнопка озвучивает через Web Speech API браузера */
.test-speak-btn-fallback { color: var(--red); }
.test-speak-btn-fallback:hover { color: var(--red); background: rgba(224,85,71,0.1); }
.test-learner-note { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 6px 10px; padding-right: 34px; border-radius: var(--radius-sm); position: relative; }
.note-lang-btn { position: absolute; top: 5px; right: 6px; font-size: 10px; font-weight: 600; color: #b45309; background: none; border: 1px solid #f59e0b; border-radius: 3px; padding: 0 4px; line-height: 16px; cursor: pointer; opacity: 0.45; transition: opacity 0.15s; }
.note-lang-btn:hover { opacity: 1; }
.test-form-chip { font-size: 12px; padding: 2px 4px; color: var(--text2); }
.test-syn-chip { display: inline-block; color: #3b82f6; padding: 1px 4px; margin: 0 1px; font-size: 11px; }
.test-cefr-badge { font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 6px; }
.test-freq-badge { font-size: 11px; font-weight: 600; background: var(--bg3); color: var(--text2); padding: 2px 8px; border-radius: 6px; }
.test-added-badge { font-size: 11px; font-weight: 600; background: var(--bg3); color: var(--text3); padding: 2px 8px; border-radius: 6px; cursor: default; }
.test-ipa-label { font-size: 10px; font-weight: 700; background: var(--bg3); color: var(--text); padding: 1px 5px; border-radius: 4px; margin-right: 5px; }
.test-ipa-text { font-family: 'Noto Sans', 'Lucida Sans Unicode', 'DejaVu Sans', 'Segoe UI', sans-serif; font-style: normal; }
.test-show-more { align-self: flex-start; background: none; border: 1px solid var(--border); color: var(--text2); font-size: 12px; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.test-show-more:hover { background: var(--bg3); }
.test-attribution { font-size: 10px; color: var(--text3); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

.stats-card h3 {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Heatmap */
.heatmap { display: flex; gap: 4px; flex-wrap: wrap; }

.heatmap-day {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--bg3);
  transition: transform var(--transition);
  cursor: default;
  position: relative;
}

.heatmap-day:hover { transform: scale(1.3); }

.heatmap-day:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg2);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.heat-0 { background: var(--bg3); }
.heat-1 { background: rgba(99,102,241,0.2); }
.heat-2 { background: rgba(99,102,241,0.38); }
.heat-3 { background: rgba(99,102,241,0.58); }
.heat-4 { background: rgba(99,102,241,0.78); }
.heat-5 { background: var(--accent); }

/* Level chart */
.level-chart { display: flex; flex-direction: column; gap: 14px; }

.level-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.level-row-label { width: 88px; color: var(--text2); font-weight: 600; }

.level-bar-wrap {
  flex: 1;
  height: 22px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.level-bar { height: 100%; border-radius: 11px; transition: width 0.6s ease; }
.level-bar.new      { background: var(--green); }
.level-bar.learning { background: var(--yellow); }
.level-bar.review   { background: var(--blue); }
.level-bar.mature   { background: linear-gradient(90deg, var(--accent), var(--purple)); }

.level-count { width: 32px; text-align: right; font-weight: 700; color: var(--text); }

/* Tag progress */
.tag-progress { display: flex; flex-direction: column; gap: 12px; }

.tag-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.tag-progress-label { color: var(--text2); }
.tag-progress-count { color: var(--accent); font-weight: 700; }

/* ============================================================
   Word item — top row with POS chips
   ============================================================ */
.word-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.pos-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(99,102,241,0.1);
  color: var(--accent);
  letter-spacing: 0.3px;
  border: 1px solid rgba(99,102,241,0.2);
}

/* ============================================================
   Inline word detail (accordion)
   ============================================================ */
.detail-word-header { margin-bottom: 20px; }

.detail-word {
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}

.detail-transcription {
  font-size: 15px;
  color: var(--text3);
  font-style: italic;
  margin-bottom: 4px;
}

.detail-meaning {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.detail-meaning:last-of-type { border-bottom: none; }

.detail-pos-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-pos-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 10px;
  border: 1px solid;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.detail-pos-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
}

.detail-meaning-translation {
  font-size: 15px;
  font-weight: 400;
  color: var(--text2);
  margin-bottom: 6px;
}

.detail-meaning-definition {
  font-size: 15px;
  font-weight: 400;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.5;
}

.detail-examples { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 4px; }
.learn-examples { margin: 12px 0 4px; gap: 10px; }
.learn-examples .detail-example {
  background: none;
  border: none;
  border-left: none;
  padding: 0;
}
.learn-examples .detail-example-en { font-size: 16px; color: var(--text2); }
.learn-examples .detail-example-ru { font-size: 14px; color: var(--text3); }

.detail-example {
  padding: 12px 4px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
}
.detail-example:last-child { border-bottom: none; }

.detail-example-en {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}

.detail-example-ru {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.5;
}

.detail-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.detail-notes {
  margin-top: 14px;
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}

.detail-notes-label {
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

/* Cambridge link inside detail */
.cambridge-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-decoration: none;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all var(--transition);
}

.cambridge-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }

/* Cambridge link in collapsed row */
.cambridge-link-meta {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 11px;
  padding: 2px 8px;
}

/* SRS stats block */
.word-item-stats {
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.srs-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 22px;
  border-right: 1px solid var(--border);
}

.srs-section-last { border-right: none; }

.srs-dots {
  display: flex;
  gap: 5px;
}

.srs-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
}

.srs-dot-new      { background: var(--green);  border-color: var(--green); }
.srs-dot-learning { background: var(--yellow); border-color: var(--yellow); }
.srs-dot-review   { background: var(--blue);   border-color: var(--blue); }
.srs-dot-mature   { background: var(--accent); border-color: var(--accent); }

.srs-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.srs-num-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.srs-num-lbl {
  font-size: 10px;
  color: var(--text3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.srs-date-lbl {
  font-size: 10px;
  color: var(--text3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.srs-date-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text2);
  white-space: nowrap;
}

.srs-date-val.srs-overdue { color: var(--red); }

/* Speak button — right side of collapsed row */
.row-speak-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  background: var(--bg3);
  color: var(--accent);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition);
  padding: 0;
}

.row-speak-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
  transform: scale(1.08);
}

.row-speak-btn.playing {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  animation: pulse 1.2s infinite;
}

/* Large round speak button — used in learn/review card */
.card-speak-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  background: var(--bg3);
  color: var(--accent);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition);
  padding: 0;
  margin: 0 auto 16px;
  flex-shrink: 0;
}
.card-speak-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: scale(1.08);
}
.card-speak-btn.playing {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  animation: pulse 1.2s infinite;
}

/* Detail action buttons (edit / delete) */
.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.detail-delete-btn {
  background: rgba(244, 63, 94, 0.08);
  color: var(--red);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.detail-delete-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ============================================================
   Meanings form
   ============================================================ */
.meanings-section {
  margin-bottom: 20px;
}

.meanings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.meaning-group {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.meaning-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.pos-select { font-weight: 700; }

.remove-meaning-btn { color: var(--red); }
.remove-meaning-btn:hover { background: rgba(244,63,94,0.08); }

.examples-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

.example-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.example-inputs { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.example-inputs .input { font-size: 13px; padding: 8px 12px; }

.remove-example-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  margin-top: 2px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-example-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }

.add-example-btn { font-size: 12px; color: var(--accent); }

/* ============================================================
   Form & Inputs
   ============================================================ */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  font-family: inherit;
}

.input:focus { border-color: var(--accent); background: var(--bg2); }
.input::placeholder { color: var(--text3); }

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

.select {
  padding: 10px 14px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition);
}

.select:focus { border-color: var(--accent); }

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ============================================================
   Modals
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 27, 75, 0.4);
  backdrop-filter: blur(6px);
}

body.dark .modal-overlay { background: rgba(0,0,0,0.65); }

.modal-content {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  max-width: 580px;
  width: calc(100vw - 48px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 { font-size: 22px; font-weight: 800; }

.modal-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--red); border-color: var(--red); color: #fff; }

.import-content p { color: var(--text2); margin-bottom: 10px; font-size: 14px; }

.code-hint {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 16px;
  font-family: 'Consolas', monospace;
  line-height: 1.7;
}

.import-textarea { min-height: 160px; font-family: 'Consolas', monospace; font-size: 13px; }

/* ============================================================
   Toast
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  padding: 13px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.22s ease;
  max-width: 320px;
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--blue); }

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

/* ============================================================
   Auth overlay
   ============================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg);
  border-radius: 24px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.auth-logo {
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 32px;
}

.auth-loading {
  display: flex;
  justify-content: center;
  padding: 32px 0 40px;
}
.auth-loading::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

.auth-form h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 22px;
}

.auth-error {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

.input-pw-wrap { position: relative; }
.input-pw-wrap .input { padding-right: 40px; width: 100%; box-sizing: border-box; }
.pw-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 0; font-size: 16px; color: var(--text3); line-height: 1; opacity: 0.6; }
.pw-eye:hover { opacity: 1; }

.auth-success {
  background: rgba(16, 185, 129, 0.08);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text2);
}
.auth-switch a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  margin-bottom: 4px;
}
.btn-google:hover {
  background: var(--bg3);
  border-color: #4285F4;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
}
.btn-google svg { flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text3);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Nav user section */
.nav-user {
  display: none !important;
}
.nav-user-name {
  font-size: 13px;
  color: var(--text2);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-streak-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 5px 16px 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  cursor: default;
}

.nav-streak-pill::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.nav-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dde4f5;
  color: #4a5fa8;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: opacity var(--transition);
}
.nav-avatar:hover { opacity: 0.8; }

.nav-avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px;
  z-index: 200;
  animation: fadeIn 0.12s ease;
}

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

.nav-avatar-user-info {
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-avatar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.nav-avatar-user-email {
  font-size: 12px;
  color: var(--text3);
}

.nav-avatar-item {
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  display: block;
}
.nav-avatar-item:hover { background: var(--bg3); }
.nav-avatar-item--danger { color: var(--red); }
.nav-avatar-item--danger:hover { background: rgba(224,85,71,0.08); }

.nav-avatar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.s-lang-switch-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.s-lang-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.5px;
  user-select: none;
}

.s-lang-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

.s-lang-switch input { display: none; }

.s-lang-slider {
  position: absolute;
  inset: 0;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  transition: background var(--transition), border-color var(--transition);
}

.s-lang-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text2);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.s-lang-switch input:checked + .s-lang-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.s-lang-switch input:checked + .s-lang-slider::before {
  transform: translate(24px, -50%);
  background: #fff;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 0 32px;
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-lang-toggle {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.settings-lang-btn {
  flex: 1;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg3);
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.settings-lang-btn:hover { border-color: var(--accent); color: var(--text); }
.settings-lang-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   Utilities
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .main { padding: 16px; }
  .nav  { padding: 0 14px; }
  .nav-center .nav-btn { padding: 7px 10px; font-size: 13px; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .stats-detail-grid { grid-template-columns: 1fr; }
  .stats-card-wide { grid-column: auto; }
  .dictionary-controls { flex-direction: column; }
  .dictionary-controls .search-box { width: 100%; }
  .choices-grid { grid-template-columns: 1fr; }
  .study-card { padding: 28px 20px; min-height: 300px; }
  .session-layout { flex-direction: column; }
  .examples-sidebar { width: 100%; }
  .card-word { font-size: 26px; }
  .rating-buttons { gap: 8px; }
  .rating-btn { min-width: 76px; padding: 11px 14px; font-size: 13px; }
  .yt-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   YouTube Videos Section
   ============================================================ */
.detail-videos {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.detail-videos-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-videos-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.yt-change-key {
  font-size: 11px;
  color: var(--text3);
  padding: 2px 8px;
}

.btn-xs { font-size: 11px; padding: 3px 10px; border-radius: 10px; }

/* API key setup */
.yt-key-setup {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.yt-key-hint {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
}

.yt-key-hint a { color: var(--accent); }

.yt-key-row {
  display: flex;
  gap: 8px;
}

.yt-key-input {
  flex: 1;
  font-size: 13px;
  padding: 8px 12px;
}

/* Search button */
.yt-search-btn {
  font-size: 13px;
  margin-bottom: 10px;
}

/* Results grid */
.yt-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.yt-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg3);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.yt-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.yt-card:hover .yt-thumb { opacity: 1; }

.yt-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 22px;
  opacity: 0;
  transition: opacity 0.2s;
}

.yt-card:hover .yt-play-overlay { opacity: 1; }

.yt-info {
  padding: 8px 10px;
}

.yt-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-channel {
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
}

/* Embedded player */
.yt-embed-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: #000;
}

.yt-embed-wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.yt-empty, .yt-error {
  font-size: 13px;
  color: var(--text2);
  padding: 10px 0;
}

.yt-error { color: var(--red); }

/* ============================================================
   YouGlish Widget
   ============================================================ */
.detail-youglish {
  margin-bottom: 0;
  padding-bottom: 20px;
}

.yg-hint {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

/* YouGlish open button */
.yg-open-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  margin-top: 8px;
  max-width: 480px;
}

.yg-open-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.yg-open-icon {
  width: 36px;
  height: 36px;
  background: #ff0000;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

.yg-open-text {
  font-size: 13px;
  color: var(--text2);
  flex-shrink: 0;
}

.yg-open-word {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  flex: 1;
}

.yg-open-arrow {
  font-size: 16px;
  color: var(--text3);
}

/* YouGlish widget container */
.yg-widget-wrap {
  margin-top: 10px;
  width: 100%;
  min-height: 320px;
}

/* YouGlish carousel nav */
.yg-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.yg-nav-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.yg-nav-btn:hover:not(:disabled) {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.yg-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.yg-nav-counter {
  font-size: 13px;
  color: var(--text2);
  min-width: 40px;
  text-align: center;
}

/* YouGlish inline player */
.yg-player {
  margin-top: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.yg-embed-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}

.yg-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yg-seek-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-top: none;
}

.yg-seek-input {
  width: 72px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
  text-align: center;
}

.yg-seek-input:focus {
  outline: none;
  border-color: var(--accent);
}

.yg-seek-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition);
}

.yg-seek-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.yg-video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.yg-video-title {
  font-size: 12px;
  color: var(--text2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yg-youglish-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.yg-youglish-link:hover {
  text-decoration: underline;
}

.yg-key-note {
  font-size: 12px;
  color: var(--text3);
  margin-top: 8px;
}

/* ============================================================
   Feedback form
   ============================================================ */
.feedback-note {
  font-size: 12px;
  color: var(--text3);
  margin: 4px 0 16px;
  text-align: center;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

/* ── Dictionary tabs ─────────────────────────────────────────────────── */
.dict-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.dict-tab {
  background: none;
  border: none;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--transition), border-color var(--transition);
}
.dict-tab:hover { color: var(--text); }
.dict-tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Admin: import card ──────────────────────────────────────────────── */
.admin-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, var(--radius));
  padding: 18px 20px;
  max-width: 480px;
}
.admin-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.admin-card-hint { font-size: 13px; color: var(--text3); margin: 0 0 12px; }
.admin-btn-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.admin-progress { font-size: 13px; color: var(--text2); min-height: 18px; }
