/* TiM SCHOOL — design system
   Палитра (фиксирована брифом): Deep Teal #174F56 · Sage #9FB7AB · Salt Gray #DDE5E2 · Light Gray #F3F5F4 · White · Charcoal #273330 · Muted #87928E
   Мотив: маршрут как схема метро — линия и станции. */
:root {
  --teal: #174F56;
  --teal-ink: #0f3a40;
  --sage: #9FB7AB;
  --salt: #DDE5E2;
  --bg: #F3F5F4;
  --white: #FFFFFF;
  --ink: #273330;
  --muted: #87928E;
  --teal-08: rgba(23, 79, 86, .08);
  --teal-14: rgba(23, 79, 86, .14);
  --sage-25: rgba(159, 183, 171, .25);
  --sage-45: rgba(159, 183, 171, .45);
  --ok: #174F56;
  --err-bg: #f4ecea;
  --err: #8a3b2e;
  --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 26px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --rail: 248px;
  --shadow-pop: 0 18px 50px -18px rgba(23, 79, 86, .35), 0 2px 6px rgba(39, 51, 48, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
img, svg { display: block; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--sage-45); }

/* ---------- типографика ---------- */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; color: var(--ink); margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.25; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 500; }
p { margin: 0 0 var(--s3); max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.lead { font-size: 17px; color: #46524f; max-width: 60ch; }
.prose h3 { margin: var(--s5) 0 var(--s2); }
.prose p { line-height: 1.7; }
.prose strong { color: var(--teal-ink); font-weight: 700; }
.prose ul { padding-left: 1.2em; }

/* ---------- оболочка ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--rail) 1fr; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--white); border-right: 1px solid var(--salt); padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 0 var(--s2); }
.brand-mark { width: 30px; height: 30px; }
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.brand-sub { font-weight: 400; color: var(--teal); letter-spacing: .02em; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { padding-top: var(--s3); border-top: 1px solid var(--salt); }
.nav-title { font-size: 12px; color: var(--muted); padding: 4px 10px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: #3d4946; text-decoration: none; font-weight: 500; font-size: 14px; }
.nav-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-link:hover { background: var(--bg); }
.nav-link.active { background: var(--teal-08); color: var(--teal); }
.nav-link.active svg { color: var(--teal); }
.rail-foot { margin-top: auto; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(243, 245, 244, .92); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--salt); }
.topbar-in { max-width: 1160px; margin: 0 auto; padding: 12px var(--s6); display: flex; align-items: center; gap: var(--s4); }
.topbar-title { font-weight: 600; font-size: 14px; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { max-width: 1160px; width: 100%; margin: 0 auto; padding: var(--s5) var(--s6) var(--s8); }
.mobile-brand { display: none; }
.tabbar { display: none; }

.pill-stat { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--white); border: 1px solid var(--salt); border-radius: 999px; font-weight: 700; font-size: 14px; text-decoration: none; color: var(--ink); }
.pill-stat svg { width: 17px; height: 17px; }
.pill-stat.streak svg { color: var(--teal); }
.pill-stat.streak.off svg { color: var(--muted); }
.pill-stat.xp svg { color: var(--sage); }
.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--salt); background: var(--white); cursor: pointer; color: var(--ink); text-decoration: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); border: 2px solid var(--white); }

/* ---------- кнопки, поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-ink); }
.btn-secondary { background: var(--sage-25); color: var(--teal-ink); border-color: var(--sage-45); }
.btn-secondary:hover { background: var(--sage-45); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--salt); }
.btn-ghost:hover { border-color: var(--sage); }
.btn-text { background: none; color: var(--teal); padding: 0 6px; min-height: 32px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s4); }
.field label, .label { font-size: 13px; font-weight: 600; color: #4b5754; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--salt); background: var(--white); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-08); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.hint { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }

/* ---------- поверхности ---------- */
.panel { background: var(--white); border: 1px solid var(--salt); border-radius: var(--r-lg); padding: var(--s5); }
.panel-flat { background: var(--white); border-radius: var(--r); padding: var(--s4); border: 1px solid var(--salt); }
.panel-tint { background: var(--teal); color: var(--white); border-radius: var(--r-xl); padding: var(--s6); }
.panel-tint h1, .panel-tint h2, .panel-tint h3 { color: var(--white); }
.panel-tint .muted { color: rgba(255, 255, 255, .7); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.spacer { flex: 1; }
.mt0 { margin-top: 0; } .mt2 { margin-top: var(--s2); } .mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); } .mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); }
.mb0 { margin-bottom: 0; } .mb2 { margin-bottom: var(--s2); } .mb4 { margin-bottom: var(--s4); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.divider { height: 1px; background: var(--salt); margin: var(--s4) 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); color: #4b5754; border: 1px solid var(--salt); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.teal { background: var(--teal-08); color: var(--teal); border-color: transparent; }
.chip.sage { background: var(--sage-25); color: var(--teal-ink); border-color: transparent; }
.chip.solid { background: var(--teal); color: var(--white); border-color: transparent; }
.tag-ap { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.tag-ap::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--sage); }

