:root {
  --navy: #172554;
  --navy-2: #1e3a8a;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --ink: #101828;
  --muted: #667085;
  --border: #d0d5dd;
  --surface: #ffffff;
  --background: #f5f7fb;
  --danger: #b42318;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.09), transparent 34rem),
    var(--background);
}

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

.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.brand {
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-decoration: none;
  white-space: nowrap;
}

.progress-meta {
  width: min(370px, 48vw);
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  background: #dfe4ec;
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--navy-2));
  transition: width 220ms ease;
}

.survey-card {
  width: min(920px, calc(100% - 32px));
  min-height: 620px;
  align-self: center;
  justify-self: center;
  padding: clamp(36px, 6vw, 74px);
  margin: 24px 0 44px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(208, 213, 221, 0.78);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.step {
  display: none;
  animation: step-in 260ms ease both;
}

.step.active { display: block; }

@keyframes step-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow,
.question-number {
  margin: 0 0 16px;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  color: var(--navy);
  line-height: 1.14;
  letter-spacing: -0.035em;
}

h1 { font-size: clamp(2.35rem, 6vw, 4.4rem); max-width: 760px; }
h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); max-width: 780px; }

.required { color: var(--danger); }

.lead {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.intro-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin: 28px 0 34px;
  color: var(--muted);
  font-size: 0.94rem;
}

.helper {
  margin: 13px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.option {
  position: relative;
  display: block;
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option span {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  line-height: 1.42;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.option span b {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 0.75rem;
}

.option:hover span {
  transform: translateY(-1px);
  border-color: #93b4f4;
  box-shadow: 0 5px 14px rgba(37,99,235,0.08);
}

.option input:checked + span {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.option input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.text-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.text-field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  background: white;
}

.text-field input:focus,
.ranking-grid select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.12);
}

.conditional-field { display: none; }
.conditional-field.visible { display: grid; }

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

.primary-btn,
.secondary-btn {
  min-height: 48px;
  padding: 12px 21px;
  border-radius: 11px;
  font-weight: 760;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-btn {
  border: 1px solid var(--blue);
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.19);
}
.primary-btn:hover { transform: translateY(-1px); background: #1d4ed8; }

.secondary-btn {
  border: 1px solid var(--border);
  color: var(--ink);
  background: white;
}
.secondary-btn:hover { background: #f9fafb; }

.keyboard-hint,
.privacy-note {
  margin: 12px 0 0;
  color: #98a2b3;
  font-size: 0.82rem;
}

.ranking-grid {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.ranking-grid label {
  display: grid;
  grid-template-columns: 1fr 96px;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  line-height: 1.4;
}

.ranking-grid select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
}

.error-message {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 650;
}

.terminal-step { text-align: center; padding: 40px 0; }
.terminal-step h2, .terminal-step .lead { margin-left: auto; margin-right: auto; }
.terminal-step .secondary-btn { margin-top: 28px; }

.terminal-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-size: 1.7rem;
  font-weight: 900;
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 28px;
  color: #98a2b3;
  font-size: 0.78rem;
  text-align: center;
}

.shake { animation: shake 260ms ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 640px) {
  .topbar { min-height: 68px; width: calc(100% - 28px); }
  .brand { font-size: 0.67rem; }
  .progress-meta { width: 45vw; }
  .survey-card {
    width: calc(100% - 20px);
    min-height: 0;
    margin: 10px 0 28px;
    padding: 30px 20px;
    border-radius: 20px;
  }
  h1 { font-size: 2.35rem; }
  h2 { font-size: 1.55rem; }
  .option span { min-height: 52px; padding: 12px 14px; }
  .actions { flex-wrap: wrap; }
  .primary-btn, .secondary-btn { flex: 1; }
  .ranking-grid label { grid-template-columns: 1fr; gap: 10px; }
  .ranking-grid select { width: 120px; }
}

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