:root {
  --canvas: #ffffff;
  --group: #f1f2f5;
  --text: #171719;
  --sec: #6e6e76;
  --ter: #73737d;
  --blue: #1295f3;
  --violet: #6a43f4;
  --green: #17914a;
  --red: #c43d57;
  --line: #ececef;
  --link: #0b6fbe;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

html, body { margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  min-height: 100dvh;
  background: #e7e9ee;
  color: var(--text);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 8px;
}

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

.app {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  max-height: 932px;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

@media (min-width: 500px) {
  .app {
    height: min(100dvh - 48px, 900px);
    border-radius: 32px;
    box-shadow: 0 30px 80px rgba(16, 24, 40, 0.18), 0 0 0 1px rgba(16, 24, 40, 0.06);
  }
}

.status {
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px 0 30px;
  font-size: 13px;
  font-weight: 600;
}

.status .icons { display: flex; gap: 5px; align-items: center; }

.app-head {
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #f4f4f6;
}

.app-head .side {
  font-size: 15px;
  color: var(--sec);
  min-width: 64px;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.app-head .head-title { font-size: 15px; font-weight: 600; }

.app-head .head-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.btn {
  height: 48px;
  border-radius: 13px;
  background: #080809;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
}

.btn:active { transform: scale(0.995); }

.link {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: center;
  font-size: 14px;
  color: var(--link);
  font-weight: 600;
  padding: 12px 0 0;
  cursor: pointer;
  background: none;
  border: 0;
  font-family: inherit;
}

/* loading / error */
.loading {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--sec);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--group);
  border-top-color: var(--blue);
  animation: spin 0.9s linear infinite;
}

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

.error-box { margin: auto; padding: 24px; text-align: center; max-width: 340px; }
.error-box h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: -0.3px; }
.error-box p { color: var(--sec); font-size: 15px; line-height: 1.45; margin: 0 0 22px; }

