/* ============================================================
   Электротехника — дизайн-система по макету Figma.
   Палитра: #0c0c0c / #121212 / #191919 / #222 / #2a2a2a,
   акценты #fc3c69 и #015d9d, текст #fff / #b4b4b4 / #949494.
   ============================================================ */

:root {
  --bg: #0c0c0c;
  --shell: #121212;
  --surface: #191919;
  --surface-2: #222;
  --surface-3: #2a2a2a;
  --line: #363636;
  --line-soft: #2f2f2f;
  --line-dashed: #444;
  --line-strong: #666;
  --ink: #fff;
  --ink-muted: #b4b4b4;
  --ink-subtle: #949494;
  --pink: #fc3c69;
  --pink-deep: #c02d50;
  --blue: #015d9d;
  --blue-deep: #0b4c7a;
  --radius: 4px;
  --font: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --mono: Consolas, "SF Mono", "Courier New", monospace;
  --notch: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, strong, b { font-weight: 500; }
h1 { font-size: 32px; line-height: 40px; }
h2 { font-size: 24px; line-height: 32px; }
h3 { font-size: 18px; line-height: 24px; }
h4 { font-size: 16px; line-height: 24px; }
p { max-width: 72ch; }
img { display: block; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--ink-muted); }
.subtle { color: var(--ink-subtle); }
.white { color: var(--ink); }
.small { font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-size: 12px;
  line-height: 20px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pink);
}
.error { color: var(--ink); }
.success { color: var(--ink-muted); }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; line-height: 24px; }
.action-link { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; display: inline-block; font-size: 14px; line-height: 24px; }
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 24px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.rule { height: 1px; background: var(--line); margin: 24px 0; }
.gap { height: 24px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.tight { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 16px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 304px; gap: 24px; align-items: start; }

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

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border: 0;
  background: var(--pink);
  color: var(--shell);
  font-size: 14px;
  line-height: 24px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  clip-path: var(--notch);
  cursor: pointer;
}
.btn:hover { background: linear-gradient(100deg, var(--pink-deep), var(--blue)); color: var(--ink); }
.btn:active { background: var(--shell); color: var(--pink); box-shadow: inset 0 0 0 2px var(--blue); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.btn:disabled { background: var(--surface-2); color: var(--ink-muted); box-shadow: inset 0 0 0 1px #777; cursor: not-allowed; }

.btn-cta { background: var(--blue); color: var(--ink); }
.btn-cta:hover { background: var(--blue-deep); color: var(--ink); }
.btn-cta:active { background: var(--blue); color: var(--ink); }

.btn-outline { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px #888; }
.btn-outline:hover { background: #303030; }

.btn-ghost {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  clip-path: none;
}
.btn-ghost:hover { background: transparent; color: var(--ink); }

.btn.is-error { background: var(--pink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--shell); }
.btn.is-error:hover { background: var(--pink-deep); }
.btn-secondary { background: var(--surface-2); color: var(--ink); }
.btn-small { min-height: 40px; padding: 8px 16px; }
.btn-block { width: 100%; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 24px; }
.back-link { display: inline-block; margin-bottom: 16px; font-size: 14px; }

/* ---------- Шапка ---------- */

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 0 32px;
  background: var(--shell);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 3;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; line-height: 24px; white-space: nowrap; text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; gap: 4px; }
.brand-mark span { display: block; width: 8px; height: 24px; background: var(--pink); }
.brand-mark span + span { background: var(--blue); height: 16px; }
.brand a { text-decoration: none; }

.navigation { display: flex; align-items: center; gap: 28px; margin-left: auto; font-size: 14px; line-height: 24px; }
.nav-item { color: var(--ink); padding: 16px 0; text-decoration: none; }
.nav-item:hover { text-decoration: underline; text-underline-offset: 4px; }
.nav-item[aria-current="page"] { border-bottom: 1px solid var(--pink); }
.top-context { font-size: 14px; color: var(--ink-muted); margin-right: auto; }
.account { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.account .action-link { text-decoration: none; }
.account .action-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.account-name { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.account-name:hover { text-decoration: underline; text-underline-offset: 4px; }
.avatar-dot {
  width: 32px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mobile-menu-label { display: none; }

/* Меню профиля */
.menu-wrap { position: relative; }
.menu-btn {
  padding: 8px 0;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.menu-btn:hover { text-decoration: underline; text-underline-offset: 4px; }
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 256px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  z-index: 6;
  box-shadow: 0 12px 24px #0006;
}
.profile-menu span, .profile-menu a, .profile-menu button {
  display: block;
  width: 100%;
  padding: 12px;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 24px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.profile-menu a:hover, .profile-menu button:hover { background: var(--surface); }
.profile-menu .selected { background: var(--surface); }
.menu-separator { height: 1px; background: #555; margin: 8px 0; }
.menu-account { font-size: 12px; color: var(--ink-muted); padding: 4px 12px 10px; }

/* ---------- Оболочка: сайдбар и контент ---------- */

.app-body { display: flex; min-height: calc(100vh - 72px); }
.sidebar {
  width: 224px;
  flex-shrink: 0;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--shell);
  border-right: 1px solid var(--line);
}
.side-section { display: flex; flex-direction: column; gap: 4px; }
.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
  cursor: pointer;
}
.side-item:hover { background: var(--surface-2); }
.side-item.selected { background: var(--surface-2); }
.side-item.selected .side-label { border-bottom: 1px solid var(--pink); }
.side-label { padding-bottom: 1px; }
.side-pet { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-pet .side-item { color: var(--ink-muted); }

.content { flex: 1; min-width: 0; padding: 32px; display: flex; flex-direction: column; }

/* Гостевая оболочка: без сайдбара, широкие поля — как в публичных кадрах макета. */
body.is-guest .sidebar { display: none; }
body.is-guest .content { padding: 32px 48px; }
body.is-guest .top-context { display: none; }

/* Первый запуск: отдельная подпись в шапке, без навигации и сайдбара. */
body.is-onboarding .navigation { display: none; }
body.is-onboarding .top-context { margin-left: auto; margin-right: 0; }
body.is-onboarding .sidebar { display: none; }
body.is-onboarding .content { padding: 32px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.page-head h1 { max-width: 30ch; }
.page-head p { margin-top: 8px; color: var(--ink-muted); font-size: 14px; line-height: 24px; }
.top-actions { flex-shrink: 0; }
.content-page { max-width: 880px; }
.page-title { margin-bottom: 24px; }
.page-title::after { content: ''; display: block; width: 48px; height: 2px; margin-top: 16px; background: var(--pink); }
.section-title { font-size: 20px; line-height: 28px; margin: 8px 0 0; }
.theme-meta { display: flex; gap: 24px; flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); margin-bottom: 24px; }

/* ---------- Панели и заглушки ---------- */

.card {
  background: var(--surface);
  border: 1px dashed var(--line-dashed);
  padding: 24px;
  min-width: 0;
  margin: 0;
}
.card + .card { margin-top: 24px; }
.card h2, .card h3 { margin-bottom: 16px; }
.card p + p { margin-top: 12px; }
.card .actions { margin-top: 24px; }
.well { background: var(--surface-2); padding: 20px; min-width: 0; }
.media-placeholder {
  height: 160px;
  background: var(--surface-3);
  border: 1px dashed var(--line-dashed);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 14px;
  margin-bottom: 20px;
}
.media-placeholder.large { height: 240px; }
.media-placeholder.tiny { height: 96px; }
.skeleton { height: 8px; border-radius: var(--radius); background: var(--surface-3); margin: 12px 0; }
.skeleton.mid { width: 84%; }
.skeleton.short { width: 62%; }

/* ---------- Статистика ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  padding: 24px;
  background: var(--surface);
}
.stat span { font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.stat strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  line-height: 36px;
  font-weight: 500;
}
.stat .unit { font: 14px var(--font); color: var(--ink-muted); }
.stat .progress { margin-top: 8px; }
.stats.plain { background: none; padding: 0; gap: 32px; }
.metric-list { display: flex; flex-direction: column; gap: 12px; }
.metric-row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.metric-row strong { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- Темы, списки, история ---------- */

.topic-list { display: flex; flex-direction: column; gap: 12px; }
.topic-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 224px;
  gap: 24px;
  align-items: center;
  padding: 24px;
  background: var(--surface);
  border: 1px dashed var(--line-dashed);
  color: var(--ink);
  text-decoration: none;
}
.topic-row:hover { border-color: var(--line-strong); }
.topic-row.locked { background: #161616; color: var(--ink-muted); }
.topic-row.locked:hover { border-color: var(--line-dashed); }
.topic-row h3, .topic-title { font-size: 18px; line-height: 24px; margin-bottom: 8px; overflow-wrap: anywhere; }
.topic-row .small { margin: 0; }
.topic-number { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-subtle); }
.topic-aside { text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.topic-aside .btn-link { font-size: 14px; }
.profile-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.profile-art {
  width: 120px;
  height: 160px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #202329;
  border: 1px dashed var(--line-dashed);
  overflow: hidden;
}
.profile-art.female { background: #2b2025; }
.profile-art.male { background: #172632; }
.profile-art .sprite-img { width: 110px; height: 150px; }
.profile-identity { min-width: 0; }
.profile-identity h2 { font-size: 24px; line-height: 32px; }
.status { display: inline-flex; font-size: 12px; line-height: 20px; color: var(--ink-muted); gap: 8px; align-items: center; }
.status.strong { color: var(--ink); }
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 20px;
  color: var(--ink-muted);
}
.feed-row { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 16px; }
.feed-row:last-child { border: 0; padding-bottom: 0; }
.feed-row:first-child { padding-top: 0; }
.feed-row .num { margin-left: auto; white-space: nowrap; }
.history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history-table th { font-size: 12px; font-weight: 400; color: var(--ink-muted); text-align: left; padding: 12px 0; }
.history-table td { padding: 16px 0; border-bottom: 1px solid var(--line); }
.history-table th:last-child, .history-table td:last-child { text-align: right; }
.review-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.review-row:last-child { border: 0; }
.review-row h3 { font-size: 16px; margin-bottom: 8px; }
.review-row p { font-size: 14px; color: var(--ink-muted); }

/* ---------- Полосы, шаги, статусы ---------- */

.progress { height: 8px; background: var(--surface-3); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: var(--pink); border-radius: var(--radius); transition: width .3s; }
.progress.blue > div { background: var(--blue); }
.step-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.step-line > span { padding-bottom: 8px; border-bottom: 1px solid var(--line-dashed); }
.step-line > .selected, .step-line > .is-current { color: var(--ink); border-color: var(--pink); }
.step-line > [aria-hidden] { border-color: transparent; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 24px; }
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-dashed);
  border-radius: var(--radius);
  color: var(--ink-muted);
  font-size: 12px;
}
.step.is-current { border-color: var(--pink); color: var(--ink); }
.rule-list { padding-left: 20px; margin: 0; }
.rule-list li { margin-bottom: 8px; }
fieldset { border: 0; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; min-width: 0; margin-bottom: 24px; }
.field > span { color: var(--ink); line-height: 24px; }
.field input, .field select {
  width: 100%;
  min-height: 44px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 2px dashed var(--ink-subtle);
  border-radius: 0;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 24px;
}
.field input::placeholder { color: #666; }
.field input:hover:not(:disabled) { border-bottom-style: solid; border-image: linear-gradient(90deg, var(--pink), var(--blue)) 1; }
.field input:focus { outline: 2px solid var(--ink); outline-offset: 8px; border-bottom-color: var(--pink); border-bottom-style: solid; }
.field input:disabled { color: var(--ink-muted); border-bottom-color: #777; cursor: not-allowed; }
.field input[readonly] { border-bottom-style: dashed; border-bottom-color: var(--line); color: var(--ink-muted); }
.field input[aria-invalid="true"] { border-bottom-color: var(--blue); border-bottom-style: solid; }

/* Строка значения с кнопкой «Показать» — как в макете входа. */
.field-row { display: flex; align-items: center; gap: 16px; border-bottom: 2px dashed var(--ink-subtle); }
.field-row:hover { border-bottom-style: solid; border-image: linear-gradient(90deg, var(--pink), var(--blue)) 1; }
.field-row:focus-within { border-bottom-style: solid; border-bottom-color: var(--pink); outline: 2px solid var(--ink); outline-offset: 8px; }
.field-row input { border-bottom: 0; }
.field-row input:focus { outline: none; }
.field-row .reveal { border: 0; }

.field-hint { font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.field-hint:empty { display: none; }
.field-hint.error { color: var(--ink); }
.field-password { position: relative; }
.field-password .reveal {
  flex: none;
  padding: 4px 0;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.field-password .reveal:hover { color: var(--pink); }
.check-row { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 24px; }
.checkbox {
  display: inline-flex;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink-subtle);
  font-size: 14px;
  color: var(--shell);
  cursor: pointer;
}
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox.is-checked { background: var(--pink); border-color: var(--pink); }
.checkbox:focus-within { outline: 2px solid var(--ink); outline-offset: 4px; }
.consent { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px dashed var(--line-strong); background: var(--surface-2); margin-bottom: 24px; }
.consent-links { display: flex; flex-wrap: wrap; gap: 16px; }
.switch { display: flex; align-items: center; gap: 12px; font-size: 14px; cursor: pointer; }
.switch-label { font-size: 14px; }
.mascot-column { min-width: 0; }
.settings-content { min-width: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle { width: 40px; height: 24px; background: #444; display: inline-flex; align-items: center; padding: 4px; border-radius: var(--radius); flex: none; }
.toggle > span { width: 16px; height: 16px; background: var(--ink-muted); border-radius: 2px; transition: transform .15s; }
.toggle.on { background: var(--blue); justify-content: flex-end; }
.toggle.on > span { background: var(--ink); }

/* ---------- Уведомления ---------- */

.notice {
  padding: 16px 20px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  line-height: 24px;
  margin: 0 0 24px;
}
.notice p { max-width: none; }
.notice.error { border-left: 4px solid var(--pink); }
.notice.info, .notice-danger { border-left: 4px solid var(--blue); }
.notice.success { border-left: 4px solid var(--pink); }
.notice h3 { margin: 0; }
.check-error { border: 1px dashed var(--pink); padding: 16px; }

/* ---------- Испытание ---------- */

.timer-hud {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 24px;
  padding: 20px 24px;
  background: var(--surface);
  margin-bottom: 24px;
}
.hud-label { font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.hud-value { font-family: var(--mono); font-size: 28px; line-height: 36px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.hud-value.urgent { color: var(--pink); }
.timer { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.battle-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; }
.battle-counters { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; font-size: 12px; color: var(--ink-muted); margin: 24px 0; }
.question-prompt { font-size: 20px; line-height: 28px; margin: 24px 0; }
.answers { display: grid; gap: 12px; }
.answer {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.answer:hover:enabled { border-color: var(--ink-subtle); }
.answer:disabled { border-color: #777; color: var(--ink-muted); cursor: default; }
.answer.selected { border: 2px solid var(--blue); padding: 15px; }
.answer.correct, .answer.is-correct { border: 2px solid var(--pink); padding: 15px; }
.answer.wrong { border: 2px solid var(--pink); padding: 15px; }
.answer-result { margin-left: auto; font-size: 12px; white-space: nowrap; }
.feedback {
  min-height: 24px;
  margin: 16px 0 0;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-left: 4px solid var(--pink);
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 24px;
}
.feedback:empty { display: none; }
.text-button { display: block; background: none; border: 0; color: var(--ink-muted); margin-top: 24px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-button:hover { color: var(--ink); }
.boss-icon { font-family: var(--mono); font-size: 48px; color: var(--pink); }
.circuit-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  height: 144px;
  background: var(--surface-3);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 24px;
  color: var(--pink);
  margin: 20px 0;
}
.circuit-art i { width: 48px; height: 2px; background: currentColor; }
.circuit-art strong { border: 1px solid var(--ink-subtle); padding: 8px 16px; font-weight: 400; }
.intensity-1 .circuit-art { color: #f4d37d; }
.intensity-2 .circuit-art { color: #ff9f86; }
.result { border-style: solid; border-color: var(--pink); }
.reward { font-family: var(--mono); font-size: 28px; line-height: 36px; margin: 16px 0; }
.reward-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.reward-stat { background: var(--surface-2); padding: 20px; }
.reward-stat strong { display: block; font-family: var(--mono); font-size: 28px; line-height: 36px; font-weight: 500; }
.reward-stat span { font-size: 12px; color: var(--ink-muted); }

/* ---------- Спутник ---------- */

.pet-panel { padding: 20px; background: var(--surface); border: 1px dashed var(--line-dashed); min-width: 0; }
.pet-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.pet-title h2, .pet-title h3 { font-size: 16px; line-height: 24px; margin: 0; }
.pet-portrait { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.pet-portrait p { margin: 0; }
.pet-message { font-size: 14px; line-height: 24px; color: var(--ink-muted); }
.pet-panel .actions { margin-top: 16px; }
.pet-mini { padding: 12px 16px; background: var(--surface-2); display: flex; align-items: center; gap: 12px; font-size: 14px; }
.pet-mini .action-link { margin-left: auto; }
.mascot-panel { background: var(--surface); border: 1px dashed var(--line-dashed); padding: 20px; }
.mascot-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.mascot-avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-3) center / contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mascot-title { display: flex; flex-direction: column; line-height: 24px; min-width: 0; }
.mascot-title strong { font-weight: 500; }
.mascot-message { font-size: 14px; line-height: 24px; color: var(--ink-muted); }
.mascot-hint { padding: 12px; border-left: 2px solid var(--blue); background: rgba(1, 93, 157, .18); }
.mascot-hint strong { display: block; font-size: 12px; line-height: 20px; color: var(--ink-muted); margin-bottom: 4px; }
.mascot-hint p { font-size: 14px; line-height: 24px; }
.mascot-toggle { margin-left: auto; font-size: 12px; }
.mascot-panel.is-collapsed .mascot-head { margin-bottom: 0; }

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

.character-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 752px; margin: 0 auto; }
.character-head { text-align: center; }
.character-head .page-head { display: block; }
.character-head .page-head h1, .character-head .page-head p { margin-inline: auto; }
.character-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  min-width: 0;
  cursor: pointer;
  text-align: center;
}
.character-card.selected { border: 2px solid var(--pink); padding: 19px; }
.character-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.character-art {
  width: 100%;
  min-height: 384px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #202329;
  overflow: hidden;
}
.character-art.male { background: #172632; }
.character-art.female { background: #2b2025; }
.character-art img { max-height: 340px; width: auto; }
.sprite-img {
  display: block;
  width: 220px;
  height: 340px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
}
.character-name { display: flex; align-items: center; gap: 12px; width: 100%; }
.character-name h2 { font-size: 18px; line-height: 24px; }
.character-actions { display: flex; align-items: center; justify-content: center; gap: 24px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Настройки ---------- */

.settings-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.settings-side { display: flex; flex-direction: column; gap: 4px; }
.settings-item {
  display: block;
  padding: 12px 16px;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 24px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.settings-item:hover { background: var(--surface-2); }
.settings-item.selected { background: var(--surface-2); }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border: 0; }
.settings-row p { font-size: 14px; color: var(--ink-muted); }
.danger-zone { margin-top: 24px; padding: 20px; border: 1px dashed var(--pink); background: var(--surface-2); }
.danger-zone h3 { color: var(--ink); }
.tabs-settings { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tab {
  padding: 10px 16px;
  background: none;
  border: 1px solid var(--line-dashed);
  color: var(--ink-muted);
  font-size: 14px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }

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

.skin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.skin-card { display: flex; flex-direction: column; gap: 12px; }
.skin-card h3 { margin: 0; }
.skin-art { height: 160px; }

/* ---------- Формулы и текст лекции ---------- */

.math { font-family: "Cambria Math", "Times New Roman", Georgia, serif; }
.math-inline { white-space: nowrap; }
.math-block, .math-display { display: block; text-align: center; margin: 20px 0; font-size: 1.12em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .28em; }
.frac .num { border-bottom: 1px solid currentColor; padding: 0 .35em; }
.frac .den { padding: 0 .35em; }
.math i { font-style: italic; }
.upright, .mtext, .sym { font-style: normal; }
.mspace { display: inline-block; }
.mspace.wide { width: .9em; }
.mspace.wider { width: 1.8em; }
.sqrt .radic { border-top: 1px solid currentColor; padding: 0 .2em; }

.lesson-content ul, .lesson-content ol { margin: 16px 0 16px 20px; }
.lesson-content li { margin-bottom: 8px; }
.lesson-content blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--blue);
  background: var(--surface-2);
  color: var(--ink-muted);
}
.lesson-content hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.lesson-content h4 { margin: 20px 0 8px; }
.lesson-content code { font-family: var(--mono); font-size: 14px; background: var(--surface-2); padding: 2px 5px; }
.lesson-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.lesson-content th, .lesson-content td { border-bottom: 1px solid var(--line); padding: 8px 0; text-align: left; }
.doc-copy { display: flex; flex-direction: column; gap: 20px; font-size: 14px; line-height: 24px; }
.doc-copy h2 { font-size: 18px; line-height: 24px; }
.doc-copy p { color: var(--ink-muted); }
.doc-copy ul { padding-left: 20px; }
.permission-note { font-size: 12px; line-height: 20px; color: var(--ink-muted); margin-top: 12px; }

/* ---------- Вход и регистрация ---------- */

.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 64px; align-items: center; max-width: 1120px; margin: 24px auto; }
.auth-story { padding: 24px; }
.auth-story h1 { font-size: 40px; line-height: 48px; margin-bottom: 24px; }
.auth-story p { font-size: 16px; line-height: 24px; color: var(--ink-muted); }
.auth-sprite {
  display: block;
  width: 112px;
  height: 284px;
  margin-top: 32px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
}
.auth-card { padding: 32px; background: var(--surface); border: 1px dashed var(--line-dashed); display: flex; flex-direction: column; gap: 24px; }
.auth-card h2 { margin-bottom: 0; }
.auth-tabs { display: flex; gap: 24px; font-size: 16px; line-height: 24px; }
.auth-tabs > span { padding-bottom: 12px; color: var(--ink); }
.auth-tabs > .selected { border-bottom: 1px solid var(--pink); }
.auth-tabs a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.auth-note { font-size: 14px; line-height: 24px; color: var(--ink-muted); margin: 0; }
/* ---------- Модальное окно ---------- */

.modal { border: 0; padding: 0; background: none; color: var(--ink); }
.modal::backdrop { background: #080808e8; }
.modal-box { width: min(600px, calc(100vw - 32px)); padding: 32px; background: var(--surface); border: 1px solid var(--line-strong); }
.modal-box h2 { font-size: 28px; line-height: 36px; margin-bottom: 20px; }
.modal-body { color: var(--ink-muted); font-size: 16px; }
.modal-body p { margin-bottom: 16px; }
.modal-box .actions { margin-top: 24px; }
.compare { display: grid; gap: 16px; }
.compare h3 { margin-bottom: 6px; color: var(--ink); }
.compare p { margin: 0; font-size: 14px; color: var(--ink-muted); }

/* ---------- Главная ---------- */

.landing-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 40px 0 48px;
  margin-bottom: 32px;
}
.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("assets/hero-city.webp");
  background-position: center 51%;
  background-size: cover;
  opacity: .23;
}
.hero-copy { position: relative; }
.landing-hero h1 { font-size: 48px; line-height: 56px; max-width: 18ch; margin-bottom: 24px; }
.landing-hero p { font-size: 18px; line-height: 28px; color: var(--ink-muted); max-width: 52ch; }
.demo-level { background: var(--surface); border: 1px dashed var(--line-dashed); padding: 24px; }
.demo-level h2 { font-size: 24px; line-height: 32px; margin: 16px 0; }
.demo-level > p { font-size: 16px; line-height: 24px; }
.demo-badge { font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.circuit { display: flex; align-items: center; justify-content: center; gap: 24px; height: 144px; background: var(--surface-3); border-radius: var(--radius); margin: 20px 0; font-family: var(--mono); font-size: 24px; }
.circuit-node { border: 1px solid var(--ink-subtle); padding: 8px 16px; font: 16px var(--mono); }
.formula { display: flex; align-items: center; gap: 24px; margin: 16px 0; font-family: var(--mono); }
.formula-part { border: 1px solid var(--ink-subtle); padding: 8px 16px; font-size: 16px; }

/* ---------- Подвал ---------- */

.site-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 12px;
  line-height: 20px;
  color: var(--ink-muted);
}
#global-error { padding: 0 32px 24px; color: var(--ink); }

/* ---------- Адаптив ---------- */

@media (max-width: 1100px) {
  .sidebar { display: none; }
  .grid-main { grid-template-columns: minmax(0, 1fr) 256px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .navigation { gap: 16px; }
  .topbar { gap: 24px; }
  .auth-layout { gap: 32px; grid-template-columns: minmax(0, 1fr) 440px; }
  .topic-row { grid-template-columns: 24px minmax(0, 1fr); gap: 16px; }
  .topic-aside { grid-column: 2; text-align: left; align-items: flex-start; }
  .skin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .topbar { height: 64px; padding: 0 20px; gap: 16px; }
  .brand { font-size: 16px; }
  .navigation, .account { display: none; }
  .mobile-menu-label { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink); }
  .content { padding: 24px 20px; }
  body.is-guest .content { padding: 24px 20px; }
  .grid-main, .grid2, .grid3, .battle-grid, .settings-layout { grid-template-columns: 1fr; }
  .page-head { display: block; }
  .top-actions { margin-top: 20px; }
  h1 { font-size: 24px; line-height: 32px; }
  h2 { font-size: 20px; line-height: 28px; }
  .landing-hero { display: flex; flex-direction: column; gap: 32px; padding: 16px 0 32px; align-items: stretch; }
  .hero-backdrop { display: none; }
  .landing-hero h1 { font-size: 36px; line-height: 40px; }
  .landing-hero p { font-size: 16px; line-height: 24px; }
  .card, .demo-level { padding: 20px; }
  .stats { grid-template-columns: 1fr 1fr; padding: 20px; gap: 24px; }
  .stat strong { font-size: 24px; line-height: 32px; }
  .topic-row { grid-template-columns: 20px minmax(0, 1fr); gap: 16px; padding: 20px; }
  .topic-aside { grid-column: 2; text-align: left; align-items: flex-start; }
  .auth-layout { display: block; margin: 0; }
  .auth-story { padding: 0 0 24px; }
  .auth-story h1 { font-size: 28px; line-height: 36px; }
  .auth-sprite { display: none; }
  .auth-card { padding: 24px; gap: 24px; }
  .character-choice { gap: 16px; }
  .character-card { padding: 12px; }
  .character-card.selected { padding: 11px; }
  .character-art { min-height: 252px; }
  .sprite-img { width: 104px; height: 256px; }
  .character-actions { flex-wrap: wrap; }
  .timer-hud { grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 20px; }
  .hud-value { font-size: 24px; line-height: 32px; }
  .reward-grid { gap: 12px; }
  .reward-stat { padding: 12px; }
  .reward-stat strong { font-size: 24px; line-height: 32px; }
  .settings-side { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .settings-item { padding: 8px 12px; }
  .skin-grid { grid-template-columns: 1fr; }
  .site-footer { display: block; }
  .site-footer > span { display: block; margin-top: 12px; }
  .modal-box { padding: 24px; }
  .modal-box h2 { font-size: 24px; line-height: 32px; }
}

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