/* Компоненты */

/* Словесный знак: маркер на слове «коллег» */
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand b {
  font-weight: inherit;
  padding: 0 0.14em;
  background: var(--marker);
  color: var(--marker-ink);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 46px;
  padding: 0 var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: var(--fs-md);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out),
    transform 0.12s var(--ease-out);
}
.btn:active:not([disabled]) { transform: scale(0.97); }
.btn-primary { background: var(--solid); color: var(--solid-ink); }
.btn-primary:hover { background: var(--solid-hover); color: var(--solid-ink); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); text-decoration: underline; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* Формы */
.form { display: grid; gap: var(--sp-5); }
.field { display: grid; gap: var(--sp-2); }
.field label { font-weight: 500; font-size: var(--fs-sm); }
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.input, .select {
  width: 100%;
  min-height: 46px;
  padding: 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s var(--ease-out);
}
.input:hover, .select:hover { border-color: var(--text-muted); }
.input:focus-visible, .select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -1px;
  border-color: var(--focus);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { font-size: var(--fs-xs); color: var(--danger); }
.field-error:empty { display: none; }
.form-error {
  padding: var(--sp-3) var(--sp-4);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}

/* Карточка: поверхность с мягкой тенью */
.card {
  padding: var(--sp-5);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-4);
}

/* Каркас приложения */
.app-shell { min-height: 100dvh; }
.app-main {
  width: 100%;
  max-width: var(--content-w);
  padding: var(--sp-6) var(--gutter) calc(var(--nav-h) + var(--sp-7) + env(safe-area-inset-bottom, 0px));
}
.app-main:focus { outline: none; }
.page-title { font-family: var(--font-display); margin-bottom: var(--sp-4); }
.page-stack { display: grid; gap: var(--sp-6); }

/* Навигация: на мобиле пять пунктов снизу, иконка над подписью */
.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-brand { display: none; }
.nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list li { flex: 1 1 0; min-width: 0; }
.nav-list .nav-item-secondary { display: none; }
.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-h);
  min-width: 44px;
  padding: var(--sp-1);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  transition: transform 0.12s var(--ease-out);
}
.nav-link:hover { color: var(--text); }
.nav-link:active { transform: scale(0.97); }
.nav-icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 1.75rem;
  border-radius: 999px;
}
.nav-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-link[aria-current="page"] { color: var(--text); }
.nav-link[aria-current="page"] .nav-icon { background: var(--marker); color: var(--marker-ink); }

/* Левая колонка на широких экранах */
@media (min-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
  }
  .nav {
    position: sticky;
    inset: 0 auto auto auto;
    height: 100dvh;
    align-self: start;
    border-top: 0;
    border-inline-end: 1px solid var(--line);
    padding: var(--sp-6) var(--sp-4);
  }
  .nav-brand {
    display: inline-block;
    margin: 0 0 var(--sp-7) var(--sp-3);
  }
  .nav-list { display: grid; gap: var(--sp-1); }
  .nav-list .nav-item-secondary { display: block; }
  .nav-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--sp-3);
    min-height: 44px;
    padding: 0 var(--sp-3);
    border-radius: var(--radius);
    font-size: var(--fs-md);
  }
  .nav-icon { width: auto; height: auto; border-radius: 0; }
  .nav-link[aria-current="page"] { background: var(--marker); color: var(--marker-ink); }
  .nav-link[aria-current="page"] .nav-icon { background: none; }
  .app-main { padding: var(--sp-8); max-width: calc(56rem + 2 * var(--sp-8)); }
  .only-mobile { display: none; }
}

