/* Тёмная тема в духе Material 3 для Android */
:root {
  --bg: #0b0c10;
  --surface: #15171d;
  --surface2: #1d2028;
  --surface3: #272b35;
  --line: #2b2f3a;
  --text: #e6e8ee;
  --muted: #8e95a3;
  --accent: #8ab4ff;
  --on-accent: #0a1a36;
  --accent-soft: #1f2d48;
  --ok: #5fd08f;
  --on-ok: #062915;
  --warn: #f2b84b;
  --danger: #ff6b6b;
  --stop: #e5383b;
  --listen: #b5179e;
  --ripple-ring: #8ab4ff;   /* круги «капли» у главных кнопок */
  --ripple-ring2: #c9dcff;
  --nav-h: 72px;
  --stop-h: 84px;
  --safe-b: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 Roboto, system-ui, sans-serif;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
body.has-stop { padding-bottom: calc(var(--nav-h) + var(--stop-h) + var(--safe-b) + 16px); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
svg { width: 24px; height: 24px; fill: currentColor; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.hint a { color: var(--accent); }

/* ---------- Верхняя панель ---------- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: var(--bg);
}
.appbar h1 { font-size: 22px; font-weight: 500; margin: 0; }
.mic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); opacity: .4; }
.mic svg { width: 20px; height: 20px; }
.mic.on { opacity: 1; color: var(--ok); background: #12301f; }

main { padding: 4px 16px 0; max-width: 680px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }

/* ---------- Карточки и кнопки ---------- */
.card { background: var(--surface); border-radius: 20px; padding: 16px; margin-bottom: 12px; }
.card-title { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 12px; letter-spacing: .02em; }
.card-title.mt { margin-top: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 24px; border: 0;
  background: var(--surface3); font-weight: 500; font-size: 15px;
}
.btn:active { filter: brightness(1.15); }
a.btn { text-decoration: none; box-sizing: border-box; }
.btn:disabled { opacity: .4; }
.btn.filled { background: var(--accent); color: var(--on-accent); }
.btn.tonal { background: var(--accent-soft); color: var(--accent); }
.btn.ok { background: var(--ok); color: var(--on-ok); }
.btn.text { background: none; color: var(--accent); }
.btn.outline { background: none; border: 1px solid var(--line); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; min-height: 56px; font-size: 16px; margin-top: 12px; }
main > .btn.wide { margin: 4px 0 12px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none;
  border: 0; border-radius: 50%; background: var(--surface3);
}
.icon-btn:active { filter: brightness(1.25); }
.icon-btn.small { width: 36px; height: 36px; background: none; }
.icon-btn.small svg { width: 20px; height: 20px; }
.icon-btn.filled { background: var(--accent); color: var(--on-accent); }

.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row > input, .row > select { flex: 1; min-width: 0; }

input[type=text], input[type=password], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface2);
  border: 1px solid transparent; border-radius: 14px; padding: 12px 14px; min-height: 50px;
}
textarea { resize: none; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 36px; margin: 4px 0 0; }
.field { display: block; margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.field > input, .field > select, .field > .row { margin-top: 6px; }
.field b { color: var(--text); font-weight: 500; float: right; }

/* сегментированный переключатель */
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0; border-radius: 14px; overflow: hidden; background: var(--surface2); }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 6px 8px; font-size: 14px; font-weight: 500; color: var(--muted);
}
.seg input:checked + span { background: var(--accent-soft); color: var(--accent); }
.seg.compact { margin: 14px 0 0; }
.seg.themes { grid-template-columns: repeat(3, 1fr); }
.listen-seg { margin: 0 0 12px; }

/* переключатели Android */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; border-top: 1px solid var(--line); }
.seg + .switch { margin-top: 12px; }
.seg + .hint { margin-top: 8px; }
.switch span { display: flex; flex-direction: column; }
.switch small { color: var(--muted); font-size: 13px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--surface3); border: 2px solid #5a606d; flex: none; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: #8e95a3; transition: .2s; }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { left: 22px; top: 2px; width: 24px; height: 24px; background: var(--on-accent); }

details.mini { margin-top: 12px; }
details.mini summary { color: var(--accent); font-size: 14px; font-weight: 500; min-height: 36px; display: flex; align-items: center; cursor: pointer; list-style: none; }
details.mini summary::-webkit-details-marker { display: none; }
details.mini summary::after { content: "›"; margin-left: 6px; transform: rotate(90deg); transition: .2s; }
details.mini[open] summary::after { transform: rotate(-90deg); }

