/* English · Outcomes — оформление. Цвета — токенами, тёмная тема ниже. */
:root {
  --brand: #0e8c9a;
  --brand-2: #0a6f7b;
  --brand-soft: #e3f4f6;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #18222b;
  --ink-2: #51606d;
  --ink-3: #8a97a3;
  --line: #e2e7ec;
  --ok: #1f9d55;
  --ok-soft: #e3f6ea;
  --bad: #d64545;
  --bad-soft: #fdeaea;
  --warn: #c98a00;
  --warn-soft: #fff4d6;
  /* навыки */
  --sk-grammar: #6a5acd;
  --sk-vocab: #0e8c9a;
  --sk-listen: #e07a1f;
  --sk-speak: #d1495b;
  --sk-read: #2e86de;
  --sk-write: #4c9a2a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 4px 16px rgba(20, 30, 40, .06);
  --tab-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #22b3c2; --brand-2: #4fc8d5; --brand-soft: #123a40;
  --bg: #0f1418; --card: #182027; --ink: #e8eef2; --ink-2: #a9b6c1; --ink-3: #6f7d89;
  --line: #26313a; --ok: #3ccf7c; --ok-soft: #16322a; --bad: #ff6b6b; --bad-soft: #3a1d20;
  --warn: #f2b632; --warn-soft: #3a3016;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #22b3c2; --brand-2: #4fc8d5; --brand-soft: #123a40;
    --bg: #0f1418; --card: #182027; --ink: #e8eef2; --ink-2: #a9b6c1; --ink-3: #6f7d89;
    --line: #26313a; --ok: #3ccf7c; --ok-soft: #16322a; --bad: #ff6b6b; --bad-soft: #3a1d20;
    --warn: #f2b632; --warn-soft: #3a3016;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: calc(16px * var(--fs, 1));
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

#app { max-width: 720px; margin: 0 auto; min-height: 100%; padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }

/* шапка */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg);
}
.top h1 { font-size: 20px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .back { border: 0; background: var(--card); width: 40px; height: 40px; border-radius: 12px; box-shadow: var(--shadow); font-size: 20px; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; white-space: nowrap; }

.wrap { padding: 0 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sec-title { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 22px 4px 4px; }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; box-shadow: 0 3px 0 var(--brand-2);
  transition: transform .06s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-2); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1.5px var(--line) inset; }
