:root {
  color-scheme: light;
  --primary: #315fce;
  --primary-dark: #244aa8;
  --primary-soft: #edf3ff;
  --ink: #1b2437;
  --muted: #6d778a;
  --line: #e4e9f2;
  --surface: #ffffff;
  --danger: #d93e4b;
  --shadow: 0 18px 50px rgba(44, 69, 121, 0.1);
}

* { box-sizing: border-box; }

html { background: #f5f7fb; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 16%, rgba(204, 220, 255, 0.4), transparent 32%),
    #f5f7fb;
}

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

.page-shell { min-height: 100vh; }

.hero {
  position: relative;
  min-height: 292px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #24499e 0%, #3569dd 52%, #6b8eed 100%);
}

.hero::after {
  position: absolute;
  right: -4%;
  bottom: -62px;
  left: -4%;
  height: 92px;
  border-radius: 50% 50% 0 0;
  background: #f5f7fb;
  content: "";
}

.hero__glow { position: absolute; border-radius: 50%; filter: blur(2px); }
.hero__glow--one { width: 260px; height: 260px; top: -120px; right: -80px; background: rgba(255,255,255,.13); }
.hero__glow--two { width: 130px; height: 130px; bottom: 20px; left: -55px; background: rgba(154,195,255,.16); }

.hero__content {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 90px;
}

.hero__eyebrow { margin: 0 0 14px; opacity: .78; font-size: 13px; letter-spacing: .18em; }
.hero h1 { margin: 0; font-size: clamp(30px, 7vw, 43px); line-height: 1.22; letter-spacing: -.02em; }
.hero__description { max-width: 580px; margin: 16px 0 0; color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.8; }