/* start */
.cover {
  height: 164px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    radial-gradient(100% 80% at 100% 0%, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 60%),
    linear-gradient(135deg, #1295f3, #6a43f4);
}

.cover-kicker {
  position: absolute;
  top: 16px;
  left: 18px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

.cover-q {
  position: absolute;
  right: 6px;
  bottom: -38px;
  font-size: 150px;
  font-weight: 800;
  opacity: 0.14;
  line-height: 1;
}

.cover-title { font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -0.4px; position: relative; }

.title-xl { font-size: 26px; font-weight: 900; letter-spacing: -0.5px; line-height: 1.15; margin: 18px 0 6px; text-wrap: wrap; }

.sub { font-size: 16px; font-weight: 400; color: var(--sec); line-height: 1.35; margin: 0; }

.chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.chip {
  font-size: 12.5px;
  font-weight: 500;
  color: #3a3c42;
  background: var(--group);
  border-radius: 999px;
  padding: 7px 11px;
}

.foot { margin-top: auto; padding-top: 14px; }

.fine { text-align: center; font-size: 11.5px; color: var(--ter); margin-top: 10px; line-height: 1.3; }

/* question */
.progress { height: 4px; background: var(--group); border-radius: 2px; margin: 0 20px; overflow: hidden; flex: 0 0 4px; }

.progress i {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
  transition: width 0.25s ease;
}

.body-q { padding-top: 16px; overflow-y: auto; }
.timer { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.timer-track { flex: 1; height: 6px; border-radius: 3px; background: var(--group); overflow: hidden; }
.timer-track i { display: block; height: 100%; width: 100%; border-radius: 3px; background: var(--blue); }
.timer b { min-width: 30px; text-align: right; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.low .timer-track i { background: var(--red); }
.timer.low b { color: var(--red); }
.next-bar { padding: 10px 20px 24px; background: #fff; border-top: 1px solid var(--line); }
.btn:disabled { opacity: 0.35; cursor: default; }
/* строка разбора: нажатие раскрывает подробности */
.brow.xp { display: block; padding: 0; }
.brow-head { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 5px 0; margin: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.brow-head:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }
.brow-head .t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.brow-head .chev { flex: 0 0 14px; font-style: normal; color: var(--ter); text-align: center; transition: transform 0.2s; }
.brow.xp.open .chev { transform: rotate(180deg); }
.brow-more { display: flex; flex-direction: column; gap: 2px; padding: 0 0 8px 23px; font-size: 12.5px; line-height: 1.35; }
.brow-more em { font-style: normal; color: var(--sec); }
.brow-more .good { color: var(--green); }
.brow-more .wrong { color: var(--red); }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.brow.detail { align-items: flex-start; padding: 6px 0; }
.brow.detail .m { margin-top: 1px; }
.brow.detail .what { display: flex; flex-direction: column; gap: 2px; white-space: normal; overflow: visible; }
.brow.detail .what b { font-weight: 600; color: var(--text); }
.brow.detail .what em { font-style: normal; color: var(--sec); }
.brow.detail .what .good { color: var(--green); }
.brow.detail .what .wrong { color: var(--red); }

.q-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.q-num { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sec); }

.cover.has-image { background-size: cover; background-position: center; }

.q-media {
  display: block;
  width: 100%;
  max-height: 280px;
  border-radius: 14px;
  background: var(--group);
  margin: 0 0 14px;
  object-fit: contain;
}

.q-video { background: #000; }

.q-audio {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.q-audio-label { font-size: 12.5px; font-weight: 600; color: var(--sec); margin-bottom: 8px; }
.q-audio audio { width: 100%; }

.q-image {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--group);
  border-radius: 14px;
  margin: 0 0 14px;
}

.q-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.45px;
  line-height: 1.2;
  margin: 0 0 18px;
  text-wrap: wrap;
}

.q-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--group); margin: 0 0 14px; }
/* Видео и звук в рамке (формат «Полоса») и на весь экран */
.q-video-frame, .q-audio-frame { background: #000; }
.q-audio-frame { background: #14161b; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.q-audio-frame audio { display: none; }
.mp-stage { display: grid; place-items: center; padding-bottom: 26px; }
.mp-over { position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; }
.q-frame.playing .mp-over .mp-play { opacity: 0; }
.q-frame.playing .mp-over:hover .mp-play, .q-frame.playing .mp-over:focus-within .mp-play { opacity: 1; }
.mp-play { width: 52px; height: 52px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.95); color: #14161b; display: grid; place-items: center; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); cursor: pointer; transition: opacity 0.2s; }
.mp-play.big { width: 68px; height: 68px; }
.mp-play svg { width: 28px; height: 28px; fill: currentColor; }
.mp-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 18px 14px 10px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.5)); }
.mp-bar { position: relative; flex: 1; height: 20px; cursor: pointer; outline: none; }
.mp-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); }
.mp-bar i { position: absolute; left: 0; top: 8px; height: 4px; border-radius: 2px; background: #fff; }
.mp-bar:focus-visible::before { box-shadow: 0 0 0 2px #1295f3; }
.mp-time { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-sound { position: absolute; top: 12px; right: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border: 0; border-radius: 17px; background: rgba(0, 0, 0, 0.55); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.mp-sound svg { width: 18px; height: 18px; }
/* «Вопрос-ответ»: карточка переворачивается за 0,7 с; при «меньше движения» стороны просто сменяются растворением */
.q-flip { overflow: visible; background: none; perspective: 1200px; }
.q-flip-card { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1); }
.q-flip-card.flipped { transform: rotateY(180deg); }
.q-flip.instant .q-flip-card { transition: none; }
.q-flip-face { position: absolute; inset: 0; border-radius: 14px; overflow: hidden; background: var(--group); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.q-flip-face.back { transform: rotateY(180deg); }
/* «Вопрос-ответ» без картинки вопроса: градиент с текстом вопроса; пока он на экране, заголовок вопроса под карточкой скрыт */
.q-flip-face.grad { color: #fff; }
.q-flip-text { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 18px 22px; overflow-y: auto; scrollbar-width: none; font-size: 26px; font-weight: 900; line-height: 1.25; text-align: center; text-wrap: wrap; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.18); }
.q-flip-text::-webkit-scrollbar { display: none; }
.q-flip-text-in { margin: auto 0; }
.screen-q.flip-front .q-text { display: none; }
@media (prefers-reduced-motion: reduce) {
  .q-flip { perspective: none; }
  .q-flip-card { transform-style: flat; transition: none; }
  .q-flip-card.flipped { transform: none; }
  .q-flip-face { backface-visibility: visible; -webkit-backface-visibility: visible; transition: opacity 0.35s; }
  .q-flip-face.back { transform: none; opacity: 0; }
  .q-flip-card.flipped .q-flip-face.front { opacity: 0; }
  .q-flip-card.flipped .q-flip-face.back { opacity: 1; }
}
.q-frame-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: var(--px, 50%) var(--py, 50%); transform-origin: var(--px, 50%) var(--py, 50%); transform: scale(var(--z, 1)); user-select: none; -webkit-user-drag: none; }
.qs-m .q-text { font-size: 19px; }
.qs-s .q-text { font-size: 17px; }
.q-text.sc { overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
.q-text.sc::-webkit-scrollbar { display: none; }
.q-text.fb { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%); mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%); }
.opts.compact { gap: 8px; }
.opts.compact .opt { min-height: 44px; padding: 6px 12px; font-size: 14px; }
.opts.compact .opt .key { width: 24px; height: 24px; flex: 0 0 24px; font-size: 11.5px; }
/* фото на весь экран: вопрос и кнопки лежат поверх */
.screen-q.fmt-full #qimage { position: absolute; inset: 0; z-index: 0; background: #1b1b1f; }
.screen-q.fmt-full #qimage .q-frame { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0; aspect-ratio: auto; }
.screen-q.fmt-full #qimage::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0.38) 40%, rgba(0, 0, 0, 0.8) 100%); pointer-events: none; }
.screen-q.fmt-full .progress { position: relative; z-index: 2; }
.screen-q.fmt-full .body-q > :not(#qimage) { position: relative; z-index: 1; }
.screen-q.fmt-full .q-num, .screen-q.fmt-full .q-hint { color: rgba(255, 255, 255, 0.8); }
.screen-q.fmt-full .q-text, .screen-q.fmt-full .timer b { color: #fff; }
.screen-q.fmt-full .timer-track { background: rgba(255, 255, 255, 0.3); }
.screen-q.fmt-full .q-num { margin-bottom: 0; }
.screen-q.fmt-full .q-top { margin-bottom: auto; }
.screen-q.fmt-full .opt { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.32); color: #fff; }
.screen-q.fmt-full .opt .key { background: rgba(255, 255, 255, 0.25); color: #fff; }
.screen-q.fmt-full .opt.picked { background: rgba(255, 255, 255, 0.34); border-color: #fff; }
.screen-q.fmt-full .opt.ok { background: rgba(23, 145, 74, 0.6); border-color: #86e3a8; }
.screen-q.fmt-full .opt.bad { background: rgba(196, 61, 87, 0.6); border-color: #ffa0b3; }
.screen-q.fmt-full .opt.dim { opacity: 0.5; }

.screen-q.fmt-full .q-text { font-size: 28px; }
.screen-q.fmt-full.qs-m .q-text { font-size: 24px; }
.screen-q.fmt-full.qs-s .q-text { font-size: 20px; }
/* на весь экран: видео играет фоном, кнопка «Звук» под строкой прогресса; звук — тёмный фон с плеером в верхней части */
/* слои на весь экран: ответы и текст лежат над фоном (z-index 1), а панель пояснения и кнопка «Дальше» ещё выше */
.screen-q.fmt-full .next-bar { position: relative; z-index: 5; }
.screen-q.fmt-full .sheet { z-index: 6; }
/* кнопка «Звук» стоит в строке «ВОПРОС N ИЗ M», чтобы не закрывать заголовок (её переносит placeSound) */
.q-top .mp-sound { position: static; }
.screen-q.fmt-full .q-audio-full { justify-content: flex-start; padding-top: 12%; }
/* под плеером звука резервируется место, чтобы длинный вопрос не закрыл его */
.screen-q.fmt-full.media-audio .q-top { min-height: 200px; align-items: flex-start; }
.screen-q.fmt-full .q-audio-full .mp-controls { position: relative; width: 100%; background: none; padding: 0 22px; margin-top: 4px; }
.screen-q.fmt-full .q-audio-full .mp-stage { padding-bottom: 14px; }
.q-text:focus, .q-text:focus-visible, .score:focus, .score:focus-visible { outline: none; }

.opts { display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 12px;
  background: #fff;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}

.opt:active { background: #fafafb; }
.opt[aria-disabled="true"] { cursor: default; }
.opt.picked { border-color: var(--blue); background: #f2f9ff; }
.opt.ok { border-color: var(--green); background: #f1fbf5; }
.opt.bad { border-color: var(--red); background: #fdf3f5; }
.opt.dim { opacity: 0.42; }

.opt .key {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--group);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #5d616b;
  flex: 0 0 28px;
}

.opt.ok .key { background: var(--green); color: #fff; }
.opt.bad .key { background: var(--red); color: #fff; }

.q-hint { margin-top: auto; padding-top: 14px; text-align: center; font-size: 12px; color: var(--ter); }

/* sheet */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 26px;
  box-shadow: 0 -12px 40px rgba(16, 24, 40, 0.16);
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.on { transform: none; }

.handle { width: 38px; height: 4px; border-radius: 2px; background: #e3e4e8; margin: 0 auto 14px; }

.verdict { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.verdict-ic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  background: var(--green);
}

.verdict-ic.bad { background: var(--red); }
.verdict-ic.info { background: var(--blue); }

.verdict b { font-size: 19px; font-weight: 800; letter-spacing: -0.2px; }

.sheet p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.4; color: #3a3c42; }

/* result */
.body-result { padding: 14px 20px 20px; }

.score { font-size: 46px; font-weight: 800; letter-spacing: -1.6px; line-height: 1; margin-top: 4px; font-variant-numeric: tabular-nums; }

.score span { font-size: 24px; color: var(--ter); font-weight: 700; }
.score.types { font-size: 30px; letter-spacing: -0.6px; line-height: 1.1; }

.score-cap { font-size: 17px; font-weight: 700; margin-top: 8px; }

.score-sub { font-size: 13.5px; color: var(--sec); margin-top: 3px; }
.score-rank { display: inline-block; align-self: flex-start; margin-top: 8px; padding: 5px 12px; border-radius: 999px; background: #e8f6ee; color: var(--green); font-size: 13px; font-weight: 800; }
/* окно с картинкой для «Поделиться»: когда телефон не умеет отправлять картинку сам */
.share-sheet { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(16, 24, 40, 0.6); }
.share-box { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; padding: 16px; border-radius: 20px; background: #fff; text-align: center; }
.share-box b { font-size: 16px; }
.share-box img { display: block; width: 100%; max-height: 46vh; object-fit: contain; border-radius: 12px; background: var(--group); }
.share-box small { color: var(--sec); font-size: 12.5px; line-height: 1.35; }
.share-box .btn { text-decoration: none; }
.btn.light { background: var(--group); color: var(--text); }

.card { background: #f7f8fa; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }

.card h3 { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sec); margin: 0 0 8px; }

.brow { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.3; padding: 4px 0; color: #3a3c42; }

.brow .m { width: 15px; flex: 0 0 15px; text-align: center; font-weight: 700; margin-top: 1px; }
.brow .m.ok { color: var(--green); }
.brow .m.no { color: var(--red); }

.brow span { min-width: 0; overflow-wrap: anywhere; }

/* Разбор ответов: вопросы переносятся на несколько строк, а листается только сама карточка. */
#breakdownCard { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 150px; overflow: hidden; position: relative; padding-right: 6px; }
#breakdownCard h3 { flex: 0 0 auto; }
#breakdown { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#breakdownCard.more::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  background: linear-gradient(to bottom, rgba(247, 248, 250, 0), #f7f8fa 85%);
  pointer-events: none;
}
.result-image, .score, .score-cap, .score-sub { flex: 0 0 auto; }

.result-actions { margin-top: auto; padding-top: 10px; flex: 0 0 auto; }
.result-actions .btn { height: 44px; }
.result-actions .link { padding: 8px 0 0; }

/* toast / utilities */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #171719;
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 320px;
  text-align: center;
}

.toast.on { opacity: 1; transform: translate(-50%, 0); }

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

/* полноэкранная обложка */
.hero {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background: linear-gradient(135deg, #1295f3, #6a43f4);
  background-size: cover;
  background-position: center;
}

.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--px, 50%) var(--py, 50%); transform-origin: var(--px, 50%) var(--py, 50%); transform: scale(var(--z, 1)); user-select: none; -webkit-user-drag: none; }

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.10) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.78) 100%);
}

.hero-content { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0 20px; }
/* Где начинается текст обложки: .hero.pos и --tt (процент высоты). Без настройки текст прижат к низу, над кнопкой. */
.hero-gap { flex: 0 0 0; }
.hero-text { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-top: 24px; overflow-y: auto; scrollbar-width: none; }
.hero-text::-webkit-scrollbar { display: none; }
.hero-text::before { content: ""; margin-top: auto; }
.hero-actions { flex: 0 0 auto; padding-bottom: 30px; }
.hero.pos .hero-gap { flex-basis: var(--tt); }
/* полутень у длинного текста обложки: сверху после прокрутки, снизу пока есть что листать */
.hero-text.fb { -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 36px), transparent 100%); }
.hero-text.ft { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 100%); }
.hero-text.ft.fb { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 36px), transparent 100%); }
.hero.pos .hero-text { padding-top: 0; }
.hero.pos .hero-text::before { display: none; }
.hero.pos .hero-scrim { background: linear-gradient(180deg, rgba(0, 0, 0, 0.10) 0%, rgba(0, 0, 0, 0.42) var(--tt), rgba(0, 0, 0, 0.78) 100%); }

.hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.4px;
  font-weight: 900;
  margin: 0 0 10px;
  text-wrap: wrap;
}

.hero-subtitle { font-size: 18px; font-weight: 700; opacity: 0.9; margin-bottom: 8px; }

.hero-lead { font-size: 16px; font-weight: 400; line-height: 1.4; opacity: 0.85; margin: 0 0 14px; max-width: 34ch; }

.hero-meta { font-size: 12.5px; opacity: 0.75; margin-bottom: 18px; }

.hero-btn { background: #fff; color: #080809; height: 54px; font-size: 16px; }

.hero-fine { text-align: center; font-size: 11.5px; opacity: 0.6; margin-top: 10px; }

.screen-start .hero { position: relative; flex: 1; min-height: 0; }  /* min-height: 0 — длинный текст листается внутри обложки, а не растягивает её за экран */

.result-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 14px;
  background: var(--group);
}

/* ---- карусель: полноэкранные листаемые карточки ---- */
html.carousel-mode .status, html.carousel-mode .app-head { display: none; }
html.carousel-mode .app { background: #000; }
.screen-car { background: #000; }
.car-view {
  position: absolute;
  inset: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  outline: none;
  cursor: grab;
}
.car-view::-webkit-scrollbar { display: none; }
.car-slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; color: #fff; }
.car-g0 { background: linear-gradient(160deg, #2b6fd6, #3a2a8f); }
.car-g1 { background: linear-gradient(160deg, #1f8a70, #15405a); }
.car-g2 { background: linear-gradient(160deg, #d9783b, #7a2150); }
.car-g3 { background: linear-gradient(160deg, #5a4bc4, #1c1a3d); }
.car-g4 { background: linear-gradient(160deg, #3c9f5a, #14412b); }
.car-g5 { background: linear-gradient(160deg, #c24b6b, #3b2250); }
/* Картинка заполняет экран без искажений и центрируется: лишнее по краям обрезается поровну. */
.car-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--px, 50%) var(--py, 50%); transform-origin: var(--px, 50%) var(--py, 50%); transform: scale(calc(var(--z, 1) * 1.06)); transition: transform 6s ease-out; user-select: none; -webkit-user-drag: none; }
.car-slide.on .car-img { transform: scale(var(--z, 1)); }
.car-slide .mp-sound { top: 30px; z-index: 4; }
.car-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.10) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.78) 100%); opacity: var(--dim, 1); pointer-events: none; }
.car-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 60%;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
  padding: 0 20px calc(34px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s 0.1s, transform 0.5s 0.1s;
}
.car-slide.on .car-text { opacity: 1; transform: none; }
/* Где начинается текст карточки: .car-slide.pos и --tt (процент высоты). Затемнение начинается вместе с текстом. */
.car-slide.pos .car-text { top: var(--tt); max-height: none; }
.car-slide.pos .car-scrim { background: linear-gradient(180deg, rgba(0, 0, 0, 0.10) 0%, rgba(0, 0, 0, 0.42) var(--tt), rgba(0, 0, 0, 0.78) 100%); }
.car-k { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.9; margin-bottom: 8px; }
.car-t { font-size: 30px; font-weight: 900; letter-spacing: -0.5px; line-height: 1.1; margin: 0 0 8px; text-wrap: wrap; }
.car-s { font-size: 18px; font-weight: 700; opacity: 0.92; margin-bottom: 8px; }
.car-p { font-size: 16px; font-weight: 400; line-height: 1.42; opacity: 0.88; margin: 0; }
/* Блок с текстом никогда не поднимается выше 60% экрана и листается целиком (заголовок, подзаголовок и текст вместе):
   палец попадает в любое место блока. Полутень сверху и снизу показывает, что есть ещё строки. */
.car-text::-webkit-scrollbar { display: none; }
.car-text.fb { -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 36px), transparent 100%); }
.car-text.ft { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 100%); }
.car-text.ft.fb { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 36px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 36px), transparent 100%); }
.car-seg { position: absolute; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; gap: 4px; z-index: 3; pointer-events: none; }
.car-seg i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); transition: background 0.3s; }
.car-seg i.on { background: #fff; }
.car-arrow { display: none; position: absolute; top: 50%; width: 38px; height: 38px; margin-top: -19px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.4); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; z-index: 3; align-items: center; justify-content: center; padding: 0 0 3px; }
.car-arrow.l { left: 10px; }
.car-arrow.r { right: 10px; }
@media (hover: hover) { .car-arrow { display: flex; } .car-arrow[hidden] { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .car-img, .car-slide.on .car-img { transform: scale(var(--z, 1)); transition: none; }
  .car-text { transform: none; }
}

/* На телефоне нарисованные строка состояния и шапка не нужны: у телефона и мессенджера они свои.
   Квиз занимает весь экран. В предпросмотре админки (класс preview) вид «телефона» остаётся. */
.preview-bar { display: none; }

@media (max-width: 499px) {
  html.preview-page .preview-bar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
    background: #17181c;
    color: #fff;
    font-size: 12.5px;
    line-height: 1.3;
  }
  html.preview-page .preview-bar a { color: #9fd0ff; font-weight: 600; white-space: nowrap; text-decoration: none; }
  html.preview-page body .screen { padding-top: 0; }
  html:not(.preview) body { background: var(--canvas); }
  html:not(.preview) .app { max-height: none; }
  html:not(.preview) .status,
  html:not(.preview) .app-head { display: none; }
  html:not(.preview) .screen { padding-top: env(safe-area-inset-top, 0px); }
  html:not(.preview) .hero-actions { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
  html:not(.preview) .next-bar { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  html:not(.preview) .sheet { padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
  html:not(.preview) .body-result { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
