:root {
  --bg: #e8eef4;
  --bg-accent: #d4e4f2;
  --surface: #f7fafc;
  --ink: #1a2b3c;
  --muted: #5a6f82;
  --line: #c5d4e0;
  --brand: #0b5f8a;
  --brand-deep: #084766;
  --ok: #1f6b4a;
  --warn: #8a5a10;
  --error: #8b2430;
  --shadow: 0 18px 50px rgba(18, 48, 72, 0.12);
  --radius: 18px;
  --font: "Manrope", "Segoe UI", sans-serif;
  --display: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #c9dff0 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #b8d4e8 0%, transparent 50%),
    linear-gradient(165deg, var(--bg), var(--bg-accent));
}

.page {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.brand {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}

h1 {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  font-weight: 700;
}

.lead, .meta, .instructions {
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth {
  min-height: calc(100vh - 5rem);
  display: grid;
  place-items: center;
}

.auth-card, .question-card, .narrow, .results {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(440px, 100%);
  padding: 2rem;
}

.narrow, .results, .test {
  padding: 1.75rem;
}

.section-head { margin-bottom: 1.25rem; }

.stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

label span, legend {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input:not([type]) {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 40%, white);
  border-color: var(--brand);
}

small { color: var(--muted); font-size: 0.8rem; }

.dob { border: 0; padding: 0; margin: 0; }
.dob-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-deep); }

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  margin-top: 1.25rem;
}

.alert {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.alert-error { background: #f8e8ea; color: var(--error); }
.alert-warn { background: #f8efd8; color: var(--warn); }
.alert-ok { background: #e4f3eb; color: var(--ok); }

.choice-list { display: grid; gap: 0.75rem; }
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.choice strong { display: block; margin-bottom: 0.2rem; }
.choice small { color: var(--muted); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: #d7e3ec;
  overflow: hidden;
  margin: 0.85rem 0 0.35rem;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0b5f8a, #2a8fbf);
}
.progress-label { margin: 0; font-size: 0.85rem; color: var(--muted); }

.question-card { margin-top: 1rem; padding: 1.5rem; }
.category {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}

.scale { display: grid; gap: 0.55rem; margin-top: 1.25rem; }
.scale-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.scale-option:has(input:checked) {
  border-color: var(--brand);
  background: #eef6fb;
}

.score-board { display: grid; gap: 0.85rem; margin: 1.25rem 0; }
.score-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1.4fr) 2fr auto;
  gap: 0.75rem;
  align-items: center;
}
.score-label { font-size: 0.92rem; }
.score-track {
  height: 12px;
  border-radius: 999px;
  background: #d7e3ec;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  background: linear-gradient(90deg, #0b5f8a, #3aa0c8);
}
.score-value { font-weight: 700; min-width: 3rem; text-align: right; }

@media (max-width: 640px) {
  .score-row { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
}
