/* Legacy-слой. Токены, reset и базовая типографика переехали в tokens.css,
   каркас страницы — в shell.css, переиспользуемые детали — в components.css.
   Здесь остаются только правила старых классов; удаляются по мере миграции. */

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 22px;
  background: rgba(20, 17, 28, .88);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 12px; font-size: 1.15rem;
  color: #fff; background: linear-gradient(135deg, var(--brand), #6d5cf0);
}
.brand-name b { color: var(--brand); font-weight: 800; }

.topnav { display: flex; gap: 2px; margin-left: 4px; }
.topnav a {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: .95rem;
  text-decoration: none; transition: background .15s, color .15s;
}
.topnav a .ph { font-size: 1.05rem; }
.topnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav a.active { background: rgba(139, 124, 246, .16); color: #d5ccff; }
.badge-dot {
  display: inline-block; min-width: 18px; height: 18px; margin-left: 1px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .72rem; font-weight: 800; line-height: 18px; text-align: center; padding: 0 5px;
}
.stats { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; font-weight: 700; white-space: nowrap; }
.stat .ph-fill { color: var(--gold); }
.stat:nth-child(1) .ph-fill { color: var(--c-theory); }
.stat:nth-child(2) .ph-fill { color: var(--gold); }
.stat:nth-child(3) .ph-fill { color: #ff8f5c; }
.stat-unit { color: var(--muted); font-weight: 600; }

/* ---------- Layout ---------- */
.app { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 30px 20px 70px; }


/* ---------- Generic ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.section-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.section-sub { color: var(--muted); margin: 0 0 20px; font-size: 1rem; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, opacity .15s;
  text-decoration: none; line-height: 1.2; color: var(--text);
}
.btn .ph { font-size: 1.15rem; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), #6d5cf0); color: #fff; box-shadow: 0 8px 22px rgba(109, 92, 240, .35); }
.btn-primary:hover { box-shadow: 0 10px 28px rgba(109, 92, 240, .5); text-decoration: none; }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: rgba(167, 139, 250, .14); color: #d5ccff;
}
.tag .ph { font-size: 1rem; }
.tag.gold { background: rgba(245, 184, 76, .14); color: #ffd98a; }
.tag.green { background: rgba(91, 214, 140, .14); color: #9cefc0; }
.tag.cyan { background: rgba(95, 208, 230, .14); color: #a9ecf8; }

/* ---------- Hero / dashboard ---------- */
.hero {
  background: linear-gradient(140deg, #221b3f 0%, #1a1630 55%, #151022 100%);
  border: 1px solid var(--border-strong);
  border-radius: 24px; padding: 36px 32px;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -70px; top: -70px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(167, 139, 250, .28) 0%, transparent 70%);
}
.hero::before {
  content: ""; position: absolute; right: 30px; bottom: -90px;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 208, 230, .18) 0%, transparent 70%);
}
.hero h1 { margin: 0 0 10px; font-size: 2rem; line-height: 1.18; letter-spacing: -.02em; }
.hero p { margin: 0 0 20px; color: #cfc9e6; max-width: 600px; font-size: 1.02rem; }
.hero .btn-primary { background: var(--c-practice); color: #241a05; box-shadow: 0 8px 24px rgba(245, 184, 76, .3); }
.hero .btn-primary:hover { box-shadow: 0 10px 30px rgba(245, 184, 76, .45); }

.progress-wrap { margin: 22px 0 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 700; color: #d5ccff; margin-bottom: 8px; }
.progress-bar { height: 12px; background: rgba(255, 255, 255, .12); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #b79cff); border-radius: 999px; transition: width .4s ease; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
@media (max-width: 720px) { .dash-grid { grid-template-columns: 1fr; } }

.method-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.method-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.method-card .icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.method-card .icon.c-words { background: rgba(95, 208, 230, .14); color: var(--c-words); }
.method-card .icon.c-theory { background: rgba(167, 139, 250, .16); color: var(--c-theory); }
.method-card .icon.c-practice { background: rgba(245, 184, 76, .14); color: var(--c-practice); }
.method-card .icon.c-reading { background: rgba(91, 214, 140, .14); color: var(--c-reading); }
.method-card .icon.c-review { background: rgba(240, 139, 176, .14); color: var(--c-review); }
.method-card h3 { margin: 0 0 4px; font-size: 1rem; }
.method-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 14px; text-align: center; box-shadow: var(--shadow); }
.stat-tile .num { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat-tile .num small { font-size: .95rem; color: var(--muted); font-weight: 600; }
.stat-tile .lbl { font-size: .84rem; color: var(--muted); margin-top: 4px; }

.achieve-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.achievement {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 14px;
  text-align: center; background: var(--surface); box-shadow: var(--shadow);
}
.achievement .icon { font-size: 1.7rem; color: var(--c-theory); }
.achievement .name { font-weight: 700; font-size: .9rem; margin-top: 8px; }
.achievement .desc { font-size: .78rem; color: var(--muted); }
.achievement.locked { opacity: .45; filter: grayscale(.9); }

/* ---------- Roadmap / curriculum ---------- */
.level-block { margin-bottom: 26px; }
.level-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.level-num {
  width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.2rem; flex-shrink: 0;
}
.level-head h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.01em; }
.level-head p { margin: 0; color: var(--muted); font-size: .92rem; }

.unit-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px; }
.unit-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.unit-title .ph { color: var(--c-theory); }
.lesson-row {
  display: flex; align-items: center; gap: 13px; padding: 12px 13px;
  border-radius: var(--radius-sm); border: 1px solid transparent; text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s;
}
.lesson-row:hover { background: var(--surface-2); text-decoration: none; }
.lesson-row.done { border-color: rgba(91, 214, 140, .4); background: rgba(91, 214, 140, .08); }
.lesson-row.current { border-color: rgba(245, 184, 76, .45); background: rgba(245, 184, 76, .07); }
.lesson-check {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--border-strong); color: transparent; font-size: 1rem; font-weight: 800;
}
.lesson-row.done .lesson-check { border-color: var(--success); background: var(--success); color: #052; }
.lesson-row.current .lesson-check { border-color: var(--c-practice); color: var(--c-practice); }
.lesson-body { flex: 1; min-width: 0; }
.lesson-title { font-weight: 700; font-size: 1rem; }
.lesson-meta { font-size: .82rem; color: var(--muted); }
.lesson-xp { font-size: .82rem; font-weight: 800; color: var(--gold); white-space: nowrap; }

.coming-soon { display: flex; align-items: center; gap: 8px; padding: 10px 6px 2px; }
.coming-soon ul { margin: 6px 0 4px; padding-left: 22px; color: var(--muted); font-size: .9rem; }
.coming-soon li { margin: 2px 0; }

/* ---------- Lesson player ---------- */
.lesson-hero { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.lesson-crumbs { color: var(--muted); font-size: .9rem; }
.lesson-hero h1 { margin: 0; font-size: 1.75rem; line-height: 1.2; letter-spacing: -.015em; }
.lesson-hero .meta-row { display: flex; gap: 8px; flex-wrap: wrap; }

.step-card { margin-bottom: 20px; border-top: 2px solid var(--border); }
.step-card.words { border-top-color: var(--c-words); }
.step-card.theory { border-top-color: var(--c-theory); }
.step-card.practice { border-top-color: var(--c-practice); }
.step-card.reading { border-top-color: var(--c-reading); }
.step-card h2 { display: flex; align-items: center; gap: 11px; margin: 0 0 16px; font-size: 1.2rem; }
.step-num {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.words .step-num { background: rgba(95, 208, 230, .14); color: var(--c-words); }
.theory .step-num { background: rgba(167, 139, 250, .16); color: var(--c-theory); }
.practice .step-num { background: rgba(245, 184, 76, .14); color: var(--c-practice); }
.reading .step-num { background: rgba(91, 214, 140, .14); color: var(--c-reading); }

/* Vocabulary */
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.vocab-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 14px 16px;
}
.vocab-card .en { font-family: var(--font-en); font-size: 1.5rem; font-weight: 600; color: #cff3fb; line-height: 1.2; }
.vocab-card .ru { color: var(--text); font-size: 1rem; margin-top: 2px; }
.vocab-card .pos { font-size: .74rem; color: var(--c-words); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
.vocab-card .ex { font-family: var(--font-en); font-size: .95rem; color: var(--muted); margin-top: 6px; }
.vocab-card .ex i { color: var(--faint); font-family: var(--font-sans); font-style: normal; font-size: .82rem; }

/* Theory */
.theory-block {
  margin-bottom: 14px;
  padding: 15px 18px 15px 20px;
  background: linear-gradient(180deg, rgba(167, 139, 250, .10), rgba(167, 139, 250, .02));
  border: 1px solid rgba(167, 139, 250, .22);
  border-left: 3px solid var(--c-theory);
  border-radius: var(--radius-sm);
}
.theory-block:last-child { margin-bottom: 0; }
.theory-h {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.04rem; margin: 0 0 8px; color: #e7e0ff;
}
.theory-h .ph { color: var(--c-theory); font-size: 1.15rem; }
.theory-p { margin: 0; color: #d5cfe9; }
.theory-p b { color: #fff; font-weight: 800; }
.theory-simple { margin-top: 10px; padding: 11px 14px; border-radius: var(--radius-sm); background: rgba(95, 209, 201, .09); border-left: 3px solid #5fd1c9; }
.theory-simple-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #5fd1c9; margin-bottom: 5px; }
.theory-simple p { margin: 0; color: #cfeee9; }
.en-inline {
  font-family: var(--font-en);
  color: #ffd98a;
  font-weight: 700;
}
.theory-example {
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: rgba(167, 139, 250, .17);
  border: 1px solid rgba(167, 139, 250, .42);
}
.theory-example .ex-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-theory); margin-bottom: 7px;
}
.theory-example .en { font-family: var(--font-en); font-size: 1.22rem; font-weight: 600; color: #ffd98a; display: block; }
.theory-example .ru { color: #b9b1d8; font-size: .92rem; display: block; margin-top: 2px; }

/* Patterns */
.pattern-list { display: flex; flex-direction: column; gap: 10px; }
.pattern {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.pattern .en { font-family: var(--font-en); font-size: 1.28rem; font-weight: 600; color: var(--text); }
.pattern .ru { color: var(--muted); font-size: .95rem; }

/* Exercise */
.exercise { margin-bottom: 18px; }
.exercise-prompt { font-weight: 700; margin-bottom: 4px; color: #e6d9ae; font-size: .9rem; }
.exercise-ru { color: var(--text); font-size: 1.05rem; margin-bottom: 12px; font-weight: 500; }
.exercise-ru .en-hint, .en-hint { font-family: var(--font-en); color: #efeaff; font-weight: 600; }

.slot {
  min-height: 60px; padding: 10px; border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm); display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 12px; background: var(--bg-2);
}
.slot.correct { border-color: var(--success); background: rgba(74, 222, 128, .08); }
.slot.wrong { border-color: var(--danger); background: rgba(248, 113, 113, .08); }

.chip {
  padding: 10px 16px; border-radius: 11px; background: var(--surface-3);
  border: 1.5px solid var(--border-strong); font-family: var(--font-en); font-size: 1.15rem; font-weight: 600;
  color: var(--text); cursor: pointer; user-select: none; transition: background .12s, border-color .12s, transform .06s;
}
.chip:hover { border-color: var(--brand); }
.chip:active { transform: scale(.96); }
.chip.in-slot { background: rgba(139, 124, 246, .22); color: #fff; border-color: var(--brand); }
.chip.disabled { pointer-events: none; opacity: .7; }

.word-bank { display: flex; flex-wrap: wrap; gap: 8px; min-height: 46px; }

.option {
  display: block; width: 100%; text-align: left; padding: 14px 18px; margin-bottom: 9px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong); background: var(--surface-2);
  font-family: var(--font-en); font-size: 1.12rem; font-weight: 600; color: var(--text);
  cursor: pointer; transition: background .12s, border-color .12s;
}
.option:hover { border-color: var(--brand); }
.option.correct { border-color: var(--success); background: rgba(74, 222, 128, .12); }
.option.wrong { border-color: var(--danger); background: rgba(248, 113, 113, .12); }
.option:disabled { cursor: default; }

.text-input {
  width: 100%; padding: 15px 18px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--bg-2);
  font-family: var(--font-en); font-size: 1.2rem; color: var(--text);
}
.text-input::placeholder { color: var(--faint); font-family: var(--font-sans); font-size: .95rem; }
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139, 124, 246, .2); }
.text-input.correct { border-color: var(--success); background: rgba(74, 222, 128, .08); }
.text-input.wrong { border-color: var(--danger); background: rgba(248, 113, 113, .08); }

.feedback { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: .98rem; display: none; }
.feedback.show { display: block; }
.feedback.good { background: rgba(74, 222, 128, .12); color: #b9f3d0; }
.feedback.bad { background: rgba(248, 113, 113, .12); color: #fdc9c9; }
.feedback .fxp { font-weight: 800; color: var(--success); }

.exercise-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Reading */
.reading-text { font-family: var(--font-en); font-size: 1.42rem; line-height: 2; }
.reading-text .word {
  cursor: pointer;
  background: rgba(95, 208, 230, .10);
  border-bottom: 1px solid rgba(95, 208, 230, .5);
  border-radius: 4px;
  padding: 0 2px;
}
.reading-text .word:hover { background: rgba(95, 208, 230, .22); }
.gloss-tip {
  position: fixed; z-index: 100; max-width: 260px; padding: 10px 14px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 10px; font-size: .95rem; font-family: var(--font-sans);
  box-shadow: var(--shadow-lg); pointer-events: none;
}

/* Review */
.review-item { margin-bottom: 20px; }
.due-pill {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: .95rem;
  color: var(--c-review); margin-bottom: 16px;
}
.due-pill .ph { font-size: 1.2rem; }

/* Dictionary */
.dict-search {
  width: 100%; padding: 14px 18px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: var(--surface-2);
  font-family: var(--font-sans); font-size: 1.05rem; color: var(--text); margin-bottom: 18px;
}
.dict-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139, 124, 246, .2); }
.dict-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.dict-row:last-child { border-bottom: none; }
.dict-row .d-en { font-family: var(--font-en); font-size: 1.25rem; font-weight: 600; width: 150px; flex-shrink: 0; color: #cff3fb; }
.dict-row .d-ru { flex: 1; }
.dict-row .d-pos { font-size: .72rem; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; width: 110px; text-align: right; flex-shrink: 0; }
.dict-row .d-learned { font-size: .72rem; font-weight: 700; color: var(--success); width: 80px; text-align: right; flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; justify-content: flex-end; }
.dict-count { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }

.complete-banner { text-align: center; padding: 36px 24px; border-top: 2px solid var(--success); }
.complete-banner .big { font-size: 2.6rem; }
.complete-banner h2 { margin: 10px 0 8px; font-size: 1.5rem; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  padding: 13px 22px; border-radius: 999px; font-size: .95rem; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--muted); padding: 46px 22px; }
.empty .big { font-size: 2.6rem; }

/* Responsive */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .topbar { gap: 10px; padding: 10px 14px; }
  .topnav a span { display: none; }
  .topnav a { padding: 9px 11px; }
  .stats { gap: 10px; }
  .stat .stat-unit { display: none; }
  .hero { padding: 26px 20px; }
  .hero h1 { font-size: 1.55rem; }
  .reading-text { font-size: 1.25rem; }
  .dict-row .d-en { width: 110px; }
  .dict-row .d-pos { width: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* Role coloring */
.role-s { color: #5fd1c9; font-weight: 700; }
.role-v { color: #f0b429; font-weight: 700; }
.role-o { color: #ff7a59; font-weight: 700; }
.role-a { color: #6fa8ff; font-weight: 700; }
.role-x { color: #8b93a7; font-weight: 600; }
.legend .ls { color: #5fd1c9; } .legend .lv { color: #f0b429; } .legend .lo { color: #ff7a59; } .legend .la { color: #6fa8ff; } .legend .lx { color: #8b93a7; }
.legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: .8rem; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; margin-bottom: 12px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .ph-fill { font-size: .55rem; }
.legend .ls { color: #5fd1c9; } .legend .lv { color: #f0b429; } .legend .lo { color: #ff7a59; }

/* Block label */
.block-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--c-theory); margin-bottom: 8px;
}
.block-label .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-theory); }

/* Compare */
.compare { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cmp-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px; border-radius: var(--radius-sm); }
.cmp-item.no { background: rgba(248, 113, 113, .10); border: 1px solid rgba(248, 113, 113, .32); }
.cmp-item.yes { background: rgba(74, 222, 128, .10); border: 1px solid rgba(74, 222, 128, .32); }
.cmp-mark { flex: 0 0 auto; font-size: 1.05rem; line-height: 1.4; }
.cmp-item.no .cmp-mark { color: var(--danger); }
.cmp-item.yes .cmp-mark { color: var(--success); }
.cmp-en { font-family: var(--font-en); font-size: 1.12rem; font-weight: 600; color: var(--text); display: block; }
.cmp-ru { font-size: .86rem; color: var(--muted); }
.cmp-note { font-size: .84rem; color: var(--faint); padding: 0 4px; }

/* Callout */
.callout { border-radius: var(--radius-sm); padding: 13px 16px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.callout__title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .9rem; margin-bottom: 6px; }
.callout__title .ph { font-size: 1.05rem; }
.callout p { margin: 0; color: var(--text); font-size: .95rem; }
.callout.warn { border-color: rgba(255, 122, 89, .4); background: rgba(255, 122, 89, .09); }
.callout.warn .callout__title { color: #ff7a59; }
.callout.info { border-color: rgba(95, 209, 201, .4); background: rgba(95, 209, 201, .09); }
.callout.info .callout__title { color: #5fd1c9; }

/* Table */
.theory-table { margin-bottom: 14px; }
.table-wrap { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table-wrap th, .table-wrap td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap th { background: var(--surface-3); font-weight: 700; color: #d5ccff; font-family: var(--font-en); }
.table-wrap td { font-family: var(--font-en); color: var(--text); }
.table-wrap td:first-child { color: #cff3fb; font-weight: 600; }

/* Sidebar */
.lesson-layout { display: flex; gap: 26px; align-items: flex-start; }
.sidebar {
  width: 250px; flex-shrink: 0; position: sticky; top: 76px;
  max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 14px 16px;
}
.sidebar-title { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.side-unit { font-size: .82rem; font-weight: 700; color: var(--c-theory); margin: 13px 0 4px; }
.side-unit:first-of-type { margin-top: 0; }
.side-lesson { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .86rem; line-height: 1.3; }
.side-lesson:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-lesson .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.side-lesson.done { color: var(--text); }
.side-lesson.done .dot { background: var(--success); }
.side-lesson.current { background: rgba(245, 184, 76, .12); color: #ffd98a; font-weight: 700; }
.side-lesson.current .dot { background: var(--c-practice); }
.lesson-main { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .lesson-layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; max-height: none; }
}

/* ============ Анимации и интерактив ============ */
@keyframes e0-view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes e0-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes e0-bounce-in { 0% { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes e0-pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .5); } 100% { box-shadow: 0 0 0 16px rgba(74, 222, 128, 0); } }
@keyframes e0-shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-3px); } 40%, 60% { transform: translateX(3px); } }
@keyframes e0-shimmer { from { transform: translateX(-120%); } to { transform: translateX(320%); } }

.app.view-enter { animation: e0-view-in .34s cubic-bezier(.22, 1, .36, 1) both; }

.lesson-main > .card, .lesson-main > .lesson-hero { animation: e0-view-in .42s ease both; }
.lesson-main > *:nth-child(2) { animation-delay: .05s; }
.lesson-main > *:nth-child(3) { animation-delay: .1s; }
.lesson-main > *:nth-child(4) { animation-delay: .15s; }
.lesson-main > *:nth-child(5) { animation-delay: .2s; }
.lesson-main > *:nth-child(6) { animation-delay: .25s; }

.chip { animation: e0-pop .16s ease both; }
.feedback.show { animation: e0-pop .2s ease both; }
.slot.correct { animation: e0-pulse .55s ease; }
.slot.wrong, .text-input.wrong { animation: e0-shake .42s ease; }
.option.correct { animation: e0-pop .2s ease both; }

.progress-bar > span { position: relative; overflow: hidden; }
.progress-bar > span::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  animation: e0-shimmer 2.6s ease-in-out infinite;
}

.method-card, .achievement, .unit-card, .stat-tile, .callout, .card { transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease; }
.method-card:hover, .achievement:hover, .stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lesson-row:hover { transform: translateX(3px); }
.side-lesson.current { animation: e0-pop .3s ease both; }

.complete-banner:not(.hidden) .big { animation: e0-bounce-in .55s cubic-bezier(.34, 1.56, .64, 1) both; }
.vocab-card { transition: transform .14s ease, border-color .2s ease; }
.vocab-card:hover { transform: translateY(-2px); border-color: var(--c-words); }

@media (prefers-reduced-motion: reduce) {
  .app.view-enter, .lesson-main > *, .chip, .feedback.show, .option.correct, .complete-banner .big { animation: none !important; }
  .progress-bar > span::after { display: none; }
}

.vocab-card .forms { font-family: var(--font-en); font-size: .84rem; color: var(--c-words); margin-top: 3px; }
.known-btn {
  flex-shrink: 0; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); border-radius: 999px; padding: 5px 13px; font-size: .78rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s, color .15s;
}
.known-btn:hover { border-color: var(--brand); color: var(--text); }
.known-btn.on { background: rgba(74, 222, 128, .14); border-color: rgba(74, 222, 128, .4); color: #9cefc0; }

/* ---------- Аккаунт: топбар ---------- */
.user-area { display: flex; align-items: center; gap: 10px; }
.user-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: .92rem; max-width: 180px;
}
.user-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-link:hover { text-decoration: none; border-color: var(--border-strong); }
.user-link .ph-fill { color: var(--brand); font-size: 1.3rem; }
.btn-sm { padding: 7px 14px; font-size: .88rem; }

/* ---------- Вход и регистрация ---------- */
.auth-wrap { max-width: 430px; margin: 26px auto 0; }
.auth-card { padding: 32px; }
.auth-icon {
  width: 54px; height: 54px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), #6d5cf0);
  color: #fff; font-size: 1.6rem; margin-bottom: 16px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 1.5rem; }
.auth-sub { color: var(--muted); margin: 0 0 18px; font-size: .95rem; }
.field-label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.auth-submit { width: 100%; justify-content: center; margin-top: 22px; }
.form-error {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, .12); border: 1px solid rgba(248, 113, 113, .35);
  color: var(--danger); font-size: .92rem;
}
.auth-alt { color: var(--muted); font-size: .92rem; margin: 16px 0 0; }
/* Контейнер виджета SmartCaptcha: пустой и скрытый, пока капча выключена. */
.captcha-box { margin-top: 18px; }

/* Виджет SmartCaptcha рисует внутри своего iframe светлую полосу по краю — в
   тёмной теме она читается как белая рамка. Снаружи её не перекрыть, поэтому
   срезаем контуром: 1 px по бокам и сверху, 2 px снизу (виджет стоит на
   дробном смещении, из-за этого нижняя полоса шире). Содержимое не задето. */
/* Виджет SmartCaptcha рисует внутри своего iframe светлый фон по краю и в углах
   скруглённой панели — в тёмной теме это читается как белая рамка с треугольниками
   по углам. Снаружи внутрь iframe не залезть, поэтому срезаем по контуру: 1 px по
   бокам и сверху, 2 px снизу (дробное смещение виджета) и скругление 10 px —
   оно больше радиуса панели, поэтому углы тоже уходят. Содержимое не задето. */
.captcha-box iframe { clip-path: inset(1px 1px 2px 1px round 10px); }
.captcha-note { color: var(--muted); font-size: .88rem; line-height: 1.4; }

/* ---------- Профиль ---------- */
.profile-head { display: flex; gap: 20px; align-items: flex-start; }
.profile-ava .ph-fill { font-size: 3.6rem; color: var(--brand); }
.profile-main { flex: 1; min-width: 0; }
.profile-main h1 { margin: 0 0 4px; font-size: 1.6rem; }
.profile-note { color: var(--muted); font-size: .93rem; margin: 0 0 14px; }
.lvl-row { display: flex; align-items: center; gap: 16px; padding: 11px 0; }
.lvl-row + .lvl-row { border-top: 1px solid var(--border); }
.lvl-name { display: flex; align-items: center; gap: 10px; width: 280px; font-weight: 600; font-size: .95rem; }
.lvl-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  color: #10131a; font-weight: 800; font-size: .9rem;
}
.lvl-bar { flex: 1; }
.lvl-count { color: var(--muted); font-size: .9rem; white-space: nowrap; }

@media (max-width: 720px) {
  .stats { display: none; }
  .lvl-name { width: 100%; }
  .lvl-row { flex-wrap: wrap; }
  .lvl-bar { width: 100%; }
}

/* ===== XP: штрафы, комбо, итог урока ===== */
.fxp.bad{color:var(--danger);font-weight:800}
.fxp.muted{color:var(--faint);font-weight:600}
.combo{margin-left:6px;font-size:.78rem;font-weight:800;color:var(--gold);background:rgba(245,184,76,.15);border-radius:999px;padding:2px 9px;white-space:nowrap}
.summary{margin:16px auto 0;max-width:430px;text-align:left}
.sum-row{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:1px solid rgba(255,255,255,.07);font-size:.92rem;color:var(--muted)}
.sum-row b{color:#fff;font-weight:800}
.sum-row.big{margin-top:6px;padding-top:11px;border-top:1px solid rgba(255,255,255,.16);font-size:1.02rem}
.summary .hint{margin:10px 0 0;font-size:.85rem;color:var(--faint);text-align:center}
