/* QA Terminal — тёмная терминальная тема */

:root {
  --bg:          #070b0f;
  --bg-grid:     #0d141b;
  --panel:       #0f1720;
  --panel-2:     #141f2a;
  --border:      #1e2d3d;
  --border-hot:  #2a4256;

  --text:        #dbe6ef;
  --text-dim:    #8fa3b5;
  --text-faint:  #7a92a6;

  --accent:      #3ff58f;
  --accent-dim:  #1f8f57;
  --cyan:        #4fd6e8;
  --danger:      #ff5f6d;
  --warn:        #ffc75f;
  --gold:        #ffd166;

  --mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', ui-monospace, monospace;
  --sans: 'Onest', 'Inter', 'Segoe UI Variable Text', system-ui, Arial, sans-serif;
  --display: 'Unbounded', 'Inter', 'Segoe UI Variable Display', system-ui, sans-serif;

  --radius: 10px;
  --tap: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 36px 36px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.mono { font-family: var(--mono); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Заставка ---------- */

#screen-boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
}

.boot-inner {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.boot-logo {
  font-family: var(--mono);
  font-size: clamp(26px, 7vw, 44px);
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(63, 245, 143, 0.35);
  margin-bottom: 4px;
}

.boot-sub {
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 1px;
  margin-bottom: 28px;
}

#boot-log {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-dim);
  min-height: 190px;
  white-space: pre-wrap;
  line-height: 1.7;
}

#boot-log .ok { color: var(--accent); }
#boot-log .dim { color: var(--text-faint); }

.cursor {
  display: inline-block;
  width: 9px;
  height: 15px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.boot-skip {
  position: absolute;
  right: 20px;
  bottom: 20px;
  background: transparent;
  border: 1px solid var(--border-hot);
  color: var(--text-dim);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  min-height: var(--tap);
}

.boot-skip:hover { color: var(--accent); border-color: var(--accent-dim); }

/* ---------- Общий каркас ---------- */

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 96px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -0.2px; margin: 0 0 12px; }
h1 { font-size: 21px; color: var(--accent); }
h2 { font-size: 17px; }
h3 { font-family: var(--mono); font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px; margin: 0 0 12px; font-weight: 600; }

.muted { color: var(--text-dim); font-size: 14px; }
.faint { color: var(--text-faint); font-size: 13px; }

/* ---------- Приветствие ---------- */

#screen-hello { padding-top: 6vh; }

.hello-mark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hello-title {
  font-family: var(--display);
  font-size: clamp(21px, 5.6vw, 29px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.8px;
  margin-bottom: 16px;
}

.hello-title em { font-style: normal; color: var(--accent); }

.hello-text {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 26px;
  max-width: 30em;
}

.hello-points { list-style: none; padding: 0; margin: 0 0 30px; }

.hello-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  color: var(--text);
}

.hello-points li:last-child { border-bottom: none; }

.hello-points .dot {
  font-family: var(--mono);
  color: var(--accent);
  flex: none;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Опрос при входе ---------- */

.step-mark {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.step-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 0 0 6px;
}

.step-sub { color: var(--text-dim); font-size: 15px; margin: 0 0 22px; }

.opts {
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
  border-top: 1px solid var(--border);
}

.opt {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 14px 16px 18px;
  min-height: var(--tap);
  transition: background 140ms ease, padding-left 140ms ease;
}

/* Левая черта — индикатор текущего выбора */
.opt::before {
  content: '';
  position: absolute;
  left: 0; top: -1px; bottom: -1px;
  width: 2px;
  background: transparent;
  transition: background 140ms ease;
}

.opt:hover { background: rgba(79, 214, 232, 0.045); padding-left: 22px; }
.opt:hover::before { background: var(--border-hot); }

.opt[aria-pressed="true"] {
  background: rgba(63, 245, 143, 0.07);
  padding-left: 22px;
}

.opt[aria-pressed="true"]::before { background: var(--accent); }

.opt-idx {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  flex: none;
  padding-top: 3px;
  letter-spacing: 0.5px;
  min-width: 30px;
}

.opt[aria-pressed="true"] .opt-idx { color: var(--accent); }

.opt-main { display: block; flex: 1; min-width: 0; }

.opt-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.opt .ot {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
}

.opt[aria-pressed="true"] .ot { color: var(--accent); }

.opt-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
}

.opt[aria-pressed="true"] .opt-tag { color: var(--cyan); border-color: var(--border-hot); }

.opt .od { display: block; font-size: 14px; color: var(--text-dim); line-height: 1.45; }

.opt-out {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 7px;
}

/* Не --accent-dim: на подсвеченном фоне он даёт контраст ниже нормы 4.5:1 */
.opt[aria-pressed="true"] .opt-out { color: #2bb06f; }

.opts-hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin: 14px 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.opts-hint kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border-hot);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-dim);
  background: var(--panel-2);
}