.seg { display: inline-flex; padding: 3px; background: var(--white); border: 1px solid var(--salt); border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--teal); color: var(--white); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--salt); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.tabs .on { color: var(--teal); border-bottom-color: var(--teal); }

.bar { height: 8px; border-radius: 99px; background: var(--salt); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar.sage > span { background: var(--sage); }
.bar.thin { height: 5px; }
.ring { position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--s3); padding: 12px 0; border-bottom: 1px solid var(--salt); text-decoration: none; color: inherit; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
a.list-item:hover .title { color: var(--teal); }
.empty { text-align: center; padding: var(--s7) var(--s4); color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--sage-25); color: var(--teal-ink); font-size: 14px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice.warn { background: var(--err-bg); color: var(--err); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--salt); }
.table td { padding: 10px; border-bottom: 1px solid var(--salt); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--salt); border-radius: 5px; font-size: 12px; background: var(--bg); }

/* ---------- приветствие ---------- */
.landing { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.landing-top { display: flex; align-items: center; justify-content: space-between; padding: var(--s5) var(--s6); max-width: 1200px; width: 100%; margin: 0 auto; }
.hero { max-width: 1200px; width: 100%; margin: 0 auto; padding: var(--s6) var(--s6) var(--s7); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--s7); align-items: center; }
.hero h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1.05; letter-spacing: -.03em; }
.hero .lead { margin-top: var(--s5); }
.hero-actions { display: flex; flex-direction: column; gap: 10px; margin-top: var(--s6); max-width: 420px; }
.choice { display: flex; align-items: center; gap: var(--s4); padding: 16px 18px; border: 1px solid var(--salt); border-radius: var(--r-lg); background: var(--white); text-decoration: none; color: var(--ink); cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--teal); }
.choice.primary { background: var(--teal); color: var(--white); border-color: var(--teal); }
.choice.primary .muted { color: rgba(255, 255, 255, .72); }
.choice .choice-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-08); color: var(--teal); flex: none; }
.choice.primary .choice-ic { background: rgba(255, 255, 255, .14); color: var(--white); }
.choice .choice-ic svg { width: 20px; height: 20px; }
.choice strong { display: block; font-size: 15px; }
.choice span.muted { font-size: 13px; }
.route-art { width: 100%; height: auto; }
.landing-foot { border-top: 1px solid var(--salt); background: var(--white); }
.landing-foot .in { max-width: 1200px; margin: 0 auto; padding: var(--s5) var(--s6); display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s5); }
.motto { font-family: var(--font-display); font-size: 14px; letter-spacing: .02em; color: var(--teal); }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .panel { padding: var(--s6); }