.btn.soft { background: var(--brand-soft); color: var(--brand-2); box-shadow: none; }
.btn.ok { background: var(--ok); box-shadow: 0 3px 0 #157a40; }
.btn.bad { background: var(--bad); box-shadow: 0 3px 0 #a83232; }
.btn:disabled { opacity: .45; cursor: default; }
.ibtn { border: 0; background: var(--brand-soft); color: var(--brand-2); width: 44px; height: 44px; border-radius: 12px; font-size: 20px; cursor: pointer; flex: none; }

/* герой «Сегодня» */
.hero { background: linear-gradient(135deg, var(--brand), #2bb3a3); color: #fff; border-radius: 24px; padding: 20px; margin: 8px 0 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero h2 { margin: 0; font-size: 22px; }
.hero .muted { color: rgba(255, 255, 255, .85); }
.hero .btn { background: #fff; color: var(--brand-2); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.hero .btn.ghost { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55) inset; font-weight: 600; }
.hero .done { background: #fff; color: #12202b; border-radius: 14px; padding: 10px 14px; margin: 0 0 10px; }
.hero .done .muted { color: #5d6b77; }
.hero:after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--ink-2); }

.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.hero .bar { background: rgba(255, 255, 255, .3); }
.hero .bar i { background: #fff; }

/* путь юнитов */
.unit {
  display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin: 10px 0; cursor: pointer; border: 2px solid transparent;
}
.unit.current { border-color: var(--brand); }
.unit .no { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; flex: none; }
.unit .ring { position: relative; }
.unit.extras .no { font-size: 13px; }

/* вкладки */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs .in { display: flex; width: 100%; max-width: 720px; }
.tabs button { flex: 1; height: var(--tab-h); border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-3); font-size: 11px; font-weight: 600; }
.tabs button .ic { font-size: 22px; line-height: 1; }
.tabs button.on { color: var(--brand); }

/* список действий в юните */
.act { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; }
.act + .act { border-top: 1px solid var(--line); }
.act .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex: none; }
.act .chev { color: var(--ink-3); font-size: 20px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-2); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* страница учебника */
.pagebox { position: relative; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; touch-action: pan-y; }
.pagebox img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.pagebox .mark { position: absolute; width: 34px; height: 34px; margin: -10px 0 0 -10px; border-radius: 50%; border: 3px solid var(--brand); background: rgba(14, 140, 154, .15); pointer-events: none; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.pagenav { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.pagenav .grow { text-align: center; font-weight: 700; }
.zoomer { position: fixed; inset: 0; z-index: 60; background: #000; overflow: auto; -webkit-overflow-scrolling: touch; }
.zoomer img { width: 200%; max-width: none; display: block; }
.zoomer .close { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 61; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-width: 48px; height: 40px; padding: 0 12px; border-radius: 12px; border: 0; background: var(--card); box-shadow: var(--shadow); font-weight: 700; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; }
.chip.done { box-shadow: 0 0 0 2px var(--ok) inset; }
.chip.part { box-shadow: 0 0 0 2px var(--warn) inset; }

/* упражнение */
.ex-head { display: flex; gap: 10px; align-items: flex-start; }
.ex-no { background: var(--brand); color: #fff; border-radius: 10px; min-width: 36px; height: 36px; display: grid; place-items: center; font-weight: 800; padding: 0 6px; flex: none; }
.item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.item:first-of-type { border-top: 0; }
.item .n { width: 28px; color: var(--ink-3); font-weight: 700; flex: none; }
.item .prompt { flex-basis: 100%; padding-left: 36px; margin-top: -4px; color: var(--ink-2); }
.item .prompt b, .text b { color: var(--ink); }
.inp {
  flex: 1; min-width: 120px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg);
  padding: 0 12px; outline: none;
}
.inp:focus { border-color: var(--brand); }
.inp.ok { border-color: var(--ok); background: var(--ok-soft); }
.inp.bad { border-color: var(--bad); background: var(--bad-soft); }
textarea.inp { height: auto; min-height: 90px; padding: 10px 12px; width: 100%; resize: vertical; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.opt { min-height: 40px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.opt.bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.fix { flex-basis: 100%; padding-left: 36px; font-size: 14px; color: var(--ok); font-weight: 600; }
.fix.bad { color: var(--bad); }
.box { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.box.words { display: flex; flex-wrap: wrap; gap: 6px; }
.box.words span { background: var(--card); border-radius: 8px; padding: 2px 8px; }
.text { white-space: pre-wrap; line-height: 1.6; }
.sticky-check { padding-top: 12px; }

/* плеер */
.player { display: flex; align-items: center; gap: 10px; background: var(--brand-soft); border-radius: 14px; padding: 10px; margin: 10px 0; }
.player .play { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 20px; cursor: pointer; flex: none; }
.player input[type=range] { flex: 1; accent-color: var(--brand); }
.player .spd { border: 0; background: var(--card); border-radius: 10px; height: 36px; padding: 0 10px; font-weight: 700; cursor: pointer; }
.script { max-height: 260px; overflow: auto; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.script p { margin: 4px 0; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.script p.on { background: var(--warn-soft); }

/* практика (сессия) */
.sess { min-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.sess .q { font-size: 22px; font-weight: 700; margin: 18px 0 8px; }
.sess .sub { color: var(--ink-2); margin-bottom: 14px; }
.choice { display: grid; gap: 10px; }
.choice button { min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 17px; font-weight: 600; cursor: pointer; text-align: left; padding: 10px 16px; box-shadow: 0 2px 0 var(--line); }
.choice button.ok { border-color: var(--ok); background: var(--ok-soft); }
.choice button.bad { border-color: var(--bad); background: var(--bad-soft); }
.feedback { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback .in { max-width: 688px; margin: 0 auto; }
.feedback h3 { margin: 0 0 4px; }
.feedback.ok h3 { color: var(--ok); }
.feedback.bad h3 { color: var(--bad); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.done-big { text-align: center; padding: 30px 0; }
.done-big .em { font-size: 72px; animation: pop .5s; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.15); } 100% { transform: none; } }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; border-radius: 14px; background: var(--bg); margin-bottom: 10px; }
.tile { min-height: 42px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; box-shadow: 0 2px 0 var(--line); }

/* слово */
.word { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.word:first-child { border-top: 0; }
.word .w { font-weight: 700; }
.ipa { color: var(--ink-3); font-family: "Segoe UI", "Lucida Sans Unicode", sans-serif; }
.flash { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.flash .big { font-size: 30px; font-weight: 800; }

.mic { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--sk-speak); color: #fff; font-size: 30px; cursor: pointer; box-shadow: 0 4px 0 #a2364a; }
.mic.rec { animation: pulse 1s infinite; }

.empty { text-align: center; padding: 30px 16px; color: var(--ink-2); }
.empty .em { font-size: 44px; }
.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: 90%; animation: up .2s; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; height: 38px; border-radius: 9px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: var(--shadow); color: var(--brand-2); }
label.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
label.set:first-of-type { border-top: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal i { aspect-ratio: 1; border-radius: 6px; background: var(--line); }
.cal i.l1 { background: #9fdbe1; } .cal i.l2 { background: #46b8c4; } .cal i.l3 { background: var(--brand); }
@media (max-width: 380px) { .stats { gap: 6px; } .stat b { font-size: 18px; } }

/* урок-поток */
.teacher { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 12px; }
.teacher .ava { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; font-size: 24px; flex: none; }
.teacher .say { background: var(--card); box-shadow: var(--shadow); border-radius: 4px 16px 16px 16px; padding: 10px 14px; font-weight: 600; }
.cropbox { position: relative; background: #fff; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.cropbox img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.cropbox .zoombtn { position: absolute; right: 8px; top: 8px; border: 0; cursor: pointer; }
.pstep { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin: 10px 0; cursor: pointer; border: 2px solid transparent; }
.pstep.cur { border-color: var(--brand); }
.pstep.lock { opacity: .55; }
.pdot { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--brand-soft); flex: none; }
.pstep.done .pdot { background: var(--ok); color: #fff; font-weight: 800; }
.pstep.cur .pdot { background: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