/* Вход и регистрация: форма слева, тёмная панель справа */
.auth-layout {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  padding: var(--sp-6) var(--gutter);
}
.auth-card { width: 100%; max-width: 24rem; display: grid; gap: var(--sp-6); justify-self: center; }
.auth-card h1 { font-family: var(--font-display); }
.auth-brand { justify-self: start; }
.auth-alt { font-size: var(--fs-sm); color: var(--text-muted); }
.auth-alt a { color: var(--text); }
.auth-aside { display: none; }
@media (min-width: 900px) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: stretch;
    align-items: center;
    padding: 0;
  }
  .auth-card { padding: var(--sp-6) var(--gutter); }
  .auth-aside {
    display: grid;
    align-content: center;
    gap: var(--sp-7);
    align-self: stretch;
    margin: var(--sp-4);
    padding: var(--sp-8) clamp(2rem, 5vw, 5rem);
    background: var(--ink-fixed);
    color: var(--on-ink);
    border-radius: 24px;
  }
  .auth-aside-terms { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-5); }
  .auth-aside-terms li {
    display: grid;
    gap: var(--sp-1);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid oklch(1 0 0 / 0.12);
  }
  .auth-aside-terms li:last-child { border-bottom: 0; padding-bottom: 0; }
  .auth-aside-word {
    font-family: var(--font-display);
    font-size: clamp(2rem, 1.2rem + 2vw, 3.25rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }
  .auth-aside-mean { color: var(--marker-fixed); font-size: var(--fs-lg); }
  .auth-aside-line {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 500;
    color: var(--on-ink-soft);
    max-width: 22rem;
  }
}

/* Всплывающие сообщения */
.toast-region {
  position: fixed;
  z-index: 50;
  inset-inline: var(--sp-4);
  bottom: calc(var(--nav-h) + var(--sp-4) + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 28rem;
  padding: var(--sp-3) var(--sp-4);
  background: var(--solid);
  color: var(--solid-ink);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}
.toast-error { background: var(--danger); color: var(--solid-ink); }
.toast-success { background: var(--success); color: var(--solid-ink); }
@media (min-width: 900px) {
  .toast-region { bottom: var(--sp-5); }
}

/* Пустое состояние: карточка, текст слева, без иконки */
.empty-state {
  display: grid;
  justify-items: start;
  gap: var(--sp-3);
  padding: var(--sp-5);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.empty-state-text { color: var(--text-muted); max-width: 34rem; }
.empty-state .btn { margin-top: var(--sp-2); }
.first-run-lead { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-3); }
.first-run-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); color: var(--text-muted); }
.first-run-list li { padding-inline-start: var(--sp-4); position: relative; }
.first-run-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--marker);
}

/* Строки «ключ — значение» */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-5); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.link-list { display: grid; gap: var(--sp-2); }

.nowrap { white-space: nowrap; }

