/* Экран участника: мобильная вёрстка 360–430 px.
   Оболочка тёмная (--navy), контент — в светлых карточках --paper с радиусом 12 px, как на слайдах. */

html, body { height: 100%; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: calc(8px + env(safe-area-inset-top)) 20px 8px;
  font-size: 14px;
}

.brand { font-weight: 800; letter-spacing: 0.02em; color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-right .muted { color: var(--on-dark-muted); }

.net-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 16px 20px;
}

.view { display: flex; flex-direction: column; gap: 16px; }
.view-center { flex: 1; align-items: center; justify-content: center; text-align: center; }

/* Текст на тёмной оболочке */
.title { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; color: var(--on-dark); }
.lead { font-size: 16px; line-height: 1.45; color: var(--on-dark-muted); }
.hint { font-size: 14px; min-height: 1.4em; color: var(--on-dark-muted); }
.error { color: var(--accent); font-size: 15px; font-weight: 600; }

/* Светлая карточка — базовый контейнер контента */
.card,
.form,
.welcome,
.option,
.res-section,
.res-hero,
.done {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
}

.card .muted, .form .muted, .welcome .muted, .res-section .muted, .res-hero .muted { color: var(--muted); }

/* Форма регистрации */
.form { display: flex; flex-direction: column; gap: 12px; padding: 20px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.field-label b { color: var(--accent); }
.field-hint { font-size: 13px; }

.field input {
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 17px;
  outline: none;
  transition: border-color 0.15s ease;
}

.field input::placeholder { color: #9aa3a9; }
.field input:focus { border-color: var(--blue); }
.field input.invalid { border-color: var(--accent); }

.linkish {
  align-self: flex-start;
  margin-top: -6px;
  padding: 6px 0;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.check input.invalid { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }

/* Приветствие после регистрации */
.welcome {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px;
  text-align: left;
  font-size: 16px;
  line-height: 1.45;
  width: 100%;
}

.welcome-title { font-size: 28px; font-weight: 800; color: var(--accent); letter-spacing: -0.01em; }

/* Реакции — на тёмной оболочке, карточки --navy-2 */
.reactions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding-top: 16px;
  margin-top: auto;
}

.react {
  flex: 1;
  max-width: 200px;
  min-height: 64px;
  border-radius: var(--radius);
  background: var(--navy-2);
  border: 1px solid var(--on-dark-line);
  font-size: 34px;
  line-height: 1;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.2s ease;
}

.react span { display: inline-block; }
.react.pop span { animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.react.cooldown { opacity: 0.6; }

.reactions.big .react { min-height: 132px; font-size: 56px; }
.reactions.big { flex: 1; align-items: center; padding-top: 0; }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(-8deg); }
  100% { transform: scale(1); }
}

.slide-caption { font-size: 15px; color: var(--on-dark-muted); }
/* Слайд на телефоне: кадр 16:9 срезает чёрные поля страниц PDF (как cover у ведущего) */
.slide-figure { width: 100%; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.slide-frame { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: var(--paper); border: 1px solid var(--on-dark-line); }
.slide-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.slide-index { font-size: 13px; color: var(--on-dark-muted); font-variant-numeric: tabular-nums; }

/* Планшет в портрете: карточки и слайд шире телефонных 480 px */
@media (min-width: 700px) {
  .app { max-width: 720px; }
}

/* Альбомная ориентация на слайде (телефон и планшет): слайд во весь экран, реакции — две кнопки поверх справа */
@media (orientation: landscape) {
  body.slide-mode .topbar,
  body.slide-mode .slide-index,
  body.slide-mode .slide-caption { display: none; }
  body.slide-mode .screen { padding: 0; }
  body.slide-mode .slide-figure {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
  }
  body.slide-mode .slide-frame {
    width: min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
    border-radius: 0;
    border: 0;
  }
  body.slide-mode .reactions {
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 6;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
  }
  body.slide-mode .react {
    flex: none;
    width: 56px;
    min-height: 56px;
    font-size: 26px;
    background: rgba(9, 38, 52, 0.72);
    border-color: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(4px);
  }
}

/* Вопрос: эйбров и вопрос на тёмном, варианты — светлые карточки */
.question-text { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--on-dark); margin-top: -6px; }

.options { display: flex; flex-direction: column; gap: 8px; }

.option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--paper);
  text-align: left;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.option:active { transform: scale(0.985); }
.option.selected { border-color: var(--accent); }

.option-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--blue-tint);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.option.selected .option-fill { background: var(--accent-tint); }

.option-label { position: relative; z-index: 1; flex: 1; }

