:root, [data-theme="light"] {
  color-scheme: light;
  --paper: #f3ead8;
  --ink: #1b2437;
  --muted: #6d6458;
  --navy: #1e3a5f;
  --navy2: #15283f;
  --red: #c44536;
  --ok: #2c6b4a;
  --ok-bg: #e7f3ec;
  --bad: #a33b32;
  --bad-bg: #fbecea;
  --line: #e4d6b8;
  --card: #fffdf8;
  --shadow: 0 10px 30px rgba(27, 36, 55, .08);
  --hero: #1e3a5f;
  --hero-fg: #f7f1e6;
  --input: #fff;
  --chip: #efe6d4;
  --chip-word: #e8eef6;
  --chip-phrase: #f8e6e3;
  --track: #efe6d4;
  --nav-fg: #efe6d4;
}
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10131a;
  --ink: #eef2f7;
  --muted: #9aa3b2;
  --navy: #5b86c6;
  --navy2: #0b0e14;
  --red: #e15b4e;
  --ok: #3d9a6a;
  --ok-bg: #163326;
  --bad: #e06a62;
  --bad-bg: #3a1c1b;
  --line: #2a3142;
  --card: #1a2030;
  --shadow: none;
  --hero: #1a2438;
  --hero-fg: #eef2f7;
  --input: #121722;
  --chip: #243044;
  --chip-word: #1d2c44;
  --chip-phrase: #3a2422;
  --track: #243044;
  --nav-fg: #d7deea;
}
* { box-sizing: border-box; margin: 0; padding: 0 }
html, body { min-height: 100% }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}
button, input { font: inherit; color: inherit }
a { color: inherit }
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px 18px 96px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.brand img { width: 42px; height: 42px; border-radius: 10px }
.brand b { display: block; font-size: 18px; letter-spacing: .02em }
.brand span { display: block; font-size: 11px; color: var(--muted) }
.top-actions { display: flex; gap: 8px; flex-shrink: 0 }
.icon-btn {
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  font-size: 16px;
}
.hero {
  background: var(--hero);
  color: var(--hero-fg);
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
}
.kicker { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted) }
.hero .kicker { color: inherit; opacity: .7 }
.hero h1 { font-size: 28px; margin: 6px 0 8px; letter-spacing: -.03em }
.hero p { opacity: .85; font-size: 14px }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.stat {
  background: rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 10px;
}
.stat b { display: block; font-size: 20px }
.stat span { font-size: 11px; opacity: .7 }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  border: 0;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(196, 69, 54, .25);
  user-select: none;
}
.mic-btn {
  min-height: 52px;
  margin: 4px 0 12px;
  position: relative;
  z-index: 6;
  font-size: 16px;
}
.btn:disabled { opacity: .45; cursor: not-allowed }
.btn.navy { background: var(--navy); color: #fff }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ok { background: var(--ok) }
.row { display: flex; gap: 8px; margin-top: 12px }
.row .btn { flex: 1 }
h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px }
h2 a { text-decoration: none }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.chip {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 99px;
  background: var(--chip); color: var(--ink);
}
.chip.word { background: var(--chip-word) }
.chip.phrase { background: var(--chip-phrase); color: var(--red) }
.chip.ok { background: var(--ok-bg); color: var(--ok) }
.chip.now { background: var(--chip-phrase); color: var(--red) }
.big {
  font-size: clamp(26px, 7vw, 38px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin: 8px 0 6px;
}
.say { color: var(--red); font-weight: 700; font-size: 15px }
.tip { color: var(--muted); font-size: 13.5px; margin-top: 10px }
.progress {
  height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 8px 0 14px;
}
.progress > i { display: block; height: 100%; background: var(--red); width: 0 }
.q { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 14px }
input.answer, .search {
  width: 100%;
  border: 2px solid var(--navy);
  background: var(--input);
  color: var(--ink);
  border-radius: 14px;
  padding: 14px;
  font-size: 18px;
  outline: none;
}
.search { border-width: 1px; font-size: 15px; margin-bottom: 10px }
input.answer.ok { border-color: var(--ok); background: var(--ok-bg) }
input.answer.bad { border-color: var(--bad); background: var(--bad-bg) }
.fb { margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-size: 14px }
.fb.ok { background: var(--ok-bg); color: var(--ok) }
.fb.bad { background: var(--bad-bg); color: var(--bad) }
.fb b { display: block; font-size: 16px; margin-bottom: 4px; color: var(--ink) }
.nav {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(398px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--navy2);
  color: var(--nav-fg);
  border-radius: 18px;
  padding: 6px;
  z-index: 5;
}
.nav a {
  text-align: center;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  padding: 10px 4px;
  border-radius: 12px;
  opacity: .7;
}
.nav a.on { background: rgba(255,255,255,.1); opacity: 1 }
.lockbox { text-align: center; padding: 28px 10px; color: var(--muted) }
.stamp { text-align: center; padding: 28px 8px 10px }
.stamp .seal {
  width: 92px; height: 92px; margin: 0 auto 12px;
  border: 4px solid var(--ok);
  color: var(--ok);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px;
  transform: rotate(-8deg);
}
.mic-btn.on, #mic.on { background: #9f1239; color: #fff }
.bubble { padding: 10px 0; border-bottom: 1px solid var(--line) }
.bubble:last-child { border-bottom: 0 }
.bubble .who { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px }
.bubble.you .who { color: var(--red) }
.bubble .en { font-weight: 800 }
.bubble .ru { color: var(--muted); font-size: 13px }
.bubble.solo { border: 0; padding: 0 }
.bubble.you.solo .big { color: var(--ink) }
.note { font-size: 12px; color: var(--muted); margin-top: 10px }
.dict-item { padding: 10px 0; border-bottom: 1px solid var(--line) }
.dict-item .en { font-weight: 800 }
.dict-item .ru { color: var(--muted); font-size: 13px }
.lvls { display: grid; gap: 8px }
.lvl {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
}
.lvl.now { border-color: var(--red) }
.lvl.done { border-color: var(--ok) }
.lvl-n {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--chip);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.lvl.done .lvl-n { background: var(--ok); color: #fff }
.lvl.now .lvl-n { background: var(--red); color: #fff }
.lvl b { display: block; font-size: 15px }
.lvl .muted { color: var(--muted); font-size: 12px }
.item-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.item-row:last-child { border-bottom: 0 }
.item-row .en { font-weight: 800 }
.item-row .ru { color: var(--muted); font-size: 13px }
@media (prefers-reduced-motion: no-preference) {
  .btn, .lvl { transition: transform .12s ease }
  .btn:active, .lvl:active { transform: scale(.98) }
}
.gate {
  position: fixed; inset: 0; z-index: 40;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}
.gate-card h1 { font-size: 28px; margin: 8px 0 6px; letter-spacing: -.03em }
.gate-card img { width: 56px; height: 56px; border-radius: 14px }
.gate-card input[type="password"] {
  width: 100%;
  border: 2px solid var(--navy);
  background: var(--input);
  color: var(--ink);
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  margin-top: 10px;
}
.remember {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--muted);
}
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10,12,18,.55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 18px;
}
.modal-card {
  width: min(400px, 100%);
  background: var(--card);
  color: var(--ink);
  border-radius: 22px;
  padding: 22px;
  margin-bottom: 12px;
}
.modal-card b { display: block; font-size: 22px; margin-bottom: 8px }
.install-chip {
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 10px;
  padding: 0 10px;
  height: 42px;
  cursor: pointer;
}
body.authed .gate { display: none }
body:not(.authed) .app, body:not(.authed) .nav { display: none }
