/* Стили из prototype.html; системный шрифт вместо Google Fonts (офлайн, без внешних запросов). */
:root {
  --bg: #E7E9E3; --ground: #F2F3EF; --surface: #FFFFFF; --ink: #16191D; --muted: #555B63;
  --line: #DADDD6; --accent: #2346A8; --accent-ink: #FFFFFF; --accent-soft: #E6ECFA;
  --warn-bg: #FFF1E0; --warn-ink: #7A3B00;
  --r1-bg: #FBE9E4; --r1-ink: #8F2D12; --r2-bg: #FFF4D6; --r2-ink: #6E5200; --r3-bg: #E3F2EA; --r3-ink: #145A3A;
  --mark: #FFE8A3; --disabled: #D9DCD5;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1012; --ground: #16191D; --surface: #1F2328; --ink: #ECEEF0; --muted: #A3AAB3;
    --line: #2F343B; --accent: #7C9BF0; --accent-ink: #0E1012; --accent-soft: #23304F;
    --warn-bg: #3A2A14; --warn-ink: #F5C98E;
    --r1-bg: #42231B; --r1-ink: #F3B4A2; --r2-bg: #3D3417; --r2-ink: #EBD28A; --r3-bg: #173527; --r3-ink: #9ED8B8;
    --mark: #5A4A12; --disabled: #2A2E34;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 560px; margin: 0 auto; height: 100dvh; background: var(--ground); display: flex; flex-direction: column; }
.screen { flex: 1; overflow-y: auto; padding: calc(24px + env(safe-area-inset-top)) 20px 20px; display: flex; flex-direction: column; gap: 18px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .title { font-size: 15px; font-weight: 600; color: var(--muted); text-align: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
h1 { margin: 0; font-size: 30px; font-weight: 700; }
.sub { font-size: 14px; color: var(--muted); line-height: 1.4; }
.sync { margin-top: -8px; }
.label { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card.list { gap: 0; padding: 4px 18px; }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.row-btn[aria-disabled="true"] { cursor: default; }
.row-btn .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.row-btn .txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row-btn .main { font-size: 18px; font-weight: 600; }
.primary { min-height: 52px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 600; width: 100%; }
.primary:disabled { background: var(--disabled); color: var(--muted); opacity: 1; }
.secondary { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 500; padding: 0 16px; }
.grow { flex: 1; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.err { color: var(--r1-ink); font-size: 14px; }
.nav { height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex-shrink: 0; }
.nav button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--muted); }
.nav button.on { color: var(--accent); font-weight: 600; }

.phrase { font-size: 30px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sense { font-size: 15px; color: var(--muted); }
.meaning { font-size: 18px; font-weight: 600; }
.en { font-size: 19px; line-height: 1.45; }
.ru { font-size: 16px; line-height: 1.45; color: var(--muted); }
mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 2px; }
.spoiler { border: 1px dashed var(--muted); border-radius: 12px; padding: 16px; min-height: 64px; background: var(--ground); width: 100%; text-align: left; font-size: 15px; color: var(--muted); }
.spoiler.open { border-style: solid; border-color: var(--line); background: var(--surface); color: var(--ink); cursor: default; }
.rates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rate { height: 64px; border-radius: 12px; border: 0; font-weight: 600; font-size: 15px; line-height: 1.2; padding: 4px; }
.r1 { background: var(--r1-bg); color: var(--r1-ink); }
.r2 { background: var(--r2-bg); color: var(--r2-ink); }
.r3 { background: var(--r3-bg); color: var(--r3-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: 14px; min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.badge { display: inline-block; align-self: flex-start; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
summary.badge { cursor: pointer; list-style: none; }
summary.badge::-webkit-details-marker { display: none; }
details.card:not([open]) { padding-bottom: 18px; }
.progressbar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.progressbar div { height: 100%; background: var(--accent); }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.item:last-child { border-bottom: 0; }
.item-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.status { font-size: 13px; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.st-gen { background: var(--ground); color: var(--muted); }
.st-review { background: var(--warn-bg); color: var(--warn-ink); }
.st-fail { background: var(--r1-bg); color: var(--r1-ink); }
.st-pool { background: var(--r3-bg); color: var(--r3-ink); }
.st-learn { background: var(--accent-soft); color: var(--accent); }
.more { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 15px; padding: 8px 0; min-height: 44px; text-align: left; }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.kv .sub { text-align: right; }
.form { display: flex; flex-direction: column; gap: 14px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=time], textarea, select {
  width: 100%; font-family: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
}
[aria-invalid="true"] { border-color: var(--r1-ink); }
textarea { resize: vertical; min-height: 64px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); border: 0; padding: 0; margin: 0; }
.field legend { padding: 0; margin-bottom: 6px; }
.center { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; flex: 1; }
.bigplay { width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; align-self: center; }
.chips-inline { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.st-flag { background: var(--warn-bg); color: var(--warn-ink); }
.chip.flag.on { background: var(--warn-bg); border-color: var(--warn-ink); color: var(--warn-ink); }
