@font-face {
  font-family: "Outfit";
  src: url("fonts/outfit.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3efe6;
  --bg-deep: #e8e2d6;
  --surface: #fffcf7;
  --surface-2: #efe9dd;
  --text: #1c1915;
  --text-soft: #5a554c;
  --muted: #5f5a52;
  --line: #e3dcd0;
  --accent: #1b6b52;
  --accent-hover: #155541;
  --accent-soft: #d7efe4;
  --accent-text: #0e3d2e;
  --craving: #c2472b;
  --craving-hover: #a83b23;
  --craving-soft: #fde8e1;
  --danger: #9f2d2d;
  --danger-soft: #fde8e8;
  --shadow: 0 12px 32px rgba(40, 28, 12, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --font-sans: "Outfit", "ui-sans-serif", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", "Palatino Linotype", Palatino, serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --pad-x: 22px;
  --theme-color: #f3efe6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13120f;
    --bg-deep: #0c0b09;
    --surface: #1d1b17;
    --surface-2: #27241e;
    --text: #f4efe6;
    --text-soft: #c6bfb3;
    --muted: #9a9388;
    --line: #322f28;
    --accent: #6ad4a8;
    --accent-hover: #8be0bb;
    --accent-soft: #1a3a2e;
    --accent-text: #d8f6e9;
    --craving: #f08a6b;
    --craving-hover: #f3a48c;
    --craving-soft: #3a221c;
    --danger: #f0a0a0;
    --danger-soft: #3a1c1c;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    --theme-color: #13120f;
    color-scheme: dark;
  }
}

[data-theme="dark"] {
  --bg: #13120f;
  --bg-deep: #0c0b09;
  --surface: #1d1b17;
  --surface-2: #27241e;
  --text: #f4efe6;
  --text-soft: #c6bfb3;
  --muted: #9a9388;
  --line: #322f28;
  --accent: #6ad4a8;
  --accent-hover: #8be0bb;
  --accent-soft: #1a3a2e;
  --accent-text: #d8f6e9;
  --craving: #f08a6b;
  --craving-hover: #f3a48c;
  --craving-soft: #3a221c;
  --danger: #f0a0a0;
  --danger-soft: #3a1c1c;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --theme-color: #13120f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
  background:
    radial-gradient(1200px 500px at 80% -10%, var(--accent-soft), transparent 55%),
    var(--bg);
}

#app {
  width: min(560px, 100%);
  margin: 0 auto;
  min-height: calc(100dvh - var(--safe-top));
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  z-index: 20;
}
.skip-link:focus { left: 12px; }

.view[hidden], [hidden] { display: none !important; }

.view {
  min-height: calc(100dvh - var(--safe-top));
  display: flex;
  flex-direction: column;
}

h1, h2 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

h1 { font-size: clamp(1.85rem, 6vw, 2.35rem); }
h2 { font-size: 1.15rem; }

.lead {
  color: var(--text-soft);
  font-size: 1.05rem;
  margin: 0 0 1.3rem;
}

.muted, .fineprint { color: var(--muted); }
.fineprint { font-size: 0.82rem; line-height: 1.45; margin: 0 0 1rem; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 560;
}

label, legend {
  display: block;
  margin: 1rem 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 560;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
textarea {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  margin: 0;
}

textarea { resize: vertical; min-height: 6rem; }

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
.choice:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  background: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
[data-theme="dark"] .btn-primary { color: #0c1f18; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #0c1f18; }
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-ghost {
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  color: var(--text-soft);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-schmacht {
  width: 100%;
  background: var(--craving);
  color: #fff;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  min-height: 58px;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--craving) 35%, transparent);
}
.btn-schmacht:hover { background: var(--craving-hover); }

[data-theme="dark"] .btn-schmacht { color: #2a120c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-schmacht { color: #2a120c; }
}

.stack-btns {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.2rem;
}
.stack-btns .btn { width: 100%; }

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem var(--pad-x) 0.4rem;
  min-height: 52px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 620;
  letter-spacing: -0.02em;
}
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.topbar-actions { display: flex; gap: 0.4rem; }
.topbar-title {
  font-family: var(--font-display);
  font-weight: 550;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  pointer-events: none;
}

.dash {
  padding: 0.4rem var(--pad-x) calc(7.5rem + var(--safe-bottom));
}

.hero-time {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  font-weight: 520;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0.25rem 0 0.35rem;
  font-variant-numeric: lining-nums;
}

.hero-sub { margin: 0 0 1.4rem; color: var(--text-soft); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 550;
  margin: 0 0 0.15rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}
.stat-label { margin: 0; color: var(--text-soft); font-size: 0.88rem; }

.wish-head, .wish-amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
}
.wish-card h2 { margin: 0; }
.wish-amounts { font-size: 0.9rem; }
.progress {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.85rem 0 0.7rem;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #e8c56b));
  border-radius: inherit;
  transition: width 0.5s ease;
}
.wish-eta { margin: 0; font-weight: 560; color: var(--accent-text); }

.milestones { margin: 1.6rem 0 1rem; }
.milestones h2 { margin-bottom: 0.2rem; }
.milestones ol { list-style: none; margin: 0; padding: 0; }
.milestones li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 0.8rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.ms-dot {
  width: 14px;
  height: 14px;
  margin-top: 0.35rem;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: transparent;
}
.milestones li.done .ms-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.milestones li.next .ms-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ms-title { font-weight: 620; margin: 0; }
.ms-text, .ms-eta { margin: 0.15rem 0 0; color: var(--text-soft); font-size: 0.92rem; }

.schmacht-dock {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 0.75rem var(--pad-x) calc(1rem + var(--safe-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 32%);
  z-index: 6;
}
.schmacht-dock .btn-schmacht {
  margin-bottom: 0;
}

.ob-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.2rem var(--pad-x) calc(1.2rem + var(--safe-bottom));
}

.ob-progress {
  height: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.7rem;
}
.ob-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 16%;
  transition: width 0.3s ease;
}
.ob-step-label { margin: 0 0 1.2rem; color: var(--muted); font-size: 0.85rem; }
.ob-mark { width: 72px; height: 72px; border-radius: 20px; margin: 1.2rem 0 1rem; box-shadow: var(--shadow); }
.ob-nav {
  display: flex;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 1.4rem;
}
.ob-nav .btn-primary { flex: 1; }

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.8rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  min-height: 42px;
  font: inherit;
  cursor: pointer;
}
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.row-add { display: flex; gap: 0.5rem; }
.row-add input { flex: 1; }
.row-add .btn { flex: 0 0 auto; padding-inline: 1rem; }

