:root {
  /* ---------- Палитра: графит и лайм ----------
     Весь цвет приложения живёт здесь. Меняешь эти строки — меняется всё.
     Прошлая фиолетовая версия, если захочется вернуть:
       --navy-1: #241c4d;  --navy-2: #453494;  --accent: #6558f5;
       --accent-soft: #a99ffb;  --accent-ink: #5a48c9;  --on-accent: #ffffff;
       --card: #f0edfe;  --card-2: #e4defd;  --bg: #f7f5fd;  --text: #241c4d;
       --muted: #7d76a0;  --locked: #b3aecb;  --locked-bg: #eae7f4;
       --shadow-rgb: 60, 40, 140;  --accent-rgb: 101, 88, 245;  --ink-rgb: 26, 20, 48;  */

  --navy-1: #17181c;        /* графит: тёмные шапки, тосты */
  --navy-2: #34363f;
  --accent: #c6f24e;        /* лайм: только заливки — кнопки, полосы прогресса */
  --accent-soft: #a9d63f;   /* приглушённый лайм */
  --accent-ink: #4a6a08;    /* лайм, затемнённый до читаемости — для текста и иконок */
  --on-accent: #1b2a05;     /* текст поверх лайма (белый на лайме не читается) */

  --card: #ebebe5;
  --card-2: #e0e0d8;
  --white: #ffffff;        /* только для текста поверх тёмного */
  --surface: #ffffff;      /* фон карточек и панелей */
  --bg: #f5f5f1;
  --text: #191a1e;
  --muted: #74746c;
  --locked: #aeaea4;
  --locked-bg: #e6e6df;
  --amber: #f7a93b;         /* тёплый акцент: звёзды, текущий модуль */
  --hairline: rgba(30, 32, 26, 0.07);   /* разделители внутри карточек */
  --hairline-strong: rgba(30, 32, 26, 0.12);
  --dash: #d7d7cd;          /* пунктир линии прогресса курса */
  --faint: #c6c6bc;         /* текст-заглушка, например пустое поле ответа */
  --ok-bg: #e6f6ea;
  --ok-ink: #1f7a38;
  --bad-bg: #fdeaea;
  --bad-ink: #a92b30;
  --backdrop: rgba(20, 21, 25, 0.45);

  /* Цвета чертежей. Файлы картинок ссылаются на эти переменные, поэтому
     один и тот же рисунок подходит обеим темам. */
  --dw-grid: #e3e3db;
  --dw-axis: #191a1e;
  --dw-curve: #3f5c07;
  --dw-vector: #191a1e;
  --dw-vector2: #3f5c07;
  --dw-figure: #3f5c07;
  --dw-fill: #c6f24e;
  --dw-label: #74746c;

  /* фон карточки модуля, который ещё не открыт */
  --surface-locked: rgba(255, 255, 255, 0.55);

  --correct: #2fa84f;
  --correct-bg: rgba(47, 168, 79, 0.13);
  --incorrect: #dd3d43;
  --incorrect-bg: rgba(221, 61, 67, 0.13);
  --warn: #d9822b;
  --warn-bg: rgba(217, 130, 43, 0.14);

  --shadow: 0 2px 6px rgba(30, 32, 26, 0.06), 0 12px 32px rgba(30, 32, 26, 0.13);
  --shadow-sm: 0 1px 3px rgba(30, 32, 26, 0.1);
  --r-card: 26px;
  --r-btn: 999px;
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: 0px;
}

/* ---------- Тёмная тема ----------
   Переопределяем только палитру — все правила ниже написаны через
   переменные, поэтому больше ничего трогать не нужно.

   Лайм остаётся лаймом: это цвет бренда, он одинаково живой на светлом
   и на тёмном. А вот --accent-ink (лайм для ТЕКСТА) приходится
   разворачивать: на белом он должен быть тёмным, на графите — светлым. */
