/* ¡Hablar! — тёплая «испанская» палитра: терракота, шафран, оливка. */
:root {
  --bg: #fbf6ef;
  --surface: #ffffff;
  --surface-2: #f4ece1;
  --border: #e8dccb;
  --text: #2b211b;
  --muted: #7a6a5c;
  --primary: #c8432f;
  --primary-ink: #ffffff;
  --primary-soft: #fbe3dc;
  --accent: #e9a91f;
  --accent-soft: #fdf0cf;
  --ok: #2f8f5b;
  --ok-soft: #dcf2e4;
  --bad: #c73a3a;
  --bad-soft: #fbe0e0;
  --blue: #3a6ea5;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --radius: 16px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1512; --surface: #251e19; --surface-2: #2f2620; --border: #3d322a;
    --text: #f3ebe2; --muted: #b0a090; --primary: #e8604a; --primary-soft: #4a2620;
    --accent: #f0b93a; --accent-soft: #4a3a15; --ok: #4cc283; --ok-soft: #1d3d2b;
    --bad: #f06363; --bad-soft: #4a2222; --blue: #7aa7d9;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1512; --surface: #251e19; --surface-2: #2f2620; --border: #3d322a;
  --text: #f3ebe2; --muted: #b0a090; --primary: #e8604a; --primary-soft: #4a2620;
  --accent: #f0b93a; --accent-soft: #4a3a15; --ok: #4cc283; --ok-soft: #1d3d2b;
  --bad: #f06363; --bad-soft: #4a2222; --blue: #7aa7d9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 900; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.es { font-weight: 700; }
.grow { flex: 1; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.ok-text { color: var(--ok); font-weight: 700; }
.bad-text { color: var(--bad); font-weight: 700; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Каркас ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.logo { font-weight: 900; font-size: 1.4rem; color: var(--text); letter-spacing: -.02em; }
.logo-mark { color: var(--primary); }
.header-stats { display: flex; gap: .4rem; margin-left: auto; align-items: center; }
.stat-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 800; font-size: .9rem; color: var(--text);
}
.stat-chip.level { flex-direction: row; }
.mini-progress { width: 38px; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; display: inline-block; }
.mini-progress span { display: block; height: 100%; background: var(--accent); }
.flame { filter: grayscale(1); opacity: .5; }
.flame.on { filter: none; opacity: 1; }
.layout { display: flex; max-width: 1240px; margin: 0 auto; }
.nav {
  position: sticky; top: 60px; align-self: flex-start; width: 210px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 2px; padding: 1rem .6rem; height: calc(100vh - 60px); overflow-y: auto;
}
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 12px;
  color: var(--text); font-weight: 700; position: relative;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav-icon { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.badge { margin-left: auto; background: var(--primary); color: var(--primary-ink); font-size: .7rem; border-radius: 999px; padding: 0 .45rem; font-weight: 800; }
main { flex: 1; min-width: 0; padding: 1.5rem 1.25rem 4rem; }
main:focus, main:focus-visible { outline: none; }
body.focus-mode .nav { display: none; }
body.focus-mode main { max-width: 760px; margin: 0 auto; }

@media (max-width: 820px) {
  .layout { display: block; }
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: auto; height: auto; z-index: 30;
    flex-direction: row; overflow-x: auto; padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); gap: 0; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex-direction: column; gap: 0; padding: .3rem .55rem; font-size: .68rem; min-width: 64px; text-align: center; }
  .nav-icon { font-size: 1.25rem; }
  .badge { position: absolute; top: 0; right: 6px; }
  main { padding: 1rem 16px 6rem; }
  .topbar { padding: .5rem 16px; gap: .5rem; }
  .logo { font-size: 1.15rem; }
  .stat-chip { padding: .2rem .5rem; font-size: .8rem; }
  .mini-progress { display: none; }
  h1 { font-size: 1.4rem; }
}

/* ---------- Компоненты ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); display: block; color: var(--text);
}
a.card { transition: transform .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); border-color: var(--primary); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card-grid > .card { margin: 0; }
.page-header { margin-bottom: 1rem; }
.page-header h1 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.back-link { display: inline-block; margin-bottom: .4rem; font-weight: 700; }
.big-emoji { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 12px; border: 2px solid var(--border); border-bottom-width: 4px;
  background: var(--surface); color: var(--text); font-weight: 800; cursor: pointer; transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.primary { background: var(--primary); border-color: color-mix(in srgb, var(--primary) 70%, black); color: var(--primary-ink); }
.btn.danger { background: var(--bad); border-color: color-mix(in srgb, var(--bad) 70%, black); color: #fff; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn.small { padding: .35rem .75rem; font-size: .85rem; border-bottom-width: 3px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 1.1rem; width: 36px; height: 36px;
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-weight: 900;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { background: var(--ok-soft); color: var(--ok); }
.speak-btn {
  border: none; background: var(--surface-2); border-radius: 50%; width: 32px; height: 32px; cursor: pointer;
  font-size: .95rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
}
.speak-btn:hover { background: var(--accent-soft); }
.speak-btn.big { width: 56px; height: 56px; font-size: 1.5rem; }

.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.progress.thick { height: 14px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; transition: width .35s ease; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chip {
  border: 2px solid var(--border); background: var(--surface); border-radius: 999px; padding: .35rem .8rem;
  cursor: pointer; font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; gap: .35rem;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip.check input { accent-color: var(--primary); }
.segmented { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 12px; gap: 2px; margin-bottom: 1rem; flex-wrap: wrap; }
.segmented button { border: none; background: transparent; padding: .4rem .9rem; border-radius: 9px; cursor: pointer; font-weight: 700; }
.segmented button.active { background: var(--surface); box-shadow: var(--shadow); }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: .1rem .5rem; border-radius: 6px; background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 60%, var(--text)); margin-top: .3rem; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.level-badge { display: inline-block; font-size: .72rem; font-weight: 900; padding: .1rem .45rem; border-radius: 6px; color: #fff; vertical-align: middle; }
.level-badge.A1 { background: #2f8f5b; }
.level-badge.A2 { background: #3a6ea5; }
.level-badge.B1 { background: #8a4fb0; }

input[type=text], input[type=search], select {
  border: 2px solid var(--border); background: var(--surface); border-radius: 12px; padding: .6rem .8rem; width: 100%; max-width: 100%;
}
input[type=text]:focus, input[type=search]:focus, select:focus { border-color: var(--primary); outline: none; }
select { width: auto; cursor: pointer; }
.search { margin-bottom: .5rem; max-width: 520px; }
.field { margin: .75rem 0; }
.field .label { font-weight: 800; margin-bottom: .3rem; }
.switch { display: flex; align-items: center; gap: .4rem; cursor: pointer; font-weight: 600; margin: .4rem 0; }
.switch input { width: 18px; height: 18px; accent-color: var(--primary); }
input[type=range] { accent-color: var(--primary); width: 200px; }

.input-wrap { width: 100%; }
.answer-input { font-size: 1.15rem; font-weight: 700; text-align: center; }
.answer-input.correct { border-color: var(--ok); background: var(--ok-soft); }
.answer-input.wrong { border-color: var(--bad); background: var(--bad-soft); }
.accent-bar { display: flex; gap: 4px; justify-content: center; margin: .4rem 0 .6rem; flex-wrap: wrap; }
.accent-key { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; min-width: 34px; height: 34px; cursor: pointer; font-weight: 800; }
.accent-key:hover { background: var(--accent-soft); }

/* ---------- Тосты, модалки ---------- */
.toasts { position: fixed; top: 70px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: .65rem 1rem; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); animation: slideIn .3s ease; transition: opacity .4s, transform .4s; }
.toast.gold { background: var(--accent); color: #2b211b; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }
.xp-pop { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 70; font-weight: 900; font-size: 1.4rem; color: var(--accent); text-shadow: 0 2px 8px rgba(0, 0, 0, .2); animation: floatUp 1.2s ease forwards; pointer-events: none; }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, 20px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -30px); } }
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 1.25rem; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.popover { position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; box-shadow: var(--shadow); max-width: 260px; display: flex; flex-direction: column; gap: .35rem; }
.pop-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }

/* ---------- Главная ---------- */
.hero { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); }
.hero-text { flex: 1; min-width: 0; }
.hero .btn.big { white-space: normal; text-align: left; }
.hero-goal { text-align: center; }
.ring {
  --p: 0; width: 112px; height: 112px; border-radius: 50%;
  background: conic-gradient(var(--ok) calc(var(--p) * 360deg), var(--surface-2) 0);
  display: grid; place-items: center;
}
.ring-inner { width: 86px; height: 86px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-inner b { font-size: 1.5rem; line-height: 1; }
.wotd { text-align: center; }
.wotd-label { font-weight: 800; color: var(--accent); text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.wotd-word { font-size: 2rem; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .3rem 0; }
.wotd-ru { color: var(--muted); font-size: 1.1rem; margin-bottom: .6rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { display: flex; gap: .9rem; align-items: center; margin: 0; }
.tile.hot { border-color: var(--accent); background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.tile-icon { font-size: 2rem; }
.tile-title { font-weight: 800; }
.heatmap-wrap { overflow-x: auto; }
.heatmap { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); display: inline-block; }
.hm-cell.l1 { background: color-mix(in srgb, var(--ok) 30%, var(--surface-2)); }
.hm-cell.l2 { background: color-mix(in srgb, var(--ok) 55%, var(--surface-2)); }
.hm-cell.l3 { background: color-mix(in srgb, var(--ok) 80%, var(--surface-2)); }
.hm-cell.l4 { background: var(--ok); }
.hm-legend { display: flex; align-items: center; gap: 3px; margin-top: .5rem; }
@media (max-width: 600px) {
  .hero { flex-direction: column-reverse; text-align: center; }
  .hero .btn.big { text-align: center; }
}

/* ---------- Курс ---------- */
.level-block { margin: 1.5rem 0; }
.level-title { display: flex; align-items: center; gap: .5rem; }
.level-title .level-badge { font-size: 1rem; padding: .2rem .6rem; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.unit { margin: 0; }
.unit.locked { opacity: .6; }
.unit.complete { border-color: var(--accent); }
.unit-head { display: flex; gap: .8rem; align-items: center; }
.unit-icon { font-size: 2.2rem; }
.unit-info { flex: 1; min-width: 0; }
.unit-info h3 { margin: 0; }
.unit-count { font-weight: 900; color: var(--muted); }
.lesson-dots { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.lesson-dot {
  width: 48px; height: 48px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface-2); border: 2px solid var(--border); border-bottom-width: 4px; font-weight: 900; color: var(--text); line-height: 1.1;
}
a.lesson-dot:hover { border-color: var(--primary); }
.lesson-dot.done { background: var(--accent); border-color: color-mix(in srgb, var(--accent) 70%, black); color: #2b211b; }
.lesson-dot.review { border-style: dashed; }
.lesson-dot.locked { opacity: .5; font-size: .9rem; }
.lesson-dot .stars { font-size: .5rem; letter-spacing: -1px; }

/* ---------- Урок ---------- */
.lesson { display: flex; flex-direction: column; min-height: calc(100vh - 140px); }
.lesson-top { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.combo { font-weight: 900; color: var(--accent); min-width: 48px; text-align: right; }
.lesson-stage { flex: 1; }
.lesson-footer {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem; margin: 1rem -1rem -1rem; border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap;
}
.lesson-footer:empty { padding: 0; }
.lesson-footer.ok { background: var(--ok-soft); color: var(--ok); }
.lesson-footer.bad { background: var(--bad-soft); color: var(--bad); }
.lesson-footer .feedback { flex: 1; min-width: 200px; }
.lesson-footer .feedback .es { color: var(--text); }
.fb-title { font-weight: 900; font-size: 1.2rem; }
@media (max-width: 820px) { .lesson-footer { bottom: 0; } body.focus-mode .nav { display: none; } body.focus-mode main { padding-bottom: 1rem; } }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-top: 1rem; }
.intro-card { border: 2px solid var(--border); border-bottom-width: 4px; background: var(--surface); border-radius: 14px; padding: .9rem; cursor: pointer; text-align: left; }
.intro-card:hover { border-color: var(--primary); }
.intro-card .es { font-size: 1.15rem; }

.exercise { max-width: 640px; margin: 0 auto; }
.ex-title { font-size: 1.35rem; font-weight: 900; margin-bottom: 1rem; }
.prompt { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.2rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.prompt.sentence { font-size: 1.3rem; }
.gap { display: inline-block; min-width: 70px; border-bottom: 3px solid var(--primary); color: var(--primary); text-align: center; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.options.wide, .options.compact { grid-template-columns: 1fr; }
.options.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
@media (max-width: 520px) { .options { grid-template-columns: 1fr; } }
.option {
  position: relative; padding: .85rem 1rem .85rem 2.4rem; border: 2px solid var(--border); border-bottom-width: 4px;
  border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 700; text-align: left; font-size: 1.02rem; transition: border-color .12s, background .12s;
}
.options.compact .option { padding: .55rem .8rem; }
.option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.option.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.option:disabled { cursor: default; }
.option.wide { width: 100%; padding-left: 1rem; margin-bottom: .5rem; display: block; }
.key-hint { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); font-size: .72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 .3rem; }
.why { color: var(--text); font-weight: 600; margin-top: .3rem; }
.check-btn { margin-top: .5rem; width: 100%; }
.listen-row { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0 1.5rem; align-items: center; }
.listen-btn { width: 96px; height: 96px; border-radius: 24px; font-size: 2.5rem; border: none; background: var(--blue); color: #fff; cursor: pointer; box-shadow: 0 4px 0 color-mix(in srgb, var(--blue) 60%, black); }
.listen-btn.small { width: 64px; height: 64px; font-size: 1.6rem; border-radius: 18px; }
.listen-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--blue) 60%, black); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.match-col { display: flex; flex-direction: column; gap: .6rem; }
.match-item { padding: .8rem; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 700; }
.match-item.selected { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 15%, var(--surface)); }
.match-item.done { opacity: .35; border-color: var(--ok); cursor: default; }
.shake { animation: shake .35s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.build-answer { min-height: 62px; border-bottom: 2px solid var(--border); padding: .5rem 0; display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.build-answer.correct { border-color: var(--ok); }
.build-answer.wrong { border-color: var(--bad); }
.build-bank { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; min-height: 48px; margin-bottom: 1rem; }
.build-bank .chip, .build-answer .chip { border-bottom-width: 4px; border-radius: 10px; font-size: 1.05rem; }
.chip.letter { min-width: 44px; justify-content: center; font-size: 1.3rem; text-transform: lowercase; }
.anagram-answer { justify-content: center; }

.result { text-align: center; padding: 2rem 0; }
.result-stars { font-size: 2.4rem; color: var(--accent); letter-spacing: .2rem; }
.result-stats { display: flex; justify-content: center; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.result-stats > div { background: var(--surface-2); border-radius: 14px; padding: .7rem 1.1rem; min-width: 96px; display: flex; flex-direction: column; }
.result-stats b { font-size: 1.5rem; }
.result-inline.ok { border-color: var(--ok); }
.result-inline.bad { border-color: var(--bad); }

/* ---------- Повторение ---------- */
.review-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.flashcard { perspective: 1000px; height: 260px; max-width: 520px; margin: 0 auto 1rem; cursor: pointer; outline: none; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .6rem; padding: 1.5rem; text-align: center; font-size: 1.8rem; font-weight: 800;
  background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow);
}
.fc-face small { font-size: .8rem; font-weight: 600; }
.fc-back { transform: rotateY(180deg); background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.fc-back .muted { font-size: 1rem; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; max-width: 520px; margin: 0 auto; }
.grade-btn { border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 12px; padding: .6rem .3rem; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.grade-btn small { color: var(--muted); }
.grade-btn.again { border-color: var(--bad); }
.grade-btn.hard { border-color: var(--accent); }
.grade-btn.good { border-color: var(--ok); }
.grade-btn.easy { border-color: var(--blue); }

/* ---------- Словарь ---------- */
.dict-list { display: flex; flex-direction: column; gap: 2px; margin-top: .5rem; }
.dict-row { display: grid; grid-template-columns: 32px 1fr 1fr 60px 36px; align-items: center; gap: .7rem; padding: .45rem .6rem; background: var(--surface); border-radius: 10px; }
.dict-row:nth-child(odd) { background: var(--surface-2); }
.strength { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.strength span { display: block; height: 100%; background: var(--ok); }
@media (max-width: 600px) { .dict-row { grid-template-columns: 32px 1fr 36px; } .dict-ru { grid-column: 2; grid-row: 2; color: var(--muted); font-size: .9rem; } .strength { display: none; } }

/* ---------- Глаголы ---------- */
.verb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.verb-card { margin: 0; padding: .9rem; }
.verb-inf { font-size: 1.15rem; }
.tense-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6rem; }
.tense-item { padding: .4rem 0; }
.conj-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.conj-table { margin: 0; }
.conj-table table, .mini-table table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.conj-table td, .mini-table td { padding: .3rem .2rem; border-bottom: 1px solid var(--border); }
.conj-table td:last-child { width: 36px; }
.irr { color: var(--primary); text-decoration: underline dotted; }
.trainer-score { display: flex; gap: 1.2rem; justify-content: center; font-size: 1.1rem; margin: .5rem 0 1rem; }
.trainer-stage { text-align: center; max-width: 560px; margin: 0 auto; }
.trainer-tense { font-weight: 800; margin-bottom: .8rem; }
.trainer-prompt { display: flex; gap: .8rem; justify-content: center; align-items: baseline; flex-wrap: wrap; margin-bottom: 1rem; }
.pronoun { font-size: 1.6rem; font-weight: 900; color: var(--blue); }
.trainer-prompt .verb-inf { font-size: 1.6rem; color: var(--primary); }
.trainer-feedback { margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.mini-table summary { cursor: pointer; color: var(--muted); }
.mini-table tr.hl td { background: var(--accent-soft); font-weight: 800; }
.settings-panel summary { cursor: pointer; font-weight: 800; }

/* ---------- Грамматика ---------- */
.topic-card { display: flex; gap: .9rem; align-items: flex-start; }
.topic-card.done { border-color: var(--ok); }
.topic-icon { font-size: 2rem; line-height: 1; }
.prose h3 { margin-top: 1.2rem; }
.prose table { border-collapse: collapse; margin: .8rem 0; width: 100%; max-width: 640px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left; }
.prose th { background: var(--surface-2); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .3rem 0; }
.prose .tip { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: .7rem 1rem; border-radius: 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.speakable { cursor: pointer; border-bottom: 1px dashed color-mix(in srgb, var(--primary) 50%, transparent); }
.speakable:hover { color: var(--primary); }
.quiz-item { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.quiz-q { font-weight: 700; margin-bottom: .5rem; }
.quiz-fb { margin-top: .4rem; font-size: .95rem; }

/* ---------- Чтение ---------- */
.story { font-size: 1.15rem; }
.story-line { padding: .6rem .5rem; border-radius: 10px; display: grid; grid-template-columns: 1fr auto; gap: .3rem .6rem; transition: background .2s; }
.story-line.reading { background: var(--accent-soft); }
.line-es { font-weight: 600; }
.line-tools { display: flex; gap: .3rem; }
.line-tr { grid-column: 1 / -1; color: var(--muted); font-size: 1rem; font-style: italic; }
.word { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.word:hover { background: var(--accent-soft); }
.word.unknown { cursor: help; }

/* ---------- Диалоги ---------- */
.chat-card { min-height: 200px; }
.chat { display: flex; flex-direction: column; gap: .7rem; }
.bubble { max-width: 80%; padding: .7rem 1rem; border-radius: 18px; animation: slideIn .3s ease; }
.bubble.npc { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-right-radius: 4px; }
.bubble-name { font-size: .8rem; font-weight: 800; color: var(--muted); }
.bubble-tools { display: flex; gap: .3rem; margin-top: .3rem; }
.bubble-tr { font-size: .9rem; font-style: italic; opacity: .85; margin-top: .2rem; }
.choices { margin-top: 1rem; }

/* ---------- Культура ---------- */
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-top: 1rem; }
.country { margin: 0; text-align: left; cursor: pointer; font: inherit; }
.flag { font-size: 2.4rem; line-height: 1.1; }
.flag.big { font-size: 5rem; }
.country-fact { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--border); }
.idioms { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.idiom { margin: 0; }
.idiom-es { display: flex; gap: .5rem; align-items: center; font-size: 1.1rem; margin-bottom: .3rem; }

/* ---------- Игры ---------- */
.game-card.disabled { opacity: .55; }
.game-stage { max-width: 680px; margin: 0 auto; }
.timer { display: flex; align-items: center; gap: .7rem; }
.timer-label { font-weight: 900; min-width: 48px; }
.timer.low .progress-fill { background: var(--bad); }
.timer.low .timer-label { color: var(--bad); }
.big-word { font-size: 2.2rem; font-weight: 900; margin: .5rem 0; word-break: break-word; }
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
@media (max-width: 560px) { .memory-grid { grid-template-columns: repeat(3, 1fr); } }
.memory-card { perspective: 600px; height: 104px; border: none; background: none; padding: 0; cursor: pointer; }
.mc-inner { position: relative; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.memory-card.flipped .mc-inner { transform: rotateY(180deg); }
.mc-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 14px; display: flex; align-items: center; justify-content: center; padding: .4rem; font-weight: 800; font-size: .92rem; text-align: center; }
.mc-back { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 1.6rem; }
.mc-front { background: var(--surface); border: 2px solid var(--border); transform: rotateY(180deg); }
.memory-card.matched .mc-front { border-color: var(--ok); background: var(--ok-soft); }
.gender-card .btn.big { min-width: 120px; font-size: 1.5rem; }
.btn.el { background: var(--blue); color: #fff; border-color: color-mix(in srgb, var(--blue) 60%, black); }
.btn.la { background: var(--primary); color: #fff; border-color: color-mix(in srgb, var(--primary) 60%, black); }
.tf-eq { font-size: 1.5rem; color: var(--muted); }
.tf-card { transition: background .3s; }
.flash-ok { animation: flashOk .4s; }
.flash-bad { animation: flashBad .4s; }
@keyframes flashOk { from { background: var(--ok-soft); } }
@keyframes flashBad { from { background: var(--bad-soft); } }
.hangman { text-align: center; }
.hangman-fig { height: 160px; display: flex; justify-content: center; }
.hangman-svg { height: 150px; stroke: var(--text); stroke-width: 4; fill: none; stroke-linecap: round; }
.hangman-word { display: flex; justify-content: center; gap: .4rem; margin: 1rem 0; flex-wrap: wrap; }
.hm-letter { width: 32px; height: 42px; border-bottom: 3px solid var(--text); font-size: 1.6rem; font-weight: 900; display: flex; align-items: flex-end; justify-content: center; }
.hm-letter.reveal { color: var(--bad); }
.keyboard { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 1rem; }
.key { width: 38px; height: 42px; border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 9px; background: var(--surface); cursor: pointer; font-weight: 900; font-size: 1.05rem; }
.key.hit { background: var(--ok-soft); border-color: var(--ok); }
.key.miss { background: var(--bad-soft); border-color: var(--bad); opacity: .6; }
.clock svg { width: 180px; height: 180px; margin: .5rem auto; display: block; }
.clock .face { fill: var(--surface-2); stroke: var(--text); stroke-width: 3; }
.clock .tick { stroke: var(--text); stroke-width: 2; }
.clock .hand-h { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.clock .hand-m { stroke: var(--primary); stroke-width: 3; stroke-linecap: round; }
.clock .pin { fill: var(--primary); }
.digital { font-weight: 900; font-size: 1.2rem; color: var(--muted); margin-bottom: 1rem; }
.mic-btn { width: 72px; height: 72px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 2rem; cursor: pointer; }
.mic-btn.rec { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--primary) 25%, transparent); } }

/* ---------- Профиль ---------- */
.profile-head { display: flex; gap: 1.2rem; align-items: center; }
.level-circle { width: 84px; height: 84px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.level-circle b { font-size: 2rem; line-height: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .8rem; display: flex; flex-direction: column; text-align: center; }
.stat b { font-size: 1.35rem; }
.stat small { color: var(--muted); }
.bars { display: flex; gap: .6rem; align-items: flex-end; height: 160px; margin: .5rem 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 42px; background: var(--accent); border-radius: 6px 6px 0 0; }
.bar.goal { background: var(--ok); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.ach { display: flex; gap: .7rem; align-items: center; padding: .6rem; border-radius: 12px; background: var(--surface-2); opacity: .55; }
.ach.got { opacity: 1; background: var(--accent-soft); }
.ach-icon { font-size: 1.8rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
