/* ============================================================
   methode willenskraft — Design: Aquarell · Grün · Gold · spirituell
   Hauptscreen: Blattkranz wächst um den Kreis, Baum wächst in der Mitte.
   ============================================================ */
:root {
  --paper:        #f1efe4;
  --paper-deep:   #e8e4d4;
  --paper-edge:   #ded8c6;
  --moss:         #4d6b52;
  --jade:         #3f6b5d;
  --emerald:      #2f5b4e;
  --emerald-deep: #234539;
  --sage:         #8aa491;
  --fir:          #1f3a31;
  --gold:         #c2a258;
  --gold-soft:    #d9bf83;
  --gold-light:   #efe2bb;
  --gold-deep:    #97793a;
  --text:         #2c3f37;
  --muted:        #56695f;
  --faint:        #8a988f;
  --green:        #3f6b5d;
  --green-soft:   #5d8a78;
  --violet:       #8a78a8;
  --danger:       #b0573f;
  --card:         rgba(255,255,255,0.46);
  --card-border:  rgba(151,121,58,0.26);
  --radius:       20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: radial-gradient(120% 90% at 50% 10%, #f3f1e7 0%, var(--paper) 52%, var(--paper-deep) 100%);
  color: var(--text);
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
body { overscroll-behavior: none; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.22 0 0 0 0 0.30 0 0 0 0 0.26 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.app {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto; height: 100dvh;
  padding:
    calc(env(safe-area-inset-top) + 18px)
    calc(env(safe-area-inset-right) + 22px)
    calc(env(safe-area-inset-bottom) + 22px)
    calc(env(safe-area-inset-left) + 22px);
  display: flex; flex-direction: column;
}
.screen { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.hidden { display: none !important; }

/* ---------- Brand / bars ---------- */
.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.brand-mark { color: var(--gold); font-size: 14px; }
.brand-name { font-family: 'Fraunces', serif; font-size: 12px; font-weight: 500; letter-spacing: .30em; text-transform: uppercase; color: var(--muted); }
.brand-name.small { letter-spacing: .26em; font-size: 11px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* ---------- Onboarding-Baum ---------- */
.hero-plant { display: flex; justify-content: center; margin: 6px 0 2px; }
.hero-plant svg { width: 150px; height: 150px; }

.lead { font-family: 'Fraunces', serif; font-size: clamp(30px, 8vw, 40px); line-height: 1.1; font-weight: 400; margin: 6px 0 12px; letter-spacing: -0.01em; color: var(--emerald); }
.lead em { color: var(--gold-deep); font-style: italic; }
.sub { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0 0 20px; }
.sub b { color: var(--text); font-weight: 600; }

/* ---------- Card / form ---------- */
.card { background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.24)); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 28px -18px rgba(31,58,49,.4); }
.form { display: flex; flex-direction: column; gap: 16px; margin-top: auto; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .04em; }

input[type="email"], input[type="text"], input[type="number"], textarea, .modal-input {
  width: 100%; padding: 14px 16px; font-size: 16px; font-family: 'Fraunces', serif;
  color: var(--text); background: rgba(255,255,255,.55); border: 1px solid var(--card-border);
  border-radius: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, .modal-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194,162,88,.16); }

.stepper { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.5); border: 1px solid var(--card-border); border-radius: 14px; padding: 6px; }
.stepper output { font-size: 28px; font-weight: 500; font-style: italic; color: var(--emerald); font-variant-numeric: tabular-nums; }
.step { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(255,255,255,.4); color: var(--emerald); font-size: 26px; font-weight: 500; cursor: pointer; }
.step:active { background: rgba(255,255,255,.7); }

/* ---------- Buttons ---------- */
.btn { border: none; border-radius: 16px; cursor: pointer; font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; padding: 16px; transition: transform .12s, filter .15s; width: 100%; }
.btn:active { transform: scale(.985); }
.btn-primary { color: #f3f0e4; background: radial-gradient(120% 150% at 26% 0%, rgba(138,164,145,.5), transparent 58%), linear-gradient(180deg, #436b5d 0%, #2f5b4e 58%, #234539 100%); box-shadow: 0 1px 0 rgba(214,228,212,.28) inset, 0 10px 22px -12px rgba(31,58,49,.7); }
.btn-primary.gold { color: #43331a; background: linear-gradient(180deg, var(--gold-soft), var(--gold) 75%, var(--gold-deep)); }
.btn-ghost { background: linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.18)); border: 1px solid var(--card-border); color: var(--emerald-deep); font-size: 15px; padding: 13px; }
.btn-ghost:disabled { opacity: .4; }
.btn:disabled { cursor: default; }

.link { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 6px; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--danger); align-self: center; margin-top: 4px; }
.hint { color: var(--faint); font-size: 13px; text-align: center; margin: 2px 0 0; font-style: italic; }
.hint-link { color: var(--gold-deep); text-decoration: underline; font-weight: 600; cursor: pointer; }
.status { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; margin: 2px 16px 10px; min-height: 20px; }
.status b { color: var(--green); }

