/* PAIN FREE — Triage-Wizard. Dunkel, klinisch-premium, ein Akzent. Mobile-first. */
:root {
  --bg: #0b0d10;
  --bg-2: #111419;
  --surface: #161a20;
  --surface-2: #1c2128;
  --line: #262c35;
  --line-2: #323a45;
  --ink: #f4f6f8;
  --ink-dim: #aeb6c0;
  --ink-faint: #727c88;
  --accent: #ff6a3d;
  --accent-2: #ff3d78;
  --accent-ink: #ffffff;
  --ok: #37d08b;
  --warn: #ffc53d;
  --danger: #ff5d5d;
  --radius: 16px;
  --radius-sm: 11px;
  --maxw: 640px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.8);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 500px at 50% -10%, rgba(255, 106, 61, 0.10), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(255, 61, 120, 0.06), transparent 55%);
}
.skip {
  position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 8px; z-index: 50;
}
.skip:focus { left: 12px; }

.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 28px);
  max-width: var(--maxw); width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(150deg, #1a1e25, #0c0f13);
  border: 1px solid var(--line-2);
  color: var(--accent);
}
.brand-name { font-family: Sora, sans-serif; font-weight: 700; letter-spacing: 0.14em; font-size: 15px; }
.brand-thin { color: var(--accent); font-weight: 600; margin-left: 2px; }
.topbar-note { color: var(--ink-faint); font-size: 13px; letter-spacing: 0.02em; }

.progress {
  position: relative; z-index: 2; height: 3px; width: min(var(--maxw), 100%);
  margin: 0 auto; background: var(--line); border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.5s var(--ease);
}

.stage {
  position: relative; z-index: 2; flex: 1;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: clamp(18px, 4vw, 30px) clamp(16px, 4vw, 28px) 40px;
}
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 32px);
  animation: rise 0.45s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

.eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
h1.q-title {
  font-family: Sora, sans-serif; font-weight: 700; letter-spacing: -0.01em;
  font-size: clamp(22px, 5.4vw, 29px); line-height: 1.18; margin: 10px 0 6px;
}
.q-help { color: var(--ink-dim); font-size: 15px; margin: 0 0 20px; }