/* Регистрация: согласие, пароль */
.consent { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-sm); line-height: 1.4; cursor: pointer; }
.consent .checkbox { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--solid); }
.auth-note { font-size: var(--fs-sm); color: var(--text-muted); }
.password-box { position: relative; }
.password-box .input { padding-inline-end: 9.5rem; }
.password-toggle { position: absolute; inset: 0 0 0 auto; padding: 0 var(--sp-3); border: 0; background: none; color: var(--text-muted); font-size: var(--fs-xs); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.password-toggle:hover { color: var(--text); }

/* Общие заготовки для экранов с формами */
.stack { display: grid; gap: var(--sp-5); }
.stack-sm { display: grid; gap: var(--sp-3); }
.two-col { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.muted { color: var(--text-muted); }
.plain-list { display: grid; gap: var(--sp-2); }
.bare-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { font-weight: 500; font-size: var(--fs-sm); }
.page-hint { font-size: var(--fs-sm); }
.page-lead { color: var(--text-muted); max-width: 34rem; }
.textarea {
  width: 100%;
  min-height: 7rem;
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
  line-height: 1.5;
  transition: border-color 0.15s var(--ease-out);
}
.textarea:hover { border-color: var(--text-muted); }
.textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
.textarea[aria-invalid="true"] { border-color: var(--danger); }
.btn-small { min-height: 44px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.inline-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }

/* Метки */
.tag {
  display: inline-block;
  padding: 0 var(--sp-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-muted);
  white-space: nowrap;
}
.tag-marker { background: var(--marker); color: var(--marker-ink); border-color: transparent; }
.tag-lang { margin-inline-start: var(--sp-3); vertical-align: middle; font-family: var(--font-sans); letter-spacing: 0; }
.tag-urgency { color: var(--text); border-color: var(--line-strong); }
.tag-urgency[data-urgency="high"] { background: var(--marker); color: var(--marker-ink); border-color: transparent; }
.tag-urgency[data-urgency="low"] { border-color: var(--line); color: var(--text-muted); }

/* Прогресс долгих запросов */
.progress-card {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  padding: var(--sp-5);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
.progress-text { font-weight: 500; }
.progress-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.spinner {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 3px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Выбор языков */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), transform 0.12s var(--ease-out);
}
.chip:hover { background: var(--surface-2); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--marker); color: var(--marker-ink); border-color: var(--marker); font-weight: 500; }
.chip-native { color: var(--text-muted); font-size: var(--fs-sm); }
.chip[aria-pressed="true"] .chip-native { color: inherit; }
.chip[hidden] { display: none; }

/* Загрузка файлов */
.dropzone {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-5);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out);
}
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { background: var(--surface-2); }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone.is-disabled { opacity: 0.55; cursor: not-allowed; }
.dropzone-title { font-weight: 500; }
.dropzone-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.uploader { display: grid; gap: var(--sp-3); }
.upload-list { display: grid; gap: var(--sp-2); }
.upload-list:empty { display: none; }
.upload-item { padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-radius: var(--radius); display: grid; gap: var(--sp-2); }
.upload-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.upload-name { font-weight: 500; overflow-wrap: anywhere; }
.upload-state { font-size: var(--fs-xs); color: var(--text-muted); }
.upload-actions { margin-inline-start: auto; display: flex; gap: var(--sp-2); }
.source-info { display: grid; gap: var(--sp-1); font-size: var(--fs-sm); }
.source-lang { font-weight: 500; }
.source-text { color: var(--text-muted); overflow-wrap: anywhere; white-space: pre-wrap; }

/* Голосовая запись */
.recorder { display: grid; gap: var(--sp-2); justify-items: start; }
.rec-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 500; }

/* Согласие */
.consent-gate { display: grid; gap: var(--sp-4); justify-items: start; max-width: 36rem; }

/* Мастер онбординга */
.wizard-card { display: grid; gap: var(--sp-5); }
.step-ind { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.wizard-card .card-title { margin-bottom: 0; }
.wizard-lead { color: var(--text-muted); max-width: 34rem; }
.wizard-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.wizard-error:empty { display: none; }
.level-group { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4) var(--sp-4); min-width: 0; }
.level-group legend { padding: 0 var(--sp-2); font-weight: 500; }
.level-options { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }
.level-option { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 40px; cursor: pointer; }
.level-option input { width: 20px; height: 20px; accent-color: var(--solid); }
.situation-list { display: grid; gap: var(--sp-3); }
.situation-item { display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-radius: var(--radius); }
.situation-item:has(.situation-text) { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.situation-actions { display: flex; gap: var(--sp-1); }
.suggest { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-radius: var(--radius); }
.gaps ul { margin: var(--sp-2) 0 0; padding-inline-start: var(--sp-5); color: var(--text-muted); }

/* Иностранный текст */
.ft ruby rt { font-size: 0.55em; color: var(--text-muted); }
.ft-reading { margin-inline-start: var(--sp-2); font-size: 0.85em; color: var(--text-muted); }
.ft-block { display: grid; gap: var(--sp-3); }
.ft-message { font-size: var(--fs-xl); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.ft-word {
  padding: 0 0.1em;
  margin: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: var(--text-muted);
  text-underline-offset: 0.25em;
}
.ft-word:hover { background: var(--surface-2); }
.ft-word.ft-term { background: var(--marker); color: var(--marker-ink); text-decoration: none; }
.ft-word[aria-expanded="true"] { outline: 2px solid var(--focus); outline-offset: 1px; }
.ft-detail { padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-radius: var(--radius); display: grid; gap: var(--sp-1); }
.ft-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--fs-lg); font-weight: 500; }
.ft-detail-tr { font-weight: 500; }
.ft-detail-meta { font-size: var(--fs-sm); color: var(--text-muted); }