/* ============================================================
   HAUPTSCREEN — Blattkranz-Emblem
   ============================================================ */
.emblem { flex: 1 1 0; min-height: 150px; display: flex; align-items: center; justify-content: center; margin: 2px auto; }
.wreath-box { position: relative; height: 100%; aspect-ratio: 1; max-height: min(86vw, 360px); }
.wreath { width: 100%; height: 100%; display: block; }

.halo { animation: halo 7.5s ease-in-out infinite; transform-origin: 170px 170px; }
@keyframes halo { 0%,100% { opacity: .72; transform: scale(1); } 50% { opacity: 1; transform: scale(1.045); } }
.wreath-breathe { animation: w-breathe 11s ease-in-out infinite; transform-origin: 170px 170px; }
@keyframes w-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.01); } }
.tip-shimmer { animation: tipshimmer 5.5s ease-in-out infinite; }
@keyframes tipshimmer { 0%,100% { opacity: .7; } 50% { opacity: 1; } }
.bud { animation: bud 4.5s ease-in-out infinite; transform-origin: center; }
@keyframes bud { 0%,100% { opacity: .85; } 50% { opacity: 1; } }

.ring-center { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.plant { width: 30%; margin-bottom: 4px; }
.plant svg { width: 100%; height: 100%; display: block; }

.countdown { display: flex; flex-direction: column; align-items: center; }
.cd-time { display: flex; align-items: baseline; justify-content: center; white-space: nowrap; }
.cd-num { font-weight: 400; font-style: italic; line-height: 1; font-variant-numeric: tabular-nums; }
.cd-day .cd-num { font-size: clamp(34px, 12vw, 50px); color: var(--emerald); }
.cd-day .cd-unit { font-size: 15px; font-style: normal; color: var(--muted); margin: 0 7px 0 3px; }
.cd-hr .cd-num { font-size: clamp(17px, 6vw, 22px); color: var(--muted); }
.cd-hr .cd-unit { font-size: 12px; color: var(--faint); margin-left: 3px; }
.cd-time.days-zero .cd-day { display: none; }
.cd-time.days-zero .cd-hr .cd-num { font-size: clamp(34px, 12vw, 50px); color: var(--emerald); }
.cd-time.days-zero .cd-hr .cd-unit { font-size: 14px; }
.cd-star { display: flex; flex-direction: column; align-items: center; font-size: clamp(34px, 12vw, 48px); line-height: 1; color: var(--gold); }
.cd-star-label { font-size: 13px; color: var(--gold-deep); font-style: italic; margin-top: 2px; }

/* ---------- Werte (Bonustage / Zyklen) — Symbol neben Zahl ---------- */
.stats { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat { position: relative; display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.22)); box-shadow: 0 1px 0 rgba(255,255,255,.62) inset, 0 6px 16px -11px rgba(31,58,49,.5); border: 1px solid var(--card-border); }
.stat-ico { width: 34px; height: 34px; flex: none; }
.stat-txt { display: flex; flex-direction: column; line-height: 1; }
.stat-val { font-size: 27px; font-weight: 400; font-style: italic; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-lbl { margin-top: 5px; font-family: 'Fraunces', serif; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

/* ---------- Aktionen ---------- */
.actions { margin-top: 16px; display: flex; flex-direction: column; gap: 11px; }
.action-row { display: flex; gap: 10px; }
.pill-konsum, .pill-entry {
  width: 100%; border: none; cursor: pointer; padding: 15px 20px; border-radius: 18px;
  font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; letter-spacing: .01em;
  text-align: center; transition: transform .12s, filter .15s;
}
.pill-konsum { color: #f3f0e4; background: radial-gradient(120% 150% at 26% 0%, rgba(138,164,145,.5), transparent 58%), linear-gradient(180deg, #436b5d 0%, #2f5b4e 58%, #234539 100%); box-shadow: 0 1px 0 rgba(214,228,212,.28) inset, 0 9px 20px -11px rgba(31,58,49,.7); }
.pill-konsum.reached { color: #43331a; background: linear-gradient(180deg, var(--gold-soft), var(--gold) 75%, var(--gold-deep)); }
.pill-entry { color: var(--emerald-deep); background: linear-gradient(180deg, rgba(255,255,255,.46), rgba(255,255,255,.18)); border: 1px solid var(--card-border); box-shadow: 0 1px 0 rgba(255,255,255,.58) inset, 0 6px 16px -11px rgba(31,58,49,.5); }
.pill-konsum:active, .pill-entry:active { transform: scale(.985); }

/* ---------- Dev-Werkzeuge ---------- */
.dev { margin-top: 14px; }
.dev summary { color: var(--faint); font-size: 12px; cursor: pointer; list-style: none; text-align: center; font-style: italic; }
.dev summary::-webkit-details-marker { display: none; }
.dev .action-row { margin-top: 10px; }
.dev .tt { font-size: 13px; }

@media (max-height: 780px) {
  .emblem { min-height: 126px; }
  .stats { margin-top: 10px; }
  .stat { padding: 11px 14px; }
  .stat-ico { width: 30px; height: 30px; }
  .stat-val { font-size: 24px; }
}

/* ---------- Heute-Eintrag (Tagebuch-Dialog) ---------- */
.today-head { display: flex; align-items: center; gap: 7px; color: var(--jade); font-weight: 600; font-size: 14px; margin-bottom: 11px; }
.today-head .opt { color: var(--faint); font-weight: 400; font-size: 12px; font-style: italic; }
.tip-i { position: relative; width: 17px; height: 17px; border-radius: 50%; flex: 0 0 auto; border: 1.4px solid var(--faint); background: none; color: var(--faint); font-size: 11px; font-weight: 700; font-style: italic; line-height: 1; cursor: pointer; padding: 0; }
.tip-i.on { border-color: var(--jade); color: var(--jade); }
.tip { display: none; position: absolute; top: 24px; left: -8px; width: 255px; z-index: 6; background: #fbf8ef; border: 1px solid var(--card-border); border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--text); font-style: normal; font-weight: 400; text-align: left; box-shadow: 0 12px 30px rgba(31,58,49,.22); }
.tip-i.on .tip { display: block; }
.today-list { display: flex; flex-direction: column; max-height: 34vh; overflow-y: auto; }
.chk { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; user-select: none; }
.chk .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--faint); display: flex; align-items: center; justify-content: center; font-size: 13px; flex: 0 0 auto; }
.chk.on .box { background: var(--jade); border-color: var(--jade); color: #f3f0e4; font-weight: 700; }
.chk-emoji { font-size: 16px; }
.chk-label { color: var(--text); }
.today-empty { color: var(--faint); font-size: 13px; text-align: center; margin: 4px 0; line-height: 1.4; font-style: italic; }
.note-inline { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; padding: 9px 11px; background: rgba(255,255,255,.5); border: 1px solid var(--card-border); border-radius: 11px; font-size: 13px; cursor: pointer; }
.note-inline .pen { color: var(--faint); flex: 0 0 auto; }
.note-inline .txt { color: var(--text); font-style: italic; line-height: 1.45; white-space: pre-wrap; }
.dayend { margin-top: 11px; text-align: center; color: var(--faint); font-size: 11.5px; }
.dayend b { color: var(--jade); font-variant-numeric: tabular-nums; font-weight: 600; }
.today-actions { display: flex; gap: 16px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--card-border); }
.today-add, .today-note { background: none; border: none; color: var(--jade); font-size: 13px; cursor: pointer; padding: 4px 0; }
.today-edit { margin-left: auto; color: var(--faint); }
.today-edit.on { color: var(--jade); }
.chk-edit { gap: 10px; }
.chk-edit .chk-label { flex: 1; }
.chk-del { background: rgba(176,87,63,.12); border: none; color: var(--danger); width: 26px; height: 26px; border-radius: 8px; font-size: 13px; cursor: pointer; flex: 0 0 auto; }
.dlg-p { color: var(--muted); font-size: 14px; margin: 0 0 10px; }

/* ---------- Tagebuch (Verlauf) ---------- */
.topbar-icons { display: flex; align-items: center; gap: 4px; }
.topbar-spacer { width: 22px; }
.journal-overview { text-align: center; color: var(--muted); font-size: 13px; margin: 2px 16px 16px; font-style: italic; }
.journal-list { display: flex; flex-direction: column; gap: 10px; }
.jday { background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.22)); border: 1px solid var(--card-border); border-radius: 16px; padding: 12px 14px; }
.jdate { font-size: 12px; color: var(--gold-deep); font-weight: 600; margin-bottom: 8px; letter-spacing: .04em; }
.jdone { display: flex; flex-wrap: wrap; gap: 6px; }
.jchip { background: rgba(63,107,93,.12); color: var(--emerald); border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.jnote { color: var(--text); font-size: 14px; line-height: 1.5; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--card-border); white-space: pre-wrap; font-style: italic; }

/* ---------- Onboarding-Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.chip { border: 1px solid var(--card-border); border-radius: 999px; padding: 8px 14px; font-size: 14px; color: var(--text); background: rgba(255,255,255,.4); cursor: pointer; }
.chip.on { background: rgba(63,107,93,.16); border-color: var(--jade); color: var(--emerald); }
.own-reward { margin-top: 14px; }
.started { text-align: center; color: var(--faint); font-size: 12px; margin: -4px 16px 16px; font-style: italic; }
.started b { color: var(--text); font-weight: 600; }
.mot-choice { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.mot-choice .btn { width: 100%; }
.mot-choice .btn.sel { box-shadow: 0 0 0 2px var(--gold); }

/* ---------- Toast / Confetti ---------- */
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 26px); transform: translate(-50%, 14px); opacity: 0; display: inline-flex; align-items: center; justify-content: center; gap: 9px; max-width: 88vw; text-align: center; line-height: 1.35; background: rgba(35,69,57,.94); border: 1px solid rgba(194,162,88,.4); color: #f1efe4; padding: 12px 22px; border-radius: 999px; font-family: 'Fraunces', serif; font-size: 15px; font-weight: 500; pointer-events: none; box-shadow: 0 12px 30px rgba(31,58,49,.4); transition: opacity .28s ease, transform .32s cubic-bezier(.22,1,.36,1); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; width: 100%; height: 100%; }

