/* ============================================================
   Szókincs — design tokens (extracted from Claude Design mockup)
   ============================================================ */
:root {
  /* wine — primary accent */
  --wine: #7A2E3A;
  --wine-deep: #6A2733;
  --wine-tint: #F3E8E9;
  --wine-line: #D8AEB2;

  /* ink — text */
  --ink: #1B1714;
  --ink-soft: #3A3530;

  /* paper / surfaces */
  --bg: #F8F5F0;
  --bg-warm: #F8F0EF;
  --card: #FFFFFF;

  /* hairlines */
  --line: #E7E0D6;
  --line-card: #E2DACE;
  --line-soft: #F0EAE0;
  --chevron: #C9BFB2;

  /* muted text scale */
  --muted: #8A817A;
  --muted-2: #6B635C;
  --muted-3: #9A918A;
  --muted-4: #A89F95;

  /* gold — suffixes */
  --gold: #B7822E;
  --gold-deep: #8A5E18;
  --gold-line: #E5CF9E;
  --gold-bg: #F6EEDD;

  /* success — бейдж доверия «выверено» */
  --success-bg: #EAF4EE;
  --success-line: #B9D9C5;
  --success-text: #2D6E4E;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --r-card: 16px;
  --r-block: 9px;
  --r-pill: 42px;
  --nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--wine);
  font-family: var(--sans);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--sans);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2.5px solid var(--wine);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- phone frame (desktop) / full-bleed (mobile) ---------- */
.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 480px) {
  body { display: flex; align-items: center; justify-content: center; padding: 24px; }
  .phone {
    height: min(880px, 94dvh);
    border-radius: 30px;
    box-shadow: 0 24px 70px rgba(0,0,0,.4);
  }
}

.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 22px 20px calc(var(--nav-h) + 26px);
}
.screen::-webkit-scrollbar { width: 0; }
.screen.no-nav { padding-bottom: 26px; }

/* ---------- bottom nav ---------- */
.nav {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  display: flex;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav.hidden { display: none; }
.nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  position: relative;
}
.nav button.active { color: var(--wine); }
.nav button.active .ico { transform: translateY(-1px); }
.nav .ico { display: block; transition: transform .15s; }
.nav .badge {
  position: absolute;
  top: 7px; left: 50%;
  transform: translateX(9px);
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--wine);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ---------- headers ---------- */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wine);
}
.h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.sub { font-size: 14px; color: var(--muted-2); line-height: 1.5; }
.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-3);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-deep); }
.btn-primary:disabled { background: #D7CDBF; color: #fff; cursor: default; transform: none; }
.btn-ghost {
  background: var(--card);
  color: var(--wine);
  border: 1px solid var(--line-card);
}
.btn-ghost:hover { background: var(--bg-warm); }
.btn-text {
  height: auto;
  width: auto;
  background: none;
  color: var(--wine);
  font-weight: 600;
  font-size: 14px;
}

/* speaker button */
.spk {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line-card);
  background: var(--card);
  color: var(--wine);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .08s;
}
.spk:hover { background: var(--bg-warm); }
.spk:active { transform: scale(.92); }
.spk.playing { background: var(--wine); color: #fff; border-color: var(--wine); }
.spk.sm { width: 34px; height: 34px; border-radius: 9px; }

/* ---------- input ---------- */
.input-wrap {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-card);
  padding: 16px;
  transition: border-color .15s;
}
.input-wrap:focus-within { border-color: var(--wine-line); }
textarea {
  width: 100%;
  min-height: 168px;
  border: none;
  outline: none;
  resize: none;
  background: none;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
}
textarea::placeholder { color: var(--muted-4); }
.input-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted-3);
}

/* ---------- generic card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px;
}

/* ---------- word / morpheme breakdown (signature, variant A) ---------- */
.word-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.word-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.word-form {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  color: var(--wine);
  line-height: 1.05;
}
.word-gloss { font-size: 14px; color: var(--muted-2); margin-top: 3px; }

