/* Calm, warm, easy to read for every age. No external fonts (privacy). */
:root {
  --bg: #fbf7f1;
  --bg2: #f3eee6;
  --card: rgba(255, 255, 255, 0.84);
  --solid: #ffffff;
  --text: #2c2a33;
  --muted: #5f5a68;
  --line: #e7e0d5;
  --accent: #3d6e60;
  --accent-soft: #e3efe9;
  --accent-text: #ffffff;
  --me: #3d6e60;
  --me-text: #ffffff;
  --bot: #ffffff;
  --warm: #fdeee5;
  --warm-line: #efcab6;
  --warm-text: #7a3b22;
  --focus: #c86b45;
  --blob1: #f6d9c7;
  --blob2: #d6e8de;
  --blob3: #e3dcf0;
  --shadow: 0 10px 30px rgba(70, 55, 40, 0.08), 0 2px 6px rgba(70, 55, 40, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161922;
    --bg2: #1b1f2a;
    --card: rgba(36, 40, 54, 0.88);
    --solid: #242836;
    --text: #eeebf2;
    --muted: #b5b0bf;
    --line: #353a4a;
    --accent: #8cc9b4;
    --accent-soft: #23342f;
    --accent-text: #10201b;
    --me: #2f5a4e;
    --me-text: #f1f7f4;
    --bot: #262b39;
    --warm: #3a2a24;
    --warm-line: #6a4434;
    --warm-text: #f6cdb9;
    --focus: #f0a27f;
    --blob1: #3b2b2a;
    --blob2: #1f3530;
    --blob3: #2c2840;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px; line-height: 1.6;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
h1, h2 { outline: none; }

.sky { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .75; }
.b1 { width: 420px; height: 420px; background: var(--blob1); top: -120px; right: -100px; animation: drift 26s ease-in-out infinite alternate; }
.b2 { width: 380px; height: 380px; background: var(--blob2); bottom: -140px; left: -120px; animation: drift 32s ease-in-out infinite alternate-reverse; }
.b3 { width: 300px; height: 300px; background: var(--blob3); top: 40%; left: 55%; animation: drift 38s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(-40px, 30px); } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--solid); color: var(--text); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 12px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: 15px; min-width: 0; margin-right: auto; }
.leaf { width: 22px; height: 22px; border-radius: 50% 50% 50% 4px; background: var(--accent); transform: rotate(-45deg); flex-shrink: 0; opacity: .9; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 2px; }
.nav button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 15px; font-weight: 600;
  padding: 7px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.nav button:hover { color: var(--text); background: var(--accent-soft); }
.nav button[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.nav button.help { color: var(--warm-text); }
.lang { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-shrink: 0; }
.lang button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 740px; margin: 0 auto; padding: 18px 16px 32px; outline: none; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow);
  padding: 28px 24px; margin: 0 0 18px; animation: fade .45s ease both;
}
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.1rem); line-height: 1.25; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 0 0 10px; line-height: 1.3; }
p { margin: 0 0 12px; }
.lead { font-size: 1.1rem; }
.sub, .hint { color: var(--muted); }
.hint { font-size: .92rem; margin: 2px 0 10px; }
.note { color: var(--muted); font-size: .9rem; margin-top: 14px; }
ul { margin: 0; padding-left: 1.2em; }
li { margin: 6px 0; }

.btn {
  border: 0; font: inherit; font-weight: 600; cursor: pointer; border-radius: 999px; padding: 13px 26px;
  background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 16px rgba(61, 110, 96, .22);
  transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: none; border: 1.5px solid var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--text); box-shadow: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.actions.center { justify-content: center; }
.link { border: 0; background: none; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px; }
.link.urgent { color: var(--warm-text); margin-top: 16px; text-align: left; padding: 6px 0; }