/* ---------- Modal / Dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(31,58,49,.42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.modal.show { opacity: 1; pointer-events: auto; }
.modal-card { width: 100%; max-width: 340px; background: linear-gradient(180deg, #fbf8ef, #f3efe2); border: 1px solid var(--card-border); border-radius: 22px; padding: 22px; box-shadow: 0 30px 70px -28px rgba(31,58,49,.5); transform: translateY(10px) scale(.96); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
.modal.show .modal-card { transform: translateY(0) scale(1); opacity: 1; }
.modal-card h4 { font-family: 'Fraunces', serif; margin: 0 0 8px; font-size: 19px; font-weight: 500; color: var(--emerald); }
.modal-card p { margin: 0 0 18px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.modal-card p b { color: var(--text); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-actions .btn { width: 100%; }
.btn-danger { background: rgba(176,87,63,.12); color: var(--danger); border: 1px solid rgba(176,87,63,.4); }
#entryModal { z-index: 55; }
.entry-card { max-width: 360px; max-height: 82vh; overflow-y: auto; }
.entry-card .today-head { margin-top: 2px; }
.entry-close { width: 100%; margin-top: 14px; }

/* ---------- Icon-Buttons ---------- */
.icon-btn { background: rgba(255,255,255,.32); border: 1px solid var(--card-border); color: var(--gold-deep); cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; line-height: 0; border-radius: 50%; transition: color .15s, background .15s, transform .12s; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; }
.icon-btn:hover { color: var(--emerald); background: rgba(255,255,255,.55); }
.icon-btn:active { transform: scale(.94); }

