/* Экран ребёнка: телефон 360–412 px, крупные кнопки, один экран — одно действие. Системные шрифты. */
:root {
  --paper: #f3f5f9; --sheet: #ffffff; --ink: #1a2030; --muted: #5d6679; --rule: #dde2ea;
  --accent: #2b47c4; --accent-ink: #ffffff; --accent-soft: #e8ecfb;
  --ok: #157a4a; --ok-soft: #e3f4ea; --bad: #b3261e; --bad-soft: #fbe9e7;
  --trap: #9a520a; --trap-soft: #fdf3e6; --mark: rgba(255, 214, 51, .55);
  --word: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1218; --sheet: #191d27; --ink: #e8ebf2; --muted: #9aa3b5; --rule: #2b3140;
    --accent: #8ea4ff; --accent-ink: #0f1218; --accent-soft: #1f2640;
    --ok: #5fd39a; --ok-soft: #15291f; --bad: #ff8a80; --bad-soft: #301a19;
    --trap: #eba862; --trap-soft: #2a2117; --mark: rgba(255, 204, 0, .28);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink); font: 17px/1.45 var(--ui);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app {
  max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1 { font-size: 24px; line-height: 1.2; margin: 6px 0 2px; }

/* --- кнопки --- */
.btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: 56px; padding: 12px 18px; border-radius: var(--radius);
  border: 1.5px solid var(--rule); background: var(--sheet); font-weight: 600; font-size: 18px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { min-height: 84px; font-size: 22px; }
.btn .sub { font-weight: 400; font-size: 14px; opacity: .85; }
.btn:disabled { opacity: .5; }
.btn:active:not(:disabled) { transform: scale(.985); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.link { background: none; border: 0; color: var(--accent); padding: 10px 4px; font-weight: 500; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--rule); background: var(--sheet);
  display: inline-grid; place-items: center; flex: none; padding: 0;
}
.play {
  width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--rule); background: var(--sheet);
  color: var(--accent); display: inline-grid; place-items: center; flex: none; padding: 0;
}
.play svg { width: 16px; height: 16px; margin-left: 3px; fill: currentColor; }
.play.big { width: 96px; height: 96px; border-width: 2px; }
.play.big svg { width: 34px; height: 34px; margin-left: 6px; }
.play.small { width: 34px; height: 34px; }
.play.small svg { width: 11px; height: 11px; margin-left: 2px; }
.play.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* --- главная --- */
.home { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chip { font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.cov { display: grid; gap: 8px; }
.cov .big { font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.cov .line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bar { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; color: var(--muted); }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.actions { display: grid; gap: 12px; margin-top: auto; }

/* --- занятие --- */
.lesson { display: flex; flex-direction: column; flex: 1; gap: 14px; }
.lesson-top { display: flex; align-items: center; gap: 12px; }
.lesson-top .bar { flex: 1; height: 8px; }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 8px 0; }
.ask { font-size: 16px; color: var(--muted); text-align: center; }
.word { font: 700 40px/1.1 var(--word); text-align: center; overflow-wrap: anywhere; }
.word.phrase { font-size: 30px; }
.ipa { font: 19px/1.2 "Charis SIL", "Doulos SIL", "Lucida Sans Unicode", var(--word); color: var(--muted); text-align: center; }
.ru-big { font-size: 26px; font-weight: 600; text-align: center; line-height: 1.25; }
.center { display: flex; justify-content: center; align-items: center; gap: 12px; }
.tag { font-size: 13px; font-weight: 600; color: var(--accent); text-align: center; letter-spacing: .02em; }
.ex { display: flex; gap: 12px; align-items: flex-start; padding-top: 14px; border-top: 1px dashed var(--rule); }
.ex .en { font: 19px/1.4 var(--word); }
.ex .ru { color: var(--muted); font-size: 15px; margin-top: 2px; }
mark { background: linear-gradient(transparent 40%, var(--mark) 40%, var(--mark) 92%, transparent 92%); color: inherit; padding: 0 1px; }
.trap { background: var(--trap-soft); color: var(--trap); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.options { display: grid; gap: 10px; }
.opt { min-height: 56px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--rule); background: var(--sheet); text-align: left; font-size: 18px; }
.opt.en { font: 22px/1.2 var(--word); text-align: center; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.field {
  width: 100%; font: 26px/1.2 var(--word); padding: 14px 16px; border-radius: 14px; border: 2px solid var(--rule);
  background: var(--sheet); color: var(--ink); text-align: center;
}
.field:focus { border-color: var(--accent); outline: none; }
.cloze { font: 24px/1.6 var(--word); text-align: center; }
.cloze .gap {
  display: inline-block; min-width: 3.2em; border-bottom: 3px solid var(--accent); color: var(--accent); padding: 0 4px;
}
.hint { text-align: center; font-size: 14px; color: var(--muted); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 52px; }
.built { min-height: 70px; padding: 10px; border-radius: 14px; border: 2px dashed var(--rule); align-content: flex-start; }
.tile { font: 20px/1 var(--word); padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--rule); background: var(--sheet); }
.tile.used { visibility: hidden; }
.built .tile { border-color: var(--accent); background: var(--accent-soft); }
.bottom { display: grid; gap: 10px; }

/* --- ответ --- */
.feedback { border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback .head { font-weight: 700; font-size: 19px; }
.feedback.ok .head { color: var(--ok); }
.feedback.bad .head { color: var(--bad); }
.feedback .ans { display: flex; gap: 10px; align-items: center; font: 20px/1.35 var(--word); }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; display: flex; gap: 12px; align-items: center;
  max-width: calc(100% - 32px); z-index: 10; font-size: 15px; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; }

/* --- итог --- */
.final { display: flex; flex-direction: column; gap: 16px; flex: 1; justify-content: center; text-align: center; }
.final .big { font-size: 46px; font-weight: 700; line-height: 1.05; }
.final .grow { font-size: 22px; font-weight: 600; }
.final .grow b { color: var(--ok); }

/* --- слова --- */
.words { display: flex; flex-direction: column; gap: 12px; }
.words .head { display: flex; align-items: center; gap: 10px; }
.search { width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--rule); background: var(--sheet); color: var(--ink); }
.seg { display: flex; border: 1.5px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--sheet); }
.seg button { flex: 1; border: 0; background: none; padding: 11px 8px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.wl { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.w { background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; padding: 10px 12px; }
.w .line { display: flex; align-items: center; gap: 10px; }
.w .t { font: 600 20px/1.2 var(--word); overflow-wrap: anywhere; }
.w .r { color: var(--muted); font-size: 15px; }
.w .grow1 { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; }
.w .meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.st { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.st.new { color: var(--muted); } .st.introducing { color: var(--trap); } .st.learning { color: var(--accent); }
.st.known, .st.learned { color: var(--ok); } .st.due { color: var(--bad); }
.w .more { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--rule); display: grid; gap: 8px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* --- вход --- */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { max-width: 420px; width: 100%; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; text-align: center; display: grid; gap: 14px; }
.login-box h1 { margin: 0; }
.login-box button.big { width: 100%; min-height: 60px; border-radius: var(--radius); border: 0; background: var(--accent); color: var(--accent-ink); font-size: 20px; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .btn, .opt, .tile, .play { transition: transform .08s, background .15s, border-color .15s; }
}