.content {
  position: relative;
  z-index: 2;
  width: min(680px, calc(100% - 28px));
  margin: -60px auto 0;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.card, .state-card {
  border: 1px solid rgba(225, 231, 242, .9);
  border-radius: 22px;
  background: rgba(255,255,255,.98);
  box-shadow: var(--shadow);
}

.card { padding: 28px; }
.state-card { padding: 54px 26px; text-align: center; }
.state-card h2 { margin: 16px 0 8px; font-size: 21px; }
.state-card p { margin: 0 auto 24px; max-width: 520px; color: var(--muted); line-height: 1.7; }
.state-card__icon { display: grid; width: 56px; height: 56px; margin: auto; place-items: center; border-radius: 50%; background: #eaf7ef; color: #218b4d; font-size: 28px; font-weight: 700; }
.state-card--error .state-card__icon { background: #fff0f1; color: var(--danger); }
.state-card pre { overflow: auto; max-height: 380px; padding: 18px; border-radius: 14px; background: #151b29; color: #d9e3ff; text-align: left; font-size: 12px; line-height: 1.65; }

.spinner { display: block; width: 36px; height: 36px; margin: 0 auto 18px; border: 3px solid #dce6ff; border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-heading { display: flex; gap: 15px; align-items: flex-start; margin-bottom: 26px; }
.section-heading__number { display: grid; flex: 0 0 42px; height: 42px; place-items: center; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 700; }
.section-heading h2 { margin: 1px 0 4px; font-size: 20px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.section-heading--compact { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field > span, .fieldset legend { color: #3a4559; font-size: 14px; font-weight: 600; }
.field b, .fieldset b { color: var(--danger); }
.field input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; outline: none; color: var(--ink); background: #fbfcff; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(49,95,206,.11); }
.field input.invalid { border-color: var(--danger); }
.field__error { min-height: 16px; color: var(--danger); font-size: 12px; }
.field__error:empty { display: none; }
.fieldset { margin: 0; padding: 0; border: 0; }
.fieldset legend { margin-bottom: 8px; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { display: grid; height: 46px; place-items: center; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: #fbfcff; transition: .2s; }
.segmented-control input:checked + span { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); font-weight: 700; }

.questions-section { margin-top: 18px; padding: 6px 0 20px; overflow: hidden; border: 1px solid #e1e7f2; border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.questions-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 18px 24px 14px; }
.current-question-heading { min-width: 0; }
.current-question-title { display: flex; gap: 8px; align-items: baseline; }
.current-question-title strong { flex: 0 0 auto; color: var(--primary); font-size: 17px; }
.current-question-title h2 { margin: 0; font-size: 17px; line-height: 1.55; }
.current-question-type { display: inline-block; margin: 8px 0 0 34px; padding: 4px 9px; border-radius: 99px; color: #69758a; background: #f0f3f8; font-size: 11px; white-space: nowrap; }
.current-question-type.multiple { color: var(--primary); background: var(--primary-soft); }
.progress-copy { flex: 0 0 auto; padding: 7px 11px; border-radius: 12px; color: var(--muted); background: #f1f5fd; font-size: 13px; line-height: 1; }
.progress-copy strong { color: var(--primary); font-size: 18px; }
.progress-track { height: 4px; margin: 0 24px 18px; overflow: hidden; border-radius: 99px; background: #e7ecf5; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #7b9af1); transition: width .25s; }

.question-card { margin: 0 18px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 24px rgba(44,69,121,.05); transition: border-color .2s, box-shadow .2s; }
.question-card.has-error { border-color: rgba(217,62,75,.6); box-shadow: 0 0 0 3px rgba(217,62,75,.07); }
.options { display: grid; gap: 10px; margin-top: 0; }
.option { position: relative; display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; outline: none; color: #485267; background: #fafbfe; cursor: pointer; appearance: none; -webkit-tap-highlight-color: transparent; text-align: left; transition: border-color .18s, background .18s, box-shadow .18s, color .18s; }
.option:hover { border-color: #aebfe8; background: #f7f9ff; }
.option:focus-visible { border-color: #8da8eb; box-shadow: 0 0 0 3px rgba(49,95,206,.12); }
.option.selected { border-color: #7898e7; color: #244aa8; background: #f4f7ff; box-shadow: inset 3px 0 0 var(--primary), 0 5px 14px rgba(49,95,206,.07); }
.option__mark { display: grid; flex: 0 0 20px; height: 20px; place-items: center; border: 1.5px solid #bdc6d5; border-radius: 50%; background: #fff; }
.multiple-option .option__mark { border-radius: 6px; }
.option.selected .option__mark { border-color: var(--primary); background: #fff; }
.option.selected:not(.multiple-option) .option__mark::after { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); content: ""; }
.multiple-option.selected .option__mark { background: var(--primary); }
.multiple-option.selected .option__mark::after { width: 6px; height: 3px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; content: ""; transform: rotate(-45deg) translate(1px, -1px); }
.question-card__error { min-height: 16px; margin: 10px 0 0; color: var(--danger); font-size: 12px; }
.question-navigation { display: flex; justify-content: space-between; gap: 12px; margin: 16px 18px 0; }
.question-navigation .button { flex: 1; min-width: 0; box-shadow: none; white-space: nowrap; }
.question-navigation .button--secondary { border: 1px solid #dfe6f2; color: #536b9d; background: #f4f7fc; }
.question-navigation .button--secondary:active { border-color: #cad7ee; color: var(--primary-dark); background: #e9effa; }
.question-navigation .button--primary { margin-left: auto; }
.question-navigation .button--primary:disabled { color: #9aa4b5; background: #e7ebf2; box-shadow: none; cursor: not-allowed; opacity: 1; transform: none; }

.start-panel { display: flex; margin-top: 18px; padding: 0; background: transparent; }
.start-panel .button { width: 100%; }
.button { min-height: 44px; padding: 0 24px; border: 0; border-radius: 13px; outline: none; font-weight: 700; appearance: none; -webkit-tap-highlight-color: transparent; transition: transform .15s, opacity .15s, background .15s, border-color .15s; }
.button:active { transform: translateY(1px); }
.button:focus-visible { box-shadow: 0 0 0 3px rgba(49,95,206,.14); }
.button--primary { min-width: 150px; color: #fff; background: linear-gradient(135deg, var(--primary), #527ee5); box-shadow: 0 9px 22px rgba(49,95,206,.23); }
.button--secondary { color: var(--primary); background: var(--primary-soft); }
.button:disabled { cursor: not-allowed; opacity: .6; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); max-width: calc(100% - 40px); padding: 11px 17px; border-radius: 10px; color: #fff; background: rgba(24,31,46,.94); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }

body.respondent-step { height: 100dvh; overflow: hidden; }
.respondent-step .page-shell { height: 100dvh; overflow: hidden; }
.question-step .content { margin-top: -96px; }
.respondent-step .hero { min-height: clamp(184px, 24vh, 230px); }
.respondent-step .hero__content { padding: clamp(25px, 4vh, 40px) 0 66px; }
.respondent-step .content { margin-top: -48px; padding-bottom: 0; }
.respondent-step .respondent-card { padding: clamp(16px, 2.4vh, 24px); }
.respondent-step .section-heading { margin-bottom: clamp(12px, 1.8vh, 20px); }
.respondent-step .form-grid { gap: clamp(13px, 1.8vh, 18px); }
.respondent-step .field { gap: 5px; }
.respondent-step .field input:not([type="radio"]):not([type="checkbox"]) { height: clamp(40px, 5.4vh, 46px); }
.respondent-step .segmented-control span { height: clamp(40px, 5.4vh, 46px); }
.respondent-step .start-panel { margin-top: clamp(12px, 1.7vh, 18px); padding: 0; }
.respondent-step .start-panel .button { min-height: 42px; }

@media (max-width: 540px) {
  .hero { min-height: 270px; }
  .hero__content { padding-top: 38px; }
  .content { margin-top: -52px; }
  .card { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .field, .field--wide { grid-column: 1; }
  .questions-section { margin-top: 12px; border-radius: 20px; }
  .questions-toolbar { gap: 10px; padding: 15px 16px 12px; }
  .current-question-title { align-items: flex-start; }
  .current-question-title strong, .current-question-title h2 { font-size: 16px; }
  .current-question-type { margin-left: 30px; }
  .progress-copy { padding: 6px 9px; }
  .progress-track { margin-right: 16px; margin-left: 16px; }
  .question-card { margin: 0 10px; padding: 18px 17px; }
  .question-navigation { margin-right: 10px; margin-left: 10px; }
  .start-panel { flex-direction: column; align-items: stretch; }
  .start-panel .button--primary { width: 100%; }
}

@media (max-height: 720px) {
  .respondent-step .hero__eyebrow,
  .respondent-step .hero__description,
  .respondent-step .section-heading p { display: none; }
  .respondent-step .hero { min-height: 145px; }
  .respondent-step .hero__content { padding-top: 22px; }
  .respondent-step .content { margin-top: -38px; }
  .respondent-step .section-heading { margin-bottom: 8px; }
  .respondent-step .form-grid { gap: 10px; }
  .respondent-step .field input:not([type="radio"]):not([type="checkbox"]),
  .respondent-step .segmented-control span { height: 38px; }
  .respondent-step .start-panel { margin-top: 9px; padding: 0; }
}
