/* Ein Stylesheet für App und Seiten. Hell und warm als Vorgabe, dunkel über die Systemeinstellung. */
:root {
  --bg: #fbf5ea;
  --card: #ffffff;
  --line: #eadfcb;
  --text: #1d2740;
  --muted: #5c6579;
  --accent: #1f6f5f;
  --accent-text: #ffffff;
  --warn: #b0611c;
  --danger: #b03a3a;
  /* Flächenfarben für Zahlen, Stufen und Hinweise */
  --butter: #fbe3a1;
  --mint: #c9ead9;
  --lilac: #dcd3f6;
  --blush: #f9d5c8;
  --on-tint: #1d2740;
  --radius: 26px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171f;
    --card: #1a222d;
    --line: #2b3644;
    --text: #edf0f4;
    --muted: #9aa6b5;
    --accent: #86d6b6;
    --accent-text: #0c1a14;
    --warn: #e8a87c;
    --danger: #e58a8a;
    --butter: #4a3f1c;
    --mint: #1d3f33;
    --lilac: #322b52;
    --blush: #4a2a22;
    --on-tint: #edf0f4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

main {
  position: relative;
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 1rem) 1rem calc(env(safe-area-inset-bottom) + 2rem);
}
body.page main { max-width: 44rem; }

/* Zwei weiche Formen hinter dem Seitenkopf: Ring und Punkt aus dem Icon, groß und blass. */
main::before, main::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
main::before {
  width: 17rem;
  height: 17rem;
  top: -6rem;
  right: -7rem;
  border: 2.6rem solid var(--mint);
}
main::after {
  width: 6rem;
  height: 6rem;
  top: 4.2rem;
  right: -1.2rem;
  background: var(--butter);
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1rem;
  margin-bottom: 2rem;
}
header > img, .home img { display: block; }
.home { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.brand { font-weight: 750; font-size: 1.1rem; letter-spacing: .01em; }

nav { display: flex; flex-wrap: wrap; gap: .4rem; }
nav a {
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  padding: .45rem .9rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
}
nav a[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }

h1 { font-size: 2.1rem; line-height: 1.12; margin: 0 0 .8rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .5rem; text-wrap: balance; }
h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 .4rem; }
p { margin: 0 0 .9rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-underline-offset: .15em; }

.lead { color: var(--muted); font-size: 1.08rem; }
.small { font-size: .85rem; color: var(--muted); }
.center { text-align: center; }

.label {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1rem;
}
.card.hint { background: var(--mint); border-color: transparent; color: var(--on-tint); }
.card.hint .label { color: inherit; opacity: .7; }
.card.note { background: var(--butter); border-color: transparent; color: var(--on-tint); }

.steps {
  list-style: none;
  counter-reset: step;
  margin: 1.4rem 0;
  padding: 0;
  color: var(--muted);
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: .15rem 0 .15rem 2.7rem;
  margin-bottom: .55rem;
  min-height: 2rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 750;
  color: var(--on-tint);
  background: var(--mint);
}
.steps li:nth-child(3n+2)::before { background: var(--butter); }
.steps li:nth-child(3n)::before { background: var(--lilac); }
.steps b { color: var(--text); }

button, select, a.button {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .7rem 1.2rem;
  min-height: 2.9rem;
}
select { border-radius: 14px; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 650; }
button:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.primary, a.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
button.primary { display: block; width: 100%; min-height: 3.3rem; font-size: 1.05rem; }
button.link {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
}
button.danger { color: var(--danger); }
button.inline { display: inline; width: auto; min-height: 0; padding: .2rem .1rem; background: none; border: 0; border-radius: 4px; font-size: inherit; font-weight: 650; color: var(--accent); text-decoration: underline; text-underline-offset: .15em; }

.more { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.4rem 0 .9rem; }
.more a { flex: 1 1 12rem; }

.progress { display: flex; align-items: center; gap: .8rem; margin-top: .9rem; }
.dots { display: flex; gap: .4rem; }
.dots i {
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
  border: 2px solid var(--accent);
}
.dots i.on { background: var(--accent); }

.answers { display: grid; gap: .5rem; }
.answers button { background: var(--card); border-color: transparent; color: var(--text); font-weight: 600; }
#answers { margin-top: 1rem; }
.reply { margin-top: 1rem; font-weight: 700; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .8rem;
  text-align: center;
}
.stats div { border-radius: 18px; padding: .7rem .3rem; background: var(--mint); color: var(--on-tint); }
.stats div:nth-child(2) { background: var(--butter); }
.stats div:nth-child(3) { background: var(--blush); }
.stats div:nth-child(4) { background: var(--lilac); }
.stats b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: .72rem; line-height: 1.2; display: block; opacity: .8; }

.field { display: grid; gap: .35rem; font-weight: 650; margin-bottom: 1rem; }
input[type="email"], input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .75rem 1rem;
  min-height: 3rem;
  width: 100%;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.code { font-size: 2.4rem; font-weight: 750; letter-spacing: .18em; font-variant-numeric: tabular-nums; margin-bottom: .6rem; }
