:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-2: #111c31;
  --card: #111a2c;
  --border: #26344d;
  --text: #e8eefb;
  --muted: #a7b5cf;
  --accent: #4fd1ff;
  --accent2: #8b7bff;
  --danger: #fb7185;
  --ok: #34d399;
  --surface: rgba(18, 27, 44, 0.68);
  --surface-soft: rgba(20, 33, 54, 0.52);
  --bar-track: rgba(255, 255, 255, 0.11);
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.26);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.34);
  --transition-fast: 160ms ease;
  font-family: Inter, "SF Pro Text", "SF Pro Display", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 620px at 0% -8%, rgba(79, 209, 255, 0.2) 0%, transparent 62%),
    radial-gradient(920px 540px at 100% -10%, rgba(139, 123, 255, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

.shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 30px clamp(16px, 4vw, 44px) 56px;
  padding-inline-end: max(clamp(16px, 4vw, 44px), 112px);
  box-sizing: border-box;
}

.shell > #errBox:not(.hidden) {
  margin: 0 0 14px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.step {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.step-n {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.step-t {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.step.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 84%, white 16%);
}

.step.done {
  color: color-mix(in srgb, var(--ok) 85%, var(--text));
  border-color: color-mix(in srgb, var(--ok) 52%, var(--border));
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

/* Тема и меню ⋯ — всегда в правом верхнем углу окна */
.app-fixed-corner {
  --corner-panel-w: min(380px, calc(100vw - max(28px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 24px)));
  position: fixed;
  /* Выше по экрану; на вырезе — чуть ниже safe-area */
  top: max(6px, calc(env(safe-area-inset-top, 0px) + 4px));
  /* Ближе к правому краю, чем у .shell; на вырезе — небольшой зазор от safe-area */
  right: max(4px, calc(env(safe-area-inset-right, 0px) + 2px));
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* Ширина блока — панель справки на всю полосу под кнопками, без смещения в узкий столбец у «⋯» */
.corner-toolbar {
  position: relative;
  width: var(--corner-panel-w);
  max-width: 100%;
}

.app-fixed-corner > .pill {
  max-width: var(--corner-panel-w);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Во время экзамена и итогов сохраняем компактный header, без резких скачков layout */
body.exam-focus .hero,
body.summary-focus .hero {
  margin-bottom: 8px;
  opacity: 0.92;
}

body.exam-focus .hero .lede,
body.summary-focus .hero .lede {
  display: none;
}

body.exam-focus .hero h1,
body.summary-focus .hero h1 {
  font-size: clamp(20px, 2.6vw, 26px);
  margin-bottom: 0;
}

.hero > div:first-child {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.15;
  width: 100%;
  max-width: none;
}

.num-mark {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: inherit;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: none;
  width: 100%;
  line-height: 1.6;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
  width: 100%;
}

.theme-toggle {
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.25rem;
  line-height: 1;
  flex: 0 0 40px;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 17px;
  line-height: 1;
  transform: translateY(0);
  opacity: 0.95;
}

.menu-dots {
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  flex: 0 0 40px;
}

.menu-dots:hover {
  border-color: rgba(110, 231, 255, 0.45);
  transform: translateY(-1px);
}

.menu-dots:active {
  transform: translateY(0);
}

.guide-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: auto;
  max-height: min(78vh, 560px);
  overflow: auto;
  padding: 14px 16px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--popover-shadow);
  z-index: 50;
  text-align: left;
}

.guide-popover h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.guide-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.guide-list li {
  margin-bottom: 8px;
}

.guide-list li:last-child {
  margin-bottom: 0;
}

.voice-settings {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.voice-settings h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.voice-settings label {
  display: block;
  margin: 14px 0 5px;
  font-size: 13px;
  color: var(--text);
}

.voice-settings h4 + label {
  margin-top: 8px;
}

.voice-select {
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}

.voice-test {
  margin-top: 6px;
  margin-bottom: 2px;
  font-size: 13px;
}

.pill {
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.run-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.run-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
  animation: statusPulse 1.8s ease infinite;
}

@keyframes statusPulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  }
  70% {
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

.run-status.run-status--prominent {
  white-space: normal;
  max-width: min(640px, 100%);
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 14px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--text);
}

body.summary-finalizing-wait .run-status:not(.hidden) {
  white-space: normal;
  max-width: min(640px, 100%);
}

@keyframes summarySpin {
  to {
    transform: rotate(360deg);
  }
}

.summary-finalizing-banner {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft));
  margin-bottom: 14px;
}

.summary-finalizing-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.summary-spinner {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-top-color: var(--accent);
  animation: summarySpin 0.75s linear infinite;
}

.summary-finalizing-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.summary-finalizing-text .muted {
  margin: 0 0 6px;
}

.summary-finalizing-elapsed {
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}

.card {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
}

.home-entry-title {
  margin: 0 0 10px;
  font-size: 20px;
}

.home-entry-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.home-entry-btn {
  display: inline-flex;
  align-items: center;
  width: 100%;
  justify-content: center;
  text-align: center;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
}

@media (min-width: 520px) {
  .home-entry-actions {
    flex-direction: row;
    align-items: stretch;
  }

  .home-entry-btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .stepper {
    grid-template-columns: 1fr 1fr;
  }
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

#topicStepTitle:empty {
  display: none;
}

.hidden {
  display: none !important;
}

/* Распознанная речь при выборе темы («Слушаю…» / «Слышу: …») — внизу окна */
.topic-heard-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 12px clamp(14px, 4vw, 40px);
  padding-inline-end: max(clamp(14px, 4vw, 40px), 112px);
  padding-bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  z-index: 300;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.22);
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
  max-height: min(30vh, 220px);
  overflow-y: auto;
  box-sizing: border-box;
}