/* Результат перевода */
.result-card { display: grid; gap: var(--sp-4); }
.result-card .card-title { margin-bottom: 0; }
.translation-big { font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.3; letter-spacing: -0.01em; }
.tone { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.reply { display: grid; gap: var(--sp-2); justify-items: start; padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.reply:first-child, .result-card > .card-title + .reply { padding-top: 0; border-top: 0; }
.reply-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 500; }
.reply-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-lg); }
.check-list { display: grid; gap: var(--sp-1); }
.check-row { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-2) 0; min-height: 44px; cursor: pointer; }
.check-row .checkbox { flex: none; width: 20px; height: 20px; margin-top: 3px; accent-color: var(--solid); }
.check-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); }
.check-word { font-weight: 500; font-size: var(--fs-lg); }
.check-tr { color: var(--text-muted); }

/* Словарь */
.vocab-list { display: grid; }
.vocab-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.vocab-row:first-child { border-top: 0; }
.vocab-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-4); min-width: 0; }
.vocab-word { font-size: var(--fs-lg); font-weight: 500; }
.vocab-tr { color: var(--text-muted); }
.vocab-row .inline-error { flex-basis: 100%; }

/* Карточка слова */
.word-card { display: grid; gap: var(--sp-3); }
.word-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-3); }
.word-main { font-size: var(--fs-xl); font-weight: 500; }
.word-translation { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 500; }
.word-meta { font-size: var(--fs-sm); }
.word-note { color: var(--text-muted); font-size: var(--fs-sm); }
.word-kv { font-size: var(--fs-sm); }
.word-subtitle { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.word-example-list { display: grid; gap: var(--sp-3); }
.word-example { display: grid; gap: var(--sp-1); justify-items: start; padding-inline-start: var(--sp-3); border-inline-start: 3px solid var(--marker); }
.word-example-tr { font-size: var(--fs-sm); }
.word-more-error:empty { display: none; }
.word-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.word-report { padding: var(--sp-2) 0; border: 0; background: none; color: var(--text-muted); font-size: var(--fs-xs); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.word-report:hover:not([disabled]) { color: var(--text); }
.word-report[disabled] { cursor: default; text-decoration: none; }

/* Словарь: раскрывающаяся строка */
.vocab-toggle { flex: 1 1 14rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-1) var(--sp-4); min-height: 44px; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.vocab-toggle:hover .vocab-word { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; }
.vocab-toggle[aria-expanded="true"] .vocab-word { text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 3px; text-underline-offset: 0.2em; }
.vocab-due { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.vocab-detail { flex-basis: 100%; padding: var(--sp-4); background: var(--surface-2); border-radius: var(--radius); }
.vocab-detail[hidden] { display: none; }

/* Бейдж «к повторению» */
.nav-link { position: relative; }
.nav-badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; border-radius: 999px; background: var(--marker); color: var(--marker-ink); font-size: 11px; font-weight: 600; line-height: 1.25rem; text-align: center; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) {
  .nav-badge { position: static; margin-inline-start: auto; }
}

/* Повторение */
.review-card { display: grid; gap: var(--sp-5); }
.review-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.review-word { font-family: var(--font-display); font-size: var(--fs-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.review-back { display: grid; gap: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.review-reading { font-size: var(--fs-lg); color: var(--text-muted); }
.review-translation { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; line-height: 1.3; }
.review-example { display: grid; gap: var(--sp-1); margin-top: var(--sp-2); padding-inline-start: var(--sp-3); border-inline-start: 3px solid var(--marker); }
.review-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.review-answers[hidden], .review-back[hidden] { display: none; }
.review-answers .btn { min-height: 56px; font-size: var(--fs-lg); }
.review-feedback { padding: var(--sp-2) var(--sp-4); background: var(--marker); color: var(--marker-ink); border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 500; justify-self: start; }
.review-keys { display: none; }
@media (min-width: 900px) { .review-keys { display: block; } }
.review-status:empty { display: none; }

/* Подталкивание на «Сегодня» */
.nudge-card { background: var(--marker); color: var(--marker-ink); }
.nudge-card .card-title { margin-bottom: 0; }
.nudge-card .btn-primary { background: var(--ink-fixed); color: var(--on-ink); }
.nudge-card .btn-primary:hover { background: var(--ink-hover); color: var(--on-ink); }

/* Переводчик: всё сообщение кликабельно, жёлтым то, чего нет в словаре */
.ft-word { padding: 0.05em 0.14em; border-radius: 4px; text-decoration: none; }
.ft-word.ft-new { background: color-mix(in oklch, var(--marker) 38%, transparent); color: inherit; }
.ft-word.ft-new:hover { background: color-mix(in oklch, var(--marker) 62%, transparent); }
.ft-word.ft-new.ft-term { background: var(--marker); color: var(--marker-ink); }
.ft-word:not(.ft-new) { background: none; }
.ft-word:not(.ft-new):hover { background: var(--surface-2); }
.ft-detail-inner { display: grid; gap: var(--sp-2); }
.ft-detail-head { justify-content: space-between; }
.ft-example { display: grid; gap: 2px; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.ft-example-label { font-size: var(--fs-xs); color: var(--text-muted); }
.ft-example-ru { font-size: var(--fs-sm); color: var(--text-muted); }
.word-rows { display: grid; }
.word-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 5rem; gap: var(--sp-3); align-items: center; min-height: 52px; padding-block: var(--sp-2); border-bottom: 1px solid var(--line); }
.word-row:last-child { border-bottom: 0; }
.word-row-main { display: grid; }
.word-row-word { font-weight: 500; font-size: var(--fs-lg); overflow-wrap: anywhere; }
.word-row-reading { font-size: var(--fs-xs); color: var(--text-muted); }
.word-row-tr { display: grid; font-size: var(--fs-sm); }
.word-row-note { font-size: var(--fs-xs); color: var(--text-muted); }
.word-plus { flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--marker); color: var(--marker-ink); font-size: 1.375rem; font-weight: 500; line-height: 1; cursor: pointer; transition: transform 0.1s var(--ease-out); }
.word-plus:active:not([disabled]) { transform: scale(0.94); }
.word-plus[disabled] { opacity: 0.5; cursor: progress; }
.word-row > .word-plus, .word-row > .word-saved { justify-self: end; }
.word-saved { flex: none; font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.reply-ru { font-size: var(--fs-sm); color: var(--text-muted); }
.reply-ru-label { font-weight: 500; }
@media (max-width: 560px) {
  .word-row { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .word-row-tr { grid-column: 1; grid-row: 2; }
  .word-row > :last-child { grid-column: 2; grid-row: 1 / span 2; }
}

/* Маскировка */
.privacy-line { font-size: var(--fs-sm); color: var(--text-muted); }
.ft-masked { padding: 0.05em 0.3em; border-radius: 4px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.mask-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.mask-chip { display: inline-flex; align-items: baseline; gap: var(--sp-2); padding: 0.3rem 0.65rem; border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.mask-type { font-size: var(--fs-xs); color: var(--text-muted); }
.btn-link { padding: 0; border: 0; background: none; color: var(--text); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.masked-view { margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: 10px; background: var(--surface-2); font-family: inherit; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Сборка словаря, ситуации, фильтры словаря */
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar-fill { height: 100%; background: var(--marker); border-inline-end: 1px solid var(--line-strong); transition: width 0.4s var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
.corpus-list { display: grid; gap: var(--sp-3); }
.corpus-row { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.corpus-row-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
.job-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.job-chip { padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: 999px; font-size: var(--fs-sm); line-height: 1.8; color: var(--text-muted); }
.job-chip[data-state="running"] { border-color: var(--line-strong); color: var(--text); border-style: dashed; }
.job-chip[data-state="done"] { background: var(--marker); color: var(--marker-ink); border-color: transparent; font-weight: 500; }
.job-chip[data-state="failed"] { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.situation-cards { display: grid; gap: var(--sp-4); }
.vocab-filters { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); }
.vocab-group { border-top: 1px solid var(--line); }
.vocab-group-toggle { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: var(--sp-3); min-height: 44px; padding: var(--sp-2) 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.vocab-group-toggle::before { content: "+"; flex: none; width: 1.2em; color: var(--text-muted); }
.vocab-group-toggle[aria-expanded="true"]::before { content: "\2212"; }
.vocab-group-title { flex: 1; font-weight: 500; }
.vocab-group-count { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.vocab-group-toggle:hover .vocab-group-title { text-decoration: underline; text-underline-offset: 0.2em; }
.vocab-group .vocab-list[hidden] { display: none; }
.vocab-main .tag { align-self: center; }
.sit-list { display: grid; }
.sit-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.sit-item:first-child { border-top: 0; }
.sit-sub { font-size: var(--fs-md); font-weight: 600; }
.chat { display: grid; gap: var(--sp-3); }
.bubble { display: grid; gap: var(--sp-1); max-width: 85%; padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border-radius: 16px 16px 16px 4px; justify-self: start; }
.bubble-alt { background: var(--marker); color: var(--marker-ink); border-radius: 16px 16px 4px 16px; justify-self: end; }
.bubble-who { font-size: var(--fs-xs); font-weight: 600; opacity: 0.75; }
.bubble-text { margin: 0; font-size: var(--fs-lg); }
.bubble-ru { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.bubble-alt .bubble-ru { color: inherit; opacity: 0.8; }

/* Кнопка звука */
.audio-btn {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.audio-btn:hover { background: var(--surface-2); color: var(--text); }
.audio-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.audio-btn.is-playing { background: var(--marker); color: var(--marker-ink); }
.audio-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .audio-btn.is-loading::after { animation: none; } }
.bubble-alt .audio-btn { color: inherit; }
.bubble-alt .audio-btn:hover { background: color-mix(in oklch, var(--marker-ink) 12%, transparent); }
.bubble-alt .audio-btn.is-playing { background: var(--ink-fixed); color: var(--on-ink); }
.bubble-alt .audio-btn.is-loading::after { border-color: color-mix(in oklch, var(--marker-ink) 25%, transparent); border-top-color: var(--marker-ink); }

.word-head { align-items: center; }
.sit-item { align-items: center; }
.sit-say { display: flex; flex: 1 1 100%; justify-content: space-between; align-items: center; gap: var(--sp-2); min-width: 0; }
.sit-say > .ft { min-width: 0; overflow-wrap: anywhere; }
.bubble > .sit-say { display: flex; justify-content: space-between; }
.review-wordrow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.review-wordrow > .ft { min-width: 0; }

/* Мини-тест */
.quiz-word { display: flex; align-items: center; gap: var(--sp-2); }
.quiz-foreign { min-width: 0; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.quiz-prompt { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.quiz-prompt:focus, .quiz-result:focus { outline: none; }
.quiz-result { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }
.quiz-options { display: grid; gap: var(--sp-2); }
.quiz-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-height: 48px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out);
}
.quiz-option:hover:not([aria-disabled="true"]) { background: var(--surface-2); }
.quiz-option:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.quiz-option[aria-disabled="true"] { cursor: default; }
.quiz-option-text { min-width: 0; overflow-wrap: anywhere; }
.quiz-option.is-right { background: var(--marker); color: var(--marker-ink); border-color: var(--marker); }
.quiz-option.is-wrong { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.quiz-mark { flex: none; font-size: var(--fs-xs); font-weight: 600; }
.quiz-feedback { display: grid; gap: var(--sp-1); }
.quiz-feedback:empty { display: none; }
.quiz-verdict { font-weight: 500; }
.quiz-reading { color: var(--text-muted); font-size: var(--fs-sm); }
.quiz-next[hidden] { display: none; }

.offline-page {
  min-height: 100dvh;
  max-width: 28rem;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
}

.names-hint { margin: 0; }
.names-mark { gap: var(--sp-2); }
.quick-text { font-size: var(--fs-lg); line-height: 1.5; white-space: pre-wrap; }
.limit-offer { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong); border-inline-start: 4px solid var(--marker); color: var(--text); }