.morphs {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--mono);
}
.morph { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.morph .seg {
  border-radius: var(--r-block);
  padding: 8px 12px;
  font-size: 18px;
  line-height: 1;
}
.morph .lbl {
  font-family: var(--sans);
  font-size: 10px;
  text-align: center;
}
.morph.stem .seg {
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 500;
  color: var(--ink);
}
.morph.stem .lbl { color: var(--muted-3); }
.morph.suffix .seg {
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
  font-weight: 700;
  color: var(--gold-deep);
}
.morph.suffix .lbl { color: var(--gold); font-weight: 600; }
.morph-plus { font-size: 17px; color: var(--chevron); padding-bottom: 23px; }

.rule { font-size: 12.5px; line-height: 1.5; color: var(--muted-2); }
.rule .pick { color: var(--gold-deep); font-weight: 600; }
.rule .alt { color: var(--muted-4); }

.example {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.example .hu { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.example .hu b { color: var(--wine); font-weight: 600; }
.example .ru { font-size: 12px; color: var(--muted-3); }

.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.disclaimer {
  font-size: 10.5px;
  color: var(--muted-4);
  line-height: 1.35;
  max-width: 190px;
}
.add-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--wine);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, transform .08s;
}
.add-btn:hover { background: var(--wine-deep); }
.add-btn:active { transform: scale(.96); }
.add-btn.done {
  background: var(--gold-bg);
  color: var(--gold-deep);
  border: 1px solid var(--gold-line);
}

/* ---------- loading ---------- */
.loading {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  text-align: center;
  min-height: 60dvh;
}
.assemble {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
}
.assemble .pc {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 26px;
  line-height: 1;
}
.assemble .pc.stem {
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-weight: 500;
  animation: szoLeft 2.1s ease-in-out infinite;
}
.assemble .pc.suf {
  background: var(--gold-bg); border: 1px solid var(--gold-line);
  color: var(--gold-deep); font-weight: 700;
  animation: szoRight 2.1s ease-in-out infinite;
}
.loading .ttl { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); }
.loading .txt { font-size: 14px; color: var(--muted-2); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: szoDots 1.4s infinite; }
.dots i:nth-child(2){ animation-delay: .2s; }
.dots i:nth-child(3){ animation-delay: .4s; }

@keyframes szoLeft  {0%{transform:translateX(-34px);opacity:0}22%{transform:translateX(0);opacity:1}72%{transform:translateX(0);opacity:1}100%{transform:translateX(-34px);opacity:0}}
@keyframes szoRight {0%{transform:translateX(34px);opacity:0}22%{transform:translateX(0);opacity:1}72%{transform:translateX(0);opacity:1}100%{transform:translateX(34px);opacity:0}}
@keyframes szoFade  {0%,100%{opacity:.35}45%,65%{opacity:1}}
@keyframes szoDots  {0%,80%,100%{opacity:.25}40%{opacity:1}}

/* ---------- empty / done states ---------- */
.center-state {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center;
  min-height: 64dvh;
  padding: 0 12px;
}
.center-state .emblem {
  width: 92px; height: 92px;
  border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
}
.center-state .ttl { font-family: var(--serif); font-size: 23px; font-weight: 600; color: var(--ink); }
.center-state .txt { font-size: 14px; color: var(--muted-2); line-height: 1.5; max-width: 280px; }

/* ---------- deck / collection rows ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  width: 100%;
  text-align: left;
  transition: border-color .15s, transform .08s;
}
.row:hover { border-color: var(--line-card); }
.row:active { transform: scale(.99); }
.row .avatar {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.row .avatar.wine { background: var(--wine-tint); color: var(--wine); }
.row .avatar.gold { background: var(--gold-bg); color: var(--gold-deep); }
.row .avatar.letter { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.row .meta { flex: 1; min-width: 0; }
.row .meta .nm { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.row .meta .dt { font-size: 12px; color: var(--muted-3); margin-top: 2px; }
.row .count {
  flex: none;
  min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 8px;
  background: var(--wine);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.row .count.muted { background: var(--bg-warm); color: var(--muted-3); }

/* ---------- review session ---------- */
.review {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100%;
}
.review-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.review-top .close {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 20px;
  border: 1px solid var(--line);
  background: var(--card);
}
.progress-pill {
  font-size: 13px; font-weight: 600; color: var(--muted-2);
  font-family: var(--mono);
}
.flashcard {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center;
  padding: 18px 4px;
}
.flashcard .big {
  font-family: var(--serif);
  font-size: 44px; font-weight: 600; color: var(--wine);
  line-height: 1.05;
}
.flashcard .hint { font-size: 13px; color: var(--muted-3); }
.flashcard .gloss-big { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); }

.grade {
  display: flex; gap: 8px;
  padding-top: 8px;
}
.grade button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 6px;
  border-radius: 14px;
  border: 1px solid var(--line-card);
  background: var(--card);
  transition: transform .08s, border-color .15s, background .15s;
}
.grade button:active { transform: scale(.96); }
.grade button .g-nm { font-size: 14px; font-weight: 600; color: var(--ink); }
.grade button .g-sub { font-size: 11px; color: var(--muted-3); }
.grade button.again:hover { border-color: var(--wine-line); background: var(--wine-tint); }
.grade button.good:hover  { border-color: var(--line-card); background: var(--bg-warm); }
.grade button.easy:hover  { border-color: var(--gold-line); background: var(--gold-bg); }