body:has(#topicHeard:not(.hidden)) .shell,
body:has(#topicPrepLineBar:not(.hidden)) .shell {
  padding-bottom: 5.5rem;
}

.topic-prep-controls {
  margin: 18px 0 12px;
}

.topic-prep-row--card {
  justify-content: flex-start;
}

.topic-prep {
  margin: 16px 0 14px;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}

.topic-prep-lead {
  margin: 0 0 12px;
  text-align: left;
}

.topic-prep-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.topic-prep-timer {
  font-size: 22px;
  min-width: 4.5ch;
}

.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.topic {
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  padding: 13px 13px;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.topic:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 84%, white 16%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.topic.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 231, 255, 0.25) inset;
}

.topic-title {
  display: block;
  font-weight: 600;
}

.topic-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

button {
  font: inherit;
}

.primary,
.ghost {
  border-radius: var(--radius-md);
  padding: 11px 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent2) 34%, transparent));
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border));
  color: var(--text);
  box-shadow: 0 8px 18px rgba(39, 132, 197, 0.24);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(39, 132, 197, 0.3);
}

.primary:active {
  transform: translateY(0);
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
}

.ghost:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 86%, white 14%);
}

/* Иначе общий .ghost { padding: 10px 14px } перебивает .theme-toggle и кнопки наезжают друг на друга */
.theme-toggle.ghost {
  padding: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 10px;
}

.exam-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 22px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.timer.warn {
  border-color: rgba(251, 113, 133, 0.55);
  color: var(--text);
}

.q-en {
  font-size: 18px;
  line-height: 1.45;
  margin: 10px 0 6px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.muted.small {
  font-size: 14px;
  line-height: 1.55;
}

.transcript-box h3 {
  margin: 14px 0 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 11px 13px;
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.error {
  color: var(--text);
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.35);
  padding: 10px 12px;
  border-radius: 12px;
  margin-top: 10px;
}

.progress {
  margin-top: 16px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: var(--bar-track);
  overflow: hidden;
  margin-top: 8px;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.25s ease;
  position: relative;
}

.bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.25) 50%, transparent 75%);
  transform: translateX(-120%);
  animation: barShimmer 2.2s linear infinite;
}

@keyframes barShimmer {
  to {
    transform: translateX(120%);
  }
}

.experts {
  display: grid;
  gap: 10px;
}

.expert {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px;
  background: var(--surface-soft);
}

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

.score {
  font-weight: 800;
  color: var(--ok);
}

.summary h3 {
  margin: 14px 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.summary .block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-soft);
  margin-bottom: 12px;
  line-height: 1.55;
}

.summary-results-title {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
}

.summary-results-kpi {
  margin: 0 0 12px;
}

.summary-results-verdict {
  margin: 0 0 10px;
  line-height: 1.5;
}