[data-theme="dark"] {
  --navy-1: #1d1e24;        /* шапки чуть светлее фона, иначе сливаются */
  --navy-2: #2f313a;

  --accent-ink: #b9e34a;    /* светлый лайм для текста и иконок */

  /* --white остаётся белым: им покрашен текст поверх тёмных шапок.
     Меняется только --surface — фон карточек. */
  --surface: #21232a;
  --card: #262830;
  --card-2: #30323b;
  --bg: #16171b;
  --text: #ececea;
  --muted: #9b9b93;
  --locked: #5d5e57;
  --locked-bg: #272930;

  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --dash: #3c3e46;
  --faint: #5d5e57;

  /* фоны ответов: на тёмном заливка должна быть глухой, а текст — ярким */
  --ok-bg: rgba(47, 168, 79, 0.18);
  --ok-ink: #66d98a;
  --bad-bg: rgba(221, 61, 67, 0.18);
  --bad-ink: #ff7b80;
  --correct-bg: rgba(47, 168, 79, 0.2);
  --incorrect-bg: rgba(221, 61, 67, 0.2);
  --warn-bg: rgba(217, 130, 43, 0.2);

  --backdrop: rgba(0, 0, 0, 0.62);

  /* На тёмном чертёж рисуется светлыми линиями — как мелом на доске. */
  --dw-grid: #33353d;
  --dw-axis: #d8d8d4;
  --dw-curve: #b9e34a;
  --dw-vector: #d8d8d4;
  --dw-vector2: #b9e34a;
  --dw-figure: #b9e34a;
  --dw-fill: #c6f24e;
  --dw-label: #8f8f88;

  /* Закрытый модуль должен уходить вглубь, а не светиться. Раньше здесь
     стоял полупрозрачный белый, и в тёмной теме недоступные модули были
     самыми яркими пятнами на экране. */
  --surface-locked: #1b1d22;

  /* на тёмном мягкая тень не читается — нужна глубже и плотнее */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 14px 36px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  /* без этого двойной тап по кнопке воспринимается как "приблизить" */
  touch-action: manipulation;
}

button {
  /* Кнопки не наследуют цвет текста — браузер красит их в свой чёрный.
     В светлой теме это совпадало с нужным цветом и ошибка не была видна,
     а на тёмном фоне текст пропадал. Наследование чинит весь класс разом;
     кнопки со своим цветом (лаймовые, в шапках) задают его явно. */
  color: inherit;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 18px 104px;
}

.screen,
.tab-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

[hidden] {
  display: none !important;
}

.screen.screen-animate,
.tab-screen.screen-animate {
  animation: screenEnter 0.32s var(--ease-smooth);
}

@keyframes screenEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tab-title {
  margin-top: var(--safe-top);
  font-size: 23px;
  font-weight: 800;
  margin: 4px 0;
  letter-spacing: -0.3px;
}

/* ---------- Тёмные шапки ---------- */

.course-header,
.screen-header {
  background: linear-gradient(165deg, var(--navy-1), var(--navy-2));
  color: var(--white);
  margin: -18px -18px 0;
  padding: calc(18px + var(--safe-top)) 20px 24px;
  border-radius: 0 0 34px 34px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.streak-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffce6a;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.streak-pill.streak-zero {
  color: rgba(255, 255, 255, 0.5);
}

.course-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  margin: 0;
}

.course-title {
  font-size: 23px;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.course-progress-caption {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
}

.course-header .progress-bar,
.screen-header .progress-bar {
  background: rgba(255, 255, 255, 0.18);
}

.course-header .progress-bar-fill,
.screen-header .progress-bar-fill {
  background: var(--accent-soft);
}

.screen-header {
  gap: 12px;
}

.screen-header .progress {
  color: rgba(255, 255, 255, 0.72);
}

/* ---------- Кнопки ---------- */

.btn-primary,
.btn-secondary {
  width: 100%;
  border: none;
  border-radius: var(--r-btn);
  padding: 15px;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 0.18s var(--ease-bounce), opacity 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 10px 24px rgba(130, 170, 40, 0.38);
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.96);
  opacity: 0.92;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent-ink);
  padding: 0;
  font-size: 14.5px;
  font-weight: 700;
  align-self: flex-start;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.back-btn:active {
  opacity: 0.55;
}

/* ---------- Прогресс ---------- */

.progress {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  font-weight: 600;
}

.progress-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--card-2);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.35s var(--ease-smooth);
  width: 0%;
}

/* ---------- Песочница ---------- */

.sandbox-toggle {
  display: flex;
  gap: 6px;
  background: var(--card-2);
  padding: 5px;
  border-radius: 999px;
}

.toggle-btn {
  flex: 1;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--accent-ink);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.toggle-btn.active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ---------- Вопрос и варианты ---------- */

.question {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
}

