:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --text: #1c1b19;
  --muted: #6b6760;
  --border: #e3e0d9;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-soft: #fdebe0;
  --good: #2f9e44;
  --warn: #e67700;
  --bad: #c92a2a;
  --focus: #1971c2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1c1c1a;
    --surface-2: #252522;
    --text: #f1efea;
    --muted: #a19d95;
    --border: #34332f;
    --accent: #ff7a2e;
    --accent-ink: #1a0d05;
    --accent-soft: #3a2316;
    --focus: #74c0fc;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.container { max-width: 760px; margin: 0 auto; padding: 24px 16px 96px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px; padding: 12px 16px;
}
.brand { display: flex; align-items: center; flex: none; }
.brand img { display: block; height: 44px; width: auto; }
@media (prefers-color-scheme: dark) { .brand img { filter: drop-shadow(0 0 1px rgba(255,255,255,.45)); } }
.logo {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700;
}
.progress-wrap { flex: 1; max-width: 420px; margin-left: auto; }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; text-align: right; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
@media (max-width: 520px) { .brand img { height: 36px; } }

/* Hero / cards */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 0 20px; }
.perks { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.perks li { display: flex; gap: 10px; align-items: flex-start; }
.perks li::before { content: "✓"; color: var(--accent); font-weight: 700; }
.fine { color: var(--muted); font-size: 13px; }

.section-head { margin: 8px 0 20px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.section-head h2 { font-size: clamp(24px, 4vw, 30px); margin: 4px 0 6px; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px;
}
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 14px; }
.grid > .q { grid-column: span 6; }
.grid > .q.half { grid-column: span 3; }
.grid > .q.third { grid-column: span 2; }
@media (max-width: 560px) {
  .grid > .q.half, .grid > .q.third { grid-column: span 6; }
}
.q-label { display: block; font-weight: 600; margin-bottom: 8px; }
.q-label .req { color: var(--accent); margin-left: 2px; }
.q-hint { color: var(--muted); font-size: 14px; margin: -4px 0 8px; }
.q.has-error .q-label { color: var(--bad); }
.q-error { color: var(--bad); font-size: 13px; margin-top: 6px; }

input[type=text], input[type=email], input[type=tel], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .opt:focus-within, .scale label:focus-within {
  outline: 2px solid var(--focus); outline-offset: 1px;
}
.q.has-error input, .q.has-error select, .q.has-error textarea { border-color: var(--bad); }

/* Options */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 9px 14px; font-family: inherit; font-size: 15px; line-height: 1.25; user-select: none;
  color: var(--text); text-align: left;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt.checked { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 500; }
.opt .tick { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; display: grid; place-items: center; font-size: 11px; }
.opt.multi .tick { border-radius: 4px; }
.opt.checked .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.checked .tick::after { content: "✓"; font-weight: 700; }
.opt .rank-badge { min-width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.opt.checked .rank-badge { background: var(--accent); color: var(--accent-ink); }
.other-input { margin-top: 10px; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale label {
  display: grid; place-items: center; height: 48px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; font-weight: 600; background: var(--surface); position: relative;
}
.scale input { position: absolute; opacity: 0; }
.scale label.checked { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.scale-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 6px; }
.q.pain { background: var(--surface-2); border-radius: 10px; padding: 14px; }

/* Nav */
.nav { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-top: 24px; }
.btn {
  font: inherit; font-weight: 600; border-radius: 10px; padding: 12px 22px; min-height: 48px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 12px 4px; }
.save-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 14px; }
.notice { border-left: 3px solid var(--warn); background: var(--surface); padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; font-size: 14px; }
.notice.error { border-color: var(--bad); }

/* Results */
.result-top { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.ring { --p: 0; --c: var(--accent); width: 132px; height: 132px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center; }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring strong { font-size: 34px; line-height: 1; display: block; }
.ring span { font-size: 12px; color: var(--muted); }
.result-top > :last-child { flex: 1 1 260px; }
.card.cta { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between;
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card.cta > div:first-child { flex: 1 1 280px; }
.card.cta h2 { margin: 0 0 6px; font-size: 20px; }
.card.cta p { margin: 0; color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.areas { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.area-row { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 6px; }
.area-score { font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 99px; }
.area-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.opps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: o; }
.opps li { counter-increment: o; display: grid; grid-template-columns: 32px 1fr; gap: 12px; }
.opps li::before { content: counter(o); width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.opps h3 { margin: 4px 0 2px; font-size: 17px; }
.opps p { margin: 0; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
