:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #6b7385;
  --line: #e3e6ee;
  --primary: #2f6fed;
  --primary-soft: #e8efff;
  --ok: #1f9d55;
  --ok-soft: #e3f6ea;
  --bad: #d64545;
  --bad-soft: #fde8e8;
  --warn: #c27c0e;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --card: #1b2029;
    --text: #e7eaf0;
    --muted: #9aa3b5;
    --line: #2c3340;
    --primary: #6c9bff;
    --primary-soft: #1f2a44;
    --ok: #4cc47f;
    --ok-soft: #173123;
    --bad: #ff7b7b;
    --bad-soft: #3a1d1d;
    --warn: #f0b04a;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 14px; font-size: 15px; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 80px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 14px 0;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; padding: 12px 6px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: 13px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font: inherit; cursor: pointer;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.big { width: 100%; padding: 13px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: none; background: var(--primary-soft); color: var(--primary);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; flex: none; font-size: 15px;
}
.icon-btn.rec { background: var(--bad-soft); color: var(--bad); }
.week { margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.week summary { cursor: pointer; }
.reading { font-size: 17px; line-height: 1.7; }
details summary { cursor: pointer; }
.lesson-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--card); color: var(--text);
}
.lesson-row.current { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.lesson-row .badge { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.lesson-row .mark { width: 22px; text-align: center; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: none; }
.item .en { font-weight: 600; }
.item .ipa { color: var(--muted); font-size: 14px; margin-left: 4px; }
.item .vi { color: var(--muted); font-size: 15px; }
.item .ex { font-size: 14px; font-style: italic; }
.dlg .who { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; }
.dlg .you .who { color: var(--ok); }
.note { white-space: pre-line; }
.speak-result { font-size: 14px; margin-top: 4px; }
.q { padding: 12px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: none; }
.q .qt { font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.opts { display: grid; gap: 6px; }
.opts label {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.opts input { accent-color: var(--primary); }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 6px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 6px; }
.chip { padding: 5px 10px; border-radius: 8px; background: var(--primary-soft); color: var(--text); border: none; font: inherit; cursor: pointer; }
.q.right { background: var(--ok-soft); border-radius: 10px; padding: 12px; }
.q.wrong { background: var(--bad-soft); border-radius: 10px; padding: 12px; }
.fb { font-size: 14px; margin-top: 6px; }
.score { font-size: 1.3rem; font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: 90vw;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.goal { background: var(--primary-soft); border-radius: 10px; padding: 10px 12px; }
@media (max-width: 480px) {
  .stat b { font-size: 1.25rem; }
  .topbar nav { gap: 10px; }
}