/* ---------- онбординг ---------- */
.onb { max-width: 760px; margin: 0 auto; }
.onb-steps { display: flex; gap: 6px; margin-bottom: var(--s5); }
.onb-steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--salt); }
.onb-steps span.on { background: var(--teal); }
.lang-card { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); border-radius: var(--r-lg); border: 1px solid var(--salt); background: var(--white); cursor: pointer; text-decoration: none; color: var(--ink); text-align: left; transition: border-color .15s; }
.lang-card:hover, .lang-card.on { border-color: var(--teal); }
.lang-card .flagmark { font-family: var(--font-display); font-size: 28px; color: var(--teal); }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.level-card { padding: var(--s4); border: 1px solid var(--salt); border-radius: var(--r); background: var(--white); cursor: pointer; text-align: left; transition: border-color .15s; }
.level-card:hover { border-color: var(--teal); }
.level-card .lv { font-family: var(--font-display); font-size: 26px; color: var(--teal); line-height: 1; }
.level-card.off { opacity: .55; cursor: not-allowed; }
.level-card.off:hover { border-color: var(--salt); }
.result-level { font-family: var(--font-display); font-size: clamp(64px, 12vw, 120px); line-height: .9; letter-spacing: -.04em; color: var(--white); }

/* ---------- маршрут (схема метро) ---------- */
.path { position: relative; }
.line-module { position: relative; padding-left: 56px; margin-bottom: var(--s6); }
.line-module::before { content: ''; position: absolute; left: 21px; top: 8px; bottom: -32px; width: 4px; border-radius: 4px; background: var(--salt); }
.line-module:last-child::before { bottom: 8px; }
.line-module.done::before, .line-module.progress::before { background: linear-gradient(var(--teal), var(--teal)) top/100% var(--fill, 0%) no-repeat, var(--salt); }
.line-module.done::before { --fill: 100%; }
.module-head { position: relative; margin-bottom: var(--s3); }
.module-head .terminal { position: absolute; left: -48px; top: -2px; width: 34px; height: 34px; border-radius: 10px; background: var(--white); border: 3px solid var(--salt); display: grid; place-items: center; font-family: var(--font-display); font-size: 13px; color: var(--muted); }
.line-module.done .terminal, .line-module.progress .terminal { border-color: var(--teal); color: var(--teal); }
.line-module.done .terminal { background: var(--teal); color: var(--white); }
.station { position: relative; display: flex; align-items: center; gap: var(--s3); padding: 10px 14px; margin: 0 0 6px; border-radius: var(--r); text-decoration: none; color: var(--ink); background: transparent; border: 1px solid transparent; }
.station::before { content: ''; position: absolute; left: -41px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--white); border: 3px solid var(--salt); box-sizing: border-box; }
.station.completed::before, .station.mastered::before { background: var(--teal); border-color: var(--teal); }
.station.mastered::before { box-shadow: 0 0 0 4px var(--sage-45); }
.station.in_progress::before, .station.available::before { border-color: var(--teal); }
.station.current { background: var(--white); border-color: var(--teal); box-shadow: var(--shadow-pop); }
.station.current::before { width: 20px; height: 20px; margin-top: -10px; left: -44px; border-width: 4px; }
.station:hover:not(.locked) { background: var(--white); border-color: var(--salt); }
.station.current:hover { border-color: var(--teal); }
.station.locked { color: var(--muted); cursor: not-allowed; }
.station .st-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--bg); color: var(--muted); flex: none; }
.station .st-ic svg { width: 16px; height: 16px; }
.station.completed .st-ic, .station.mastered .st-ic { background: var(--teal-08); color: var(--teal); }
.station.checkpoint .st-ic { background: var(--sage-25); color: var(--teal-ink); border-radius: 50%; }
.station .grow { flex: 1; min-width: 0; }
.station .st-title { font-weight: 600; font-size: 14.5px; }
.station .st-meta { font-size: 12.5px; color: var(--muted); }
.status-chip { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.status-chip.completed, .status-chip.mastered { color: var(--teal); }
.status-chip.in_progress { color: var(--teal-ink); }

/* ---------- урок ---------- */
.lesson-shell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s5); align-items: start; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s5); }
.stepper button { border: 1px solid var(--salt); background: var(--white); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.stepper button.on { border-color: var(--teal); color: var(--teal); }
.stepper button.done { background: var(--teal-08); border-color: transparent; color: var(--teal); }
.stepper button:disabled { cursor: default; opacity: .6; }
.example { padding: 10px 14px; border-left: 3px solid var(--sage); background: var(--bg); border-radius: 0 var(--r-sm) var(--r-sm) 0; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.word-card { display: flex; gap: var(--s3); align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--salt); }
.word-card:last-child { border-bottom: 0; }
.word-card .w { font-weight: 700; font-size: 16px; }
.speak-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--salt); background: var(--white); display: grid; place-items: center; cursor: pointer; color: var(--teal); flex: none; }
.speak-btn svg { width: 15px; height: 15px; }