#install-home { display: block; width: 100%; margin-bottom: 1rem; }
#account-text { flex: 1 1 100%; font-size: .9rem; color: var(--muted); }

details { margin-top: 1.2rem; }
summary { cursor: pointer; font-weight: 650; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .9rem; }

.error {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  border: 1px solid var(--danger);
  border-radius: 16px;
  padding: .7rem 1rem;
}

/* --- Seiten: Warum, Wie, Rechtliches ------------------------------------------------------------------------- */

article h1 { font-size: 2.4rem; }
article h2 { margin-top: 2.4rem; font-size: 1.5rem; }
article ul { padding-left: 1.2rem; margin: 0 0 .9rem; }
article li { margin-bottom: .5rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .7rem; margin: 1.6rem 0 .4rem; }
.facts div { border-radius: var(--radius); padding: 1.1rem 1.2rem; background: var(--butter); color: var(--on-tint); }
.facts div:nth-child(2) { background: var(--mint); }
.facts div:nth-child(3) { background: var(--lilac); }
.facts b { display: block; font-size: 2rem; line-height: 1.1; margin-bottom: .3rem; }
.facts span { font-size: .9rem; line-height: 1.35; display: block; }
.facts a, .stage a, .study a { color: inherit; }

.study, .stage {
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: .8rem;
  background: var(--card);
  border: 1px solid var(--line);
}
.stage { border-color: transparent; background: var(--mint); color: var(--on-tint); }
.stage:nth-of-type(4n+2) { background: var(--butter); }
.stage:nth-of-type(4n+3) { background: var(--lilac); }
.stage:nth-of-type(4n) { background: var(--blush); }
.stage .label { color: inherit; opacity: .7; }

.cta { display: flex; flex-wrap: wrap; gap: .6rem; margin: 2.2rem 0 0; }

.sources { padding-left: 1.4rem; font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.sources li { margin-bottom: .6rem; }
:target { scroll-margin-top: 1rem; }
.sources li:target { color: var(--text); }

.legal h2 { font-size: 1.2rem; margin-top: 1.8rem; }
.legal address { font-style: normal; margin-bottom: .9rem; }

footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.2rem 1rem calc(env(safe-area-inset-bottom) + 2rem);
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.1rem;
  font-size: .85rem;
  border-top: 1px solid var(--line);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 26rem) {
  h1, article h1 { font-size: 1.85rem; }
  main::before { width: 13rem; height: 13rem; border-width: 2rem; }
}

/* --- App: ein Bildschirm, Navigation unten ------------------------------------------------------------------ */

body.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
body.app::before, body.app::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
body.app::before { width: 15rem; height: 15rem; top: -7rem; right: -7rem; border: 2.4rem solid var(--mint); }
body.app::after { width: 4.5rem; height: 4.5rem; top: 3.2rem; right: -1.4rem; background: var(--butter); }
body.app main::before, body.app main::after { display: none; }

body.app header {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + .7rem) 1rem .5rem;
}
body.app main {
  width: 100%;
  padding: .3rem 1rem .8rem;
  /* Passt alles, scrollt nichts; auf sehr kleinen Bildschirmen bleibt trotzdem alles erreichbar. */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stack { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .7rem; }
.stack > * { margin: 0; flex-shrink: 0; }
.grow { flex: 1 1 0; min-height: 0; }

body.app h1 { font-size: 1.6rem; margin: 0; }
body.app .card { padding: 1rem 1.1rem; margin: 0; }
body.app .card > * + * { margin-top: .5rem; }
body.app .card > p { margin-bottom: 0; }
body.app .lead { font-size: 1rem; }
body.app .stats { margin: 0; }
body.app .stats div { padding: .45rem .2rem; }
body.app .stats b { font-size: 1.25rem; }
#profile p { font-size: .93rem; line-height: 1.45; }
body.app .progress { margin-top: .5rem; }
body.app details { margin: 0; }
body.app button.link { min-height: 2rem; padding: .15rem 1rem; }
body.app .stack { gap: .6rem; }
#welcome .small { font-size: .78rem; }
#welcome #account-links { font-size: .95rem; }

.chip, .tag {
  display: inline-block;
  font-size: .78rem;
  font-weight: 650;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag { font-size: .68rem; letter-spacing: .04em; padding: .1rem .5rem; background: var(--lilac); border-color: transparent; color: var(--on-tint); text-transform: none; opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips .chip { background: var(--butter); border-color: transparent; color: var(--on-tint); }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  background: var(--butter);
  color: var(--on-tint);
  border-radius: 18px;
  padding: .5rem .6rem .5rem 1rem;
  font-size: .9rem;
}
.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 4.6rem);
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 26rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .6rem .6rem 1.1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .92rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgb(0 0 0 / .25);
  animation: toast-in .35s ease-out;
}
.toast span { flex: 1; }
.toast button { min-height: 2.3rem; padding: .3rem 1rem; flex-shrink: 0; }
.toast button.primary { display: inline-block; width: auto; font-size: .92rem; min-height: 2.3rem; }
.toast #update-later { background: none; border: 0; color: inherit; padding: .3rem .6rem; font-size: 1.2rem; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 1rem); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.banner button { min-height: 2.3rem; padding: .3rem .9rem; flex-shrink: 0; }

