:root {
  color-scheme: light;
  --navy: #0d1b2a;
  --blue: #173a5f;
  --blue-mid: #1a5fad;
  --blue-light: #4aaee8;
  --text-soft: #536273;
  --surface: #fff;
  --page: #f7f8fa;
  --line: #dce5ed;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--navy);
  background:
    radial-gradient(ellipse 430px 320px at 7% 17%, rgba(74, 174, 232, .13), transparent 76%),
    radial-gradient(ellipse 470px 340px at 95% 92%, rgba(23, 58, 95, .08), transparent 76%),
    var(--page);
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }
button { cursor: pointer; }

.page-shell {
  width: min(100%, 1140px);
  min-height: 100vh;
  margin-inline: auto;
  padding: 8px 24px 38px;
}

.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70px;
}

.brand-logo {
  display: block;
  width: clamp(220px, 33vw, 296px);
  height: auto;
}

.main-content { width: min(100%, 662px); margin: 9px auto 0; }
.intro { text-align: center; margin-bottom: 22px; }

.intro h1 {
  max-width: 620px;
  margin: 0 auto 10px;
  font-size: clamp(29px, 4.2vw, 40px);
  line-height: 1.16;
  letter-spacing: -.045em;
  font-weight: 800;
}
.intro h1 span { color: var(--blue-mid); }
.intro > p:last-child {
  max-width: 580px;
  margin: 0 auto;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.quiz-card {
  position: relative;
  overflow: hidden;
  min-height: 480px;
  padding: 27px 43px 29px;
  border: 1px solid rgba(23, 58, 95, .095);
  border-radius: 25px;
  background: var(--surface);
  box-shadow: 0 26px 65px rgba(13, 27, 42, .10), 0 4px 12px rgba(13, 27, 42, .025);
}
.quiz-topline {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #0f2d5a, #1a5fad 55%, #4aaee8);
}
.progress-track { overflow: hidden; height: 8px; margin-top: 3px; border-radius: 99px; background: #e8eef4; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #173a5f, #1a5fad, #4aaee8); transition: width .48s ease; }

.question-heading { margin-top: 24px; }
.question-kicker { color: var(--blue-mid); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.question-heading h2 {
  margin: 10px 0 7px;
  font-size: clamp(23px, 3.6vw, 30px);
  line-height: 1.27;
  letter-spacing: -.037em;
  font-weight: 800;
}
.question-heading h2:focus, .loading-panel h2:focus { outline: none; }
.question-hint { margin: 0; color: #697788; font-size: 13px; line-height: 1.5; }

.options { display: grid; gap: 10px; margin-top: 18px; }
.options--gender { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 62px;
  padding: 11px 15px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #203247;
  text-align: left;
  box-shadow: 0 2px 5px rgba(13, 27, 42, .02);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.option-button:hover { border-color: #8aaecd; background: #f9fcff; box-shadow: 0 5px 16px rgba(23, 58, 95, .07); transform: translateY(-1px); }
.option-button:focus-visible, .back-button:focus-visible, .loading-fallback:focus-visible { outline: 3px solid #4aaee8; outline-offset: 3px; }
.option-button.is-selected { border-color: var(--blue-mid); background: #eef6fd; box-shadow: 0 0 0 3px rgba(26, 95, 173, .09); }
.option-letter {
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #edf3f8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  transition: background .2s ease, color .2s ease;
}
.option-button.is-selected .option-letter { background: var(--blue); color: #fff; }
.option-text { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.45; }
.option-arrow { flex: 0 0 18px; width: 18px; height: 18px; color: #93a5b6; transition: color .2s ease, transform .2s ease; }
.option-button:hover .option-arrow, .option-button.is-selected .option-arrow { color: var(--blue-mid); transform: translateX(2px); }

.option-button--gender {
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-height: 164px;
  padding: 17px 12px;
  text-align: center;
}
.option-symbol {
  flex: 0 0 76px;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: linear-gradient(145deg, #e8f4fc, #eef3fb);
  color: var(--blue-mid);
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.option-symbol svg { display: block; width: 50px; height: 50px; }
.option-button--gender .option-text { flex: 0 1 auto; font-size: 17px; }
.option-button--gender:hover .option-symbol { transform: scale(1.05); }
.option-button--gender.is-selected .option-symbol { background: var(--blue); color: #fff; }

.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 28px; margin-top: 23px; }
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: -6px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #536273;
  font-size: 12px;
  font-weight: 800;
}
.back-button:hover { color: var(--blue-mid); }
.back-button svg { width: 15px; height: 15px; }
.back-button[hidden], .loading-panel[hidden], .loading-fallback[hidden], .question-panel[hidden] { display: none; }
.footer-tip { margin-left: auto; color: #8191a0; font-size: 11px; }

.loading-panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(ellipse 430px 320px at 7% 17%, rgba(74, 174, 232, .13), transparent 76%),
    radial-gradient(ellipse 470px 340px at 95% 92%, rgba(23, 58, 95, .08), transparent 76%),
    #f7f8fa;
  text-align: center;
}
.loading-logo { position: absolute; top: clamp(22px, 4vh, 42px); left: 50%; width: clamp(220px, 33vw, 296px); height: auto; transform: translateX(-50%); }
.loading-content { display: flex; flex-direction: column; align-items: center; justify-content: center; width: min(100%, 540px); opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease; }
.loading-panel.is-visible .loading-content { opacity: 1; transform: translateY(0); }
.loading-spinner {
  width: 68px;
  height: 68px;
  margin-bottom: 27px;
  border: 5px solid #e5f0f9;
  border-top-color: var(--blue);
  border-right-color: var(--blue-light);
  border-radius: 50%;
  box-shadow: 0 0 0 9px rgba(74, 174, 232, .06);
  animation: spin .9s linear infinite;
}
.loading-panel h2 { margin: 0 0 9px; font-size: clamp(25px, 3.7vw, 32px); font-weight: 800; line-height: 1.25; letter-spacing: -.04em; }
.loading-panel p { margin: 0; color: var(--text-soft); font-size: 14px; line-height: 1.65; }
.loading-fallback { display: inline-block; margin-top: 19px; color: var(--blue-mid); font-size: 13px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

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

@media (max-width: 600px) {
  .page-shell { padding: 8px 15px 28px; }
  .site-header { min-height: 76px; }
  .brand-logo { width: 244px; }
  .main-content { margin-top: 15px; }
  .intro { margin-bottom: 22px; }
  .intro h1 { max-width: 440px; font-size: clamp(27px, 7.7vw, 35px); }
  .intro > p:last-child { max-width: 470px; font-size: 12px; line-height: 1.55; }
  .quiz-card { min-height: 420px; padding: 26px 20px 20px; border-radius: 20px; }
  .question-heading { margin-top: 26px; }
  .question-heading h2 { font-size: clamp(22px, 6vw, 28px); }
  .options { gap: 9px; margin-top: 20px; }
  .option-button { min-height: 59px; padding: 10px 12px; gap: 12px; }
  .option-text { font-size: 13px; }
  .option-button--gender { min-height: 148px; padding: 14px 10px; gap: 9px; }
  .option-button--gender .option-text { font-size: 15px; }
  .option-symbol { flex-basis: 66px; width: 66px; height: 66px; }
  .option-symbol svg { width: 44px; height: 44px; }
  .card-footer { margin-top: 19px; }
  .loading-logo { width: 244px; }
  .loading-panel { padding: 28px 18px; }
}

@media (max-width: 370px) {
  .quiz-card { padding-inline: 15px; }
  .option-button { gap: 9px; }
  .option-text { font-size: 12px; }
  .footer-tip { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