.progress { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s; }
.progress.thin { height: 4px; }
.status { color: var(--muted); font-size: 14px; margin-top: 8px; min-height: 1.2em; }
.log { margin: 4px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; max-height: 200px; overflow: auto; }
.log li.err { color: var(--danger); }

/* ---------- Материал ---------- */
.resume {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--accent-soft); color: var(--text); border: 0; border-radius: 20px; padding: 16px; margin-bottom: 12px;
}
.resume-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.resume-text span { color: var(--muted); font-size: 14px; }
.resume .ic { color: var(--accent); width: 32px; height: 32px; }

.sources { list-style: none; margin: 0 0 12px; padding: 0; }
.sources:empty { display: none; }
.sources li { display: flex; align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); }
.sources li svg { color: var(--muted); }
.sources .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources .size { color: var(--muted); font-size: 13px; white-space: nowrap; }
.add-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 14px; background: none; font-size: 15px; font-weight: 500;
}
.chip-btn svg { width: 20px; height: 20px; color: var(--accent); }
.chip-btn:active { background: var(--surface2); }
.paste { display: grid; gap: 10px; margin-top: 12px; }

.stepper { display: flex; align-items: center; justify-content: space-between; }
.stepper output { font-size: 28px; font-weight: 500; }

/* ---------- План ---------- */
.empty { text-align: center; color: var(--muted); padding: 64px 24px; }
.empty svg { width: 56px; height: 56px; opacity: .5; }
.plan-sum { font-size: 15px; }
.plan-sum .big { font-size: 22px; font-weight: 500; display: block; margin-bottom: 2px; }
.plan-sum .warn { color: var(--warn); }