.answers { grid-template-columns: repeat(3, 1fr); }
.answers button { padding: .6rem .3rem; font-size: .92rem; background: var(--card); border: 1px solid var(--line); }
#answers { margin-top: 0; }
.reply { margin: 0; }

.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.moods button { padding: 0; min-height: 2.8rem; font-size: 1.4rem; line-height: 1; border-radius: 16px; }
.moods button[aria-checked="true"] { background: var(--mint); border-color: var(--accent); }
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .6rem .8rem;
  width: 100%;
  resize: none;
}
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.app .field { margin-bottom: 0; }
.row.tight { margin-top: 0; flex-wrap: nowrap; }
.row.tight > * { flex: 1; width: auto; display: block; min-height: 2.9rem; font-size: 1rem; }

.tile {
  display: grid;
  gap: .1rem;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: .8rem 1.1rem;
  min-height: 0;
}
.tile span { font-size: .85rem; color: var(--muted); }
#know-list .tile:nth-of-type(1) { background: var(--butter); border-color: transparent; color: var(--on-tint); }
#know-list .tile:nth-of-type(2) { background: var(--mint); border-color: transparent; color: var(--on-tint); }
#know-list .tile:nth-of-type(3) { background: var(--lilac); border-color: transparent; color: var(--on-tint); }
#know-list .tile span { color: inherit; opacity: .75; }

.back { align-self: flex-start; min-height: 2.2rem; padding: .2rem .9rem; font-size: .9rem; }
.plain { margin: 0; padding-left: 1.1rem; font-size: .88rem; line-height: 1.4; }
.panel > p { font-size: .95rem; }
.plain li { margin-bottom: .3rem; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 1rem; }
.legal-links a { color: var(--muted); }

#reader, #pattern { gap: .6rem; }
.reading { flex: 1; min-height: 0; overflow-y: auto; padding-right: .2rem; }
.reading h1 { font-size: 1.7rem; margin-bottom: .6rem; }
.reading h2 { margin-top: 1.8rem; font-size: 1.25rem; }
.reading ul { padding-left: 1.2rem; margin: 0 0 .9rem; }
.reading li { margin-bottom: .5rem; }
.reading .study, .reading .stage { padding: 1rem 1.1rem; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: .3rem .5rem calc(env(safe-area-inset-bottom) + .4rem);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.tabs button {
  display: grid;
  justify-items: center;
  gap: .1rem;
  background: none;
  border: 0;
  border-radius: 14px;
  padding: .35rem 0;
  min-height: 0;
  font-size: .72rem;
  font-weight: 650;
  color: var(--muted);
}
.tabs svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs svg .fill { fill: currentColor; stroke: none; }
.tabs button[aria-current="page"] { color: var(--accent); }

/* Apps antippen (Autopilot-Hinweis, „Wo?“) */
#app-ask .label { margin-bottom: .4rem; }
.picks { display: flex; flex-wrap: wrap; gap: .4rem; }
.pick { min-height: 2.5rem; padding: .3rem .9rem; font-size: .92rem; border-radius: 999px; }
.pick.quiet { background: none; border-color: transparent; color: var(--muted); }
#app-other { margin-top: .5rem; }
#app-other button, #app-add button { flex: 0 0 auto; }
.banner .close, .line .close { background: none; border: 0; color: inherit; min-height: 2.3rem; padding: .2rem .6rem; font-size: 1.2rem; line-height: 1; }
.banner span { flex: 1; }

/* Mein Muster */
.pattern > * + * { margin-top: .7rem; }
.pattern h2 { margin-top: 1.6rem; }
.pattern .label { margin-bottom: 0; }
.pattern p { margin-bottom: 0; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.step { font-weight: 650; }
.trend { display: block; width: 100%; height: auto; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend circle { fill: var(--accent); }
.trend text { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.rows { display: grid; gap: .45rem; }
.line { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.line .name { flex: 0 0 6.2rem; }
.line b.name { flex: 1 1 auto; overflow-wrap: anywhere; }
.line .num { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.line .when { flex: 0 0 6.6rem; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.line .what { flex: 1; overflow-wrap: anywhere; }
.line .arrow { font-weight: 750; width: 1.2rem; text-align: center; }
.bar { flex: 1; height: .55rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.entry { border: 1px solid var(--line); border-radius: 18px; background: var(--card); padding: .6rem .9rem; }
.entry .tools { display: flex; gap: 1rem; font-size: .85rem; }
.tip summary { font-size: .92rem; }
.tip ol { padding-left: 1.2rem; margin: .5rem 0; font-size: .9rem; }
.tip p { font-size: .9rem; margin-top: .5rem; }
#pattern-body .row.tight { margin-top: .7rem; }

[hidden] { display: none !important; }
