/* =========================================================================
   Wohlfühl-Check — gemeinsames Stylesheet
   Mobile-first. Reines CSS, keine Frameworks. BEM-Namensschema.
   Farb- und Abstands-Tokens als CSS-Variablen (leicht in PHP übertragbar).
   ========================================================================= */

/* ---------- Design-Tokens ------------------------------------------------ */
:root {
  /* Grundfarben */
  --c-bg:            #f6f4ef;   /* warmer, ruhiger Hintergrund */
  --c-surface:       #ffffff;   /* Karten */
  --c-surface-soft:  #f0ede6;   /* zarte Flächen */
  --c-text:          #2b2f36;   /* Haupttext, kein reines Schwarz */
  --c-text-muted:    #6b7280;   /* Nebentext */
  --c-text-faint:    #9aa0aa;   /* Disclaimer, Zähler */
  --c-border:        #e4e0d7;   /* Trennlinien / Kartenrand */

  /* Akzent (Buttons, Fokus) — ruhiges, vertrauensvolles Blau */
  --c-accent:        #3f7ba6;
  --c-accent-dark:   #336488;
  --c-accent-soft:   #e9f1f6;

  /* Semantische Zonen — bewusst gedämpft, „weich“ */
  --zone-gruen-bg:      #e7f0e6;
  --zone-gruen-border:  #bcd6bc;
  --zone-gruen-solid:   #5c9d6c;
  --zone-gruen-text:    #3c6b4a;

  --zone-gelb-bg:      #fbf1db;
  --zone-gelb-border:  #ecd4a0;
  --zone-gelb-solid:   #d9a441;
  --zone-gelb-text:    #8a6a23;

  /* Rot bewusst als warmes Terrakotta — unterstützend, nicht alarmierend */
  --zone-rot-bg:       #f5e7e2;
  --zone-rot-border:   #e2beb2;
  --zone-rot-solid:    #c17a67;
  --zone-rot-text:     #9a5544;

  /* Form */
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(43, 47, 54, .06);
  --shadow:    0 6px 20px rgba(43, 47, 54, .07);
  --shadow-lg: 0 14px 40px rgba(43, 47, 54, .10);

  --space:  16px;
  --touch:  56px;   /* minimale Tap-Größe */

  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Reset / Basis ------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ---------- Seiten-Layout ------------------------------------------------ */
.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.page__inner {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Inhalt vertikal etwas zentrieren (für kurze Seiten) */
.page--center .page__inner { justify-content: center; }

.stack   { display: flex; flex-direction: column; gap: 20px; }
.stack--tight { gap: 12px; }
.mt-auto { margin-top: auto; }

/* ---------- Karte -------------------------------------------------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

/* ---------- Typo-Bausteine ---------------------------------------------- */
.eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-accent);
}
.title {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.lead {
  font-size: 17px;
  color: var(--c-text-muted);
  text-wrap: pretty;
}
.muted { color: var(--c-text-muted); }

/* ---------- Meta-Zeile (Chips) ------------------------------------------ */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.meta__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text-muted);
  background: var(--c-surface-soft);
  border-radius: 999px;
}

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 24px;
  font-size: 17px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }

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

.btn--ghost {
  background: transparent;
  color: var(--c-text-muted);
  border-color: var(--c-border);
}
.btn--ghost:hover { background: var(--c-surface-soft); color: var(--c-text); }

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

/* ---------- Formularfelder ---------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }

.field__label {
  font-size: 16px;
  font-weight: 600;
}
.field__optional {
  font-weight: 500;
  color: var(--c-text-faint);
}
.field__hint {
  font-size: 14px;
  color: var(--c-text-muted);
}
.field__input,
.textarea {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field__input { min-height: var(--touch); }
.textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
}
.field__input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 4px var(--c-accent-soft);
}
.field__input::placeholder,
.textarea::placeholder { color: var(--c-text-faint); }

/* ---------- Hinweis-Box (Anonymität o. Ä.) ------------------------------ */
.note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--c-text-muted);
  background: var(--c-accent-soft);
  border-radius: var(--radius);
}
.note__icon { flex: none; color: var(--c-accent); }

/* ---------- Fortschritt -------------------------------------------------- */
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-muted);
}
.progress__track {
  height: 8px;
  background: var(--c-surface-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--c-accent);
  border-radius: 999px;
  transition: width .3s ease;
}

/* ---------- Frage -------------------------------------------------------- */
.question__text {
  font-size: 23px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.005em;
  text-wrap: pretty;
}

/* ---------- Antwort-Karten (Radio) -------------------------------------- */
.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.answer { display: block; position: relative; cursor: pointer; }

/* echtes Radio, visuell versteckt aber fokussierbar */
.answer__input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
}

.answer__box {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 16px 18px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  transition: border-color .15s ease, background-color .15s ease,
              box-shadow .15s ease;
}
.answer:hover .answer__box { border-color: #c9d7e1; }

.answer__mark {
  flex: none;
  width: 24px; height: 24px;
  border: 2px solid var(--c-border);
  border-radius: 50%;
  position: relative;
  transition: border-color .15s ease;
}
.answer__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--c-accent);
  transform: scale(0);
  transition: transform .15s ease;
}
.answer__label {
  font-size: 17px;
  font-weight: 500;
}

