:root {
  --bg: #151c36;          /* глубокий индиго — не дуолинговский графит */
  --card: #1f294e;
  --border: #33407c;
  --text: #f6f3ea;        /* тёплый белый */
  --dim: #9aa3c9;
  --primary: #ffb020;     /* янтарь — фирменный цвет Степы */
  --primary-deep: #e08e00;
  --good: #23d18b;        /* мятный, не лаймовый */
  --good-soft: #123b2e;
  --bad: #ff6b6b;         /* коралл вместо алого */
  --bad-soft: #43223066;
  --gold: #ffd166;
  --blue: #5bc0eb;
  --cream: #fff6e9;
  --cream-text: #3c2f1b;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 0%, #1b2447 0%, var(--bg) 55%) fixed var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Rounded", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  overscroll-behavior: none;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }

/* ---------- кнопки: пилюли с мягкой тенью ---------- */
.btn {
  display: block; width: 100%;
  padding: 15px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, #ffc14d, var(--primary));
  box-shadow: 0 8px 20px rgba(255, 176, 32, .28), inset 0 -2px 0 rgba(0,0,0,.12);
  color: #3c2800;
  font-weight: 800; font-size: 16px; letter-spacing: .02em;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 3px 8px rgba(255, 176, 32, .2); }
.btn:disabled { background: var(--card); box-shadow: none; color: var(--dim); }
.btn.blue { background: linear-gradient(180deg, #74cdf1, var(--blue)); box-shadow: 0 8px 20px rgba(91,192,235,.25); color: #06263a; }
.btn.red { background: linear-gradient(180deg, #ff8585, var(--bad)); box-shadow: 0 8px 20px rgba(255,107,107,.25); color: #3d0f0f; }
.btn.ghost { background: transparent; border: 2px solid var(--border); box-shadow: none; color: var(--dim); }

/* ---------- онбординг ---------- */
.hero { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px; gap: 12px; text-align: center; }
.hero .owl { font-size: 72px; }
.hero h1 { font-size: 26px; }
.hero p { color: var(--dim); margin-bottom: 12px; }
.hero .btn + .btn { margin-top: 10px; }
.stepa-hero { display: flex; justify-content: center; }
.stepa-hero img {
  height: 190px; background: var(--cream); border-radius: 36px;
  padding: 10px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.char-body {
  height: 134px; background: #fff; border-radius: 20px; padding: 6px 10px;
  flex-shrink: 0; box-shadow: 0 6px 16px rgba(0,0,0,.3);
}
.finale .stepa-big {
  height: 170px; background: var(--cream); border-radius: 30px;
  padding: 8px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.35);
}

/* ---------- шапка карты ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; position: sticky; top: 0; z-index: 5;
  background: rgba(21, 28, 54, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .stat { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 5px; }
.stat.streak { color: #ff9f43; }
.stat.xp { color: var(--primary); }
.stat.hearts { color: var(--bad); }
.lang-switch { display: inline-flex; gap: 4px; background: rgba(255,255,255,.07); border-radius: 999px; padding: 3px; }
.lang-switch button {
  border: 2px solid transparent; background: transparent; font-size: 17px;
  border-radius: 999px; padding: 2px 7px; line-height: 1.2; opacity: .45;
}
.lang-switch button.active { border-color: var(--primary); background: rgba(255,176,32,.15); opacity: 1; }
.hero-lang { display: flex; justify-content: center; margin-bottom: 8px; }
.level-badge {
  background: var(--primary); color: #3c2800; font-weight: 900;
  padding: 3px 12px; border-radius: 999px; font-size: 14px;
}

/* ---------- разделы ---------- */
.section-tabs {
  display: flex; gap: 8px; padding: 12px 18px 0;
}
.section-tabs button {
  flex: 1; border: 2px solid var(--border); background: transparent; color: var(--dim);
  font-weight: 800; font-size: 14px; border-radius: 999px; padding: 9px 10px;
}
.section-tabs button.active {
  border-color: var(--primary); color: var(--primary); background: rgba(255,176,32,.12);
}
.rule-card {
  background: var(--cream); color: var(--cream-text); border-radius: 18px;
  padding: 16px 18px; font-weight: 600; font-size: 16px; line-height: 1.45;
  text-align: left; box-shadow: 0 6px 16px rgba(0,0,0,.25);
}

/* ---------- карта ---------- */
.map { padding: 18px; display: flex; flex-direction: column; gap: 14px; padding-bottom: 40px; }
.level-header {
  margin-top: 10px;
  background: linear-gradient(135deg, #26315e, var(--card));
  border-radius: 20px; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 9px;
}
.lh-row { display: flex; justify-content: space-between; align-items: center; }
.lh-bar { height: 10px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.lh-bar .fill { height: 100%; background: linear-gradient(90deg, var(--primary), #ff9f43); border-radius: 999px; }
.lh-note { color: var(--dim); font-size: 13px; font-weight: 700; }
.level-header .tag { font-weight: 900; font-size: 20px; }
.level-header .sub { color: var(--dim); font-size: 14px; }
.unit {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border-radius: 20px; padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.unit .icon { font-size: 32px; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center;
  background: var(--cream); border-radius: 18px; }
.unit .info { flex: 1; }
.unit .title { font-weight: 800; }
.unit .progress-text { color: var(--dim); font-size: 13px; margin-top: 2px; }
.unit .go {
  border: none; background: linear-gradient(180deg, #ffc14d, var(--primary));
  box-shadow: 0 5px 14px rgba(255,176,32,.3);
  color: #3c2800; font-weight: 800; border-radius: 999px; padding: 10px 16px; font-size: 14px;
}
.unit .go:active { transform: translateY(2px); }
.unit.locked { opacity: .45; }
.unit.locked .go { background: var(--card); border: 2px solid var(--border); box-shadow: none; color: var(--dim); }
.unit.done-all .go { background: linear-gradient(180deg, #ffe08a, var(--gold)); color: #4a3800; box-shadow: 0 5px 14px rgba(255,209,102,.3); }
.practice-card {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #17395c, #14304d);
  border-radius: 20px; padding: 14px 16px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.practice-card .info { flex: 1; }
.practice-card .title { font-weight: 800; color: var(--blue); }
.practice-card .sub { color: var(--dim); font-size: 13px; }
.practice-card .go {
  border: none; background: linear-gradient(180deg, #74cdf1, var(--blue));
  color: #06263a; font-weight: 800; border-radius: 999px; padding: 10px 16px; font-size: 14px;
  box-shadow: 0 5px 14px rgba(91,192,235,.3);
}

/* ---------- урок ---------- */
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.lesson-top .close { background: none; border: none; color: var(--dim); font-size: 22px; font-weight: 800; }
.bar { flex: 1; height: 14px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), #ff9f43); border-radius: 999px; transition: width .3s; }
.bar.combo .fill { background: linear-gradient(90deg, var(--gold), #ffe08a, var(--gold)); }
.lesson-hearts { color: var(--bad); font-weight: 800; font-size: 15px; }
.combo-note { text-align: center; color: var(--gold); font-weight: 800; font-size: 13px; height: 18px; letter-spacing: .05em; }

.exercise { flex: 1; padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.ex-tag { font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.ex-tag.new { color: #c792ff; }
.ex-tag.hard { color: var(--bad); }
.exercise h2 { font-size: 22px; }
.speech-row { display: flex; align-items: flex-start; gap: 14px; }
.bubble {
  background: #fff; color: var(--cream-text); border-radius: 16px;
  padding: 11px 15px; font-weight: 700; position: relative;
  display: flex; align-items: center; gap: 8px; margin-top: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
/* хвостик облачка — ко рту Степы */
.bubble::before {
  content: ""; position: absolute; left: -9px; top: 15px;
  border: 9px solid transparent; border-right-color: #fff; border-left: 0;
}
.bubble .speak { background: none; border: none; font-size: 18px; }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; background: var(--card); color: var(--text);
  border: 2px solid var(--border); border-radius: 18px;
  padding: 13px 16px; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; gap: 10px;
  transition: border-color .1s, background .1s;
}
.opt .num {
  border: 2px solid var(--border); border-radius: 8px; color: var(--dim);
  font-size: 12px; padding: 1px 7px; font-weight: 800;
}
.opt.selected { border-color: var(--primary); background: #33305a; color: var(--primary); }
.opt.right { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.opt.wrong { border-color: var(--bad); background: #3c2334; color: var(--bad); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card-opt {
  background: var(--card); border: 2px solid var(--border);
  border-radius: 18px; padding: 14px 6px; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .1s, background .1s;
}
.card-opt .pic { font-size: 42px; }
.card-opt .cap { font-weight: 700; font-size: 14px; }
.card-opt.selected { border-color: var(--primary); background: #33305a; }
.card-opt.right { border-color: var(--good); background: var(--good-soft); }
.card-opt.wrong { border-color: var(--bad); background: #3c2334; }

.answer-line {
  min-height: 56px; border-bottom: 2px solid var(--border); padding: 8px 2px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
}
.tile-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 6px; }
.tile {
  background: var(--card); border: 2px solid var(--border);
  border-radius: 14px; padding: 9px 14px; font-weight: 700; color: var(--text); font-size: 16px;
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
}
.tile.used { visibility: hidden; }

/* ---------- футер урока ---------- */
.lesson-footer { border-top: 1px solid var(--border); padding: 14px 18px 22px; background: rgba(21,28,54,.6); }
.feedback { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.feedback .mark { font-size: 34px; }
.feedback .msg { font-weight: 900; font-size: 18px; }
.feedback .detail { color: var(--dim); font-size: 14px; margin-top: 2px; }
.feedback.good .msg { color: var(--good); }
.feedback.bad .msg { color: var(--bad); }

/* ---------- финал ---------- */
.finale { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 28px; text-align: center; }
.finale .big { font-size: 64px; }
.finale h1 { font-size: 24px; color: var(--primary); }
.stats-row { display: flex; gap: 12px; width: 100%; }
.stat-card { flex: 1; border-radius: 18px; padding: 3px; }
.stat-card .inner { background: var(--bg); border-radius: 15px; padding: 12px 8px; }
.stat-card .label { font-size: 11px; font-weight: 900; letter-spacing: .06em; }
.stat-card .value { font-size: 20px; font-weight: 900; margin-top: 4px; }
.stat-card.gold { background: var(--gold); } .stat-card.gold .label, .stat-card.gold .value { color: var(--gold); }
.stat-card.green { background: var(--good); } .stat-card.green .label, .stat-card.green .value { color: var(--good); }
.stat-card.blue { background: var(--blue); } .stat-card.blue .label, .stat-card.blue .value { color: var(--blue); }
.finale .footer-btn { width: 100%; margin-top: 14px; }

/* ---------- аудирование / диалог / ввод ---------- */
.listen-row { display: flex; align-items: center; gap: 14px; }
.listen-btn {
  border: none; background: linear-gradient(180deg, #74cdf1, var(--blue));
  color: #06263a; font-weight: 800; border-radius: 999px; padding: 14px 22px; font-size: 16px;
  box-shadow: 0 6px 16px rgba(91,192,235,.3);
}
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; }
.chat-line { max-width: 82%; border-radius: 16px; padding: 9px 13px; }
.chat-line.left { align-self: flex-start; background: var(--cream); color: var(--cream-text); border-bottom-left-radius: 4px; }
.chat-line.right { align-self: flex-end; background: #2b3a6e; border-bottom-right-radius: 4px; }
.chat-who { font-size: 11px; font-weight: 900; opacity: .6; letter-spacing: .05em; text-transform: uppercase; }
.chat-text { font-weight: 700; }
.chat-ru { font-size: 13px; opacity: .7; margin-top: 2px; }
.type-input {
  width: 100%; background: var(--card); border: 2px solid var(--border); border-radius: 14px;
  color: var(--text); font: inherit; font-weight: 700; padding: 12px 14px; outline: none;
}
.type-input:focus { border-color: var(--primary); }
.kb-toggle {
  background: none; border: none; color: var(--blue); font-weight: 800; font-size: 14px;
  align-self: center; padding: 4px;
}
.why-btn {
  display: block; margin-top: 6px; background: none; border: 2px solid var(--border);
  border-radius: 999px; color: var(--blue); font-weight: 800; font-size: 13px; padding: 4px 12px;
}
.explain { margin-top: 8px; color: var(--text); font-size: 14px; line-height: 1.4; }
.rule-btn {
  border: 2px solid var(--border); background: transparent; border-radius: 12px;
  font-size: 17px; padding: 8px 10px; margin-right: -6px;
}

/* ---------- админ-статистика ---------- */
.adm-btn { border: none; background: none; font-size: 18px; padding: 2px; }
.adm-block {
  background: var(--card); border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.adm-title { font-weight: 800; font-size: 14px; color: var(--dim); margin-bottom: 10px; }
.bars { display: flex; gap: 4px; align-items: flex-end; height: 96px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.bar-fill { width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; opacity: .9; }
.bar-num { font-size: 9px; color: var(--dim); height: 12px; }
.bar-days { display: flex; margin-top: 4px; }
.bar-days span { flex: 1; font-size: 8px; color: var(--dim); text-align: center; }
.adm-row {
  display: flex; justify-content: space-between; font-size: 14px; font-weight: 700;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.adm-row span:last-child { color: var(--dim); }

/* ---------- сертификат ---------- */
.cert-img { width: 100%; border-radius: 16px; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.cert-btn {
  border: none; background: linear-gradient(180deg, #ffc14d, var(--primary));
  color: #3c2800; font-weight: 800; border-radius: 999px; padding: 4px 12px;
  font-size: 13px; margin-left: 8px;
}
.finale .btn + .btn { margin-top: 0; }
.finale .btn { margin-top: 0; }

/* ---------- placement ---------- */
.result-card {
  background: var(--card); border-radius: 24px;
  padding: 26px; width: 100%; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.result-card .lvl { font-size: 52px; font-weight: 900; color: var(--primary); }
.result-card .lvl-name { color: var(--dim); font-weight: 700; margin-top: 4px; }