.view-immersive { background: var(--bg); }
.schmacht-body, .after-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.4rem var(--pad-x) calc(1.5rem + var(--safe-bottom));
}
.schmacht-body h1, .after-body h1 { max-width: 22ch; }
.countdown-label { margin: 0; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; font-weight: 620; }
.countdown {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 16vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  margin: 0 0 0.6rem;
  font-variant-numeric: tabular-nums lining-nums;
}

.step-visual { height: 210px; display: grid; place-items: center; margin: 0.2rem 0 0.8rem; }
.step-icon { font-size: 4.5rem; line-height: 1; filter: saturate(0.9); }

.breath { position: relative; width: 200px; height: 200px; display: grid; place-items: center; }
.breath-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, white), var(--accent));
  box-shadow: 0 0 0 16px var(--accent-soft);
  transform: scale(0.62);
  transition: transform 4s linear;
}
.breath[data-phase="inhale"] .breath-circle { transform: scale(1); transition-duration: 4s; }
.breath[data-phase="hold"] .breath-circle { transform: scale(1); transition-duration: 0.2s; }
.breath[data-phase="exhale"] .breath-circle { transform: scale(0.62); transition-duration: 8s; }
.breath-phase {
  position: absolute;
  bottom: 0;
  margin: 0;
  font-weight: 620;
  color: var(--accent-text);
}

.reason-card {
  margin: 1.2rem 0 0;
  padding: 1rem 1.1rem;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.35;
  max-width: 32ch;
}
.reason-card::before {
  content: "Dein Grund";
  display: block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 650;
  margin-bottom: 0.35rem;
  opacity: 0.8;
}

.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn .icon-voice-on { display: none; }
.icon-btn[aria-pressed="true"] .icon-voice-on { display: block; }
.icon-btn[aria-pressed="true"] .icon-voice-off { display: none; }

.after-body { justify-content: center; }
.after-body .stack-btns, .after-body .reason-card { width: min(100%, 400px); }

.sheet {
  padding: 0.6rem var(--pad-x) calc(2rem + var(--safe-bottom));
}

.choice-cards { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.6rem; }
.choice {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.choice strong { display: block; margin-bottom: 0.3rem; font-size: 1.05rem; }
.choice span { color: var(--text-soft); font-size: 0.95rem; }
.choice:hover, .choice:active { border-color: var(--accent); }
.choice:active { transform: scale(0.99); background: var(--accent-soft); }
.choice.is-recommended { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.choice-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  margin-bottom: 0.45rem;
}
.won-line {
  margin: -0.6rem 0 1.2rem;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.95rem;
}
.milestone-next {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.8rem;
  box-shadow: var(--shadow);
}
.milestone-next .ms-eta { color: var(--accent-text); font-weight: 620; margin: 0 0 0.3rem; }
.ms-toggle {
  margin: 0.4rem 0 0.2rem;
  padding: 0.4rem 0;
  font: inherit;
  font-weight: 600;
  color: var(--text-soft);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.ms-toggle[aria-expanded="false"] + #milestone-reached { display: none; }
.slip-help { margin-top: 1.4rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.settings h2 { margin: 1.8rem 0 0.7rem; }
.settings form .btn { width: 100%; margin-top: 1.2rem; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.segmented label {
  margin: 0;
  text-align: center;
  padding: 0.55rem 0.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stats-list { display: flex; flex-direction: column; gap: 0.65rem; }
.stat-row { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: 0.6rem; align-items: center; font-size: 0.92rem; }
.stat-row .bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.stat-row .bar > span { display: block; height: 100%; background: var(--accent); }

.event-log { list-style: none; margin: 0; padding: 0; }
.event-log li {
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}
.event-log time { display: block; color: var(--muted); font-size: 0.8rem; }
.event-empty { color: var(--muted); }

.disclaimer {
  margin: 2.4rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.84rem;
}
.disclaimer a { color: var(--accent-hover); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  background: var(--text);
  color: var(--bg);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.toast p { margin: 0; }
#ios-hint.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  bottom: calc(92px + var(--safe-bottom));
}

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(420px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(12, 10, 8, 0.45); }
.dialog-body { padding: 1.2rem 1.2rem 1.1rem; }
.dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

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

@media (min-width: 700px) {
  body { background-color: var(--bg-deep); }
  #app {
    margin: 1.2rem auto calc(1.2rem + var(--safe-bottom));
    min-height: calc(100dvh - var(--safe-top) - 2.4rem);
    background: var(--bg);
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
}

.linkish {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent-hover);
  text-decoration: underline;
  cursor: pointer;
}
.ob-import-hint { margin-top: 1.2rem; }
