:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #15171C;
  --muted: #6B7080;
  --faint: #A3A7B3;
  --line: #E4E6EB;
  --der: #2F6BDB;
  --die: #D6404B;
  --das: #279257;
  --again: #D6404B;
  --hard: #C7790E;
  --good: #279257;
  --easy: #2F6BDB;
  --vika: #E8664A;
  --julia: #3D8C8C;
  --note-bg: #FFF6D9;
  --note-line: #F0DFA8;
  --note-ink: #9A7410;
  --ui: "Inter", system-ui, -apple-system, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --user: var(--ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
h1, h2, h3, p { margin: 0; }

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 16px) 20px calc(env(safe-area-inset-bottom) + 28px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.i { width: 20px; height: 20px; flex: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.art { font-family: var(--serif); font-style: italic; font-weight: 400; }
.art-der { color: var(--der); }
.art-die { color: var(--die); }
.art-das { color: var(--das); }
.lemma { font-family: var(--serif); font-weight: 500; }

/* ---------- buttons */

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin: -6px;
  border: none; background: none; border-radius: 10px; color: var(--ink);
}
.icon-btn .i { width: 22px; height: 22px; }
.icon-btn.faint { color: var(--faint); }
.icon-btn.faint .i { width: 19px; height: 19px; }
.icon-btn.danger { color: var(--die); }

.btn-primary, .btn-outline, .btn-ghost, .btn-soft {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 18px; border-radius: 14px;
  font-size: 16px; font-weight: 600; border: 1px solid transparent;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line); font-weight: 500; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn-soft { height: 38px; padding: 0 12px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; }
.btn-soft:disabled { background: var(--bg); color: var(--muted); opacity: 1; }
.btn-soft .i, .btn-outline.small .i { width: 16px; height: 16px; }
.btn-outline.small { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.wide { width: 100%; }

/* ---------- main screen */

.heading { padding-top: 8px; }
.app-title { font-family: var(--serif); font-size: 38px; font-weight: 600; letter-spacing: -0.02em; }

.users { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  object-fit: cover; background: #FEF9ED;
  box-shadow: 0 0 0 1px var(--line);
}
.user-text { flex: 1; min-width: 0; }
.user-name { font-size: 17px; font-weight: 600; }
.user-due { font-size: 13px; font-weight: 500; color: var(--user); white-space: nowrap; }
.btn-square {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
}
.btn-square .i { width: 18px; height: 18px; }
.btn-user {
  height: 44px; padding: 0 16px; border-radius: 12px; flex: none;
  background: var(--user); color: #fff; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.btn-user .i { width: 14px; height: 14px; }

.add-box {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 14px 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.add-box textarea {
  border: none; outline: none; resize: none; background: none;
  font: 17px/1.45 var(--serif); color: var(--ink); padding: 0;
  field-sizing: content; min-height: 3lh;
}
.add-box textarea::placeholder { color: var(--faint); font-family: var(--ui); font-size: 16px; }
.add-box-footer { display: flex; justify-content: flex-end; }

.words { display: flex; flex-direction: column; gap: 10px; }
.list-header h2 { font-size: 20px; font-weight: 600; }
.list-header .count { color: var(--faint); font-weight: 400; }
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--faint);
}
.search .i { width: 17px; height: 17px; }
.search input { flex: 1; border: none; outline: none; background: none; font: inherit; font-size: 15px; color: var(--ink); }
.word-list { display: flex; flex-direction: column; }
.word-row { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.word-line { font-size: 19px; }
.tr-line { display: flex; gap: 8px; align-items: baseline; }
.tr-line .en { color: var(--muted); font-size: 14px; }
.tr-line .ru { color: var(--faint); font-size: 13px; }
.empty { color: var(--faint); padding: 16px 0; }

/* ---------- navigation */

.nav { display: flex; align-items: center; gap: 14px; min-height: 36px; padding: 0 4px; }
.nav-title { flex: 1; font-size: 17px; font-weight: 600; }

/* ---------- cards */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 28px;
}
.answer-body { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.head { display: flex; flex-direction: column; gap: 8px; }
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.word-big { font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; }
.word-big .art { font-size: 24px; }
.pron { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.speak {
  width: 28px; height: 28px; border-radius: 50%; border: none; flex: none;
  background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.speak .i { width: 14px; height: 14px; }
.forms { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.forms .key { color: var(--faint); font-size: 13px; }

.section { border-top: 1px solid var(--line); padding-top: 14px; }
.translations { display: flex; flex-direction: column; gap: 6px; }
.tr { display: flex; align-items: center; gap: 12px; }
.tr-en { font-size: 22px; font-weight: 500; }
.tr-ru { font-size: 16px; color: var(--muted); }
.tag {
  width: 30px; flex: none; padding: 3px 0; border-radius: 6px; text-align: center;
  background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.3;
}
.tag-plain { background: none; color: var(--faint); }
.tag-outline { background: none; border: 1px solid var(--line); }
.examples { display: flex; flex-direction: column; gap: 10px; }
.example { display: flex; gap: 12px; align-items: flex-start; }
.example .tag { margin-top: 2px; }
.example-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.example .de { font-family: var(--serif); font-size: 17px; line-height: 1.3; }
.example .ex-tr { font-size: 13px; color: var(--muted); }
.synonyms { display: flex; gap: 12px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 11px; border-radius: 99px; background: var(--bg); font-family: var(--serif); font-size: 16px; }
.comment { padding: 12px 14px; border-radius: 14px; background: var(--note-bg); display: flex; flex-direction: column; gap: 6px; }
.comment-label { font-size: 12px; font-weight: 600; color: var(--note-ink); }
.comment-body { font-size: 14px; line-height: 1.35; white-space: pre-wrap; }

/* ---------- edit form */

.edit-form { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.field-row { display: flex; gap: 10px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-article { flex: 0 0 96px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field em { font-style: normal; font-weight: 400; color: var(--faint); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  outline: none; resize: vertical;
}
.field textarea { field-sizing: content; min-height: 2lh; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink); }
.field textarea + input { margin-top: 4px; font-size: 14px; color: var(--muted); }
.edit-form > .btn-outline { height: 44px; font-size: 15px; margin-top: 4px; }
.edit-form > .btn-outline .i { width: 17px; height: 17px; }
.edit-actions { display: flex; gap: 8px; }
.edit-actions button { flex: 1; height: 48px; }

/* ---------- review */

.screen-review { gap: 0; }
.review { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.review-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; min-height: 36px; }
.progress-label { font-weight: 600; }
.mode-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.mode-chip .i { width: 12px; height: 12px; }
.mode-chip.free { background: var(--ink); border-color: var(--ink); color: #fff; }
.progress { height: 4px; border-radius: 2px; background: var(--line); margin: -4px 4px 0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--user); border-radius: 2px; transition: width .3s; }

.card-question {
  flex: 1; min-height: 420px; position: relative; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 28px; text-align: center; user-select: none;
}
.word-huge { font-size: 40px; line-height: 1.15; letter-spacing: -0.01em; }
.word-huge .art { font-size: 30px; }
.pron.pill { padding: 8px 16px 8px 10px; border-radius: 99px; background: var(--bg); font-size: 16px; }
.pron.pill .speak { width: 32px; height: 32px; }
.pron.pill .speak .i { width: 16px; height: 16px; }
.due-hint { position: absolute; top: 22px; left: 0; right: 0; text-align: center; font-size: 13px; color: var(--faint); }
.hint { text-align: center; color: var(--muted); font-size: 14px; padding: 8px 0 4px; }

.card-answer { overflow: hidden; }
.screen-review .card-answer { flex: 1; }
.ratings { display: flex; gap: 8px; position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); }
.rate {
  flex: 1; height: 62px; border: none; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.rate-label { font-size: 15px; font-weight: 600; }
.rate-int { font-size: 12px; color: var(--muted); }
.rate-again { background: #FBE7E8; } .rate-again .rate-label { color: var(--again); }
.rate-hard { background: #F8EEDD; } .rate-hard .rate-label { color: var(--hard); }
.rate-good { background: #E3F1E8; } .rate-good .rate-label { color: var(--good); }
.rate-easy { background: #E4ECFA; } .rate-easy .rate-label { color: var(--easy); }

.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 0; text-align: center; }
.done-check { width: 72px; height: 72px; border-radius: 50%; background: #E3F1E8; color: var(--good); display: flex; align-items: center; justify-content: center; }
.done-check .i { width: 34px; height: 34px; }
.done h2 { font-family: var(--serif); font-size: 34px; font-weight: 500; }
.muted { color: var(--muted); }
.stats { display: flex; gap: 22px; padding-top: 6px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat b { font: 500 26px var(--serif); }
.stat span { font-size: 12px; color: var(--muted); }
.stat.again b { color: var(--again); } .stat.hard b { color: var(--hard); }
.stat.good b { color: var(--good); } .stat.easy b { color: var(--easy); }
.offer { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.offer h3 { font-size: 17px; font-weight: 600; }
.offer p { font-size: 14px; color: var(--muted); }
.offer .i { width: 18px; height: 18px; }

/* ---------- adding words */

.results { display: flex; flex-direction: column; gap: 8px; }
.results:empty { display: none; }
.item {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.item.edit-form { padding: 18px 16px; gap: 12px; }
.item-head { display: flex; align-items: center; gap: 14px; }
.item-word { flex: 1; min-width: 0; font-size: 19px; }
.item-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.item-status .i { width: 15px; height: 15px; }
.item-tr { display: flex; gap: 8px; align-items: baseline; }
.item-tr .en { font-size: 16px; font-weight: 500; }
.item-tr .ru { font-size: 14px; color: var(--muted); }
.item-note { font-size: 13px; color: var(--note-ink); }
.item-error { font-size: 14px; color: var(--die); }
.skeleton { display: flex; gap: 8px; }
.skeleton i { display: block; height: 12px; width: 96px; border-radius: 6px; background: var(--bg); }
.skeleton i + i { width: 72px; }
.item-duplicate { background: var(--note-bg); border-color: var(--note-line); }
.badge-dup { padding: 4px 10px; border-radius: 99px; background: #fff; color: var(--note-ink); font-size: 12px; font-weight: 500; }
.item-dup-note { font-size: 13px; color: var(--note-ink); }
.item-more { display: flex; flex-direction: column; }
.item-more summary { font-size: 13px; color: var(--muted); cursor: pointer; padding: 2px 0; }
.item-more[open] { gap: 10px; }
.item-more[open] > * + * { margin-top: 10px; }
.item-more .example .de { font-size: 15px; }
.add-commit { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); margin-top: auto; }
.add-commit .i { width: 18px; height: 18px; }