.task-image {
  display: block;
  width: 100%;
  max-width: 340px;
  /* страховка: высокий чертёж не должен занимать пол-экрана */
  max-height: 42vh;
  object-fit: contain;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.answer-pad {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answer-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--card-2);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.answer-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.answer-value {
  flex: 1;
  text-align: right;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.answer-value.empty {
  color: var(--faint);
}

.answer-backspace {
  background: none;
  border: none;
  padding: 4px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  transition: transform 0.14s var(--ease-bounce), opacity 0.15s ease;
}

.answer-backspace:active {
  transform: scale(0.88);
  opacity: 0.6;
}

.answer-box.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
}

.answer-box.incorrect {
  border-color: var(--incorrect);
  background: var(--incorrect-bg);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.key {
  background: var(--surface);
  border: none;
  border-radius: 20px;
  padding: 16px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s var(--ease-bounce), background 0.15s ease;
}

.key:active:not(:disabled) {
  transform: scale(0.93);
  background: var(--card-2);
}

.key-util {
  background: var(--card-2);
  color: var(--accent-ink);
}

.key:disabled,
.check-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---------- Карточки и результаты ---------- */

.banner {
  background: var(--card);
  padding: 16px 18px;
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

.result-card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 24px 18px;
  text-align: center;
  border-width: 2px;
  border-style: solid;
  border-color: transparent;
  box-shadow: var(--shadow);
  animation: screenEnter 0.35s var(--ease-smooth);
}

.result-card.decision-good {
  border-color: var(--correct);
  background: var(--correct-bg);
}

.result-card.decision-bad {
  border-color: var(--incorrect);
  background: var(--incorrect-bg);
}

.result-card.decision-neutral {
  border-color: var(--warn);
  background: var(--warn-bg);
}

.big {
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  margin: 4px 0;
}

.hint {
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.error {
  color: var(--incorrect);
}

/* ---------- Списки ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-tile {
  background: var(--card);
  border-radius: 20px;
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Нижняя навигация ---------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--surface);
  padding: 10px 8px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 16px rgba(30, 32, 26, 0.1);
  border-radius: 30px 30px 0 0;
  max-width: 480px;
  margin: 0 auto;
  z-index: 10;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 5px 4px;
  cursor: pointer;
  color: var(--locked);
  transition: transform 0.15s var(--ease-bounce), color 0.15s ease;
}

.nav-btn:active {
  transform: scale(0.9);
}

.nav-btn.active {
  color: var(--accent-ink);
}

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
}

/* ---------- Сообщение об ошибке связи ---------- */

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  max-width: 448px;
  margin: 0 auto;
  background: var(--navy-1);
  color: var(--white);
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(20, 21, 25, 0.35);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-smooth);
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Экран приветствия ---------- */

.welcome-card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}

.welcome-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.welcome-text {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 4px;
}

/* ---------- Напоминание о диагностике ---------- */

.diagnostic-offer[hidden] + .lesson-card {
  margin-top: -40px;
}

.diagnostic-offer {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 18px;
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}

.diagnostic-offer-text {
  flex: 1;
  min-width: 0;
}

.diagnostic-offer-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.diagnostic-offer-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin: 2px 0 0;
}

.diagnostic-offer-btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-bounce);
}

.diagnostic-offer-btn:active {
  transform: scale(0.94);
}

.diagnostic-offer-close {
  background: none;
  border: none;
  color: var(--locked);
  font-size: 22px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Шапка курса: профиль и плитки ---------- */

.course-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(130, 170, 40, 0.45);
}

.user-meta {
  min-width: 0;
}

.user-name {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 11.5px;
  margin: 1px 0 0;
  color: rgba(255, 255, 255, 0.55);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 4px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 11px 8px;
  text-align: center;
}

.stat-box-value {
  display: block;
  font-size: 21px;
  font-weight: 800;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.stat-box-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.section-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 -6px 2px;
}

/* ---------- Дорожка модулей: карточки ---------- */

.roadmap {
  display: flex;
  flex-direction: column;
}

.module-row {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 12px;
  opacity: 0;
  animation: cardIn 0.45s var(--ease-smooth) forwards;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.module-rail {
  width: 38px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  position: relative;
}

.module-row:not(:last-child) .module-rail::after {
  content: "";
  position: absolute;
  top: 42px;
  bottom: -12px;
  width: 0;
  border-left: 2px dashed var(--dash);
}

.module-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1;
  flex-shrink: 0;
}

