@font-face {
  font-family: 'Figtree';
  src: url('/fonts/figtree.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --bg: #f6f2ec;
  --surface: #fffdf9;
  --surface-2: #f0eae2;
  --ink: #2f2a26;
  --ink-2: #6b625a;
  --ink-3: #9a9087;
  --line: #e6ddd2;
  --accent: #5f8d72;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece5;
  --warm-soft: #f8e6d8;
  --mood: #cf7a52;
  --anx: #7a6ab3;
  --energy: #b88722;
  --sleep: #4a80aa;
  --flow: #3f8a68;
  --sun: #d3a12f;
  --press: #8a7f76;
  --shadow: 0 1px 2px rgba(60, 45, 30, .05), 0 8px 24px -12px rgba(60, 45, 30, .18);
  --radius: 22px;
  --radius-s: 14px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1d2125;
    --surface-2: #262b30;
    --ink: #f1ece6;
    --ink-2: #b5ada4;
    --ink-3: #857d75;
    --line: #2f353b;
    --accent: #8dbb9f;
    --accent-ink: #13201a;
    --accent-soft: #23322a;
    --warm-soft: #3a2c22;
    --mood: #e79a76;
    --anx: #a99be2;
    --energy: #dcb04f;
    --sleep: #7eaed6;
    --flow: #77bf9c;
    --sun: #e8c260;
    --press: #a69c93;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 30px; font-weight: 600; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: 14px; }
.small { font-size: 14px; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  outline: none;
  animation: fade .35s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stack > * + * { margin-top: 14px; }
.stack-l > * + * { margin-top: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.header { margin-bottom: 22px; }
.header .eyebrow { color: var(--ink-3); font-size: 14px; font-weight: 500; text-transform: capitalize; }
.header h1 { margin-top: 4px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.warm { background: var(--warm-soft); box-shadow: none; }
.card.accent { background: var(--accent-soft); box-shadow: none; }
.card-title { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 22px;
  font-weight: 600; font-size: 16px;
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn { white-space: nowrap; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.line { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: transparent; color: #c0563f; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { text-decoration: none; background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 14px; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border-radius: 14px;
  color: var(--ink-3); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
body.focus .tabbar { display: none; }

/* ---------- Home ---------- */
.cta-card { display: flex; flex-direction: column; gap: 14px; }
.cta-card .art { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; background: var(--surface); }
.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.pill b { color: var(--ink); font-weight: 650; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.week .day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.week .day.today { color: var(--ink); }
.week .face-s { width: 30px; height: 30px; }
.week .empty { width: 30px; height: 30px; border-radius: 50%; border: 1.5px dashed var(--line); }
.anx-bar { width: 22px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.anx-bar i { display: block; height: 100%; background: var(--anx); border-radius: 2px; }

.weather { display: flex; align-items: center; gap: 14px; }
.weather .wicon { font-size: 34px; line-height: 1; }
.weather .temp { font-size: 26px; font-weight: 600; }

.insight-quote { font-size: 17px; line-height: 1.45; }

/* ---------- Check-in ---------- */
.checkin {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 20px);
  overflow-y: auto;
}
.checkin-inner { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; flex: 1; }
.checkin-top { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.progress { flex: 1; display: flex; gap: 5px; }
.progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); transition: background .3s; }
.progress i.on { background: var(--accent); }

.step { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 0; animation: slide .35s ease; }
@keyframes slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.step h2 { font-size: 26px; font-weight: 600; }
.step .sub { color: var(--ink-2); margin-top: 8px; }
.step-body { margin-top: 30px; }
.step-actions { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }

.why { margin-top: 26px; font-size: 14px; color: var(--ink-2); }
.why summary { cursor: pointer; color: var(--ink-3); font-weight: 600; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.why summary::-webkit-details-marker { display: none; }
.why p { margin-top: 8px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-s); }

.faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice {
  border: 0; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 8px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-weight: 600; font-size: 14px; color: var(--ink-2);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.choice:active { transform: scale(.96); }
.choice.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); color: var(--ink); }
.choice .face { width: 64px; height: 64px; }

.scale { display: flex; flex-direction: column; gap: 10px; }
.scale .opt {
  border: 0; background: var(--surface); box-shadow: var(--shadow);
  border-radius: var(--radius-s); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; text-align: left;
  font-weight: 550; transition: transform .15s ease, background .2s;
}
.scale .opt:active { transform: scale(.98); }
.scale .opt.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.scale .lvl { display: flex; gap: 4px; flex: none; }
.scale .lvl i { width: 8px; height: 22px; border-radius: 4px; background: var(--line); }
.scale .lvl i.on { background: var(--c, var(--accent)); }
.scale .opt small { display: block; color: var(--ink-3); font-weight: 500; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; border-radius: 999px; padding: 10px 16px;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 550; font-size: 15px; color: var(--ink-2);
  transition: background .15s, box-shadow .15s, color .15s;
}
.chip.sel { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.chip.add { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); background: transparent; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 20px; }
.stepper .val { font-size: 34px; font-weight: 600; min-width: 110px; text-align: center; }
.stepper .val small { font-size: 16px; color: var(--ink-3); font-weight: 500; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 24px; font-weight: 500; }
.label-s { font-size: 14px; color: var(--ink-3); font-weight: 600; text-align: center; margin-top: 26px; }

textarea, input[type=text], input[type=search], input[type=time] {
  width: 100%; border: 0; border-radius: var(--radius-s);
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
  padding: 14px 16px; font-size: 16px; outline: none;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
input[type=time] { width: auto; min-width: 120px; padding: 10px 14px; }

.done { text-align: center; align-items: center; }
.done .big { font-size: 64px; line-height: 1; }

/* ---------- Atmen ---------- */
.breathe { align-items: center; text-align: center; }
.orb-wrap { position: relative; width: 260px; height: 260px; margin: 34px auto; display: grid; place-items: center; }
.orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff8ef, var(--accent) 75%);
  box-shadow: 0 0 60px -10px var(--accent);
  transform: scale(1);
  transition-property: transform; transition-timing-function: ease-in-out;
}
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px dashed var(--line); }
.orb-label { position: absolute; bottom: -8px; left: 0; right: 0; font-size: 20px; font-weight: 600; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg button.sel { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.chart-head h3 { display: flex; align-items: center; gap: 8px; }
.chart-head .avg { font-size: 14px; color: var(--ink-2); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--ink-3); font-size: 11px; font-family: inherit; }
.tip {
  position: absolute; top: 0; pointer-events: none; z-index: 2;
  background: var(--ink); color: var(--bg);
  border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 600; white-space: nowrap;
  transform: translate(-50%, -110%); opacity: 0; transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip span { font-weight: 450; opacity: .75; }

/* ---------- Insights ---------- */
.finding h3 { display: flex; gap: 8px; align-items: center; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin: 8px 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg-dot.hollow { background: var(--surface) !important; box-shadow: inset 0 0 0 2px var(--ink-2); }
.lg-dot.filled { background: var(--ink); }
.cmp { display: grid; grid-template-columns: 92px 1fr 64px; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; }
.cmp .lbl { color: var(--ink-2); font-weight: 550; }
.cmp .diff { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.cmp svg { width: 100%; height: 24px; display: block; }
.badge { display: inline-block; white-space: nowrap; flex: none; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.badge.strong { background: var(--accent-soft); color: var(--accent); }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 12px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.knowledge details { border-top: 1px solid var(--line); padding: 14px 0; }
.knowledge details:first-of-type { border-top: 0; padding-top: 4px; }
.knowledge summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.knowledge summary::-webkit-details-marker { display: none; }
.knowledge summary::after { content: '+'; color: var(--ink-3); font-weight: 500; font-size: 20px; line-height: 1; }
.knowledge details[open] summary::after { content: '–'; }
.knowledge details p { margin-top: 10px; color: var(--ink-2); font-size: 15px; }
.knowledge .src { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- History ---------- */
.day-card { display: flex; gap: 14px; align-items: flex-start; }
.day-card .face-s { width: 40px; height: 40px; flex: none; }
.day-card .date { font-weight: 650; }
.day-card .note { margin-top: 6px; color: var(--ink-2); font-size: 14px; font-style: italic; }
.day-card .actions { display: flex; gap: 14px; margin-top: 8px; }

/* ---------- Settings ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; padding-top: 0; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.results button { text-align: left; border: 0; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

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

/* Hantel-Vergleich (gefüllt = Gruppe A, hohl = Gruppe B) */
.db { position: relative; height: 24px; }
.db .track { position: absolute; left: 0; right: 0; top: 11px; height: 2px; border-radius: 1px; background: var(--line); }
.db .span { position: absolute; top: 10px; height: 4px; border-radius: 2px; background: var(--c); opacity: .35; }
.db .pt { position: absolute; top: 5px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; }
.db .pt.a { background: var(--c); box-shadow: 0 0 0 2px var(--surface); }
.db .pt.b { background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--c), 0 0 0 2px var(--surface); }
.face-s { width: 30px; height: 30px; flex: none; }
.day-card .empty, .row .empty { width: 40px; height: 40px; border-radius: 50%; border: 1.5px dashed var(--line); flex: none; }