.step-dots { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.step-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-hot); display: block; }
.step-dots i.on { background: var(--accent); }

.step-back {
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 4px;
  min-height: var(--tap);
}

.step-back:hover { color: var(--text-dim); }

/* ---------- Регистрация ---------- */

#screen-register { padding-top: 32px; }

.field { margin-bottom: 18px; }

.field label,
.field .field-label {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 7px;
  letter-spacing: 0.5px;
}

.field .optional { color: var(--text-faint); }

.field input, .field select {
  width: 100%;
  min-height: var(--tap);
  background: var(--bg);
  border: 1px solid var(--border-hot);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 15px;
}

.field input:focus, .field select:focus { border-color: var(--accent-dim); }

.hint { font-size: 13px; color: var(--text-faint); margin-top: 6px; }

.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }

.choice {
  flex: 1 1 30%;
  min-height: var(--tap);
  background: var(--bg);
  border: 1px solid var(--border-hot);
  border-radius: 8px;
  color: var(--text-dim);
  padding: 10px 8px;
  font-family: var(--mono);
  font-size: 14px;
}

.choice[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(63, 245, 143, 0.08);
}

.btn-primary {
  width: 100%;
  min-height: 52px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #04180d;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

.btn-primary:disabled { background: var(--border-hot); color: var(--text-faint); cursor: not-allowed; }
.btn-primary:not(:disabled):hover { box-shadow: 0 0 22px rgba(63, 245, 143, 0.3); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-hot);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 10px 16px;
  min-height: var(--tap);
  font-family: var(--mono);
  font-size: 14px;
}

.btn-ghost:hover { color: var(--text); border-color: var(--accent-dim); }
/* Кнопка выхода из сессии компактнее прочих, но остаётся в пределах пальца:
   раньше высота задавалась прямо в разметке и была 32 px. */
.btn-quit { padding: 4px 12px; font-size: 12px; min-height: var(--tap); }
.btn-danger { border-color: #5a2630; color: var(--danger); }

/* ---------- Верхняя панель ---------- */

#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  /* Непрозрачный фон: при полупрозрачном сквозь шапку просвечивал текст,
     проезжающий под ней при прокрутке. */
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 0 10px;
  margin-bottom: 14px;
}

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

.top-name { font-family: var(--mono); font-size: 15px; }
.top-rank { font-size: 12px; color: var(--accent); font-family: var(--mono); }

.top-stats { margin-left: auto; display: flex; gap: 14px; font-family: var(--mono); font-size: 14px; }
.stat-streak { color: var(--warn); }
.stat-coins { color: var(--gold); }

.xpbar {
  margin-top: 9px;
  height: 6px;
  background: var(--panel-2);
  border-radius: 3px;
  overflow: hidden;
}

.xpbar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  width: 0%;
  transition: width 200ms ease;
}

.xp-label { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* ---------- Главный экран ---------- */

.hero { text-align: center; padding: 26px 18px; }

.hero-title { font-family: var(--mono); font-size: 15px; color: var(--text-dim); margin-bottom: 18px; }

.goal-ring { font-family: var(--mono); font-size: 13px; color: var(--text-faint); margin-top: 14px; }

.goal-track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.goal-track > i { display: block; height: 100%; background: var(--cyan); width: 0%; transition: width 200ms ease; }

/* Путь по темам и выбор темы */

.path-list { display: flex; flex-direction: column; gap: 9px; }

.path-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  min-height: var(--tap);
}

.path-item:not(:disabled):hover { border-color: var(--accent-dim); }
.path-item:disabled { opacity: 0.55; cursor: default; }

.path-num {
  font-family: var(--mono);
  font-size: 13px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-hot);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  color: var(--text-faint);
}