/* ---------- welcome ---------- */
.sun { width: 60px; height: 60px; border-radius: 50%; margin-bottom: 14px;
  background: radial-gradient(circle at 35% 35%, #ffe3b8, #f4b07c 70%);
  box-shadow: 0 0 0 10px rgba(244, 176, 124, .15), 0 0 0 22px rgba(244, 176, 124, .07); }
.field { margin-top: 26px; }
.label { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0; }
.n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .85rem; flex-shrink: 0; }
input[type="text"], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--solid);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 42px; }
.results { list-style: none; margin: 6px 0 0; padding: 6px; background: var(--solid); border: 1.5px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.results li { margin: 0; }
.results button { width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.results button:hover, .results button:focus { background: var(--accent-soft); }
.results .none { color: var(--muted); padding: 9px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1.5px solid var(--line); background: var(--solid); color: var(--text); font: inherit; font-size: .95rem;
  padding: 8px 15px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(.98); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.soft-red { border-style: dashed; border-color: var(--warm-line); }
.picked { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border-radius: 16px; padding: 12px 16px; }
.picked strong { flex: 1; }
.pin { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.lang-hint { margin: 10px 0 0; color: var(--muted); font-size: .95rem; }
.safe { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border-radius: 16px; padding: 12px 14px; font-size: .95rem; margin-top: 26px; }
.safe svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }

/* ---------- chat ---------- */
body.in-chat main { padding-bottom: 120px; }
.log { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.msg { display: flex; gap: 10px; align-items: flex-end; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.bot { justify-content: flex-start; padding-right: 12%; }
.msg.me { justify-content: flex-end; padding-left: 14%; }
.msg.wide { padding-right: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; margin-bottom: 2px;
  background: radial-gradient(circle at 35% 35%, #ffe3b8, #f4b07c 75%); box-shadow: 0 0 0 4px rgba(244, 176, 124, .15); }
.bubble { padding: 12px 16px; border-radius: 20px; max-width: 100%; box-shadow: var(--shadow); }
.bubble p:last-child, .bubble ul:last-child { margin-bottom: 0; }
.bot .bubble { background: var(--bot); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.me .bubble { background: var(--me); color: var(--me-text); border-bottom-right-radius: 6px; white-space: normal; overflow-wrap: anywhere; }
.msg.wide .bubble { flex: 1; }
.msg.urgent .bubble { background: var(--warm); border-color: var(--warm-line); }
.typing .bubble { padding: 14px 18px; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-3px); } }
.topic-label { font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.step { background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; margin: 0; }
.reason-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.reason-list li { margin: 0; padding: 10px 12px; border-radius: 14px; background: var(--accent-soft); }
.copybox { background: var(--solid); border: 1.5px dashed var(--warm-line); border-radius: 14px; padding: 10px 12px; font-style: italic; }

.controls { margin: 14px 0 0 40px; }
.controls:empty { display: none; }
.controls .chips { margin: 0 0 10px; }
.replies { display: flex; flex-wrap: wrap; gap: 8px; }
.reply {
  border: 1.5px solid var(--accent); background: var(--solid); color: var(--accent); font: inherit; font-weight: 600; font-size: .95rem;
  padding: 9px 16px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.reply:hover { background: var(--accent); color: var(--accent-text); }
.reply.small { font-size: .88rem; padding: 6px 13px; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.tool { text-align: left; font: inherit; color: var(--text); cursor: pointer; background: var(--accent-soft); border: 1.5px solid transparent; border-radius: 16px; padding: 12px 14px; }
.tool:hover { border-color: var(--accent); }
.tool strong { display: block; }
.tool span { color: var(--muted); font-size: .88rem; }

.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg2) 30%); }
.composer-inner { max-width: 740px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end;
  background: var(--solid); border: 1.5px solid var(--line); border-radius: 24px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); }
.composer-inner:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer textarea { border: 0; padding: 9px 0; min-height: 42px; max-height: 200px; resize: none; background: transparent; box-shadow: none !important; line-height: 1.45; }
.send { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer; display: grid; place-items: center; }
.send:hover { filter: brightness(1.08); }

/* ---------- helplines ---------- */
.help-in-chat { }
.lines { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.line { background: var(--solid); border-radius: 14px; padding: 10px 12px; border: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0; }
.line-name { font-weight: 600; display: block; }
.line-note { color: var(--muted); font-size: .86rem; display: block; }
.num { font-weight: 700; font-size: 1.1rem; color: var(--accent); text-decoration: none; white-space: nowrap; border: 1.5px solid var(--accent); border-radius: 999px; padding: 5px 14px; }
.num:hover { background: var(--accent); color: var(--accent-text); }
.emergency { margin: 10px 0 0; font-weight: 600; }
.emergency a { color: var(--warm-text); }
.checked { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }

/* ---------- 100 reasons ---------- */
.hundred { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hundred li { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--solid); border: 1px solid var(--line); transition: box-shadow .3s, border-color .3s; }
.rn { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; }
.hundred li.glow { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }

/* ---------- panel ---------- */
dialog { border: 0; border-radius: 26px; padding: 0; max-width: 560px; width: calc(100% - 32px); background: var(--solid); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 25, 35, .45); backdrop-filter: blur(3px); }
.panel-inner { position: relative; padding: 26px 22px 22px; max-height: 86vh; overflow: auto; }
.panel-inner h2 { padding-right: 44px; }
.icon-btn { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 50%; width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; }
.icon-btn.close { position: absolute; top: 18px; right: 18px; }
select { margin-top: 6px; }
.panel-inner textarea { min-height: 220px; resize: vertical; }
.breath-wrap { display: grid; place-items: center; padding: 22px 0 6px; }
.breath { width: min(220px, 60vw); height: min(220px, 60vw); border-radius: 50%; transform: scale(.55);
  background: radial-gradient(circle at 40% 35%, var(--blob2), var(--accent) 120%);
  transition-property: transform; transition-timing-function: ease-in-out; box-shadow: 0 0 0 14px var(--accent-soft); }
.breath-label { font-weight: 600; font-size: 1.15rem; margin-top: 18px; min-height: 1.6em; text-align: center; }
.breath-count { color: var(--muted); font-size: .9rem; text-align: center; }
.ground-step { font-size: 1.2rem; font-weight: 600; background: var(--accent-soft); border-radius: 18px; padding: 20px; margin: 16px 0 0; }
.progress { display: flex; gap: 6px; margin-top: 12px; }
.progress span { height: 6px; flex: 1; border-radius: 6px; background: var(--line); }
.progress span.on { background: var(--accent); }

.foot { display: flex; justify-content: center; padding: 6px 16px 26px; }
body.in-chat .foot { display: none; }
.foot-link { border: 0; background: none; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.noscript { max-width: 640px; margin: 20px auto; padding: 16px; background: var(--warm); border-radius: 16px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .top { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .brand-text { font-size: 14px; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .nav button { padding: 6px 8px; font-size: 14px; }
  .card { padding: 22px 18px; border-radius: 22px; }
  .msg.bot { padding-right: 4%; }
  .msg.me { padding-left: 10%; }
  .controls { margin-left: 0; }
  .actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* breathing exercise choice */
.segs { display: flex; flex-wrap: wrap; gap: 6px; background: var(--accent-soft); padding: 5px; border-radius: 999px; margin-top: 6px; }
.seg { flex: 1 1 auto; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .92rem; font-weight: 600; padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.ex-desc { color: var(--muted); font-size: .95rem; margin: 12px 0 0; min-height: 3em; }
.msg.still { animation: none; }

/* ---------- calmer, more professional chat (Fassung 4) ---------- */
.blob { opacity: .5; }
.card { box-shadow: 0 1px 2px rgba(40, 30, 20, .04), 0 8px 24px rgba(40, 30, 20, .05); }
.log { gap: 4px; }
.msg { margin-top: 14px; }
.msg.grouped { margin-top: 0; }
.msg.grouped .avatar { visibility: hidden; }
.msg.me { margin-top: 18px; }
.bot .bubble { box-shadow: none; border-color: color-mix(in srgb, var(--line) 80%, transparent); border-radius: 18px; border-bottom-left-radius: 18px; line-height: 1.65; }
.msg.bot:not(.grouped) .bubble { border-top-left-radius: 6px; }
.me .bubble { box-shadow: none; border-radius: 18px; border-bottom-right-radius: 6px; }
.helps-intro { margin: 10px 0 4px; font-weight: 600; }
.topic-label { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.reason-list li { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.controls { margin-top: 18px; }
.reply { background: transparent; border-width: 1.5px; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--text); font-weight: 500; }
.reply:hover, .reply:focus-visible { background: var(--accent-soft); color: var(--text); }
.chip[aria-pressed="true"] { font-weight: 600; }
.newmsg {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; z-index: 7;
  display: flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font: inherit; font-size: .9rem; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: rise .3s ease both;
}
body:not(.in-chat) .newmsg { display: none; }
.top { background: color-mix(in srgb, var(--bg) 88%, transparent); }
.brand-text { letter-spacing: .02em; font-weight: 700; }
h1 { font-weight: 700; letter-spacing: -.02em; }
.intro .segs { margin-bottom: 18px; }
.bubble p.soft { color: var(--muted); font-size: .92rem; }

/* ---------- test banner + feedback ---------- */
.banner { max-width: 740px; margin: 10px auto 0; padding: 8px 14px; border-radius: 999px; background: var(--warm); color: var(--warm-text); font-size: .9rem; text-align: center; width: calc(100% - 32px); }
.banner .link { color: var(--warm-text); font-weight: 600; padding: 0 2px; }
.foot { gap: 10px; color: var(--muted); }
.fb-label { margin-top: 18px; margin-bottom: 6px; font-size: .95rem; }
textarea.fb { min-height: 84px; resize: vertical; }
.rating .seg { font-size: .85rem; padding: 7px 8px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.btn:disabled { opacity: .6; cursor: default; }
