/* Рабочий, спокойный стиль (§5): без мультяшности. Иврит — Noto Sans Hebrew, русский — Inter. RTL-безопасная вёрстка. */
:root { --bg: #F7F7F5; --card: #fff; --ink: #1F2A24; --muted: #6B7570; --line: #E3E6E2; --accent: #2F6B4F; --accent2: #2C5FA8; --ok: #2E9E5B; --bad: #C9463D; --warn: #B8860B; --s0: #FFE9A8; --s1: #FFF3CC; --s2: #F1F6EE; --mt: #EEF0EE; --radius: 12px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, sans-serif; font-size: 17px; line-height: 1.45; }
.app { max-width: 820px; margin: 0 auto; padding: 12px 16px 40px; }
.screen { display: flex; flex-direction: column; gap: 14px; }
.he { font-family: 'Noto Sans Hebrew', 'Arial Hebrew', 'David', sans-serif; direction: rtl; unicode-bidi: isolate; }
.he.big { font-size: 26px; font-weight: 600; }
.ru { unicode-bidi: isolate; }
.small { font-size: 14px; color: var(--muted); }
.en { font-style: italic; }
.topbar { display: flex; align-items: center; gap: 10px; }
.topbar .title { font-weight: 700; font-size: 19px; flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.center { text-align: center; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.hero { text-align: center; }
.big-number { font-size: 56px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stats-row { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; color: var(--muted); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: left; font: inherit; cursor: pointer; min-height: 72px; }
.mode:active { background: #f0f2ef; }
.mode-icon { font-size: 26px; } .mode-text { display: flex; flex-direction: column; gap: 2px; }
.btn { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.icon { min-width: 44px; padding: 8px; font-size: 20px; }
.btn.next { align-self: flex-end; margin-top: 8px; }
.btn.link, .link { background: none; border: none; color: var(--accent2); text-decoration: underline; padding: 0; font: inherit; cursor: pointer; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.space { justify-content: space-between; }
.hint { color: var(--muted); font-size: 14px; }
.warn { background: #FFF6DA; border: 1px solid #E8D48B; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.input, .text-input, .answer { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); width: 100%; }
.text-input { font-family: 'Noto Sans Hebrew', sans-serif; font-size: 18px; line-height: 1.7; }
.text-input.he, .answer[dir=rtl] { direction: rtl; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list.compact { gap: 4px; }
.list-item { text-align: left; font: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.list-item:disabled { opacity: 0.5; cursor: default; }
.list-item.static { cursor: default; }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.badge.ok { background: #E1F3E7; color: var(--ok); } .badge.warn { background: #FFF1D6; color: var(--warn); }

/* --- чтение с поддержкой (§3–4) --- */
.reading-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-family: 'Noto Sans Hebrew', sans-serif; font-size: 20px; line-height: 2.3; }
.reading-box p { margin: 0 0 12px; }
.term { border-radius: 6px; padding: 0 4px; cursor: pointer; position: relative; unicode-bidi: isolate; display: inline-block; text-align: center; line-height: 1.35; vertical-align: baseline; }
.term.s0 { background: var(--s0); border-bottom: 2px solid var(--warn); }
.term.s1 { background: var(--s1); border-bottom: 2px solid #D9B85A; }
.term.s2 { background: var(--s2); border-bottom: 1px dashed #9DBD9F; }
.term.s3, .term.s4 { background: none; }
.term .ruby { display: block; font-family: Inter, sans-serif; font-size: 11px; line-height: 1.1; color: var(--muted); direction: ltr; text-align: center; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.word { cursor: pointer; border-radius: 4px; } .word:hover { background: var(--mt); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.legend .term { font-size: 13px; cursor: default; }
/* --- карточки: глоссарий (сплошная рамка, ✓) и автоперевод (пунктир, серый) --- */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.3); }
.sheet-body { position: relative; width: min(820px, 100%); max-height: 80vh; overflow: auto; background: var(--card); border-radius: 16px 16px 0 0; padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.sheet-body.verified { border: 3px solid var(--accent); border-bottom: none; }
.sheet-body.mt { border: 3px dashed #9AA39E; border-bottom: none; background: var(--mt); }
.ru-label { font-size: 20px; font-weight: 700; }
.def-he { font-size: 18px; }
.example { color: #3d4a44; } .confuse { background: #FFF6DA; border-radius: 8px; padding: 8px 10px; font-size: 15px; }
.mt-result { font-size: 20px; font-weight: 600; }
/* --- диагностика, объяснение --- */
.question { margin-top: 12px; font-weight: 600; }
.expl { font-size: 17px; }
/* --- задания --- */
.stage { display: flex; flex-direction: column; gap: 12px; }
.drill-head .drill-title { font-weight: 700; font-size: 18px; } .drill-sub { color: var(--muted); font-size: 14px; }
.prompt-he, .prompt-ru { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 18px; }
.sentence { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: right; font-size: 20px; line-height: 1.8; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { font: inherit; font-size: 17px; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 12px; min-height: 56px; cursor: pointer; text-align: center; }
.choice.ok { border-color: var(--ok); background: #E9F7EE; } .choice.bad { border-color: var(--bad); background: #FBEBEA; } .choice:disabled { opacity: 0.7; }
.explain { background: #FBEBEA; border-radius: 10px; padding: 10px 12px; white-space: pre-line; } .explain.ok { background: #E9F7EE; }
.labels { display: flex; flex-wrap: wrap; gap: 8px; }
.label-chip { font: inherit; font-size: 16px; background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 44px; }
.label-chip.sel { border-color: var(--accent2); background: #E8F0FB; } .label-chip.bad { border-color: var(--bad); } .label-chip.placed { border-color: var(--ok); background: #E9F7EE; cursor: default; } .label-chip:disabled { opacity: 0.5; }
.diagram-wrap svg { width: 100%; max-height: 300px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.slot { fill: #fff; stroke: var(--accent2); stroke-width: 2; cursor: pointer; } .slot.done { fill: #E9F7EE; stroke: var(--ok); }
.slot-text { font-size: 14px; font-weight: 700; fill: var(--accent2); pointer-events: none; } .slot-text.done { font-size: 11px; fill: var(--ink); font-family: 'Noto Sans Hebrew', sans-serif; }
.chain { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chain-slot { min-width: 110px; min-height: 48px; border: 2px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 6px 10px; font-family: 'Noto Sans Hebrew', sans-serif; }
.chain-slot.next { border-color: var(--accent2); border-style: solid; } .chain-slot.done { border-style: solid; border-color: var(--ok); background: #E9F7EE; }
.arrow { font-size: 22px; color: var(--muted); }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { min-height: 120px; background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.cat-title { font-weight: 700; display: flex; flex-direction: column; }
table.cmp { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.cmp th, table.cmp td { border: 1px solid var(--line); padding: 8px; text-align: center; font-family: 'Noto Sans Hebrew', sans-serif; }
.cell-btn { font: inherit; font-size: 18px; font-weight: 700; width: 100%; min-height: 40px; border: 2px dashed var(--accent2); border-radius: 8px; background: #fff; cursor: pointer; color: var(--accent2); }
.cell-btn.sel { background: #E8F0FB; border-style: solid; }
.reference { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.stat { margin: 4px 0; }
.quick-out { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 480px) { .modes { grid-template-columns: 1fr; } .choices { grid-template-columns: 1fr; } .he.big { font-size: 22px; } .reading-box { font-size: 18px; } }
.related { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.chip-link { font-family: 'Noto Sans Hebrew', sans-serif; font-size: 15px; background: #EEF3FA; border-radius: 999px; padding: 2px 10px; text-decoration: none; }

.textbook details { border-top: 1px solid var(--line); padding: 6px 0; } .textbook summary { cursor: pointer; display: flex; gap: 8px; align-items: center; font-weight: 600; padding: 6px 0; } .tb-num { background: var(--accent); color: #fff; border-radius: 6px; padding: 0 8px; font-size: 13px; }
.tb-chapter { display: flex; gap: 8px; align-items: center; width: 100%; text-align: right; } .tb-chapter.done { opacity: .7; }

.he.nikud { line-height: 1.9; letter-spacing: 0.01em; } .he.big.nikud { font-size: 30px; }
.translit { font-family: system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif; color: var(--muted); font-size: 15px; direction: ltr; text-align: left; margin-top: 2px; } .translit.inline { font-size: 13px; }
.term-head { display: flex; flex-direction: column; gap: 2px; }
.version { text-align: center; margin-top: 12px; opacity: .6; }

/* Вход, аккаунт и состояние синхронизации */
.hidden { display: none !important; }
.card.login { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.btn.wide { width: 100%; }
.screen.login code, .screen.parent-home code { font-size: 12px; word-break: break-all; background: var(--line); padding: 2px 5px; border-radius: 6px; }
.sync { position: fixed; left: 12px; right: 12px; bottom: 12px; margin: 0 auto; max-width: 560px; z-index: 20; background: #FFF6DA; border: 1px solid #E8D48B; border-radius: 10px; padding: 10px 12px; font-size: 14px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.sync.error { background: #FDE8E8; border-color: #E8A9A9; }
