/* ==========================================================
   OXYMAGNETIC Anamnese – Design
   Idee: kühles, luftiges „Sauerstoff“-Weiß, tiefes Marine als Tinte,
   Markenblau nur als Signal (Fortschritt, Fokus, Häkchen).
   Eine Schriftfamilie (Hanken Grotesk, lokal), Hierarchie über Größe & Gewicht.
   ========================================================== */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-latin-ext.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Palette */
  --air: #f4f7fa;        /* Hintergrund */
  --surface: #ffffff;    /* Flächen */
  --ink: #0e2233;        /* Text, Primärbutton, Auswahl */
  --ink-2: #2c4255;
  --slate: #5f7385;      /* Sekundärtext */
  --mist: #dde6ee;       /* Linien, Ränder */
  --mist-2: #ebf1f6;
  --accent: #1b8dd6;     /* Markenblau – wird aus config.js gesetzt */
  --accent-strong: #136aa3;
  --accent-soft: #e8f3fb;
  --accent-ring: rgba(27, 141, 214, .25);
  --danger: #b42318;
  --danger-soft: #fef3f2;

  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Tiefe: zwei Ebenen, sehr weich, leicht bläulich */
  --lift-1: 0 1px 2px rgba(14, 34, 51, .05), 0 1px 1px rgba(14, 34, 51, .03);
  --lift-2: 0 2px 4px rgba(14, 34, 51, .04), 0 12px 32px -8px rgba(14, 34, 51, .12);
  --lift-ink: 0 1px 2px rgba(14, 34, 51, .25), 0 10px 24px -10px rgba(14, 34, 51, .55);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --col: 680px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--air); color: var(--ink);
  font-family: var(--font); font-size: 18px; line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility;
  overscroll-behavior: none; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-user-select: none; user-select: none; cursor: pointer; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 3px; }

.app {
  position: fixed; inset: 0 0 auto 0;
  height: var(--app-h, 100dvh);
  display: flex; flex-direction: column;
  padding-left: var(--safe-l); padding-right: var(--safe-r);
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- Kopfzeile ---------- */
.topbar {
  flex: none; position: relative;
  padding: calc(var(--safe-t) + 18px) 28px 16px;
  display: flex; align-items: center; gap: 20px;
  background: var(--air);
}
.topbar__logo { height: 34px; width: auto; flex: none; }
.topbar__count { margin-left: auto; font-size: 16px; font-weight: 500; color: var(--slate); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.topbar__count b { color: var(--ink); font-weight: 650; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--mist-2); }
.progress__bar { height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; transition: width .6s cubic-bezier(.22, .8, .24, 1); }
.iconbtn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--mist); background: var(--surface); color: var(--slate);
  display: grid; place-items: center; box-shadow: var(--lift-1);
}
.iconbtn:active { background: var(--mist-2); }
.iconbtn svg { width: 18px; height: 18px; }

/* ---------- Inhaltsfläche ---------- */
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.inner { max-width: calc(var(--col) + 64px); margin: 0 auto; padding: 48px 32px 64px; }
.step-head { margin-bottom: 40px; }
.step-title { font-size: 40px; line-height: 1.08; font-weight: 650; letter-spacing: -.028em; margin: 0; text-wrap: balance; }
.step-intro { font-size: 19px; line-height: 1.5; color: var(--slate); margin: 14px 0 0; max-width: 52ch; }

/* ---------- Fragen ---------- */
.q { padding: 0 0 44px; }
.q[hidden] { display: none; }
.q-label { font-size: 23px; line-height: 1.32; font-weight: 600; letter-spacing: -.012em; margin: 0; text-wrap: pretty; max-width: 34em; }
.q-hint { font-size: 17px; line-height: 1.5; color: var(--slate); margin: 8px 0 0; max-width: 56ch; }
.opts { display: grid; gap: 12px; margin-top: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; }
.opts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 100%; }
.opt {
  position: relative; min-height: 68px; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--mist); border-radius: 16px;
  background: var(--surface); box-shadow: var(--lift-1);
  font-size: 20px; font-weight: 550; text-align: left; color: var(--ink);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.opt:active { transform: scale(.98); }