.module-row.done .module-dot {
  background: var(--accent);
  color: var(--on-accent);
}

.module-row.current .module-dot {
  background: var(--surface);
  border: 3px solid var(--accent-ink);
  box-shadow: 0 0 0 5px rgba(130, 170, 40, 0.14);
}

.module-row.current .module-dot .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}

.module-row.future .module-dot {
  background: var(--locked-bg);
  color: var(--locked);
}

.module-card {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: transform 0.16s var(--ease-bounce), box-shadow 0.2s ease;
}

.module-card:active {
  transform: scale(0.98);
}

.module-row.future .module-card {
  background: var(--surface-locked);
  box-shadow: none;
  border: 1px solid var(--hairline);
}

.module-row.current .module-card {
  background: var(--card);
  box-shadow: var(--shadow);
  border: 1.5px solid rgba(130, 170, 40, 0.35);
  animation: currentGlow 3.4s ease-in-out infinite;
}

@keyframes currentGlow {
  0%, 100% {
    box-shadow: 0 2px 6px rgba(30, 32, 26, 0.06), 0 10px 26px rgba(130, 170, 40, 0.16);
  }
  50% {
    box-shadow: 0 2px 6px rgba(30, 32, 26, 0.06), 0 14px 34px rgba(130, 170, 40, 0.32);
  }
}

.module-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.module-icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: var(--card-2);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.module-row.future .module-icon {
  background: var(--locked-bg);
  color: var(--locked);
}

.module-titles {
  flex: 1;
  min-width: 0;
}

.module-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0;
}

.module-title {
  font-size: 15.5px;
  font-weight: 700;
  margin: 2px 0 0;
  line-height: 1.25;
}

.module-row.future .module-eyebrow,
.module-row.future .module-title {
  color: var(--locked);
}

.module-counter {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--card-2);
  border-radius: 999px;
  padding: 5px 10px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.module-row.future .module-counter {
  background: var(--locked-bg);
  color: var(--locked);
}

.module-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}

.module-row.future .module-progress {
  background: var(--locked-bg);
}

.module-progress i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  animation: fillIn 0.9s var(--ease-smooth);
}

@keyframes fillIn {
  from {
    width: 0;
  }
}

.module-next {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 12px;
}

.module-next-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.module-next-task {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.module-go {
  padding: 13px;
  font-size: 15px;
}

/* ---------- Профиль: панели и темы ---------- */

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-bounce);
}

.icon-btn:active {
  transform: scale(0.9);
}

.panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--card-2);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.panel-row-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-row-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.panel-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--card-2);
  overflow: hidden;
}

.panel-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  animation: fillIn 0.9s var(--ease-smooth);
}

.panel-note,
.panel-empty {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.topic-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.topic-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.topic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.topic-name {
  font-size: 14.5px;
  font-weight: 650;
}

.topic-value {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.topic-value.good { color: var(--correct); }
.topic-value.mid { color: var(--warn); }
.topic-value.low { color: var(--incorrect); }

.topic-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}

.topic-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  animation: fillIn 0.9s var(--ease-smooth);
}

.topic-bar i.good { background: var(--correct); }
.topic-bar i.mid { background: var(--warn); }
.topic-bar i.low { background: var(--incorrect); }

.topic-meta {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Шторка настроек ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 30;
}

.sheet-backdrop.visible {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  z-index: 31;
  transform: translateY(100%);
  transition: transform 0.28s var(--ease-smooth);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet.visible {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--locked);
  margin: 2px auto 6px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--card-2);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  border: none;
  font: inherit;
  text-align: left;
}

.sheet-row-button {
  cursor: pointer;
  transition: transform 0.15s var(--ease-bounce);
}

.sheet-row-button:active {
  transform: scale(0.98);
}

.sheet-row-label {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}

.sheet-row.danger .sheet-row-label {
  color: var(--incorrect);
}

.switch {
  width: 50px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: var(--card-2);
  padding: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.22s ease;
}

.switch span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(20, 21, 25, 0.25);
  transition: transform 0.22s var(--ease-bounce);
}

.switch.on {
  background: var(--accent);
}

.switch.on span {
  transform: translateX(20px);
}

.sheet-note {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  margin: 4px 0 0;
}

/* ---------- Экран задания ---------- */

.screen-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

.screen-header-title.dark {
  color: var(--text);
}

.task-steps {
  display: flex;
  gap: 4px;
  padding: 0 2px;
}