.summary-results-improve {
  margin: 0 0 12px;
}

/* Объединённый отзыв — короткие абзацы, визуальный якорь */
.summary-verdict-combined {
  margin: 0 0 16px;
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--accent) 6%);
}

.summary-verdict-combined-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 10px;
}

.summary-verdict-combined-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.summary-verdict-combined-hint {
  font-size: 12px;
}

.summary-synth-read {
  margin: 0;
  max-width: 42rem;
}

.summary-synth-read .synth-line {
  margin: 0 0 0.65rem;
  font-size: 15px;
  line-height: 1.58;
  color: var(--text);
}

.summary-synth-read .synth-line:last-child {
  margin-bottom: 0;
}

.summary-more-body .more-sec--good .summary-synth-read {
  margin-top: 4px;
}

.summary-results-line {
  margin: 8px 0 0;
}

.summary .summary-judges-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.summary-criteria .fipi-criteria {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.summary-criteria h3 {
  margin-top: 0;
  color: var(--text);
}

.judges-pack-hint {
  margin: 0 0 10px;
}

.judges-pack .judges-grid {
  margin-bottom: 0;
}

.summary-score-main .score-rule {
  margin: 10px 0 0;
  max-width: 52rem;
}

/* Итог: герой-блок + «Подробнее» + глубокие карточки судей */
.summary-hero {
  text-align: center;
  padding: 24px 18px 22px;
  border-width: 2px;
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  box-shadow: 0 14px 30px rgba(39, 132, 197, 0.2);
}

.summary-hero.summary-hero--top {
  margin-bottom: 16px;
}

.summary-hero-title {
  margin: 0 0 10px;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
  color: var(--text);
}

.summary-hero-score {
  margin: 0 0 8px;
  line-height: 1.1;
}

.summary-hero-score .hero-num {
  font-size: clamp(52px, 12vw, 94px);
  vertical-align: baseline;
  line-height: 1;
}

.summary-hero-score .hero-denom {
  font-size: clamp(22px, 4vw, 30px);
  color: var(--muted);
  font-weight: 600;
  margin-left: 4px;
}

.summary-subscores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px 22px;
  margin: 10px 0 14px;
}

.summary-judge-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 15px;
  line-height: 1.35;
  max-width: 100%;
}

.summary-judge-chip-text strong {
  font-variant-numeric: tabular-nums;
}

.judge-avatar-thumb {
  flex-shrink: 0;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.judge-avatar-thumb.judge-avatar-hero {
  border-radius: 16px;
}

.judge-deep-summary-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  text-align: left;
}

/* Компактная таблица баллов под итоговой оценкой */
.summary-merged-wrap {
  margin-top: 14px;
  text-align: left;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.summary-merged-caption {
  margin: 0 0 6px;
  text-align: center;
}

.summary-merged-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.summary-merged-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.summary-merged-table th,
.summary-merged-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: center;
}

.summary-merged-table thead th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-merged-table tbody th[scope="row"] {
  width: 3rem;
  color: var(--muted);
  font-weight: 600;
  background: color-mix(in srgb, var(--surface-soft) 80%, transparent);
}

.summary-merged-table tbody td.merged-pt-cell {
  font-weight: 700;
  font-size: 15px;
}

.summary-merged-table .merged-pt-yes {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}

.summary-merged-table .merged-pt-no {
  color: var(--muted);
}

.summary-merged-table tfoot th,
.summary-merged-table tfoot td {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft));
  font-weight: 600;
  text-align: center;
}

.summary-merged-table tfoot .merged-total-val {
  color: var(--ok);
  font-size: 16px;
}

.summary-qa .summary-qa-heading {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.summary-qa .summary-qa-inner {
  text-align: left;
}

.summary-qa-row + .summary-qa-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.summary-more-wrap {
  margin-bottom: 12px;
}

.summary-more-summary {
  font-weight: 600;
  font-size: 15px;
}

.summary-more-body {
  padding-top: 12px;
}

.summary-more-body .more-sec--outline {
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.summary-more-body .more-sec-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.summary-more-body .more-verdict-lead {
  margin: 0 0 10px;
}

.summary-more-body .more-remark-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  line-height: 1.5;
}

.summary-more-body .more-tech-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.summary-more-body .more-sec--secondary {
  opacity: 0.92;
  margin-top: 8px;
}

.summary-more-body .more-sec {
  margin-bottom: 18px;
}

.summary-more-body .more-sec h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.summary-more-body .model-ans {
  font-size: 14px;
  line-height: 1.55;
}

.judges-deep-pack .judges-deep-hint {
  margin: 0 0 12px;
}

details.judge-deep {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px 10px;
  background: var(--surface-soft);
}

details.judge-deep > summary.judge-deep-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  font-weight: 600;
  color: var(--text);
}

