/* eng.errtyflow.com — стили.
   Идея: слово едет по линии метро. Каждая станция — интервал повторения
   (новое → 1 день → 3 дня → неделя → … → 4 месяца). Линия — главный визуальный элемент,
   всё остальное спокойное. Цвета линий — как цвета веток лондонского метро. */

@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(/fonts/onest-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(/fonts/onest-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 600; font-display: swap; src: url(/fonts/onest-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; font-weight: 600; font-display: swap; src: url(/fonts/onest-cyrillic-600-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 800; font-display: swap; src: url(/fonts/onest-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; font-weight: 800; font-display: swap; src: url(/fonts/onest-cyrillic-800-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --line: #0019A8;     /* синяя ветка — основной цвет */
  --line-2: #0A2FD6;
  --paper: #EEF1F6;    /* холодный фон «плитки» */
  --card: #FFFFFF;
  --text: #10183A;
  --muted: #5D6684;
  --rule: #D5DAE5;
  --go: #00843D;       /* зелёная ветка — верно */
  --go-bg: #E3F4EA;
  --stop: #E32017;     /* красная ветка — ошибка */
  --stop-bg: #FCE6E4;
  --sun: #FFD329;      /* жёлтая ветка — серия и опыт */
  --r-big: 22px;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--text);
  font: 400 17px/1.45 Onest, -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
a { color: var(--line); }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(var(--safe-t) + 18px) 18px calc(var(--safe-b) + 28px);
  display: flex;
  flex-direction: column;
}

/* ---------- общие элементы ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.title { font-weight: 800; font-size: 28px; letter-spacing: -0.02em; margin: 0; }
.sub { color: var(--muted); font-size: 15px; margin: 2px 0 0; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--card); display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 1px 0 var(--rule);
}
.btn {
  display: block; width: 100%; border: 0; border-radius: var(--r);
  padding: 16px 18px; font-weight: 600; font-size: 18px; text-align: center;
}
.btn-main { background: var(--line); color: #fff; }
.btn-main:active { background: var(--line-2); }
.btn-ghost { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- вход ---------- */
.login { margin: auto 0; }
.login .title { font-size: 44px; }
.login input {
  width: 100%; padding: 16px; border-radius: var(--r); border: 1.5px solid var(--rule);
  background: var(--card); margin: 22px 0 12px; font-size: 18px;
}
.err { color: var(--stop); font-size: 15px; min-height: 22px; }

/* ---------- главная ---------- */
.streak {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--sun); color: #2A2200; font-weight: 800;
  padding: 8px 12px; border-radius: 999px; font-size: 15px;
}
.goal { background: var(--card); border-radius: var(--r-big); padding: 18px; margin-bottom: 14px; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.goal-num { font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--line); border-radius: 99px; transition: width .4s; }
.goal .btn { margin-top: 16px; }

/* Линия станций — главный элемент */
.map { background: var(--card); border-radius: var(--r-big); padding: 18px 18px 8px; margin-bottom: 14px; }
.map h2 { font-size: 17px; margin: 0 0 12px; font-weight: 800; }
.stations { list-style: none; margin: 0; padding: 0; position: relative; }
.stations::before {
  content: ""; position: absolute; left: 11px; top: 14px; bottom: 26px;
  width: 8px; background: var(--line); border-radius: 4px;
}
.st { position: relative; display: flex; align-items: center; gap: 14px; padding: 7px 0; min-height: 44px; }
.st-dot {
  position: relative; z-index: 1; flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 6px solid var(--line);
}
.st.empty .st-dot { border-color: var(--rule); }
.st.last .st-dot { border-color: var(--go); }
.st-name { flex: 1; font-weight: 600; }
.st-name small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.st-count { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 18px; }
.st.empty .st-count, .st.empty .st-name { color: var(--muted); }

.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: var(--card); border: 0; border-radius: var(--r-big); padding: 16px; text-align: left;
  min-height: 92px; display: flex; flex-direction: column; justify-content: space-between;
}
.tile b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 15px; }
.tile.warn b { color: var(--stop); }

/* ---------- игра ---------- */
.play-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
/* поезд по линии: станции = карточки раунда */
.train { flex: 1; display: flex; align-items: center; height: 44px; }
.train i { flex: 1; height: 6px; background: var(--rule); position: relative; }
.train i::after {
  content: ""; position: absolute; right: -5px; top: -4px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 3px solid var(--rule); z-index: 1;
}
.train i.done { background: var(--line); }
.train i.done::after { border-color: var(--line); }
.train i.miss::after { border-color: var(--stop); }
.train i.now::after { background: var(--sun); border-color: var(--line); width: 14px; height: 14px; top: -6px; right: -7px; }
.xp { font-weight: 800; color: var(--line); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

.card {
  background: var(--card); border-radius: var(--r-big); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.card.enter { animation: enter .22s ease-out; }
@keyframes enter { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.q-label { color: var(--muted); font-size: 15px; margin: 0; }
.q-word { font-weight: 800; font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; margin: 0; word-break: break-word; }
.q-ru { font-weight: 800; font-size: 28px; line-height: 1.2; margin: 0; }
.ipa { color: var(--muted); font-size: 17px; }
.sentence { font-size: 22px; line-height: 1.4; font-weight: 600; margin: 0; }
.gap { display: inline-block; min-width: 88px; border-bottom: 3px solid var(--line); margin: 0 2px; }

.pic {
  position: relative; border-radius: var(--r); overflow: hidden; background: var(--paper);
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic .credit {
  position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.7); text-decoration: none;
}
/* глаголы оживляем лёгким наездом камеры */
.pic.verb img { animation: kenburns 7s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.12) translate(-2%, -2%); } }

.say {
  border: 0; background: var(--paper); border-radius: 999px; padding: 8px 14px;
  font-weight: 600; font-size: 15px; display: inline-flex; gap: 6px; align-items: center;
}
.say-big {
  width: 120px; height: 120px; border-radius: 50%; border: 0; margin: 10px auto;
  background: var(--line); color: #fff; font-size: 44px; display: grid; place-items: center;
}

.opts { display: grid; gap: 10px; }
.opt {
  border: 0; border-radius: var(--r); background: var(--paper);
  padding: 15px 16px; text-align: left; font-weight: 600; font-size: 18px; min-height: 56px;
  transition: background .15s;
}
.opt:active { background: var(--rule); }
.opt.ok { background: var(--go); color: #fff; }
.opt.bad { background: var(--stop); color: #fff; }
.opts.pics { grid-template-columns: 1fr 1fr; }
.opt-pic { padding: 0; overflow: hidden; aspect-ratio: 1; position: relative; }
.opt-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opt-pic.ok, .opt-pic.bad { box-shadow: inset 0 0 0 6px var(--go); }
.opt-pic.bad { box-shadow: inset 0 0 0 6px var(--stop); }
.opt-pic.ok img, .opt-pic.bad img { opacity: .85; }

.type-in {
  width: 100%; padding: 16px; font-size: 22px; font-weight: 600; border-radius: var(--r);
  border: 2px solid var(--rule); background: #fff;
}
.type-in.ok { border-color: var(--go); background: var(--go-bg); }
.type-in.bad { border-color: var(--stop); background: var(--stop-bg); }

/* разбор после ответа */
.verdict { border-radius: var(--r); padding: 14px 16px; }
.verdict.ok { background: var(--go-bg); }
.verdict.bad { background: var(--stop-bg); }
.verdict h3 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.verdict p { margin: 4px 0 0; }
.trap { font-size: 15px; color: #6B3A00; }
.mnem { font-size: 15px; }
.mnem b { color: var(--line); }

/* знакомство с новым словом */
.intro-tag {
  align-self: flex-start; background: var(--sun); color: #2A2200; font-weight: 800;
  font-size: 13px; padding: 4px 10px; border-radius: 999px;
}

/* итог раунда */
.done-big { font-size: 56px; font-weight: 800; letter-spacing: -0.03em; margin: 0; color: var(--line); }
.miss-list { list-style: none; padding: 0; margin: 0; }
.miss-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.miss-list li:last-child { border-bottom: 0; }

/* ---------- список слов ---------- */
.search {
  width: 100%; padding: 14px 16px; border-radius: var(--r); border: 1.5px solid var(--rule);
  background: var(--card); margin-bottom: 12px; font-size: 17px;
}
.wlist { background: var(--card); border-radius: var(--r-big); padding: 4px 0; }
.wrow {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none;
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--paper);
}
.wrow:last-child { border-bottom: 0; }
.wrow .w { font-weight: 600; flex: 1; }
.wrow .t { color: var(--muted); font-size: 15px; flex: 1.2; text-align: right; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--rule); flex: none; }
.dot.b1, .dot.b2 { border-color: var(--line); }
.dot.b3, .dot.b4, .dot.b5 { border-color: var(--line); background: var(--line); }
.dot.b6, .dot.b7 { border-color: var(--go); background: var(--go); }
.dot.weak { border-color: var(--stop); }

/* окно слова */
.sheet-bg {
  position: fixed; inset: 0; background: rgba(16, 24, 58, .45); display: flex; align-items: flex-end;
  justify-content: center; z-index: 10;
}
.sheet-panel {
  background: var(--card); width: 100%; max-width: 560px; border-radius: var(--r-big) var(--r-big) 0 0;
  padding: 20px 18px calc(var(--safe-b) + 20px); max-height: 92vh; overflow: auto;
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.mini-line { display: flex; gap: 4px; align-items: center; margin: 4px 0; }
.mini-line i { flex: 1; height: 6px; border-radius: 3px; background: var(--rule); }
.mini-line i.on { background: var(--line); }
.mini-line i.on.know { background: var(--go); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- статистика ---------- */
.chart { background: var(--card); border-radius: var(--r-big); padding: 18px; margin-bottom: 14px; }
.chart h2, .panel h2 { font-size: 17px; margin: 0 0 14px; font-weight: 800; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars b { display: block; background: var(--line); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars b.goal-ok { background: var(--go); }
.bars span { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; }
.panel { background: var(--card); border-radius: var(--r-big); padding: 18px; margin-bottom: 14px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 20px); transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 20;
}
#toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- разделы по частям речи ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 14px; padding: 2px 18px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; border-radius: 999px; padding: 9px 14px; background: var(--card);
  font-weight: 600; font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--rule);
}
.chip span { color: var(--muted); font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--line); color: #fff; box-shadow: none; }
.chip.on span { color: rgba(255, 255, 255, .75); }

/* ---------- пиктограммы местоимений ---------- */
.pic.picto { background: #F6F8FC; }
.picto svg { width: 100%; height: 100%; display: block; }
.opt-pic.picto { background: #F6F8FC; }
