:root {
  color-scheme: dark;
  --navy-950: #020d1a;
  --navy-900: #071423;
  --navy-800: #0c1b2c;
  --navy-700: #13283d;
  --gold: #b99a5e;
  --gold-strong: #d4b979;
  --cream: #f5f0e7;
  --muted: #aeb9c7;
  --danger: #ff9d9d;
  --success: #90d7ad;
  --line: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--navy-950); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 15% 0%, rgba(185, 154, 94, 0.12), transparent 32rem),
    radial-gradient(circle at 90% 90%, rgba(44, 92, 128, 0.16), transparent 34rem),
    var(--navy-950);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { touch-action: manipulation; }

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

.diagnostic-header,
.diagnostic-footer {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

.diagnostic-header { padding: 24px 0 12px; }
.brand-link { display: inline-flex; }
.brand-link img { display: block; width: min(210px, 58vw); height: auto; }

.diagnostic-main {
  display: grid;
  align-items: center;
  width: min(100% - 24px, 860px);
  margin: 0 auto;
  padding: 20px 0 40px;
}

.diagnostic-card {
  position: relative;
  overflow: hidden;
  min-height: min(620px, calc(100vh - 190px));
  padding: clamp(24px, 5vw, 64px);
  border: 1px solid rgba(185, 154, 94, 0.3);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(19, 40, 61, 0.92), rgba(5, 18, 31, 0.97));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.diagnostic-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.screen { animation: screen-in 260ms ease both; }
.screen[hidden], [hidden] { display: none !important; }

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

.welcome-screen { max-width: 680px; }
.eyebrow, .question-number {
  display: block;
  margin-bottom: 12px;
  color: var(--gold-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, .question-title {
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.welcome-screen p,
.question-description {
  max-width: 660px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.65;
}

.welcome-screen .button { margin-top: 20px; }

.progress-region { margin-bottom: clamp(34px, 7vw, 68px); }
.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

#save-status[data-state="error"] { color: var(--danger); }
#save-status[data-state="saved"] { color: var(--success); }
.progress-track { height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
#progress-bar { display: block; width: 25%; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-strong)); transition: width 240ms ease; }

.question-title { font-size: clamp(1.75rem, 5vw, 3rem); }
.optional { color: var(--muted); font-size: .8rem; font-weight: 500; letter-spacing: 0; }

.field-wrap { margin-top: 32px; }
.text-input {
  width: 100%;
  min-height: 58px;
  padding: 14px 0;
  border: 0;
  border-bottom: 2px solid rgba(255,255,255,.28);
  border-radius: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font-size: clamp(1.2rem, 4vw, 1.65rem);
  transition: border-color 160ms ease;
}
.text-input::placeholder { color: #748192; }
.text-input:focus { border-color: var(--gold-strong); }
.text-input[aria-invalid="true"] { border-color: var(--danger); }

.options { display: grid; gap: 12px; margin-top: 28px; }
.option {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.option:hover { border-color: rgba(185,154,94,.65); background: rgba(185,154,94,.08); }
.option:has(input:checked) { border-color: var(--gold); background: rgba(185,154,94,.14); }
.option:focus-within { outline: 3px solid rgba(212,185,121,.25); outline-offset: 2px; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 7px;
  color: var(--gold-strong);
  font-size: .78rem;
  font-weight: 800;
}
.option:has(input:checked) .option-key { color: var(--navy-950); border-color: var(--gold-strong); background: var(--gold-strong); }

.consent-box {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 24px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}
.consent-box input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--gold); }
a { color: var(--gold-strong); }

.validation-message { min-height: 24px; margin-top: 16px; color: var(--danger); font-size: .9rem; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.button {
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, background 160ms ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.button:focus-visible { outline: 3px solid rgba(212,185,121,.4); outline-offset: 3px; }
.button:disabled { opacity: .62; cursor: wait; transform: none; }
.button-primary { color: #071423; background: linear-gradient(135deg, var(--gold-strong), #a8894e); }
.button-secondary { color: var(--cream); border-color: var(--line); background: transparent; }
.keyboard-hint { margin: 16px 4px 0; color: #7f8b99; font-size: .75rem; }
kbd { padding: 2px 6px; border: 1px solid rgba(255,255,255,.16); border-radius: 4px; background: rgba(255,255,255,.06); font: inherit; }

.diagnostic-footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0 28px; color: #748192; font-size: .78rem; }
.diagnostic-footer a { color: #9aa7b6; }

@media (max-width: 620px) {
  .diagnostic-header { padding-top: 18px; }
  .diagnostic-main { align-items: start; width: min(100% - 16px, 860px); padding-top: 8px; }
  .diagnostic-card { min-height: calc(100vh - 150px); padding: 28px 20px; border-radius: 18px; }
  .progress-copy { font-size: .72rem; }
  .form-actions { position: sticky; bottom: 10px; padding-top: 10px; background: linear-gradient(transparent, rgba(5,18,31,.96) 24%); }
  .button { padding-inline: 18px; }
  .diagnostic-footer { padding-inline: 8px; }
}

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