/* ---------- Einstellungen ---------- */
.settings-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.22)); border: 1px solid var(--card-border); border-radius: 14px; padding: 16px 18px; color: var(--text); font-family: 'Fraunces', serif; font-size: 15px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; }
.settings-row:hover { background: rgba(255,255,255,.66); }
.settings-row.danger { color: var(--danger); }
.settings-row.danger:hover { border-color: rgba(176,87,63,.45); }
.settings-chevron { color: var(--faint); font-size: 18px; line-height: 1; }
.settings-group-title { color: var(--gold-deep); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; margin: 22px 4px 8px; }
.settings-check { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.22)); border: 1px solid var(--card-border); border-radius: 14px; padding: 14px 18px; color: var(--text); font-family: 'Fraunces', serif; font-size: 15px; font-weight: 500; cursor: pointer; }
.settings-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--jade); cursor: pointer; flex: none; }

/* ---------- Login-Benachrichtigung ---------- */
.login-notif { position: fixed; z-index: 60; left: 50%; top: 22px; transform: translate(-50%, -18px); opacity: 0; display: flex; align-items: center; gap: 9px; background: rgba(63,107,93,.14); border: 1px solid rgba(63,107,93,.5); color: var(--emerald); padding: 12px 20px; border-radius: 999px; font-family: 'Fraunces', serif; font-size: 14.5px; font-weight: 500; pointer-events: none; transition: opacity .28s ease, transform .32s cubic-bezier(.22,1,.36,1); }
.login-notif.show { opacity: 1; transform: translate(-50%, 0); }
.login-notif .ck { width: 22px; height: 22px; border-radius: 50%; flex: none; background: var(--jade); color: #f1efe4; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Slides ---------- */
#slides { padding-bottom: 0; }
.slides-track { display: flex; flex: 1; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.slides-track::-webkit-scrollbar { display: none; }
.slide { min-width: 100%; scroll-snap-align: center; display: flex; flex-direction: column; padding: 0 2px; }
.slide .hero-plant { margin-top: 8px; }
.slide .lead { margin-top: 6px; }
.slide .card { margin-bottom: 4px; }
.slides-dots { display: flex; justify-content: center; gap: 8px; padding: 14px 0 4px; }
.slides-dots .dot { width: 7px; height: 7px; border-radius: 999px; background: rgba(31,58,49,.2); transition: background .2s, width .2s; }
.slides-dots .dot.active { background: var(--gold); width: 18px; }

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