.plan { list-style: none; margin: 0 0 8px; padding: 0; }
.plan li { background: var(--surface); border-radius: 16px; margin-bottom: 8px; }
.plan .phead { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; background: none; border: 0; text-align: left; }
.plan .pnum {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface3);
  display: grid; place-items: center; font-weight: 500; font-size: 14px;
}
.plan .pbody { flex: 1; min-width: 0; }
.plan .ptitle { display: block; font-weight: 500; overflow-wrap: anywhere; }
.plan .pmeta { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.plan .pstate { flex: none; font-size: 13px; color: var(--muted); }
.plan .pstate.ok { color: var(--ok); }
.plan .pstate.err { color: var(--danger); }
.plan li.current .pnum { background: var(--accent); color: var(--on-accent); }
.plan li.done .pnum { background: #173a27; color: var(--ok); }
.plan li.skipped { opacity: .45; }
.plan .pdetail { padding: 0 14px 14px 58px; font-size: 14px; color: var(--muted); }
.plan .pdetail p { margin: 0 0 8px; }
.plan .pdetail .bad { color: var(--warn); }
.plan .pactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.plan .pactions .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
.plan .pactions .icon-btn { width: 40px; height: 40px; }
.plan .points { margin: 10px 0 0; padding-left: 18px; }
.plan .points .miss { color: var(--danger); }
.dots { letter-spacing: 2px; color: var(--warn); }

/* ---------- Диктовка ---------- */
.banner { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 16px; padding: 10px 6px 10px 14px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.banner .ic { color: var(--accent); }
.banner span { flex: 1; }
.banner.warn { color: #ffd99a; padding-right: 14px; display: block; }

.topic { margin: 4px 0 12px; }
.topic-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.topic h2 { font-size: 20px; font-weight: 500; margin: 2px 0 10px; overflow-wrap: anywhere; }

.chunk {
  position: relative; background: var(--surface); border-radius: 24px; padding: 20px 20px 24px;
  min-height: 34vh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; cursor: pointer;
}
.chunk p { margin: 0; font-size: 24px; line-height: 1.45; }
.chunk.hidden-text p { filter: blur(10px); user-select: none; }
.chunk .kind { position: absolute; top: 14px; left: 20px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); }
.chunk-hint { position: absolute; top: 12px; right: 14px; color: var(--muted); opacity: .35; }
.chunk-hint svg { width: 18px; height: 18px; }
.chunk .gap { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
.chunk .gap div { height: 100%; width: 0; background: var(--ok); }

.state-row { display: flex; gap: 12px; align-items: flex-start; margin: 14px 4px; min-height: 48px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-top: 7px; flex: none; }
.dot.s-speaking { background: var(--accent); box-shadow: 0 0 0 4px rgba(138, 180, 255, .2); }
.dot.s-gap { background: var(--ok); }
.dot.s-listening, .dot.s-confirm, .dot.s-topicEnd { background: var(--warn); animation: pulse 1.2s infinite; }
.dot.s-thinking, .dot.s-answering { background: #c58aff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(242, 184, 75, .25); } }
.state { font-weight: 500; }
.heard { color: var(--muted); font-style: italic; font-size: 14px; overflow-wrap: anywhere; }
.heard:empty, #dictMsg:empty { display: none; }

.qa { background: var(--surface); border-radius: 20px; padding: 14px; margin-bottom: 14px; }
.answer { background: var(--surface2); border-radius: 16px; padding: 14px; margin-bottom: 12px; font-size: 17px; white-space: pre-wrap; }
.answer .q { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.ask-row { display: flex; gap: 8px; align-items: flex-end; }
.ask-row textarea { flex: 1; min-height: 48px; max-height: 120px; border-radius: 24px; padding: 12px 16px; }
#qaHistory .item { border-top: 1px solid var(--line); padding: 10px 0; font-size: 14px; }
#qaHistory .q { font-weight: 500; }
#qaHistory .a { color: var(--muted); white-space: pre-wrap; }

.player { display: flex; align-items: center; justify-content: center; gap: 20px; position: relative; margin: 6px 0 18px; }
.icon-btn.big { width: 60px; height: 60px; }
.icon-btn.big svg { width: 28px; height: 28px; }
.icon-btn.play { width: 80px; height: 80px; border-radius: 28px; background: var(--accent); color: var(--on-accent); }
.icon-btn.play svg { width: 40px; height: 40px; }
.icon-btn.more { position: absolute; right: 0; background: none; }
.icon-btn:disabled { opacity: .35; }

.overall .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 8px; }

.cmds { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.cmds b { color: var(--text); font-weight: 500; }

/* ---------- СТОП ---------- */
.stopbar {
  position: fixed; left: 0; right: 0; z-index: 20;
  bottom: calc(var(--nav-h) + var(--safe-b)); padding: 8px 16px;
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}
.stop {
  display: block; width: 100%; max-width: 680px; margin: 0 auto; height: calc(var(--stop-h) - 16px);
  border: 0; border-radius: 34px; background: var(--stop); color: #fff;
  font-size: 24px; font-weight: 700; letter-spacing: .04em; user-select: none;
}
.stop:active { filter: brightness(1.15); transform: scale(.985); }
.stop.listening { background: var(--listen); }
.stop { --ripple-ring: #ff9a9c; --ripple-ring2: #ffd3d4; }
.stop.listening { --ripple-ring: #ef8fdc; --ripple-ring2: #f9cdf0; }

/* ---------- Нижняя навигация ---------- */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface);
}
.navbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 500;
}
.navbar .pill { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; transition: background .2s; }
.navbar button.active { color: var(--text); }
.navbar button.active .pill { background: var(--accent-soft); color: var(--accent); }

/* ---------- Нижнее меню ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 680px; margin: 0 auto;
  background: var(--surface2); border-radius: 28px 28px 0 0; padding: 8px 8px calc(16px + var(--safe-b));
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(100%); } }
.sheet-handle { width: 32px; height: 4px; border-radius: 2px; background: #555b66; margin: 8px auto 12px; }
.sheet-item { display: block; width: 100%; min-height: 56px; padding: 0 20px; text-align: left; border: 0; background: none; border-radius: 16px; font-size: 16px; }
.sheet-item:active { background: var(--surface3); }
.sheet-row { display: grid; grid-template-columns: 1fr 1fr; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  background: #e6e8ee; color: #111; padding: 12px 18px; border-radius: 8px;
  max-width: calc(100% - 32px); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.has-stop .toast { bottom: calc(var(--nav-h) + var(--stop-h) + var(--safe-b) + 12px); }
.toast.show { opacity: 1; }

/* когда открыт вопрос — текст куска компактнее, ответ ближе к кнопкам */
.qa-open .chunk { min-height: 0; }
.qa-open .chunk p { font-size: 18px; }
#fitPauseBtn { margin-top: 8px; padding: 0 4px; min-height: 40px; }

/* ---------- Мастер первого запуска ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: var(--bg);
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + var(--safe-b));
}
.ob-step { max-width: 520px; margin: 0 auto; }
.ob-lang { float: right; margin: -8px -8px 0 0; }
.ob-step h2 { font-size: 26px; font-weight: 500; margin: 8px 0 16px; }
.ob-logo { width: 72px; height: 72px; border-radius: 20px; margin-top: 24px; }
.ob-num { color: var(--accent); font-size: 14px; font-weight: 500; }
.ob-list { padding-left: 20px; color: var(--muted); margin: 0 0 24px; }
.ob-list li { margin-bottom: 10px; }
.ob-steps { padding-left: 22px; margin: 0 0 8px; }
.ob-steps li { margin-bottom: 18px; }
.ob-steps li b { color: var(--accent); font-weight: 500; }
.ob-steps .btn, .ob-steps .row { margin-top: 10px; }
.ob-status { min-height: 1.4em; margin: 10px 2px; font-size: 15px; color: var(--muted); }
.ob-status.ok { color: var(--ok); }
.ob-status.err { color: var(--danger); }
.ob-step > .btn.text { display: block; margin: 8px auto 0; }
.ai-summary { font-size: 15px; }
.ai-summary .muted { display: block; font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
#manualAi[open] { margin-bottom: 4px; }
#manualAi .field:first-of-type { margin-top: 8px; }
.ob-steps li > .btn { display: flex; }

/* ---------- Установка приложения ---------- */
.install { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 20px; padding: 12px 12px 12px 14px; margin-bottom: 12px; }
.install img { width: 44px; height: 44px; border-radius: 12px; }
.install > span { flex: 1; display: flex; flex-direction: column; font-size: 15px; }
.install > span span { color: var(--muted); font-size: 13px; }
.install .btn { min-height: 40px; padding: 0 16px; }
.ob-sub { display: block; margin: 6px 0; padding: 8px 12px; background: var(--surface); border-radius: 12px; color: var(--muted); font-size: 14px; }

/* ---------- Предметы, повторение, перерыв ---------- */
.appbar-title { display: flex; flex-direction: column; min-width: 0; }
.appbar h1 { line-height: 1.15; }
.subject-btn { border: 0; background: none; color: var(--accent); font-size: 13px; padding: 0; text-align: left; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar { height: calc(60px + env(safe-area-inset-top)); }
.sheet-title { font-size: 14px; color: var(--muted); padding: 4px 20px 8px; }
.sheet-item.active { color: var(--accent); background: var(--accent-soft); }
.sheet-item.accent { color: var(--accent); }
.sheet-item.danger { color: var(--danger); }
.sheet-sep { height: 1px; background: var(--line); margin: 6px 12px; }
#subjectList { max-height: 40vh; overflow-y: auto; }
.mt8 { margin-top: 8px; }
.field.mt, .mt { margin-top: 14px; }
#exportBtn { margin-top: 8px; padding: 0 4px; min-height: 40px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; margin-left: 6px; vertical-align: 1px; }
.badge.weak { background: #3a2410; color: var(--warn); }
.badge.due { background: var(--accent-soft); color: var(--accent); }
.badge.good { background: #173a27; color: var(--ok); }
#breakCard { display: flex; color: var(--text); }
#breakCard .btn { min-height: 40px; }
#stopReviewBtn { margin: 0 0 12px; }
.quiz-q { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.chunk { padding-top: 40px; }

/* ---------- Перемотка по кускам ---------- */
.seek { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: none; touch-action: none; }
.seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--surface3) var(--fill, 0%)); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--accent); border: 0; }
.seek:disabled::-webkit-slider-thumb { background: transparent; }
.seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface3); }
.seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.seek::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 0; }
.chunk.preview { outline: 2px dashed var(--accent); outline-offset: -2px; }
.field.grow { flex: 1; min-width: 0; margin-bottom: 8px; }
.field.grow select { margin-top: 6px; }

/* приложение не запустилось после обновления */
.boot-fail {
  position: fixed; left: 16px; right: 16px; top: 16px; z-index: 1000; padding: 16px; border-radius: 16px;
  background: var(--surface2); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); font-size: 15px; line-height: 1.4;
}
.boot-fail button { display: block; margin: 12px 0 6px; padding: 10px 18px; border: 0; border-radius: 20px; background: var(--accent); color: var(--on-accent, #000); font: inherit; font-weight: 500; }
.boot-fail small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Формулы ---------- */
.topic-meta { align-items: center; gap: 8px; }
.fx-btn { margin-left: auto; border: 0; border-radius: 14px; padding: 4px 12px; font-size: 13px; font-weight: 500; background: var(--surface3); color: var(--muted); }
.fx-btn.here { background: var(--accent-soft); color: var(--accent); }
.badge.fx { background: var(--accent-soft); color: var(--accent); }
.fx-body { display: flex; flex-direction: column; max-height: 86vh; padding-left: 12px; padding-right: 12px; }
.fx-head { display: flex; align-items: center; gap: 8px; padding: 0 0 10px; }
.fx-head .icon-btn { background: var(--surface3); }
.fx-head .icon-btn:disabled { opacity: .25; }
.fx-title { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.fx-title small { color: var(--muted); font-size: 12px; }
.fx-title b { font-weight: 500; font-size: 16px; overflow-wrap: anywhere; }
.fx-list { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 8px; }
.fx-item { background: var(--surface); border-radius: 16px; padding: 12px 14px; }
.fx-name { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.fx-f { font: 22px/1.4 'Noto Serif', 'Cambria Math', Georgia, serif; overflow-wrap: anywhere; user-select: text; }
.fx-d { color: var(--muted); font-size: 14px; margin-top: 6px; }
.fx-close { margin-top: 8px; min-height: 48px; flex: none; }

/* ---------- Запись лекции ---------- */
.lecture { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.lecture-head { display: flex; align-items: center; gap: 10px; font-size: 22px; }
.lecture-head b { font-variant-numeric: tabular-nums; font-weight: 500; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.rec-dot.on { background: var(--stop); animation: rec 1.2s ease-in-out infinite; }
@keyframes rec { 50% { opacity: .35; } }
.lecture-text { max-height: 34vh; min-height: 96px; overflow-y: auto; background: var(--surface2); border-radius: 14px; padding: 12px 14px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.lecture-text i { color: var(--muted); font-style: normal; }
.lecture-text:empty::before { content: 'Здесь появится текст лекции'; color: var(--muted); }

/* ---------- Компьютер и планшет: вкладки слева, шире текст ---------- */
@media (min-width: 900px) {
  :root { --nav-h: 0px; --rail: 96px; }
  body { padding-left: var(--rail); }
  .navbar {
    top: 0; right: auto; width: var(--rail); height: auto; padding: 0;
    grid-template-columns: 1fr; grid-auto-rows: 84px; align-content: center; border-right: 1px solid var(--line);
  }
  .stopbar { left: var(--rail); padding: 10px 24px 16px; }
  .toast { left: calc(50% + var(--rail) / 2); }
  .sheet-body { left: var(--rail); bottom: 24px; border-radius: 28px; }
  main { max-width: 820px; padding: 8px 24px 0; }
  .appbar { padding-left: 24px; padding-right: 24px; }
  .chunk { min-height: 30vh; padding: 28px 32px 32px; }
  .chunk p { font-size: 28px; }
  .desk-only { display: block; }
}
.desk-only { display: none; }
body.ios .android-only, body:not(.ios) .ios-only { display: none !important; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.keys kbd { font: 600 12px/1 ui-monospace, monospace; color: var(--text); background: var(--surface3); border-radius: 6px; padding: 5px 8px; justify-self: start; }

/* ---------- «Капля» при нажатии (js/ripple.js) ---------- */
.ripple { position: fixed; z-index: 45; overflow: hidden; pointer-events: none; }
.ripple-ink { position: absolute; border-radius: 50%; opacity: 0; animation: ripple-ink .55s cubic-bezier(.2, .6, .3, 1); }
@keyframes ripple-ink { from { transform: scale(.1); opacity: .3; } 50% { opacity: .2; } to { transform: scale(1); opacity: 0; } }
.ripple-ring, .ripple-dot { position: fixed; z-index: 45; pointer-events: none; border-radius: 50%; opacity: 0; }
.ripple-ring { border: 2px solid; animation: ripple-ring .7s cubic-bezier(.15, .7, .3, 1); }
.ripple-ring.second { animation-delay: .13s; }
@keyframes ripple-ring { from { transform: scale(.12); opacity: .85; } to { transform: scale(1); opacity: 0; } }
.ripple-dot { width: 14px; height: 14px; background: #fff; animation: ripple-dot .25s ease-out; }
@keyframes ripple-dot { from { opacity: .9; } to { transform: scale(0); opacity: 0; } }

/* ---------- Экзамен, шпаргалка, аудиоконспект ---------- */
.exam-body, .tool-body { padding: 8px 16px calc(16px + var(--safe-b)); max-height: 90vh; overflow-y: auto; }
.exam-body .field, .tool-body .field { margin: 6px 0 6px; }

/* подсветка читаемого слова */
.chunk p .w { border-radius: 6px; transition: background-color .12s, color .12s; }
.chunk p .w.hl { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* статистика */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats-row b { display: block; font-size: 22px; font-weight: 600; }
.stats-row span { color: var(--muted); font-size: 13px; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 84px; margin-top: 14px; }
.bars .bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bars .bar i { display: block; width: 100%; max-width: 18px; min-height: 0; border-radius: 4px 4px 2px 2px; background: var(--accent); opacity: .75; }
.bars .bar.today i { opacity: 1; }
.bars .bar span { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1; }
.bars .bar i.none { background: var(--surface3); opacity: 1; }
#statsCard .hint:empty { display: none; }

/* шпаргалка: предпросмотр — белый лист; при печати видна только она */
.cheat-preview { background: #fff; color: #111; border-radius: 12px; padding: 14px; max-height: 56vh; overflow-y: auto; }
.cheat-preview .cs-cols { column-count: 1; }
@media (min-width: 640px) { .cheat-preview .cs-cols { column-count: 2; } }
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  html, body { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  @page { margin: 12mm; }
}
.btn.grow { flex: 1; min-width: 0; }
.audio-player { width: 100%; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- Подготовка к экзамену и билеты ---------- */
.prep-date { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.prep-date label { color: var(--muted); font-size: 14px; }
.prep-date input[type=date] { flex: 1; min-width: 150px; font: inherit; color: var(--text); background: var(--surface2, transparent); border: 1px solid var(--line, rgba(127, 127, 127, .35)); border-radius: 10px; padding: 8px 10px; color-scheme: light dark; }
.prep-list { list-style: none; padding: 0; margin: 6px 0 8px; display: grid; gap: 6px; }
.prep-list li { padding-left: 20px; position: relative; overflow-wrap: anywhere; }
.prep-list li::before { content: '○'; position: absolute; left: 0; color: var(--muted); }
.prep-list li.ok::before { content: '✓'; color: var(--ok, #4caf50); }
.prep-list li.warn { color: var(--warn, #e0a800); }
#ticketText { width: 100%; min-height: 160px; }
.tickets { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.tickets li { border: 1px solid var(--line, rgba(127, 127, 127, .25)); border-radius: 12px; overflow: hidden; }
.tickets .thead { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 10px 12px; cursor: pointer; }
.tickets .tnum { min-width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tickets .tq { flex: 1; overflow-wrap: anywhere; }
.tickets .tdetail { padding: 0 12px 12px 44px; }
.tickets .tans { white-space: pre-line; margin: 0 0 10px; font-size: 14px; line-height: 1.45; }

/* ---------- «Аврора» и «Чернила»: круглый «СТОП» внизу, «повторить» и «дальше» — по бокам от него ---------- */
/* подложка «СТОПа» уходит до низа экрана — текст под ним и под панелью вкладок плавно исчезает */
:is([data-theme="aurora"], [data-theme="ink"]) .stopbar { display: flex; justify-content: center; bottom: 0; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px); }
:is([data-theme="aurora"], [data-theme="ink"]) :is(.seg, .switch) + .card-title { margin-top: 20px; }
:is([data-theme="aurora"], [data-theme="ink"]) .chip-btn { min-width: 0; padding: 0 4px; font-size: 14px; gap: 4px; }
:is([data-theme="aurora"], [data-theme="ink"]) .add-row { gap: 6px; }
:is([data-theme="aurora"], [data-theme="ink"]) .stop { flex: none; margin: 0; }
:is([data-theme="aurora"], [data-theme="ink"]) body.has-stop[data-tab="dictate"] :is(#repeatBtn, #nextBtn) {
  position: fixed; z-index: 21; width: 56px; height: 56px;
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--stop-h) / 2 - 28px);
}
:is([data-theme="aurora"], [data-theme="ink"]) body.has-stop[data-tab="dictate"] #repeatBtn { left: calc(50% + var(--rail, 0px) / 2 - 136px); }
:is([data-theme="aurora"], [data-theme="ink"]) body.has-stop[data-tab="dictate"] #nextBtn { left: calc(50% + var(--rail, 0px) / 2 + 80px); }