.step {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--card-2);
  transition: background 0.3s ease, transform 0.3s var(--ease-bounce);
}

.step.done {
  background: var(--accent);
}

.step.active {
  background: var(--accent-soft);
  transform: scaleY(1.6);
}

.task-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-chip {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--card-2);
  border-radius: 999px;
  padding: 5px 11px;
}

.task-stars {
  display: flex;
  gap: 2px;
  font-size: 13px;
  color: var(--locked);
}

.task-stars .star.on {
  color: var(--amber);
}

.task-question {
  font-size: 17.5px;
  font-weight: 650;
  line-height: 1.4;
  margin: 0;
}

/* ---------- Плашка результата ---------- */

.result-bar {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 452px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(20, 21, 25, 0.28);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.25s ease, transform 0.3s var(--ease-smooth);
  z-index: 25;
}

.result-bar.above-nav {
  bottom: calc(92px + env(safe-area-inset-bottom));
}

.result-bar.visible {
  opacity: 1;
  transform: translateY(0);
}

.result-bar.ok {
  background: var(--ok-bg);
  border: 1.5px solid var(--correct);
}

.result-bar.bad {
  background: var(--bad-bg);
  border: 1.5px solid var(--incorrect);
}

.result-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.result-bar.ok .result-mark {
  background: var(--correct);
}

.result-bar.bad .result-mark {
  background: var(--incorrect);
}

.result-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.result-title {
  font-size: 15.5px;
  font-weight: 800;
}

.result-bar.ok .result-title { color: var(--ok-ink); }
.result-bar.bad .result-title { color: var(--bad-ink); }

.result-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 1px;
}

.result-next {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--white);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-bounce);
}

.result-bar.ok .result-next { background: var(--correct); }
.result-bar.bad .result-next { background: var(--incorrect); }
/* без своего фона кнопка была белой на светлой карточке и почти пропадала */
.result-bar.revealed .result-next { background: var(--navy-1); }

.result-next:active {
  transform: scale(0.94);
}

/* ---------- Экран ЕГЭ ---------- */

.exam-locked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--locked-bg);
  color: var(--muted);
  border-radius: 16px;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--hairline);
}

.history-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.history-score {
  width: 52px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  border-radius: 12px;
  padding: 7px 0;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.history-score.good { background: var(--correct-bg); color: var(--correct); }
.history-score.mid { background: var(--warn-bg); color: var(--warn); }
.history-score.low { background: var(--incorrect-bg); color: var(--incorrect); }

.history-text {
  display: flex;
  flex-direction: column;
}

.history-decision {
  font-size: 14px;
  font-weight: 650;
}

.history-date {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* ---------- Песочница ---------- */

.practice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  padding: 8px 8px 8px 14px;
}

.practice-mode {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.practice-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  color: #d9822b;
  background: var(--warn-bg);
  border-radius: 999px;
  padding: 5px 10px;
  flex-shrink: 0;
}

.practice-reset {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.mistake-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mistake-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mistake-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mistake-dots {
  display: flex;
  gap: 5px;
}

.mistake-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--card-2);
  transition: background 0.25s ease, transform 0.25s var(--ease-bounce);
}

.mistake-dot.on {
  background: var(--correct);
  transform: scale(1.12);
}

.mistake-hint {
  font-size: 12px;
  color: var(--muted);
}

.mistake-practice {
  padding: 12px;
  font-size: 14.5px;
}

/* ---------- Статистика проекта (только для владельца) ---------- */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.admin-tile {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
}

.admin-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.admin-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.admin-day {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}

.admin-day:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.admin-day-date {
  font-weight: 800;
  width: 52px;
  font-variant-numeric: tabular-nums;
}

.admin-day-people {
  flex: 1;
  color: var(--accent-ink);
  font-weight: 700;
}

.admin-day-answers {
  color: var(--muted);
}


/* ---------- Разбор при неверном ответе ---------- */

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.result-solution {
  width: 100%;
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  /* длинный разбор не должен выталкивать кнопку «Дальше» за экран */
  max-height: 38vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.result-solution-title {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.result-step {
  display: flex;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.45;
  margin: 0 0 8px;
  color: var(--text);
}

.result-step:last-child {
  margin-bottom: 0;
}

.result-step-num {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}


/* ---------- Теория ---------- */

.screen-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-chip {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease-bounce), background 0.15s ease;
}

.header-chip:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.26);
}