.option-pct {
  position: relative;
  z-index: 1;
  min-width: 3.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.options.answered .option-pct { opacity: 1; }
.option.selected .option-pct { color: var(--ink); }

/* Агент */
.card {
  width: 100%;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.card-title { font-size: 22px; font-weight: 700; }

.agent-icon { width: 56px; height: 56px; display: grid; place-items: center; font-size: 44px; }
.agent-icon.spinner { width: 44px; height: 44px; border-width: 4px; }

/* ---------- Финал: разбор ---------- */

.final { gap: 12px; }

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

/* Эйбров секции на светлой карточке — синий капс, как на светлых слайдах PDF */
.res-kicker,
.res-h {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--blue);
  line-height: 1.3;
}

.res-h {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 12px;
}

.res-h-note {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.res-section { padding: 20px 16px; }

.res-p { font-size: 16px; line-height: 1.5; }
.res-p + .res-p { margin-top: 12px; }

.res-name { font-size: 24px; font-weight: 800; line-height: 1.15; margin: -4px 0 12px; letter-spacing: -0.01em; }

/* Шапка: уровень, балл, полоса, зал */
.res-hero { display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; }

.res-title { font-size: 32px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.res-subtitle { font-size: 17px; color: var(--muted); }

.res-score { margin-top: 10px; font-size: 17px; color: var(--muted); }
.res-score b { font-size: 40px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; margin-right: 2px; line-height: 1; }

.res-bar { height: 12px; }

.hall { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.hall-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }

.hall-bars {
  display: grid;
  grid-template-columns: repeat(19, 1fr);
  gap: 3px;
  height: 64px;
  align-items: end;
}

.hall-col { display: flex; align-items: flex-end; height: 100%; }

.hall-bar {
  display: block;
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: var(--steel);
  transition: height 0.5s ease;
}

.hall-col.you .hall-bar { background: var(--accent); }

.hall-axis {
  position: relative;
  height: 20px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hall-tick { position: absolute; top: 0; }
.hall-tick:first-child { left: 0; }
.hall-tick:last-child { right: 0; }
.hall-tick.hide { visibility: hidden; }

.hall-you {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 700;
  color: var(--accent);
}

.hall-you.left { left: 0; transform: none; }
.hall-you.right { right: 0; transform: none; }

/* Карта по блокам: точка цветом по баллу (0–1 accent, 2 жёлтый, 3 зелёный) */
.map { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

.map-row { display: grid; grid-template-columns: 14px 1fr; gap: 12px; align-items: start; }

.map-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--score-mid);
}

.map-dot.red { background: var(--score-low); }
.map-dot.yellow { background: var(--score-mid); }
.map-dot.green { background: var(--score-high); }

.map-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.map-title { font-size: 17px; font-weight: 700; }
.map-score { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 700; }
.map-tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.map-verdict { margin-top: 3px; font-size: 15px; line-height: 1.45; color: var(--ink); }

/* Три шага */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }

.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }

.step-num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--on-dark);
  font-weight: 800;
  font-size: 16px;
}

.step-body { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.step-title { font-size: 19px; font-weight: 700; line-height: 1.2; }
.step-text { font-size: 15px; line-height: 1.5; }
.step-meta { font-size: 14px; line-height: 1.45; color: var(--muted); }
.step-meta em { font-style: italic; }

/* Сайт */
.site-note {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--mid-tint);
  border: 1px solid rgba(217, 164, 0, 0.4);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.site-kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0 10px 14px;
  border-left: 3px solid var(--steel);
  margin-bottom: 12px;
}

.site-kv.bad { border-left-color: var(--accent); }
.site-kv.good { border-left-color: var(--score-high); }
.site-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.site-kv.bad .site-k { color: var(--accent); }
.site-kv.good .site-k { color: var(--score-high); }
.site-v { font-size: 15px; line-height: 1.5; }

.site-pending { display: flex; align-items: center; gap: 14px; }
.spinner.small { width: 22px; height: 22px; border-width: 3px; flex: none; }

.site-checks { margin-top: 6px; }

.site-checks summary {
  cursor: pointer;
  list-style: none;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--blue);
  user-select: none;
}

.site-checks summary::-webkit-details-marker { display: none; }
.site-checks summary::before { content: '▸'; font-size: 13px; transition: transform 0.15s ease; }
.site-checks[open] summary::before { transform: rotate(90deg); }

.checks { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.checks-group {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.checks-group:first-child { margin-top: 0; }

.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }

.check-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  background: var(--line);
  color: var(--muted);
}

.check.ok .check-mark { background: var(--high-tint); color: var(--score-high); }
.check.missing .check-mark { background: var(--accent-tint); color: var(--accent); }
.check.problem .check-mark { background: var(--mid-tint); color: #9a7400; }

.check-body { display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.check-title { font-size: 15px; font-weight: 700; }
.check-text { font-size: 14px; line-height: 1.45; color: var(--muted); }

/* Агент в финале — карточка внутри секции, без второй рамки */
.res-agent .card { padding: 4px 0 0; text-align: center; }

/* Кнопки финала — на тёмной оболочке */
.final-actions { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.permalink { display: flex; flex-direction: column; gap: 6px; padding: 12px 0 0; border-top: 1px solid var(--on-dark-line); margin-top: 6px; }
.permalink-title { font-size: 14px; color: var(--on-dark-muted); }
.permalink-url { font-size: 14px; font-weight: 700; color: var(--on-dark); word-break: break-all; }
.final-actions .btn { color: var(--on-dark); }
.final-actions .btn-primary { color: #fff; }

.done {
  padding: 14px 16px;
  color: var(--score-high);
  font-weight: 700;
  text-align: center;
}

/* Строка статуса агента */
.agent-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 20px calc(8px + env(safe-area-inset-bottom));
  background: var(--navy-2);
  border-top: 1px solid var(--on-dark-line);
  font-size: 13px;
  color: var(--on-dark-muted);
}

.agent-bar a { margin-left: auto; font-weight: 700; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--on-dark-muted); flex: none; }
.dot.busy { background: var(--score-mid); animation: pulse 1.2s ease-in-out infinite; }
.dot.ready { background: var(--score-high); }
.dot.failed { background: var(--accent); }

@keyframes pulse { 50% { opacity: 0.35; } }