/* ---------- плеер заданий ---------- */
.player { max-width: 720px; }
.player-top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.player-top .bar { flex: 1; }
.q-card { background: var(--white); border: 1px solid var(--salt); border-radius: var(--r-lg); padding: var(--s5); }
.q-instr { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.q-prompt { font-size: 19px; font-weight: 600; line-height: 1.45; margin-bottom: var(--s5); }
.q-passage { max-height: 340px; overflow-y: auto; padding: var(--s4); background: var(--bg); border-radius: var(--r); margin-bottom: var(--s4); line-height: 1.7; font-size: 15px; white-space: pre-line; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1.5px solid var(--salt); border-radius: var(--r); background: var(--white); cursor: pointer; text-align: left; font-weight: 600; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--sage); }
.opt.sel { border-color: var(--teal); background: var(--teal-08); }
.opt.right { border-color: var(--teal); background: var(--teal); color: var(--white); }
.opt.wrong { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.opt .k { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--salt); display: grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
.opt.right .k { border-color: rgba(255,255,255,.5); color: var(--white); }
.tokens { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.token { padding: 8px 13px; border-radius: 10px; border: 1.5px solid var(--salt); background: var(--white); font-weight: 600; cursor: pointer; }
.token:hover { border-color: var(--sage); }
.token.used { visibility: hidden; }
.answer-line { min-height: 56px; padding: 8px; border-bottom: 2px solid var(--salt); margin-bottom: var(--s4); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.answer-line .token { background: var(--teal-08); border-color: transparent; color: var(--teal-ink); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px var(--s4); }
.match .opt { justify-content: flex-start; }
.match .opt.paired { border-color: var(--sage); background: var(--sage-25); }
.accent-keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.accent-keys button { min-width: 32px; height: 30px; border-radius: 7px; border: 1px solid var(--salt); background: var(--white); cursor: pointer; font-weight: 600; }
.listen-btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; border: 0; background: var(--teal); color: var(--white); font-weight: 700; cursor: pointer; margin-bottom: var(--s4); }
.listen-btn svg { width: 18px; height: 18px; }
.feedback { margin-top: var(--s4); padding: var(--s4); border-radius: var(--r); display: flex; gap: var(--s3); align-items: flex-start; animation: fb .2s ease-out; }
.feedback.ok { background: var(--teal-08); color: var(--teal-ink); }
.feedback.no { background: var(--err-bg); color: var(--err); }
.feedback svg { width: 22px; height: 22px; flex: none; }
.feedback b { display: block; margin-bottom: 2px; }
@keyframes fb { from { opacity: 0; transform: translateY(4px); } }
.player-actions { display: flex; justify-content: flex-end; gap: var(--s3); margin-top: var(--s4); }
.wc { font-size: 13px; color: var(--muted); }
.wc.ok { color: var(--teal); font-weight: 700; }
.rec { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.rec-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--teal); color: var(--white); display: grid; place-items: center; cursor: pointer; }
.rec-btn svg { width: 26px; height: 26px; }
.rec-btn.on { background: var(--err); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(138, 59, 46, .12); } }
.chart-box { background: var(--bg); border-radius: var(--r); padding: var(--s4); margin-bottom: var(--s4); }
.criteria { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.criteria > div { padding: 12px; border-radius: var(--r); background: var(--bg); }
.criteria .band { font-family: var(--font-display); font-size: 26px; color: var(--teal); }

/* ---------- игровые элементы ---------- */
.today { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s5); align-items: center; }
.today .t-stats { display: flex; gap: var(--s5); flex-wrap: wrap; }
.big-num { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.continue { display: flex; align-items: center; gap: var(--s4); padding: var(--s5); border-radius: var(--r-xl); background: var(--teal); color: var(--white); text-decoration: none; }
.continue .c-ic { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; flex: none; }
.continue .c-ic svg { width: 24px; height: 24px; }
.continue .muted { color: rgba(255, 255, 255, .7); }
.continue .btn { background: var(--white); color: var(--teal); }
.challenge { display: flex; align-items: center; gap: var(--s3); padding: 12px 0; border-bottom: 1px solid var(--salt); text-decoration: none; color: inherit; }
.challenge:last-child { border-bottom: 0; }
.challenge .c-dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--salt); display: grid; place-items: center; flex: none; color: var(--muted); }
.challenge .c-dot svg { width: 16px; height: 16px; }
.challenge.done .c-dot { background: var(--sage); border-color: var(--sage); color: var(--white); }
.challenge .grow { flex: 1; min-width: 0; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: var(--s4) var(--s3); border-radius: var(--r-lg); background: var(--white); border: 1px solid var(--salt); }
.badge .b-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); border: 2px dashed var(--salt); }
.badge .b-ic svg { width: 26px; height: 26px; }
.badge.earned .b-ic { background: var(--teal-08); color: var(--teal); border: 2px solid var(--sage); }
.badge.earned.rare .b-ic { background: var(--sage-25); border-color: var(--teal); }
.badge.earned.epic .b-ic { background: var(--teal); color: var(--white); border-color: var(--teal); box-shadow: 0 0 0 4px var(--sage-45); }
.badge .b-title { font-weight: 700; font-size: 14px; }
.badge .b-desc { font-size: 12.5px; color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .wd { font-size: 11px; color: var(--muted); text-align: center; }
.cal .d { aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--white); border: 1px solid var(--salt); color: var(--muted); }
.cal .d.active { background: var(--sage-45); border-color: transparent; color: var(--teal-ink); }
.cal .d.goal { background: var(--teal); color: var(--white); border-color: transparent; }
.cal .d.freeze { background: var(--white); border: 2px dashed var(--teal); color: var(--teal); }
.cal .d.today { outline: 2px solid var(--teal); outline-offset: 1px; }
.cal .d.blank { background: none; border: 0; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }
.levels-track { display: flex; gap: 0; overflow-x: auto; padding-bottom: 6px; }
.lvl { flex: 1; min-width: 92px; text-align: center; position: relative; padding-top: 30px; font-size: 12px; color: var(--muted); }
.lvl::before { content: ''; position: absolute; top: 10px; left: 0; right: 0; height: 4px; background: var(--salt); }
.lvl::after { content: attr(data-n); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: var(--white); border: 3px solid var(--salt); font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 18px; color: var(--muted); }
.lvl.reached::before { background: var(--teal); }
.lvl.reached::after { border-color: var(--teal); background: var(--teal); color: var(--white); }
.lvl b { display: block; color: var(--ink); font-size: 12.5px; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.chart-bars span { flex: 1; background: var(--sage); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart-bars span.goal { background: var(--teal); }

/* ---------- модальные окна, тосты, награды ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(39, 51, 48, .42); display: grid; place-items: center; padding: var(--s4); animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--white); border-radius: var(--r-xl); padding: var(--s6); box-shadow: var(--shadow-pop); animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { max-width: 1000px; padding: var(--s4); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--white); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-pop); animation: pop .2s; max-width: 90vw; }
.toast.err { background: var(--err); }
.reward { text-align: center; }
.reward .xp-burst { font-family: var(--font-display); font-size: 54px; color: var(--teal); line-height: 1; animation: rise .6s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes rise { from { transform: translateY(14px) scale(.8); opacity: 0; } }
.reward-list { display: flex; flex-direction: column; gap: 8px; margin: var(--s5) 0; text-align: left; }
.reward-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--bg); font-weight: 600; font-size: 14px; animation: pop .3s backwards; }
.reward-item svg { width: 20px; height: 20px; color: var(--teal); flex: none; }
.reward-item:nth-child(2) { animation-delay: .08s; } .reward-item:nth-child(3) { animation-delay: .16s; } .reward-item:nth-child(4) { animation-delay: .24s; } .reward-item:nth-child(5) { animation-delay: .32s; }
.notif-pop { position: absolute; top: 46px; right: 0; width: 360px; max-height: 70vh; overflow-y: auto; background: var(--white); border: 1px solid var(--salt); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--s3); z-index: 50; }
.notif { display: block; padding: 10px; border-radius: var(--r-sm); text-decoration: none; color: inherit; }
.notif:hover { background: var(--bg); }
.notif.unread { background: var(--teal-08); }
.chat { display: flex; flex-direction: column; gap: var(--s3); min-height: 320px; max-height: 58vh; overflow-y: auto; padding: var(--s2); }
.msg { max-width: 82%; padding: 11px 15px; border-radius: 16px; line-height: 1.6; white-space: pre-wrap; font-size: 14.5px; }
.msg.user { align-self: flex-end; background: var(--teal); color: var(--white); border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--white); border: 1px solid var(--salt); border-bottom-left-radius: 5px; }
.skeleton { background: linear-gradient(90deg, var(--salt) 25%, #e8eeec 50%, var(--salt) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
  .lesson-shell { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mobile-brand { display: flex; }
  .topbar-in, .page { padding-left: var(--s4); padding-right: var(--s4); }
  .page { padding-bottom: 96px; }
  .topbar-title { display: none; }
  .hero { grid-template-columns: 1fr; gap: var(--s5); padding: var(--s4); }
  .hero-art { order: -1; max-width: 520px; }
  .landing-top { padding: var(--s4); }
  .landing-foot .in { grid-template-columns: 1fr 1fr; padding: var(--s5) var(--s4); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--white); border-top: 1px solid var(--salt); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--teal); }
  .today { grid-template-columns: auto 1fr; }
  .today .t-cta { grid-column: 1 / -1; }
  .criteria { grid-template-columns: repeat(2, 1fr); }
  .notif-pop { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: var(--s4); border-radius: var(--r); }
  .panel-tint { padding: var(--s5); border-radius: var(--r-lg); }
  .q-card { padding: var(--s4); }
  .q-prompt { font-size: 17px; }
  .match { grid-template-columns: 1fr 1fr; gap: 6px; }
  .match .opt { padding: 10px; font-size: 13px; }
  .line-module { padding-left: 44px; }
  .line-module::before { left: 15px; }
  .module-head .terminal { left: -42px; width: 30px; height: 30px; }
  .station { padding: 8px 10px; }
  .station::before { left: -35px; }
  .station.current::before { left: -38px; }
  .station .st-ic { display: none; }
  .continue { flex-wrap: wrap; padding: var(--s4); }
  .pill-stat { padding: 5px 9px; font-size: 13px; }
  .landing-foot .in { grid-template-columns: 1fr; }
  .modal { padding: var(--s5); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }
.rail .btn { white-space: normal; line-height: 1.25; padding: 9px 12px; font-size: 13px; text-align: left; justify-content: flex-start; }
.mobile-only { display: none; }
@media (max-width: 900px) { .mobile-only { display: grid; } #tb-stats .pill-stat:nth-child(3) { display: none; } }
@media (max-width: 600px) { .continue .btn { width: 100%; } .continue h2 { font-size: 18px; } .mobile-brand .brand-name { display: none; } }

/* Плашка «Доступна новая версия» (service worker) */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 150; display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; max-width: calc(100% - 32px); background: var(--white); color: var(--ink); border: 1px solid var(--salt); border-radius: 999px; box-shadow: var(--shadow-pop); font-weight: 700; font-size: 14px; }
.update-bar span { flex: 1; min-width: 0; }
@media (max-width: 900px) { .update-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }
/* Юридические документы внутри приложения */
.legal-doc h2 { font-size: 18px; margin-top: var(--s6); }
.legal-doc .lg-date { color: var(--muted); font-size: 14px; }
.legal-doc .table-wrap { overflow-x: auto; }
.legal-doc table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 14px; }
.legal-doc th, .legal-doc td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--salt); }
.legal-doc mark.todo { background: var(--err-bg); color: var(--err); padding: 0 4px; border-radius: 4px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.modal.wide .legal-doc { max-width: 760px; margin: 0 auto; }
.legal-doc { overflow-wrap: anywhere; }