/* Options */
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 13px; width: 100%;
  text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 15px 16px; font-size: 15.5px;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.12s var(--ease);
}
.opt:hover { border-color: var(--line-2); }
.opt:active { transform: scale(0.985); }
.opt .box {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid var(--line-2); display: grid; place-items: center;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.opt.radio .box { border-radius: 50%; }
.opt .box svg { width: 13px; height: 13px; opacity: 0; transform: scale(0.8); transition: opacity 0.15s var(--ease), transform 0.15s var(--ease); }
.opt.sel { border-color: var(--accent); background: linear-gradient(180deg, rgba(255,106,61,0.12), rgba(255,106,61,0.04)); }
.opt.sel .box { border-color: var(--accent); background: var(--accent); }
.opt.sel .box svg { opacity: 1; transform: none; color: #fff; }
.opt .lbl { flex: 1; }

/* Fields */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13.5px; color: var(--ink-dim); margin-bottom: 7px; font-weight: 500; }
.field input, .field textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: var(--radius-sm); padding: 13px 14px; font: inherit;
  transition: border-color 0.18s var(--ease);
}
.field input:focus, .field textarea:focus, .opt:focus-visible { outline: none; border-color: var(--accent); }
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.field .err { color: var(--danger); font-size: 12.5px; margin-top: 6px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.charcount { text-align: right; color: var(--ink-faint); font-size: 12px; margin-top: 6px; }

/* Consent */
.consent-intro { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; color: var(--ink-dim); font-size: 14.5px; margin-bottom: 18px; }
.consent-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.consent-item:first-of-type { border-top: none; }
.consent-item .box { margin-top: 2px; }
.consent-item .lbl { font-size: 14.5px; color: var(--ink); }

/* Boolean grid (safety) */
.bgrid { display: grid; gap: 12px; }
.bgrid-row { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 15px; }
.bgrid-q { font-size: 15px; margin-bottom: 11px; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yn button {
  cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-dim);
  border-radius: 9px; padding: 10px; font: inherit; font-weight: 600; transition: all 0.16s var(--ease);
}
.yn button:active { transform: scale(0.97); }
.yn button.sel-no { border-color: var(--ok); background: rgba(55,208,139,0.14); color: #c9f5e1; }
.yn button.sel-yes { border-color: var(--warn); background: rgba(255,197,61,0.16); color: #ffe6a8; }

/* Body map */
.bodymap-wrap { display: grid; gap: 14px; }
.bodymap-toolbar { display: flex; gap: 8px; justify-content: center; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: none; background: none; color: var(--ink-dim); font: inherit; font-weight: 600; font-size: 14px; padding: 8px 18px; border-radius: 8px; cursor: pointer; transition: all 0.16s var(--ease); }
.seg button.on { background: var(--accent); color: #fff; }
.bodymap-stage { display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(255,106,61,0.07), transparent 60%); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.bodymap-stage svg { width: 100%; max-width: 280px; height: auto; touch-action: manipulation; }
.hotspot { cursor: pointer; }
.hotspot circle { transition: r 0.18s var(--ease), fill 0.18s var(--ease), stroke 0.18s var(--ease); }
.hotspot .hs-dot { fill: rgba(255,255,255,0.12); stroke: var(--line-2); stroke-width: 1.5; }
.hotspot:hover .hs-dot { stroke: var(--accent); }
.hotspot.sel .hs-dot { fill: var(--accent); stroke: #fff; }
.hotspot.sel .hs-pulse { animation: pulse 1.6s ease-out infinite; transform-origin: center; }
@keyframes pulse { 0% { opacity: 0.5; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
.body-outline { fill: #0e1217; stroke: var(--line-2); stroke-width: 1.5; }
.selected-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--accent); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; }
.chip button { border: none; background: none; color: var(--ink-faint); cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.hint { color: var(--ink-faint); font-size: 13px; text-align: center; }

/* Region detail groups */
.rd-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px; margin-bottom: 14px; background: var(--surface-2); }
.rd-group h3 { font-family: Sora, sans-serif; font-size: 16px; margin: 0 0 12px; }
.rd-sub { font-size: 13.5px; color: var(--ink-dim); margin: 14px 0 8px; }

/* Nav */
.nav { display: flex; gap: 12px; margin-top: 26px; align-items: center; }
.btn {
  cursor: pointer; font: inherit; font-weight: 600; border-radius: var(--radius-sm);
  padding: 14px 22px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  transition: transform 0.12s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease), opacity 0.16s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  flex: 1; border: none; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -12px rgba(255, 106, 61, 0.7);
}
.btn-primary[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { color: var(--ink-dim); background: transparent; border-color: var(--line); }
.form-error { color: var(--danger); font-size: 13.5px; margin-top: 12px; min-height: 18px; }

/* Review */
.review-list { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.review-row { display: grid; grid-template-columns: 38% 1fr; gap: 10px; padding: 12px 15px; background: var(--surface-2); font-size: 14px; }
.review-row dt { color: var(--ink-faint); }
.review-row dd { margin: 0; color: var(--ink); }

/* Result */
.result { text-align: center; }
.result .halo { width: 78px; height: 78px; margin: 4px auto 18px; border-radius: 50%; display: grid; place-items: center; }
.result.received .halo { background: rgba(55,208,139,0.14); color: var(--ok); border: 1px solid rgba(55,208,139,0.4); }
.result.medical .halo { background: rgba(255,197,61,0.14); color: var(--warn); border: 1px solid rgba(255,197,61,0.4); }
.result.crisis .halo { background: rgba(93,160,255,0.14); color: #7db1ff; border: 1px solid rgba(93,160,255,0.4); }
.result h1 { font-family: Sora, sans-serif; font-size: clamp(22px, 5.4vw, 28px); margin: 0 0 12px; }
.result p { color: var(--ink-dim); font-size: 15.5px; }
.resources { display: grid; gap: 10px; margin: 20px 0 6px; text-align: left; }
.resource { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.resource .rl { font-size: 13.5px; color: var(--ink-dim); }
.resource .rn { font-family: Sora, sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); letter-spacing: 0.02em; white-space: nowrap; }
.resource .rn a { color: var(--accent); text-decoration: none; }
.also { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); text-align: left; }

.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.7s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  position: relative; z-index: 2; text-align: center; color: var(--ink-faint); font-size: 12.5px;
  padding: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.footer .dot { opacity: 0.5; }

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