/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Tokens ── */
:root {
  --page: #161515;
  --primary: #9b3549;
  --secondary: #5f2330;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
}

/* ── Base ── */
body {
  background: var(--page);
  color: var(--text-primary);
  font-family: 'Open Sans', sans-serif;
  min-height: 100vh;
}

/* ── Shell: full-viewport flex, centers the container in both axes ── */
.site-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Centered max-width container — photos + quiz ── */
.quiz-container {
  position: relative;
  width: 100%;
  max-width: 1440px;
  /* min-height must contain side images: top 103px + height 594px = 697px */
  min-height: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Desktop two-column layout ── */
.experience {
  width: 100%;
  max-width: 940px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Visual stage (promo image) ── */
.visual-stage {
  width: 384px;
  height: 392px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.promo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Quiz panel ── */
#quiz-main {
  width: 410px;
  flex-shrink: 0;
}

/* ── Quiz card ── */
.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.quiz-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Text container ── */
.text-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.quiz-heading {
  font-family: 'Open Sans', sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--text-primary);
  line-height: 1;
  outline: none;
}

.quiz-subtitle {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1;
}

/* ── Button ── */
.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  padding: 12px 16px;
  background: var(--primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.primary-button:hover {
  opacity: 0.9;
}

.primary-button:active {
  opacity: 0.8;
}

/* ── Loader screen ── */
.loader-card {
  gap: 32px;
}

.loader-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.loader-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.loader-pct {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 8px;
  width: 0%;
}

.loader-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.loader-hint {
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1;
}

/* ── Result screen ── */
.result-card {
  gap: 32px;
}

.result-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.result-box {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.result-box-title {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
  line-height: 1;
}

.result-box-body {
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1;
}

.result-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.redirect-error {
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  color: #ff6b6b;
  text-align: center;
}

/* ── Mobile ── */
@media (max-width: 900px) {
  .site-shell {
    display: block;
  }

  .quiz-container {
    min-height: 100vh;
  }

  /* Content container: absolute, anchored to top, spans full viewport height */
  .experience {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 375px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 24px;
    gap: 40px;
    box-sizing: border-box;
  }

  /* Remove transform so .quiz-card doesn't become the containing block for the absolute button */
  .quiz-card,
  .quiz-card.is-visible {
    transform: none;
  }

  .visual-stage {
    width: 250px;
    height: 255px;
    border-radius: 5px;
    flex-shrink: 0;
  }

  #quiz-main {
    width: 100%;
  }

  .quiz-card {
    gap: 16px;
  }

  .quiz-heading {
    font-size: 18px;
  }

  .quiz-subtitle {
    font-size: 14px;
  }

  /* Button: absolute, anchored to bottom of .experience (which spans 100vh) */
  .primary-button {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    width: auto;
    border-radius: 8px;
    font-size: 14px;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .quiz-card,
  .primary-button {
    transition: none;
  }
}

/* ════════════════════════════════════════
   QUESTION SCREEN (steps 2+)
   ════════════════════════════════════════ */

/* Side/mobile images — hidden until question screen */
.q-img { display: none; }

/* ── Steps indicator ── */
.steps {
  display: flex;
  align-items: center;
}

.step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.step-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-primary);
}

.step-dot.done {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--text-primary);
}

.step-line {
  width: 16px;
  height: 1px;
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

/* ── Answer list ── */
.answer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* ── Desktop question / loader / result layout ── */
body.screen-question .visual-stage,
body.screen-loader .visual-stage,
body.screen-result .visual-stage { display: none; }

body.screen-question .q-img--mobile,
body.screen-loader .q-img--mobile,
body.screen-result .q-img--mobile { display: none; }

body.screen-question .experience,
body.screen-loader .experience,
body.screen-result .experience {
  justify-content: center;
}

body.screen-question #quiz-main,
body.screen-loader #quiz-main,
body.screen-result #quiz-main {
  width: 410px;
  flex-shrink: 0;
}

/* Question/loader/result heading is smaller than intro heading */
body.screen-question .quiz-heading,
body.screen-loader .quiz-heading,
body.screen-result .quiz-heading {
  font-size: 24px;
}

/* Side images: absolutely positioned relative to .quiz-container */
body.screen-question .q-img--left,
body.screen-question .q-img--right,
body.screen-loader .q-img--left,
body.screen-loader .q-img--right,
body.screen-result .q-img--left,
body.screen-result .q-img--right {
  display: block;
  position: absolute;
  top: 103px;
  width: 311px;
  height: 594px;
  object-fit: cover;
  border-radius: 8px;
}
body.screen-question .q-img--left,
body.screen-loader .q-img--left,
body.screen-result .q-img--left { left: 70px; }
body.screen-question .q-img--right,
body.screen-loader .q-img--right,
body.screen-result .q-img--right { right: 70px; }

/* ── Mobile question / loader / result layout ── */
@media (max-width: 900px) {
  body.screen-question .experience,
  body.screen-loader .experience,
  body.screen-result .experience {
    /* Reset intro's absolute positioning */
    position: relative;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    flex-direction: column;
    justify-content: flex-start; /* image at top, quiz-main fills the rest */
    align-items: center;
    padding: 24px;
    gap: 0;
  }

  body.screen-question .q-img--mobile,
  body.screen-loader .q-img--mobile,
  body.screen-result .q-img--mobile {
    display: block;
    width: 327px;
    height: 178px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
  }

  body.screen-question .q-img--left,
  body.screen-question .q-img--right,
  body.screen-loader .q-img--left,
  body.screen-loader .q-img--right,
  body.screen-result .q-img--left,
  body.screen-result .q-img--right { display: none; }

  /* quiz-main fills the remaining height after the image */
  body.screen-question #quiz-main,
  body.screen-loader #quiz-main,
  body.screen-result #quiz-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  /* quiz-card stretches to fill quiz-main, text at top, buttons at bottom */
  body.screen-question .quiz-card {
    flex: 1;
    justify-content: flex-start;
    gap: 16px;
    padding-top: 16px;
  }

  /* loader-card / result-card: stretch, footer at bottom */
  body.screen-loader .loader-card,
  body.screen-result .result-card {
    flex: 1;
    justify-content: space-between;
    padding-top: 16px;
  }

  /* result box mobile sizes */
  body.screen-result .result-box {
    padding: 12px 16px;
  }

  body.screen-result .result-box-title {
    font-size: 14px;
  }

  body.screen-result .result-box-body {
    font-size: 13px;
  }

  body.screen-result .loader-hint {
    font-size: 13px;
  }

  /* Push answer buttons to the bottom of the card */
  body.screen-question .answer-list {
    margin-top: auto;
  }

  /* Heading smaller on mobile question/loader/result */
  body.screen-question .quiz-heading,
  body.screen-loader .quiz-heading,
  body.screen-result .quiz-heading { font-size: 16px; }

  /* Buttons in question/loader/result screen are in normal flow — not absolute */
  body.screen-question .primary-button,
  body.screen-loader .primary-button,
  body.screen-result .primary-button {
    position: static;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    font-size: 14px;
    border-radius: 8px;
  }

  /* Step dots smaller on mobile */
  .step-dot {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  /* Loader mobile overrides */
  .loader-pct {
    font-size: 14px;
  }

  .loader-hint {
    font-weight: 600;
    font-size: 14px;
  }
}