.opt__check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--mist); background: transparent;
  transition: background-color .18s, border-color .18s;
}
.opt__check svg { width: 14px; height: 14px; color: var(--ink); opacity: 0; transform: scale(.5); transition: opacity .18s, transform .22s cubic-bezier(.3, 1.5, .5, 1); }
.opt[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: var(--lift-ink); }
.opt[aria-checked="true"] .opt__check { background: #fff; border-color: #fff; }
.opt[aria-checked="true"] .opt__check svg { opacity: 1; transform: none; }
.q.has-error .opt { border-color: #f1b8b2; }

/* Beschreibung bei „Ja“ */
.details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s cubic-bezier(.22, .8, .24, 1); }
.details > div { overflow: hidden; }
.details.open { grid-template-rows: 1fr; }
.details__inner { padding: 18px 0 2px 0; max-width: 620px; }
.details label { display: block; font-size: 16px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }

/* ---------- Textfelder ---------- */
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 18px; }
.field { grid-column: span 2; }
.field.half { grid-column: span 1; }
.field > label, .field > .flabel { display: block; font-size: 16px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.field .opt-tag { font-weight: 450; color: var(--slate); }
.input, .textarea {
  width: 100%; height: 64px; padding: 0 20px;
  font-size: 20px; font-weight: 500; color: var(--ink);
  border: 1px solid var(--mist); border-radius: 14px; background: var(--surface);
  box-shadow: var(--lift-1);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.textarea { height: auto; min-height: 112px; padding: 16px 20px; resize: none; line-height: 1.45; }
.input:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--accent-ring); }
.input::placeholder, .textarea::placeholder { color: #9aabbb; font-weight: 450; }
.has-error .input, .input.err, .textarea.err { border-color: var(--danger); }
.date { display: flex; gap: 10px; align-items: center; max-width: 360px; }
.date .input { text-align: center; padding: 0 6px; font-variant-numeric: tabular-nums; }
.date .d, .date .m { width: 88px; flex: none; }
.date .y { flex: 1; }
.date__sep { color: #b3c2cf; font-size: 22px; font-weight: 300; }

.error { display: none; align-items: center; gap: 8px; margin-top: 12px; color: var(--danger); font-size: 16px; font-weight: 550; }
.error.show { display: flex; animation: errIn .25s ease; }
.error svg { width: 18px; height: 18px; flex: none; }

/* ---------- Fußleiste ---------- */
.footbar {
  flex: none; position: relative;
  padding: 18px 28px calc(var(--safe-b) + 22px);
  background: linear-gradient(to bottom, rgba(244, 247, 250, 0), var(--air) 28%);
  margin-top: -28px;
}
.footbar__in { max-width: calc(var(--col) + 8px); margin: 0 auto; display: flex; gap: 14px; align-items: center; }
.btn {
  height: 64px; padding: 0 34px; border-radius: 999px;
  font-size: 19px; font-weight: 600; letter-spacing: -.005em; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background-color .18s, transform .12s, opacity .18s, box-shadow .18s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; }
.btn--primary { background: var(--ink); color: #fff; margin-left: auto; min-width: 220px; box-shadow: var(--lift-ink); }
.btn--primary:active:not(:disabled) { background: var(--ink-2); }
.btn--primary:disabled { background: #a9b6c2; box-shadow: none; }
.btn--ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--mist); box-shadow: var(--lift-1); padding: 0 26px 0 20px; }
.btn--ghost:active { background: var(--mist-2); }
.btn--big { height: 76px; font-size: 22px; padding: 0 44px; margin: 0; min-width: 280px; }
.linkbtn { border: 0; background: none; color: var(--accent-strong); font-weight: 600; font-size: 17px; padding: 10px 6px; }
.linkbtn:active { opacity: .6; }

/* ---------- Start / Willkommen / Danke ---------- */
.hero {
  flex: 1; min-height: 0; overflow-y: auto; position: relative; overflow-x: hidden;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 36px) 56px calc(var(--safe-b) + 40px);
}
.hero__top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.hero__logo { height: 54px; width: auto; }
.hero__body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 620px; padding: 48px 0; position: relative; z-index: 1; }
.hero h1 { font-size: 60px; line-height: 1.02; font-weight: 650; letter-spacing: -.035em; margin: 0 0 24px; text-wrap: balance; }
.hero .lead { font-size: 22px; line-height: 1.5; color: var(--ink-2); margin: 0 0 44px; max-width: 30em; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.hero__foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; color: var(--slate); font-size: 16px; }
.hero__foot span { display: inline-flex; align-items: center; gap: 8px; }
.hero__foot svg { width: 18px; height: 18px; color: var(--accent); }
.hero__ver { margin-left: auto; color: #9aabbb; font-size: 14px; }

/* Ringe aus dem Logo (Sauerstoffblasen) als einziges Schmuckelement */
.rings-wrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.rings { position: absolute; right: -180px; bottom: -160px; width: 720px; height: 720px; pointer-events: none; z-index: 0; color: var(--accent); }
.rings circle { fill: none; stroke: currentColor; }

/* Praxis-Infos unten rechts: bewusst unauffällig */
.staff { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 14px; color: #8d9eae; }
.staff__status { display: inline-flex; align-items: center; gap: 7px; }
.staff__status i { width: 6px; height: 6px; border-radius: 50%; background: #9fb3c3; }
.staff__status.is-ok i { background: #5fb592; }
.staff__status.is-warn i { background: #d9a530; }
.staff__status.is-err { color: var(--danger); }
.staff__status.is-err i { background: var(--danger); }
.staff__link { color: #8d9eae; text-decoration: none; }
.stats { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--mist);
  font-size: 16px; color: var(--ink-2); font-weight: 500; box-shadow: var(--lift-1);
}
.pill b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: #1f9d6b; display: inline-block; }
.pill--warn i { background: #d99a00; }
.pill--err { border-color: #f6cdc8; background: var(--danger-soft); color: var(--danger); }
.pill--err i { background: var(--danger); }
.pill--demo { background: #fffaeb; border-color: #f7e2a8; color: #7a5300; }
.pill--demo i { background: #d99a00; }
.sheetlink { color: var(--slate); font-size: 16px; text-decoration: none; border-bottom: 1px solid var(--mist); padding-bottom: 1px; }
.ghostsmall { border: 1px solid var(--mist); background: var(--surface); color: var(--slate); font-size: 15px; font-weight: 550; padding: 10px 16px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center; box-shadow: var(--lift-1); }
.ghostsmall svg { width: 16px; height: 16px; }
.ghostsmall:active { background: var(--mist-2); }

.check-big {
  width: 88px; height: 88px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; margin-bottom: 36px; box-shadow: var(--lift-ink);
  animation: pop .55s cubic-bezier(.2, 1.4, .4, 1) both;
}
.check-big svg { width: 42px; height: 42px; }
.check-big path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .45s .3s ease forwards; }
.handback {
  display: inline-flex; align-items: center; gap: 16px;
  padding: 20px 26px; border-radius: 18px; background: var(--surface); border: 1px solid var(--mist);
  font-size: 20px; font-weight: 600; color: var(--ink); box-shadow: var(--lift-2);
}
.handback svg { width: 26px; height: 26px; color: var(--accent); flex: none; }

/* ---------- Übersicht ---------- */
.review { display: flex; flex-direction: column; gap: 20px; }
.rcard { background: var(--surface); border: 1px solid var(--mist); border-radius: 20px; box-shadow: var(--lift-1); }
.rcard__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 6px 26px; }
.rcard__title { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.rlist { margin: 0; padding: 4px 26px 14px; }
.rrow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; padding: 13px 0; border-top: 1px solid var(--mist-2); }
.rrow:first-child { border-top: 0; }
.rrow dt { color: var(--slate); font-size: 16px; line-height: 1.45; }
.rrow dd { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.rrow dd small { display: block; font-weight: 450; color: var(--ink-2); font-size: 16px; margin-top: 3px; white-space: pre-wrap; }

/* ---------- Unterschrift ---------- */
.who { display: flex; flex-wrap: wrap; gap: 6px 36px; margin: -16px 0 28px; font-size: 17px; }
.who span { color: var(--slate); }
.who b { color: var(--ink); font-weight: 600; }
.cbox {
  display: flex; gap: 18px; align-items: flex-start; padding: 20px 22px; margin-bottom: 12px;
  border: 1px solid var(--mist); border-radius: 16px; background: var(--surface); box-shadow: var(--lift-1);
  text-align: left; width: 100%; font-size: 17px; line-height: 1.5; color: var(--ink-2);
  transition: border-color .18s, box-shadow .18s;
}
.cbox__box { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid #b9c7d3; display: grid; place-items: center; margin-top: 0; transition: background-color .18s, border-color .18s; }
.cbox__box svg { width: 16px; height: 16px; color: #fff; opacity: 0; transform: scale(.5); transition: opacity .18s, transform .22s cubic-bezier(.3, 1.5, .5, 1); }
.cbox[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset, var(--lift-1); color: var(--ink); }
.cbox[aria-checked="true"] .cbox__box { background: var(--ink); border-color: var(--ink); }
.cbox[aria-checked="true"] .cbox__box svg { opacity: 1; transform: none; }
.sigwrap { margin-top: 32px; }
.sighead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sighead .flabel { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.sigbox { position: relative; height: 300px; border: 1px solid var(--mist); border-radius: 20px; background: var(--surface); overflow: hidden; box-shadow: var(--lift-2); transition: border-color .2s; }
.sigbox.signed { border-color: var(--ink); }
.sigbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sigbox__ph { position: absolute; left: 36px; right: 36px; bottom: 82px; color: #a7b6c4; font-size: 20px; pointer-events: none; transition: opacity .2s; }
.sigbox.signed .sigbox__ph { opacity: 0; }
.sigbox__line { position: absolute; left: 36px; right: 36px; bottom: 70px; border-bottom: 1.5px solid var(--mist); pointer-events: none; }
.sigbox__x { display: none; }

/* ---------- PIN ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(14, 34, 51, .42); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: fade .2s ease;
}
.pin { width: min(380px, calc(100vw - 32px)); background: var(--surface); border-radius: 28px; padding: 34px 28px 24px; text-align: center; box-shadow: 0 40px 100px -20px rgba(14, 34, 51, .45); animation: rise .28s cubic-bezier(.22, .8, .24, 1); }
.pin h2 { margin: 0 0 6px; font-size: 22px; font-weight: 650; letter-spacing: -.015em; }
.pin p { margin: 0 0 26px; color: var(--slate); font-size: 16px; }
.pin__dots { display: flex; gap: 18px; justify-content: center; margin-bottom: 28px; }
.pin__dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--mist); transition: background-color .12s, transform .12s; }
.pin__dots i.on { background: var(--ink); transform: scale(1.1); }
.pin__dots.shake { animation: shake .4s; }
.pin__dots.shake i { background: var(--danger); }
.pin__pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin__pad button { height: 70px; border-radius: 20px; border: 0; background: var(--air); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pin__pad button:active { background: var(--mist); }
.pin__pad .muted { background: transparent; font-size: 16px; color: var(--slate); font-weight: 550; }

/* ---------- Bewegung (nur als Antwort auf Aktionen) ---------- */
.anim-fwd { animation: inFwd .38s cubic-bezier(.22, .8, .24, 1) both; }
.anim-back { animation: inBack .38s cubic-bezier(.22, .8, .24, 1) both; }
.anim-fade { animation: fade .4s ease both; }
@keyframes inFwd { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes inBack { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes errIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
/* Einstieg Start/Willkommen: Überschrift Wort für Wort, dann Text, Button, Fußzeile */
.intro .w { display: inline-block; opacity: 0; transform: translateY(.38em); filter: blur(8px);
  animation: wordIn 1.1s cubic-bezier(.16, .84, .24, 1) forwards; animation-delay: calc(var(--i) * 90ms + 150ms); }
.intro .seq { opacity: 0; transform: translateY(14px); animation: seqIn 1s cubic-bezier(.16, .84, .24, 1) forwards; animation-delay: var(--d); }
.intro .hero__logo { opacity: 0; animation: fade 1.2s ease forwards; }
.intro .rings { opacity: 0; transform: scale(.92); transform-origin: 58% 61%; animation: ringsIn 2.4s cubic-bezier(.16, .84, .24, 1) .2s forwards; }
@keyframes wordIn { to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes seqIn { to { opacity: 1; transform: none; } }
@keyframes ringsIn { to { opacity: 1; transform: none; } }

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

/* ---------- Kleinere Bildschirme ---------- */
@media (max-width: 640px) {
  html, body { font-size: 17px; }
  .inner { padding: 32px 20px 48px; }
  .step-title { font-size: 31px; }
  .q-label { font-size: 21px; }
  .opts--3 { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .field, .field.half { grid-column: span 1; }
  .btn--primary { min-width: 0; flex: 1; }
  .btn--big { width: 100%; min-width: 0; }
  .hero { padding-left: 22px; padding-right: 22px; }
  .hero h1 { font-size: 40px; }
  .hero .lead { font-size: 19px; }
  .rings { width: 460px; height: 460px; right: -200px; bottom: -140px; }
  .rrow { grid-template-columns: 1fr; gap: 2px; }
  .topbar { padding-left: 18px; padding-right: 14px; }
  .footbar { padding-left: 18px; padding-right: 18px; }
}