.module-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.module-theory {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--card-2);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-bounce);
}

.module-theory:active {
  transform: scale(0.92);
}

.module-theory svg {
  width: 13px;
  height: 13px;
}

.module-row.future .module-theory {
  background: var(--locked-bg);
  color: var(--locked);
}

.sheet-tall {
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.theory-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.theory-intro {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 16px;
}

.theory-section {
  margin-bottom: 18px;
}

.theory-section-title {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 9px;
}

.theory-item {
  display: flex;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 8px;
}

.theory-item::before {
  content: "";
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
}

.theory-traps {
  background: var(--warn-bg);
  border-radius: 16px;
  padding: 13px 15px;
  margin-top: 4px;
}

.theory-traps .theory-section-title {
  color: var(--warn);
}

.theory-traps .theory-item::before {
  background: var(--warn);
}

/* ---------- Блиц ---------- */

.blitz-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
  border: none;
  border-radius: var(--r-card);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 22px rgba(20, 21, 25, 0.22);
  transition: transform 0.18s var(--ease-bounce);
}

.blitz-card:active {
  transform: scale(0.97);
}

.blitz-card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.blitz-card-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--accent);
}

.blitz-card-sub {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.66);
}

.blitz-card-go {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.blitz-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: var(--safe-top);
}

.blitz-quit {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.blitz-timer {
  flex: 1;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.blitz-timer.hurry {
  color: var(--incorrect);
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.blitz-score {
  min-width: 48px;
  text-align: right;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.blitz-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}

.blitz-progress i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: var(--accent);
  transform-origin: left;
  transition: transform 0.25s linear;
}

.blitz-flash {
  animation: flashIn 0.3s ease;
}

@keyframes flashIn {
  from { opacity: 0.35; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.blitz-result-card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 30px 20px 22px;
  text-align: center;
  margin-top: calc(var(--safe-top) + 30px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.blitz-result-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.blitz-result-score {
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  letter-spacing: -2px;
}

.blitz-result-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 12px;
}

.blitz-result-card .btn-secondary {
  margin-top: 2px;
}

/* ---------- Кольцо цели дня ---------- */

.daily-ring {
  position: relative;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
}

.daily-ring svg {
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 119.4;
  stroke-dashoffset: 119.4;
  transition: stroke-dashoffset 0.6s var(--ease-smooth);
}

.daily-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.daily-ring.done .daily-ring-text {
  color: var(--accent);
}


.sheet-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sheet-row-hint {
  font-size: 11.5px;
  color: var(--muted);
}


/* ---------- Список людей в админке ---------- */

.admin-people {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-user {
  padding: 11px 2px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-user:last-child {
  border-bottom: none;
}

/* те, кто ни разу не решал — приглушены, чтобы не мешали читать список */
.admin-user.cold {
  opacity: 0.55;
}

.admin-user-main {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.admin-user-name {
  font-size: 14.5px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-nick {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--card-2);
  border: none;
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  max-width: 55%;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s var(--ease-bounce);
}

.admin-user-nick:active {
  transform: scale(0.94);
}

.admin-user-nick.copied {
  background: var(--accent);
  color: var(--on-accent);
}

.admin-user-stats {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.admin-user-stats b {
  color: var(--accent-ink);
}

.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-user-when {
  font-size: 11.5px;
  color: var(--muted);
}

.admin-user-flag {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--card-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
}


/* Блок админки — обычный div, поэтому отступ в 16px, который есть между
   блоками страницы, внутрь него не распространялся: разделы жались друг
   к другу, а заголовок наезжал на свою карточку. Задаём тот же ритм. */
#admin-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}


/* текст в списке людей должен выделяться пальцем — на случай,
   если копирование по нажатию не сработает */
.admin-user-name,
.admin-user-stats {
  user-select: text;
  -webkit-user-select: text;
}


.admin-caption {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 0;
}


/* ---------- Последние заходы ---------- */

.admin-visits {
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 0;
}

.admin-visit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}

.admin-visit:last-child {
  border-bottom: none;
}

.admin-visit-time {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
  flex-shrink: 0;
  min-width: 46px;
}

.admin-visit-who {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-visit-flag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-2);
  border-radius: 999px;
  padding: 2px 8px;
  flex-shrink: 0;
}


.admin-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* новички — самая важная цифра для роста, выделяем */
.admin-tile.accent {
  background: var(--accent);
}

.admin-tile.accent .admin-value,
.admin-tile.accent .admin-label {
  color: var(--on-accent);
}

.admin-day-new {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* ---------- Таблица по дням ---------- */

.day-row {
  display: grid;
  grid-template-columns: 46px repeat(4, 1fr);
  align-items: center;
  gap: 4px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
}

.day-row:last-child {
  border-bottom: none;
}

.day-head {
  padding-top: 0;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--hairline-strong);
}

.day-head .day-num {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.day-date {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.day-row.today .day-date {
  color: var(--accent-ink);
}

.day-num {
  font-size: 14.5px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.day-num.up {
  color: var(--accent-ink);
}

.day-num.zero,
.day-num.muted {
  color: var(--locked);
  font-weight: 700;
}

/* ---------- Воронка ---------- */

.funnel-step {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.funnel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.funnel-label {
  font-size: 13.5px;
  font-weight: 700;
}

.funnel-label i {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.funnel-value {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.funnel-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--card-2);
  overflow: hidden;
}

.funnel-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.5s var(--ease-smooth);
}

/* ---------- Кнопка разбора ---------- */

.practice-chip {
  background: var(--card-2);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-bounce);
}

.practice-chip:active {
  transform: scale(0.93);
}

.header-chip:disabled,
.practice-chip:disabled {
  opacity: 0.5;
}

/* разбор по просьбе — нейтральный, а не «ты ошибся» */
.result-bar.revealed {
  background: var(--card);
  border: 1.5px solid var(--locked);
}

.result-bar.revealed .result-mark {
  background: var(--muted);
}

.result-bar.revealed .result-title {
  color: var(--text);
}

/* ---------- Экран разбора примера ---------- */

.example-idea {
  background: var(--card-2);
  border-radius: 16px;
  padding: 13px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}

.example-steps {
  gap: 0;
}

.example-step {
  display: flex;
  gap: 11px;
  font-size: 14px;
  line-height: 1.55;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline);
}

.example-step:first-child {
  padding-top: 0;
}

.example-step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.example-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.example-answer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
  border-radius: 20px;
  padding: 16px 20px;
}

.example-answer-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.example-answer-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.example-note {
  background: var(--warn-bg);
  border-radius: 16px;
  padding: 13px 15px;
}

.example-note-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--warn);
}

.example-note p {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
}

#screen-example .task-card .task-chip {
  align-self: flex-start;
}

/* ---------- Дорожка для новичков ---------- */

.start-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-card);
  padding: 15px 17px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease-bounce);
}