/* compact morpheme strip on review back */
.morphs.compact .seg { font-size: 16px; padding: 7px 11px; }

.stack { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.gap-14 { gap: 14px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

.fade-in { animation: fadeIn .26s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- quiet harmony link (вход в статью) ---------- */
.harmony-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  font-size: 12.5px;
  color: var(--muted-2);
}
.hl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600;
  color: var(--wine);
}
.hl-btn:hover { color: var(--wine-deep); }

/* ---------- topic grid (подборки) ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.topic-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  text-align: left;
  transition: border-color .15s, transform .08s;
}
.topic-card:hover { border-color: var(--line-card); }
.topic-card:active { transform: scale(.98); }
.avatar.sm { width: 38px; height: 38px; border-radius: 11px; }
.topic-card .nm { font-size: 14px; font-weight: 600; color: var(--ink); }
.topic-card .dt { font-size: 11.5px; color: var(--muted-3); margin-top: 2px; }

/* ---------- deck overview: decorative card stack + big number ---------- */
.card-stack { position: relative; width: 132px; height: 96px; margin: 0 auto; }
.card-stack .cs-layer, .card-stack .cs-top {
  position: absolute; left: 50%; border-radius: 14px;
}
.cs-top {
  top: 0; transform: translateX(-50%);
  width: 132px; height: 84px;
  background: var(--card); border: 1px solid var(--line-card);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--wine);
  box-shadow: 0 6px 18px rgba(27,23,20,.07);
}
.cs-layer.cs-2 { top: 7px; width: 116px; height: 84px; transform: translateX(-50%); background: #F3E8E9; border: 1px solid var(--line); z-index: -1; }
.cs-layer.cs-3 { top: 13px; width: 100px; height: 84px; transform: translateX(-50%); background: #EFE7DB; border: 1px solid var(--line); z-index: -2; }
.big-num {
  font-family: var(--serif); font-size: 68px; font-weight: 600;
  color: var(--wine); line-height: 1;
}

/* ---------- review progress bar ---------- */
.progress-track {
  height: 3px; border-radius: 2px;
  background: var(--line-soft);
  margin: 2px 0 6px;
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--wine); border-radius: 2px; transition: width .3s; }

/* ---------- grammar article ---------- */
.article {
  display: flex; flex-direction: column; gap: 18px;
  padding-bottom: 16px;
}
.article-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--wine);
}
.article-head { display: flex; flex-direction: column; gap: 10px; }
.article-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.article-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.trust-badge {
  display: inline-flex; align-items: center;
  background: var(--success-bg); border: 1px solid var(--success-line);
  color: var(--success-text);
  border-radius: 20px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
}
.article-sub { font-size: 13px; color: var(--muted-2); }
.mono-gold { font-family: var(--mono); color: var(--gold-deep); font-weight: 700; }
.mono-faint { font-family: var(--mono); color: var(--muted-4); }
.article-lead { font-size: 13.5px; line-height: 1.65; color: var(--ink-soft); }
.article-section { display: flex; flex-direction: column; gap: 10px; }
.sec-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.vowel-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vowel-cap { font-size: 12px; font-weight: 600; color: var(--muted-2); margin-bottom: 7px; }
.vowels { display: flex; flex-wrap: wrap; gap: 5px; }
.vchip {
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  padding: 4px 8px; border-radius: 7px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
}
.vchip.front { background: var(--gold-bg); border-color: var(--gold-line); color: var(--gold-deep); }
.hex-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hex-col {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px;
  display: flex; flex-direction: column; gap: 7px;
}
.hex-head { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.hex-kind { font-family: var(--sans); font-size: 11px; font-weight: 500; color: var(--muted-3); }
.hex-row { font-family: var(--mono); font-size: 14px; }
.hex-stem { color: var(--ink); }
.hex-sfx { color: var(--gold-deep); font-weight: 700; }
.sidenote { font-size: 13px; line-height: 1.6; color: var(--muted-2); padding-left: 13px; border-left: 3px solid var(--gold); }
.sidenote.caution { border-left-color: var(--wine); }
.closing-plaque {
  background: var(--wine); border-radius: 14px; padding: 14px 16px;
  font-size: 13px; line-height: 1.55; color: #F2E2E2;
}
.cp-stem { color: #F8F0EF; font-weight: 600; }
.cp-right { color: var(--gold-line); font-weight: 700; font-family: var(--mono); }
.cp-wrong { color: #C99FAA; font-family: var(--mono); }

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