:root {
  --bg: #fffaf5;
  --card: #ffffff;
  --text: #1f1a17;
  --muted: #6b6159;
  --line: #eadfd5;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --mid: #a16207;
  --mid-bg: #fef9c3;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412; --card: #221e1b; --text: #f3ece6; --muted: #b3a79d; --line: #3a332e;
    --accent: #fb923c; --accent-ink: #1b0f06;
    --ok: #4ade80; --ok-bg: #12301d; --mid: #facc15; --mid-bg: #33290a; --bad: #f87171; --bad-bg: #3a1414;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
body.fullscreen { padding-bottom: 0; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 20px; margin: 20px 0 10px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.card.big { padding: 20px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row > .grow { flex: 1; }
button, .btn {
  font: inherit; font-weight: 600; min-height: 52px; padding: 12px 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  touch-action: manipulation;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.block, .btn.block { width: 100%; }
button:disabled { opacity: .5; }
button.ok:disabled, button.bad:disabled { opacity: 1; }
button.ghost { background: transparent; border-color: transparent; color: var(--accent); min-height: 44px; }
button.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
button.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.mic {
  width: 96px; height: 96px; border-radius: 50%; font-size: 40px; margin: 8px auto; display: flex;
  background: var(--accent); color: var(--accent-ink); border: none;
}
.mic.listening { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: .8; } }
input, textarea, select {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.seg button { flex: 1; border: none; border-radius: 0; min-height: 46px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10;
}
.tabs[hidden] { display: none; }
.tabs a {
  flex: 1; text-align: center; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: 13px;
}
.tabs a .ico { display: block; font-size: 22px; line-height: 1.3; }
.tabs a.on { color: var(--accent); font-weight: 700; }
.badge {
  display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--line);
}
.badge.ready { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--bad-bg); color: var(--bad); }
.badge.processing, .badge.queued { background: var(--mid-bg); color: var(--mid); }
.warn { color: var(--mid); font-size: 14px; white-space: pre-line; }
.err { color: var(--bad); font-size: 14px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0 16px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.topbar { display: flex; align-items: center; gap: 8px; }
.topbar .grow { flex: 1; }
.es { font-size: 24px; font-weight: 600; line-height: 1.3; }
.ru { font-size: 20px; }
.huge .es, .huge .ru { font-size: 28px; }
.verdict { border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.verdict.correct { background: var(--ok-bg); }
.verdict.almost { background: var(--mid-bg); }
.verdict.wrong { background: var(--bad-bg); }
.verdict .title { font-weight: 700; }
mark { background: var(--mid-bg); color: inherit; border-radius: 4px; padding: 0 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; }
.chips.answer { border: 2px dashed var(--line); border-radius: 14px; padding: 8px; }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 12px; font-weight: 500; }
.line { padding: 10px 12px; border-radius: 12px; margin: 8px 0; background: var(--card); border: 1px solid var(--line); }
.line.B, .line.user { background: transparent; margin-left: 32px; }
.line .who { font-size: 12px; color: var(--muted); }
.play { min-height: 40px; padding: 6px 12px; }
.center { text-align: center; }
.score { font-size: 40px; font-weight: 800; }
.hidden { display: none !important; }
