/* BioHarmony Quiz — quiz.css */

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

:root {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --border:     #334155;
  --accent:     #3DA5FF;
  --accent-dim: rgba(61, 165, 255, 0.15);
  --text:       #f1f5f9;
  --muted:      #94a3b8;
  --radius:     5px;
  --step-w:     640px;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.quiz-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 64px;
}

.quiz-header {
  width: 100%;
  max-width: var(--step-w);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.85;
}

/* ── Progress dots ───────────────────────────────────────────────────── */

.progress-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 40px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s, transform 0.3s;
}

.dot.active {
  background: var(--accent);
  transform: scale(1.35);
}

.dot.done {
  background: rgba(61, 165, 255, 0.45);
}

/* ── Steps container ─────────────────────────────────────────────────── */

.steps-outer {
  width: 100%;
  max-width: var(--step-w);
  overflow: hidden;
  position: relative;
}

.steps-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step {
  min-width: 100%;
  padding: 0 4px;
}

/* ── Step inner card ─────────────────────────────────────────────────── */

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
}

.step-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.step-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.25;
}

.step-sub {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.55;
}

.scale-tradeoff {
  font-size: 13px;
  color: var(--muted);
  margin-top: -20px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Email step ──────────────────────────────────────────────────────── */

.email-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.email-field input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.email-field input[type="email"]:focus {
  border-color: var(--accent);
}

.email-field input[type="email"]::placeholder {
  color: var(--muted);
}

/* ── Chip grid (goal selection) ──────────────────────────────────────── */

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.chip {
  padding: 10px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  user-select: none;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.chip-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: -20px;
  margin-bottom: 32px;
}

/* ── 5-point labeled scale ───────────────────────────────────────────── */

.scale-wrap {
  margin-bottom: 32px;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.scale-label-text {
  font-size: 12px;
  color: var(--muted);
  max-width: 120px;
  line-height: 1.3;
}

.scale-label-text:last-child {
  text-align: right;
}

.scale-btns {
  display: flex;
  gap: 8px;
}

.scale-btn {
  flex: 1;
  padding: 14px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.scale-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.scale-btn.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Advanced sliders step ───────────────────────────────────────────── */

.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 11px;
  transition: background 0.2s;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
}

.toggle-switch input:checked ~ .toggle-knob {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 14px;
  color: var(--muted);
}

.slider-section {
  display: none;
  flex-direction: column;
  gap: 0;
  margin-bottom: 28px;
}

.slider-section.visible {
  display: flex;
}

.slider-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.slider-row label {
  flex: 0 0 140px;
  font-size: 13px;
  color: var(--muted);
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

.slider-val {
  flex: 0 0 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ── Results step ────────────────────────────────────────────────────── */

.results-profile-line {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.results-profile-line strong {
  color: var(--text);
  font-weight: 600;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.result-rank {
  flex: 0 0 24px;
  font-size: 18px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

.result-name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.result-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.result-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.result-delta {
  font-size: 12px;
  color: var(--muted);
}

.result-delta.pos {
  color: #4ade80;
}

.result-delta.neg {
  color: #f87171;
}

.tier-pill {
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.results-cta {
  display: flex;
  justify-content: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 10px 16px;
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-cta {
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  padding: 16px 36px;
}

.btn-cta:hover {
  opacity: 0.88;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}

.nav-row-right {
  margin-left: auto;
}

/* ── Error state ─────────────────────────────────────────────────────── */

.field-error {
  font-size: 13px;
  color: #f87171;
  margin-top: -4px;
  display: none;
}

.field-error.visible {
  display: block;
}

/* ── Loading spinner ─────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ── Mobile ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .step-card {
    padding: 28px 20px;
  }

  .step-title {
    font-size: 20px;
  }

  .scale-btns {
    gap: 5px;
  }

  .scale-btn {
    padding: 12px 4px;
    font-size: 13px;
  }

  .slider-row label {
    flex: 0 0 110px;
    font-size: 12px;
  }

  .result-card {
    gap: 10px;
  }

  .btn-cta {
    width: 100%;
  }
}
