:root {
  color-scheme: light dark;
  --bg: #eef3f0; --panel: #fff; --ink: #14251f; --muted: #566a62; --line: #cbd8d1;
  --head: #16423c; --accent: #16423c; --on-accent: #fff; --sun: #f2b632;
  --good: #14713f; --good-bg: #dcf3e5; --bad: #a8261f; --bad-bg: #fbe3e0; --near: #7a5200; --near-bg: #fdf0cf;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a17; --panel: #182723; --ink: #e8f0ec; --muted: #9db3a9; --line: #2f453d;
    --head: #11342f; --accent: #f2b632; --on-accent: #1d1500;
    --good: #7fdba5; --good-bg: #16382a; --bad: #ff9d94; --bad-bg: #44201e; --near: #f7cd6b; --near-bg: #40330f;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
header { background: var(--head); color: #fff; padding: calc(14px + env(safe-area-inset-top)) max(16px, calc(50% - 380px)) 0; }
h1 { margin: 0 0 8px; font-size: 1.25rem; }
h2 { margin: 0; font-size: 1.15rem; }
nav { display: flex; overflow-x: auto; }
nav button { background: none; border: 0; border-bottom: 4px solid transparent; border-radius: 0; color: #d4e4dd; padding: 10px 12px; white-space: nowrap; }
nav button.on { color: #fff; border-color: var(--sun); font-weight: 600; }
main { max-width: 792px; margin: 0 auto; padding: 20px 16px 60px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 18px; min-height: 46px; }
button:hover { filter: brightness(1.06); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.big { width: 100%; font-size: 1.1rem; min-height: 56px; }
.link { background: none; border: 0; padding: 0 4px; color: var(--muted); text-decoration: underline; }
input, select, textarea { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; }
label { display: block; font-size: .9rem; color: var(--muted); }
label input, label select { margin-top: 4px; color: var(--ink); font-size: 1rem; }
.check { display: flex; gap: 10px; align-items: center; color: var(--ink); }
.panel, .card { background: var(--panel); border-radius: 16px; padding: 20px; margin-bottom: 18px; display: grid; gap: 16px; border: 1px solid var(--line); }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: .92rem; }
.msg:empty { display: none; }
.msg { font-weight: 600; }
.stats { display: flex; gap: 28px; margin: 4px 4px 20px; flex-wrap: wrap; }
.stats b { display: block; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: .9rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0 0 8px; color: var(--muted); font-size: .9rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.choices label { position: relative; color: var(--ink); font-size: 1rem; cursor: pointer; }
.choices input { position: absolute; opacity: 0; inset: 0; min-height: 0; margin: 0; cursor: pointer; }
.choices span { display: block; padding: 14px; border: 2px solid var(--line); border-radius: 12px; }
.choices input:checked + span { border-color: var(--sun); background: var(--near-bg); font-weight: 600; }
.choices input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.topline { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--line); margin: 6px 0 18px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--sun); transition: width .25s; }
.dir { color: var(--muted); }
.word { display: flex; gap: 14px; align-items: center; justify-content: space-between; font-size: clamp(1.5rem, 5vw, 2.1rem); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.word > span { min-width: 0; }
.word.small { font-size: 1.4rem; }
.speak { flex: none; width: 54px; height: 54px; padding: 0; border-radius: 50%; background: var(--near-bg); font-size: 1.4rem; line-height: 1; }
#answerForm, #result { display: grid; gap: 14px; }
#answer { font-size: 1.3rem; padding: 14px; }
.verdict { padding: 10px 14px; border-radius: 10px; font-weight: 700; margin-bottom: 10px; }
.good { background: var(--good-bg); color: var(--good); }
.bad { background: var(--bad-bg); color: var(--bad); }
.near { background: var(--near-bg); color: var(--near); }
.yours:empty, .note:empty { display: none; }
mark { background: var(--near-bg); color: var(--near); border-radius: 4px; }
.note { color: var(--muted); margin-top: 6px; }
.cards { list-style: none; padding: 0; margin: 10px 0; }
.cards li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cards .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cards .txt small { color: var(--muted); display: block; }
.cards .speak { width: 44px; height: 44px; font-size: 1.1rem; }
.cards .link { font-size: .9rem; }
@media (max-width: 520px) { .cards li { flex-wrap: wrap; } .cards .txt { flex-basis: calc(100% - 60px); } }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }
@media (max-width: 420px) { nav button { padding: 10px 6px; font-size: .92rem; flex: 1; } }
.brand { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#who { color: #d4e4dd; font-size: .95rem; }
button:disabled { opacity: .5; cursor: default; }
.errs { max-height: 420px; overflow-y: auto; margin: 0; }
.errs:empty { display: none; }
.errs li { flex-wrap: nowrap; }
.pick { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; color: var(--ink); cursor: pointer; }
.pick input { flex: none; }
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; }
.chart .col { display: grid; gap: 4px; border: 0; background: none; padding: 0; min-width: 0; min-height: 0; }
.chart .plot { display: flex; align-items: flex-end; justify-content: center; height: 130px; border-bottom: 1px solid var(--line); }
.chart i { width: min(22px, 80%); background: var(--accent); border-radius: 4px 4px 0 0; }
.chart .col:hover .plot, .chart .col:focus-visible .plot { background: var(--bg); }
.chart small { color: var(--muted); font-size: .75rem; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child { text-align: left; white-space: normal; font-weight: 500; }
thead th { color: var(--muted); font-weight: 500; }
th:first-child { hyphens: auto; overflow-wrap: anywhere; min-width: 90px; }
@media (max-width: 520px) { table { font-size: .84rem; } th, td { padding: 8px 4px; } .panel, .card { padding: 16px; } }