.start-card:active {
  transform: scale(0.98);
}

.start-card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.start-card-title {
  font-size: 15.5px;
  font-weight: 800;
}

.start-card-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.start-card-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}

.start-card-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s var(--ease-smooth);
}

.start-block {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  background: var(--card);
  border: none;
  border-radius: 20px;
  padding: 15px 16px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s var(--ease-bounce);
}

.start-block:active {
  transform: scale(0.98);
}

.start-block.locked {
  opacity: 0.5;
  cursor: default;
}

.start-block-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.start-block.finished .start-block-num {
  background: var(--accent);
  color: var(--on-accent);
}

.start-block-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.start-block-title {
  font-size: 15px;
  font-weight: 800;
}

.start-block-hint {
  font-size: 12px;
  color: var(--muted);
}

.start-block-count {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

#start-blocks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* ---------- Замок по подписке ---------- */

.gate {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 26px 20px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.gate-badge {
  align-self: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--card-2);
  border-radius: 999px;
  padding: 5px 13px;
}

.gate-title {
  font-size: 21px;
  font-weight: 800;
  margin: 4px 0 0;
}

.gate-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 8px;
}

/* ---------- Позвать друга ---------- */

.invite-lead {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}

.invite-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.invite-count-value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-ink);
}

.invite-count-label {
  flex: 1;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

/* Ссылка длинная, поэтому режем её многоточием, а не переносим в три строки */
.invite-link {
  width: 100%;
  border: 1px dashed var(--locked);
  background: var(--card-2);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s var(--ease-bounce);
}

.invite-link:active {
  transform: scale(0.98);
}

.invite-link.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.invite-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid var(--card-2);
  padding-top: 12px;
}

.invite-person {
  display: flex;
  align-items: center;
  gap: 9px;
}

.invite-person-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--locked);
  flex-shrink: 0;
}