details.judge-deep > summary.judge-deep-summary::-webkit-details-marker {
  display: none;
}

.judge-deep-title {
  flex: 1;
  min-width: min(100%, 160px);
  text-align: left;
  line-height: 1.35;
}

.judge-deep-badge {
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.judge-deep-body {
  padding-bottom: 4px;
}

.judge-panel {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--accent) 15%);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.judge-panel--closing {
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent2) 20%);
  background: color-mix(in srgb, var(--accent2) 8%, var(--surface));
}

.judge-panel--errors {
  border-color: color-mix(in srgb, var(--border) 75%, var(--danger) 14%);
}

.judge-panel--improve {
  border-color: color-mix(in srgb, var(--border) 75%, var(--ok) 14%);
}

.judge-panel-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.judge-closing-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.summary-majority-hint {
  opacity: 0.92;
}

.judge-deep-h4 {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.judge-score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0 4px;
}

.judge-score-table th,
.judge-score-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.judge-score-table thead th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
}

.judge-score-total td,
.judge-score-total th {
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.judge-breakdown .judge-crit-line {
  margin: 0 0 10px;
  font-size: 14px;
}

.judge-breakdown-scroll {
  overflow-x: auto;
}

.judge-breakdown-list {
  display: grid;
  gap: 10px;
  margin: 8px 0 10px;
}

.judge-answer-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface);
}

.judge-answer-card.card-ok {
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
}