.path-item.done .path-num { background: var(--accent); border-color: var(--accent); color: #04180d; }
.path-item.now .path-num { border-color: var(--accent); color: var(--accent); }

.path-body { flex: 1; min-width: 0; }
.path-name { font-size: 14.5px; margin-bottom: 5px; }
.path-item.now .path-name { color: var(--accent); font-weight: 600; }
.path-bar { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.path-bar > i { display: block; height: 100%; background: var(--accent-dim); width: 0%; }
.path-meta { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 5px; }
.path-go { font-family: var(--mono); font-size: 12px; color: var(--accent); flex: none; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

.chip {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border-hot);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text-dim);
  background: var(--panel-2);
  /* Выбор цели и уровня — это кнопки, а высота в 30 px мимо пальца. */
  min-height: var(--tap);
}

.chip.on { border-color: var(--accent); color: var(--accent); }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.topic-cell {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  /* Названия тем бывают в одну и в две строки. Без колонки полоса и подпись
     съезжают на разную высоту и ряд выглядит рваным. */
  display: flex;
  flex-direction: column;
}

.topic-cell .name { font-size: 13px; margin-bottom: 8px; line-height: 1.25; flex: 1; }
.topic-cell .bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.topic-cell .bar > i { display: block; height: 100%; background: var(--accent-dim); width: 0%; }
.topic-cell .pct { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 5px; }

/* ---------- Квиз ---------- */

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.quiz-progress { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-bottom: 18px; }
.quiz-progress > i { display: block; height: 100%; background: var(--accent); width: 0%; transition: width 200ms ease; }

.q-topic {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--cyan);
  border: 1px solid var(--border-hot);
  border-radius: 4px;
  padding: 3px 8px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.q-text { font-size: 17px; line-height: 1.42; margin-bottom: 17px; }

.answers { display: flex; flex-direction: column; gap: 10px; }

.answer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border-hot);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.38;
  transition: border-color 150ms, background 150ms;
}

.answer:not(:disabled):hover { border-color: var(--accent-dim); background: #16232f; }

.answer .key {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
  border: 1px solid var(--border-hot);
  border-radius: 4px;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.answer.correct { border-color: var(--accent); background: rgba(63, 245, 143, 0.1); }
.answer.correct .key { border-color: var(--accent); color: var(--accent); }
.answer.wrong { border-color: var(--danger); background: rgba(255, 95, 109, 0.1); }
.answer.wrong .key { border-color: var(--danger); color: var(--danger); }
.answer:disabled { cursor: default; }

.verdict {
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border-hot);
  background: var(--panel-2);
}

.verdict-title { font-family: var(--mono); font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.verdict.ok .verdict-title { color: var(--accent); }
.verdict.no .verdict-title { color: var(--danger); }
.verdict p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.5; }
.verdict p:last-child { margin-bottom: 0; }
.verdict .why { color: var(--text-dim); font-size: 13.5px; }

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  flex: none;
}