.invite-person-dot.active {
  background: var(--accent-soft);
}

.invite-person-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invite-person-note {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Вход в админку и её экран ---------- */

.admin-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--navy-1);
  color: var(--white);
  border: none;
  border-radius: 20px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease-bounce);
}

.admin-entry:active {
  transform: scale(0.98);
}

.admin-entry-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-entry-title {
  font-size: 16px;
  font-weight: 800;
}

.admin-entry-hint {
  font-size: 12.5px;
  color: var(--locked);
}

.admin-entry-arrow {
  font-size: 24px;
  line-height: 1;
  color: var(--accent);
}

/* Вкладки внутри админки — та же таблетка, что в песочнице */
.admin-tabs {
  display: flex;
  gap: 6px;
  background: var(--card-2);
  padding: 5px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.admin-tabs .toggle-btn {
  padding: 10px 6px;
  font-size: 13.5px;
}

/* ---------- Рефералы в админке ---------- */

.ref-inviter {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-2);
}

.ref-inviter:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.ref-inviter-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ref-medal {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ref-inviter-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.ref-inviter-active {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.ref-inviter .invite-list {
  border-top: none;
  padding-top: 0;
  padding-left: 44px;
}

.ref-arrow {
  color: var(--locked);
  flex-shrink: 0;
}

.admin-visit-who.muted {
  color: var(--muted);
}

/* Внутри админского экрана список прокручивается вместе со страницей:
   скролл в скролле на телефоне почти невозможно поймать пальцем. */
#screen-admin .admin-people,
#screen-admin .admin-visits {
  max-height: none;
  overflow-y: visible;
}

/* ---------- Плашка "подпишись на канал" ---------- */

.channel-sheet {
  gap: 12px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.channel-badge {
  align-self: flex-start;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 11px;
}

.channel-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}

.channel-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 2px;
}

.channel-later {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  padding: 10px;
  cursor: pointer;
}

.channel-later:active {
  opacity: 0.6;
}

/* Плитки с оценкой: значения длиннее обычных («≈ 29 мин»), поэтому
   даём шрифту ужаться, чтобы строка не ломалась пополам. */
.admin-grid.compact .admin-value {
  font-size: clamp(14px, 4.4vw, 20px);
  white-space: nowrap;
}

/* Строка показателей: переносим её целыми блоками. Без этого flex ужимает
   каждый показатель и рвёт слова внутри — «5 заходов» разъезжается на две
   строки, а строка выглядит сломанной. */
.admin-user-stats {
  flex-wrap: wrap;
  row-gap: 4px;
}

.admin-user-stats > span {
  white-space: nowrap;
}

/* ---------- Рейтинг недели ---------- */

.rating-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: none;
  border-radius: var(--r-card);
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s var(--ease-bounce);
}

.rating-card:active {
  transform: scale(0.98);
}

.rating-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.rating-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
}

.rating-left {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.rating-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rating-place {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.rating-place.top {
  background: var(--accent);
  color: var(--on-accent);
}

.rating-name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating-score {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

/* своя строка отделена чертой — её ищут глазами первой */
.rating-me {
  border-top: 1px solid var(--hairline);
  padding-top: 8px;
}

.rating-row.me .rating-name {
  color: var(--accent-ink);
}

.rating-empty {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}

.rating-more {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-ink);
  align-self: flex-end;
}

.rating-full {
  gap: 9px;
}

/* Стрелка у строки настроек, которая куда-то ведёт: отличает её от
   переключателей, которые действуют на месте. */
.sheet-row-arrow {
  font-size: 22px;
  line-height: 1;
  color: var(--locked);
  flex-shrink: 0;
}

/* Строка-ссылка в настройках: по умолчанию браузер красит ссылки синим
   и подчёркивает — приводим её к виду обычной строки. */
a.sheet-row {
  color: var(--text);
  text-decoration: none;
  box-sizing: border-box;
}

/* Чертёж вставлен в страницу как <svg>, а не картинкой, поэтому размеры
   задаём контейнеру, а сама графика тянется по нему. */
.task-image svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 42vh;
}

.task-image-failed {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

/* Дорожка для новичков, когда приложение её советует: подсвечиваем сильнее
   обычного, чтобы человек её заметил именно в тот момент, когда она нужна. */
.start-card-suggested {
  border-width: 2px;
  box-shadow: 0 0 0 4px rgba(130, 170, 40, 0.14);
}
