:root {
  color-scheme: light;
  --bg: #f5f5ed;
  --surface: #fffefa;
  --text: #162b22;
  --muted: #50675c;
  --line: #d8e1d5;
  --accent: #215b43;
  --selected: #e1ede0;
  --reading: #f4efdf;
  --reading-text: #634719;
  --good: #d9efdc;
  --bad: #f7d8d5;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131e19;
  --surface: #1e2b24;
  --text: #f1f5ec;
  --muted: #b6caba;
  --line: #45574c;
  --accent: #a9dcba;
  --selected: #314b3b;
  --reading: #382f20;
  --reading-text: #f1d79f;
  --good: #235437;
  --bad: #663934;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #131e19;
    --surface: #1e2b24;
    --text: #f1f5ec;
    --muted: #b6caba;
    --line: #45574c;
    --accent: #a9dcba;
    --selected: #314b3b;
    --reading: #382f20;
    --reading-text: #f1d79f;
    --good: #235437;
    --bad: #663934;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.5 system-ui, sans-serif; }
a { color: var(--accent); }
.shell { width: min(100% - 32px, 1140px); margin-inline: auto; }
.skip { position: fixed; left: 12px; top: 10px; transform: translateY(-160%); z-index: 3; background: var(--surface); padding: 12px; }
.skip:focus { transform: translateY(0); }
.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.brand a { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 780; text-decoration: none; }
.brand img { border-radius: 12px; }
.layout { display: grid; grid-template-columns: 182px minmax(0, 1fr); gap: 36px; padding-block: 32px 52px; }
nav { align-self: start; position: sticky; top: 18px; display: grid; gap: 4px; }
nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
nav a span { width: 23px; font-size: 1.15rem; text-align: center; }
nav a:hover, nav a[aria-current] { background: var(--selected); color: var(--accent); }
main { min-width: 0; }
main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, p { margin: 0 0 12px; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.07; letter-spacing: -.045em; }
h2 { font-size: 1.2rem; line-height: 1.25; }
p + h2, .stats + h2 { margin-top: 24px; }
p { color: var(--muted); }
.hero {
  padding: clamp(24px, 6vw, 56px);
  border-radius: 24px;
  background: radial-gradient(ellipse at 92% 10%, #32745b, transparent 58%), #174735;
  color: #fffdf0;
}
.hero h1 { font-size: clamp(2.65rem, 7vw, 5.2rem); line-height: .99; margin-bottom: 16px; }
.hero p { color: #e1eee5; }
.hero-label { text-transform: uppercase; font-size: .78rem; font-weight: 700; letter-spacing: .12em; }
.hero .actions { margin-top: 26px; }
.hero .primary { background: #e6f1d6; color: #193b2a; }
.hero-link { color: #fffdf0; padding: 11px 8px; }
.stats, .filters, .cards { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: 12px; }
.filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel, .card { padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.panel { margin-block: 12px; }
.stats .panel { margin: 0; }
.stats strong { color: var(--accent); font-size: 1.35rem; }
.stats p { margin-bottom: 6px; }
progress { width: 100%; accent-color: var(--accent); }
.next { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.next strong { flex: 1; }
.phrase { font-size: 1.48rem; color: var(--accent); line-height: 1.25; font-weight: 720; }
.meaning { color: var(--text); }
.reading { background: var(--reading); color: var(--reading-text); border-radius: 9px; padding: 8px 10px; }
.reading small { display: block; }
.muted { color: var(--muted); font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
button, .primary, input, select { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 44px; color: var(--text); background: var(--surface); }
button, summary { cursor: pointer; }
button:hover { border-color: var(--accent); }
.primary { display: inline-flex; align-items: center; background: #215b43; border-color: #215b43; color: #fff; font-weight: 650; text-decoration: none; }
.primary:hover { background: #194a35; }
:disabled { opacity: .55; cursor: default; }
label { display: grid; gap: 4px; font-weight: 620; margin-bottom: 12px; min-width: 0; }
input, select { width: 100%; min-width: 0; }
.checkbox { display: flex; align-items: center; gap: 9px; }
.checkbox input { width: 19px; min-height: 28px; accent-color: var(--accent); }
summary { font-weight: 680; }
.choices { display: grid; gap: 8px; margin-block: 12px; }
.choices button { text-align: left; }
.good { background: var(--good); }
.bad { background: var(--bad); }
.status { position: sticky; bottom: 10px; padding: 10px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
.status:empty { display: none; }
@media (max-width: 780px) {
  .layout { display: block; padding-top: 0; }
  nav { position: static; display: flex; overflow-x: auto; margin: 0 -16px 20px; padding: 10px 16px; }
  nav a { white-space: nowrap; }
}
@media (max-width: 540px) {
  .stats, .cards, .filters { grid-template-columns: 1fr; }
  .brand { min-height: 58px; }
  .hero { border-radius: 18px; }
}
@media (max-width: 640px) {
  nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; overflow: visible; margin-inline: 0; padding-inline: 0; }
  nav a { font-size: .85rem; padding-inline: 6px; gap: 4px; white-space: normal; }
  nav a span { flex: 0 0 17px; font-size: 1rem; }
}
textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.phrase-details, .oral-target:not(:empty) { margin-top: 12px; }
.phrase-details p, .term { margin-block: 8px; }
.term { padding-inline-start: 10px; border-inline-start: 2px solid var(--line); }
.oral-result audio { width: 100%; margin-top: 8px; }