.judge-answer-card.card-warn {
  background: color-mix(in srgb, #f1c40f 16%, var(--surface));
}

.judge-answer-card.card-bad {
  background: color-mix(in srgb, #d84a4a 10%, var(--surface));
}

.judge-answer-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.judge-answer-title.is-ok {
  color: var(--ok);
}

.judge-answer-title.is-warn {
  color: #f1c40f;
}

.judge-answer-title.is-bad {
  color: #d84a4a;
}

.judge-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0 10px;
}

.judge-breakdown-table th,
.judge-breakdown-table td {
  border: 1px solid var(--border);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.judge-breakdown-table thead th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
}

.judge-breakdown-table td .crit-cell {
  border-radius: 8px;
  padding: 7px 8px;
}

.judge-breakdown-table td .crit-main {
  margin: 0;
}

.judge-breakdown-table td .crit-note {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.judge-breakdown-table td .crit-ok {
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.judge-breakdown-table td .crit-warn {
  background: color-mix(in srgb, #f1c40f 18%, transparent);
}

.judge-breakdown-table td .crit-bad {
  background: color-mix(in srgb, #d84a4a 13%, transparent);
}

.ans-highlight {
  display: inline;
  padding: 1px 4px;
  border-radius: 5px;
}

.ans-highlight.ans-highlight-bad {
  background: color-mix(in srgb, #d84a4a 28%, transparent);
  color: #8e1f1f;
}

.ans-highlight.ans-highlight-warn {
  background: color-mix(in srgb, #f1c40f 28%, transparent);
  color: #6b5600;
}

.judge-q-label {
  font-weight: 700;
}

.judge-q-label.judge-q-ok {
  color: var(--ok);
}

.judge-q-label.judge-q-bad {
  color: #d84a4a;
}

.judge-breakdown-table th.judge-q-cell-ok {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}

.judge-breakdown-table th.judge-q-cell-bad {
  background: color-mix(in srgb, #d84a4a 12%, transparent);
}

.judge-err-wrap .err-group h4 {
  margin: 10px 0 6px;
  font-size: 13px;
}

.judge-improve {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.judge-action-list {
  margin: 0;
  padding-left: 20px;
}

.judge-action-list li + li {
  margin-top: 6px;
}

.summary-synth h3 {
  margin-top: 0;
  color: var(--text);
}

details.judge-details {
  margin-bottom: 8px;
}

details.judge-details > summary.judge-details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--text);
}

.judge-details-name {
  flex: 1;
  text-align: left;
}

.judge-details-score {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.judge-details-body {
  padding-top: 8px;
}

.judge-mini-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 8px 0 12px;
}

.judge-mini-pt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.judge-mini-pt.pt-one {
  background: color-mix(in srgb, var(--ok) 22%, transparent);
  color: var(--ok);
}

.judge-mini-pt.pt-zero {
  color: var(--muted);
}

.judge-mini-sum {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.judges-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.judge-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}

.summary .judge-card h3 {
  color: var(--text);
}

.judge-voice {
  margin: 0 0 10px;
}

.fipi-series {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}

.judge-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 10px 0 0;
}

.judge-table th,
.judge-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.judge-table thead th {
  background: var(--surface-soft);
  font-weight: 600;
  color: var(--muted);
}

.judge-table tbody th[scope="row"] {
  width: 7rem;
  white-space: nowrap;
  color: var(--muted);
}

.judge-closing {
  margin: 12px 0 0;
  font-size: 14px;
}

.points-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
}

.pt-cell {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pt-q {
  font-size: 12px;
  color: var(--muted);
}

.pt-val {
  font-size: 18px;
  font-weight: 800;
}

.pt-zero {
  color: #fb7185;
}

.pt-one {
  color: #34d399;
}

.summary-toggle > summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-toggle > summary::after {
  content: "▾";
  float: right;
  transform: rotate(-90deg);
  transition: transform var(--transition-fast);
}

.summary-toggle[open] > summary::after {
  transform: rotate(0deg);
}

.summary-toggle[open] > summary {
  margin-bottom: 10px;
}

#stepHome.step-enter,
#stepTopic.step-enter,
#stepExam.step-enter,
#stepSummary.step-enter {
  animation: sectionIn 220ms ease-out;
}

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

.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface-soft) 92%, white 8%) 25%, color-mix(in srgb, var(--surface-soft) 84%, white 16%) 37%, color-mix(in srgb, var(--surface-soft) 92%, white 8%) 63%);
  background-size: 400% 100%;
  animation: skeletonShimmer 1.25s ease infinite;
}

.skeleton-line {
  height: 14px;
  margin: 8px 0;
}

.skeleton-line.w40 {
  width: 40%;
}

.skeleton-line.w60 {
  width: 60%;
}

.skeleton-line.w80 {
  width: 80%;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.err-group {
  margin: 10px 0;
}

.err-group h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.err-issue {
  color: #fb7185;
  font-weight: 600;
}

.err-fix {
  color: #34d399;
  font-weight: 600;
}

.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;
}

kbd {
  font: inherit;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* ---------- Светлая тема ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --text: #0f172a;
  --muted: #475569;
  --bg: #f1f5f9;
  --bg-2: #eaf1f8;
  --card: #ffffff;
  --border: #d2dceb;
  --accent: #0ea5e9;
  --accent2: #7c3aed;
  --danger: #e11d48;
  --ok: #15803d;
  --surface: #ffffff;
  --surface-soft: #f4f8ff;
  --bar-track: rgba(15, 23, 42, 0.1);
  --popover-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1200px 620px at 0% -8%, rgba(14, 165, 233, 0.14) 0%, transparent 62%),
    radial-gradient(920px 540px at 100% -10%, rgba(124, 58, 237, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

html[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), #ffffff 45%), var(--card);
}

html[data-theme="light"] .primary {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(124, 58, 237, 0.18));
  border-color: rgba(14, 165, 233, 0.45);
}

html[data-theme="light"] .error {
  color: #9f1239;
  background: rgba(251, 113, 133, 0.15);
  border-color: rgba(251, 113, 133, 0.45);
}

html[data-theme="light"] .timer.warn {
  color: #9f1239;
  border-color: rgba(225, 29, 72, 0.45);
}

html[data-theme="light"] .menu-dots:hover {
  border-color: rgba(2, 132, 199, 0.5);
}

html[data-theme="light"] .topic:hover {
  border-color: rgba(2, 132, 199, 0.5);
}

html[data-theme="light"] .topic.selected {
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.28) inset;
}