/* ausgewählter Zustand — deutlich hervorgehoben */
.answer__input:checked ~ .answer__box {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
  box-shadow: 0 0 0 1px var(--c-accent);
}
.answer__input:checked ~ .answer__box .answer__mark {
  border-color: var(--c-accent);
}
.answer__input:checked ~ .answer__box .answer__mark::after {
  transform: scale(1);
}
.answer__input:checked ~ .answer__box .answer__label {
  font-weight: 600;
}
/* Tastatur-Fokus */
.answer__input:focus-visible ~ .answer__box {
  box-shadow: 0 0 0 4px var(--c-accent-soft), 0 0 0 1px var(--c-accent);
}

/* ---------- Navigation (Zurück / Weiter) -------------------------------- */
.nav {
  display: flex;
  gap: 12px;
}
.nav .btn--ghost { flex: 0 0 auto; }
.nav .btn--primary { flex: 1; }
/* auf der ersten Frage: <div class="nav nav--first"> -> „Zurück“ ausblenden */
.nav--first .nav__back { display: none; }

/* ---------- Ergebnis: Zonen-Karte --------------------------------------- */
/* Zonenfarben über Modifikator: .result--gruen / --gelb / --rot           */
.result { --zone-bg: var(--c-surface); --zone-border: var(--c-border);
          --zone-solid: var(--c-accent); --zone-text: var(--c-text); }
.result--gruen { --zone-bg: var(--zone-gruen-bg); --zone-border: var(--zone-gruen-border);
                 --zone-solid: var(--zone-gruen-solid); --zone-text: var(--zone-gruen-text); }
.result--gelb  { --zone-bg: var(--zone-gelb-bg);  --zone-border: var(--zone-gelb-border);
                 --zone-solid: var(--zone-gelb-solid);  --zone-text: var(--zone-gelb-text); }
.result--rot   { --zone-bg: var(--zone-rot-bg);   --zone-border: var(--zone-rot-border);
                 --zone-solid: var(--zone-rot-solid);   --zone-text: var(--zone-rot-text); }

.result__card {
  background: var(--zone-bg);
  border: 1px solid var(--zone-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}
.result__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  background: var(--zone-solid);
  border-radius: 999px;
}
.result__title {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--zone-text);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.result__text {
  margin-top: 12px;
  font-size: 17px;
  color: var(--c-text);
  text-wrap: pretty;
}

/* „Was kannst du jetzt tun?“ */
.todo {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--zone-border);
}
.todo__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--zone-text);
  margin-bottom: 12px;
}
.todo__list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.todo__item {
  display: flex;
  gap: 12px;
  font-size: 16px;
  line-height: 1.45;
}
.todo__num {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--zone-solid);
  background: var(--zone-bg);
  border: 1.5px solid var(--zone-solid);
  border-radius: 50%;
}

/* ---------- SOS-Block (auf allen Ergebnis-Seiten) ----------------------- */
.sos {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-accent);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.sos__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 4px;
}
.sos__text { font-size: 15px; color: var(--c-text-muted); }
.sos__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-top: 10px;
}
.sos__phone {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-accent);
  white-space: nowrap;
}
.sos__phone-label { font-size: 15px; color: var(--c-text-muted); }
.sos__link { font-weight: 600; }

/* ---------- Teilen / Ergebnis-Link -------------------------------------- */
.share {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.share__label {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.share__hint { font-size: 14px; color: var(--c-text-muted); margin-bottom: 12px; }
.share__row {
  display: flex;
  gap: 8px;
}
.share__url {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--c-text-muted);
  background: var(--c-surface-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share__copy {
  flex: none;
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .15s ease;
}
.share__copy:hover { background: #dce9f1; }
.share__copy.is-copied { color: var(--zone-gruen-text); background: var(--zone-gruen-bg); }

/* ---------- Disclaimer --------------------------------------------------- */
.disclaimer {
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-text-faint);
  text-align: center;
  text-wrap: pretty;
}

/* ---------- Kopfzeile (kleines Label über Frage-Seiten) ----------------- */
.brandline {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-faint);
  letter-spacing: .01em;
}

/* ---------- Desktop-Feinschliff ----------------------------------------- */
@media (min-width: 720px) {
  body { font-size: 18px; }
  .page { padding: 40px 24px; }
  .title { font-size: 32px; }
  .question__text { font-size: 26px; }
  .result__title { font-size: 28px; }
  .card { padding: 36px 34px; }
  .result__card { padding: 34px 32px; }
}

/* ---------- Reduzierte Bewegung ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Ergänzung: Validierungs-Hinweis (nicht vom Designer) ---------- */
.answers--error .answer__box {
  border-color: var(--zone-rot-solid);
}
.answers--error::after {
  content: "Bitte wähle eine Antwort aus.";
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--zone-rot-text);
}

/* hidden-Attribut muss auch gegen .stack { display:flex } gewinnen */
[hidden] { display: none !important; }