.verdict.ok .mark { background: var(--accent); color: #04180d; }
.verdict.no .mark { background: var(--danger); color: #21070a; }

/* ---------- Итог сессии ---------- */

.result-score { font-family: var(--mono); font-size: 44px; color: var(--accent); text-align: center; margin: 8px 0 2px; }
.result-sub { text-align: center; color: var(--text-dim); margin-bottom: 20px; font-size: 14px; }

.reward-row { display: flex; gap: 10px; margin-bottom: 18px; }

.reward {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.reward .val { font-family: var(--mono); font-size: 20px; }
.reward .lbl { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

/* ---------- Персонаж ---------- */

.hero-card { padding-bottom: 14px; }

.avatar-stage { display: flex; justify-content: center; padding: 4px 0 14px; }

.avatar {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 24px;
  border: 1px solid var(--border-hot);
  overflow: hidden;
  background: var(--panel-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.avatar svg { width: 100%; height: 100%; display: block; }

.avatar-actions { display: flex; align-items: center; gap: 12px; }
.avatar-actions .btn-ghost { min-height: var(--tap); padding: 8px 14px; font-size: 13px; }
.unlocked { font-size: 12px; color: var(--text-faint); margin-left: auto; }

/* Полоса категорий */
/* Категорий десять, и раньше они ехали в одну строку с горизонтальной
   прокруткой, у которой был спрятан индикатор. Видно было семь, остальные —
   борода, серьги, фон — существовали, но найти их было нечем. Переносим по
   строкам: всё на виду. */
.cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cat {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
  color: var(--text-dim);
  font-size: 13px;
  white-space: nowrap;
}

/* На телефоне десять категорий в две строки не помещаются, а четыре строки
   съедают экран над сеткой. Значки категорий там мало что объясняют — прячем
   их и ужимаем отступы, чтобы строк стало меньше. */
@media (max-width: 430px) {
  .cat { padding: 8px 10px; font-size: 12.5px; gap: 0; }
  .cat .ci { display: none; }
}


.cat:hover { color: var(--text); background: var(--panel-2); }
.cat[aria-selected="true"] { background: rgba(63, 245, 143, 0.1); border-color: var(--accent); color: var(--accent); }
.cat .ci { font-family: var(--mono); font-size: 12px; }

/* Палитра цветов */
.palette { margin-bottom: 16px; }
.palette h3 { margin-bottom: 9px; }
.palette-row { display: flex; gap: 9px; flex-wrap: wrap; }

.dot-color {
  width: var(--tap);
  height: var(--tap);
  border-radius: 12px;
  border: 2px solid transparent;
  padding: 0;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.dot-color[aria-pressed="true"] { border-color: var(--accent); }
.dot-color[aria-pressed="true"]::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #04180d;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

/* Плитки деталей */
.part-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }

.part {
  min-height: 116px;
  border-radius: var(--radius);
  border: 1px solid var(--border-hot);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 6px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color 140ms, transform 140ms;
}

.part:not(:disabled):hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.part[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: rgba(63, 245, 143, 0.07); }

.part .thumb {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  flex: none;
}

.part .thumb svg { width: 100%; height: 100%; display: block; }
.part .pname { line-height: 1.2; text-align: center; }
.part .price { font-family: var(--mono); font-size: 11px; color: var(--gold); }
.part.locked { border-style: dashed; border-color: var(--border); }
.part.locked .thumb { opacity: 0.78; }
.part.locked .pname { color: var(--text-dim); }
.part.locked .price {
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 999px;
  padding: 1px 8px;
  background: rgba(255, 209, 102, 0.08);
}

.lock-badge {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 10px;
  color: var(--gold);
}

/* ---------- Магазин ---------- */

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.shop-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.shop-icon { font-size: 30px; margin-bottom: 8px; }
.shop-name { font-size: 14px; margin-bottom: 4px; }
.shop-price { font-family: var(--mono); font-size: 13px; color: var(--gold); margin-bottom: 10px; }

.shop-item .btn-ghost { width: 100%; font-size: 12px; min-height: var(--tap); padding: 8px; }

.banner {
  border: 1px dashed var(--border-hot);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
  font-family: var(--mono);
}

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

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

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

.lb-place { font-family: var(--mono); font-size: 14px; color: var(--text-faint); min-width: 28px; }
.lb-face { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none; background: var(--panel-2); }
.lb-face svg { width: 100%; height: 100%; }
.lb-name { flex: 1; font-size: 14.5px; }
.lb-xp { font-family: var(--mono); font-size: 14px; color: var(--text-dim); }

.lb-row.me { background: rgba(63, 245, 143, 0.07); border-radius: 8px; }
.lb-row.me .lb-name { color: var(--accent); font-weight: 600; }
.lb-row.me .lb-place { color: var(--accent); }

/* ---------- Профиль ---------- */

.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-dim); }
.kv .v { font-family: var(--mono); }

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

#tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: rgba(9, 14, 20, 0.97);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-faint);
  min-height: var(--tap);
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 8px;
}

.tab .ico { font-size: 18px; line-height: 1; display: block; }
.tab .ico svg { width: 22px; height: 22px; display: block; }

/* Подпись набирается Inter: он нарисован под мелкий интерфейсный кегль,
   а моноширинный разгонял «Тренировку» почти на всю ширину кнопки. */
.tab .lbl { font-family: 'Inter', var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.1px; }

/* У каждого раздела свой цвет: так вкладки различаются ещё до чтения подписи. */
.tab[data-tab="train"]   { --tab-color: #3ff58f; }
.tab[data-tab="hero"]    { --tab-color: #4fd6e8; }
.tab[data-tab="shop"]    { --tab-color: #ffc75f; }
.tab[data-tab="board"]   { --tab-color: #c489f0; }   /* светлее исходного: тёмно-фиолетовый в приглушении давал контраст 3.09 */
.tab[data-tab="profile"] { --tab-color: #ff8a8a; }

.tab .ico svg { color: var(--tab-color); opacity: 0.78; transition: opacity 120ms ease; }
.tab[aria-selected="true"] { color: var(--tab-color); }
.tab[aria-selected="true"] .ico svg {
  opacity: 1;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tab-color) 50%, transparent));
}

/* ---------- Всплывающее сообщение ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
  /* Сообщение висит поверх кнопок и раньше перехватывало нажатия. */
  pointer-events: none;
}

@media (max-width: 380px) {
  .q-text { font-size: 16px; }
  .answer { font-size: 13.8px; }
  .top-stats { gap: 9px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Подсказка: погашенные варианты ---------- */

.answer.dimmed {
  opacity: 0.38;
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}

/* ---------- Разбор ошибок на экране итогов ---------- */

.miss-head {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 18px 0 8px;
}

.miss-list { list-style: none; margin: 0 0 14px; padding: 0; }

.miss-list li {
  border-left: 2px solid var(--danger);
  padding: 8px 0 8px 12px;
  margin-bottom: 8px;
  background: var(--panel-2);
  border-radius: 0 8px 8px 0;
}

.miss-topic {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 3px;
}

.miss-text { display: block; font-size: 13.5px; line-height: 1.45; color: var(--text); }

/* ---------- Магазин ---------- */

.shop-desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
  margin-bottom: 8px;
  min-height: 34px;
}

.shop-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.shop-buy[disabled] { opacity: 0.45; cursor: default; }

/* ---------- Живой фон персонажа (покупка в магазине) ---------- */

.avatar-stage.alive {
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    radial-gradient(circle at 70% 75%, color-mix(in srgb, var(--cyan) 20%, transparent), transparent 55%),
    var(--panel-2);
  background-size: 180% 180%, 180% 180%, auto;
  animation: alive-drift 12s ease-in-out infinite alternate;
}

@keyframes alive-drift {
  from { background-position: 0% 0%, 100% 100%, 0 0; }
  to   { background-position: 100% 60%, 0% 20%, 0 0; }
}

/* Карточка товара строкой: шесть высоких плиток в столбик давали полтора
   экрана прокрутки на телефоне. */
.shop-grid { grid-template-columns: 1fr; }

.shop-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  grid-template-areas:
    "icon name  price"
    "icon desc  desc"
    "note note  note"
    "buy  buy   buy";
  gap: 2px 12px;
  align-items: center;
  text-align: left;
}

.shop-item .shop-icon  { grid-area: icon; font-size: 26px; margin: 0; }
.shop-item .shop-name  { grid-area: name; margin: 0; }
.shop-item .shop-price { grid-area: price; margin: 0; white-space: nowrap; }
.shop-item .shop-desc  { grid-area: desc; margin: 0; min-height: 0; }
.shop-item .shop-note  { grid-area: note; margin: 6px 0 0; }
.shop-item .shop-buy   { grid-area: buy; margin-top: 10px; }

/* ---------- Заставка: ожидание нажатия ---------- */

.boot-go {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  min-height: var(--tap);
  padding: 12px 22px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  animation: boot-blink 1.4s steps(1, end) infinite;
}

.boot-go:hover, .boot-go:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

@keyframes boot-blink {
  0%, 55%   { opacity: 1; box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent); }
  56%, 100% { opacity: 0.45; box-shadow: none; }
}

/* Для тех, кому мигание мешает: общее правило ниже гасит анимации, но кнопка
   должна остаться видимой, а не замереть в полупрозрачном состоянии. */
@media (prefers-reduced-motion: reduce) {
  .boot-go { animation: none; opacity: 1; }
}

/* ---------- Выключенный вариант выбора ---------- */

.opt-off {
  opacity: 0.5;
  cursor: default;
}

.opt-off:hover {
  border-color: var(--border);
  background: var(--panel);
}

.chip[disabled] { opacity: 0.45; cursor: default; }

.hello-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin: 18px 0 20px;
}

.hello-points b { font-weight: 600; color: var(--text); }

/* ---------- Шаг 5: сбор персонажа ---------- */

.dice {
  margin-top: 8px;
  background: transparent;
  border: 1px dashed var(--border-hot);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  min-height: var(--tap);
  padding: 8px 14px;
  cursor: pointer;
}

.dice:hover, .dice:focus-visible { color: var(--accent); border-color: var(--accent); }

.ob-stage {
  display: flex;
  justify-content: center;
  padding: 6px 0 14px;
}

.ob-stage .avatar { width: 160px; height: 160px; }
.ob-stage .avatar svg { width: 100%; height: 100%; border-radius: var(--radius); }

.ob-row { margin-top: 18px; }

.ob-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.ob-parts { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }

.ob-part {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  overflow: hidden;
}

.ob-part svg { width: 100%; height: 100%; display: block; }
.ob-part.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.ob-swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.ob-swatch {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.ob-swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

#screen-avatar .btn-primary { margin-top: 22px; }

/* Полоса категорий на шаге знакомства: та же, что в конструкторе, но компактнее
   и с прокруткой — на узком экране десять категорий в строку не помещаются. */
.ob-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 4px;
}

.ob-cats .cat { font-size: 12px; padding: 8px 10px; }
