:root {
  --bg: #fff7f5;
  --surface: #ffffff;
  --surface-2: #fff0ec;
  --surface-3: #fde4de;
  --text: #2b1d21;
  --muted: #8a7276;
  --line: #f1dcd7;
  --accent: #ff5c7a;
  --accent-2: #e84393;
  --accent-ink: #ffffff;
  --ok: #22a06b;
  --warn: #d97706;
  --danger: #e5484d;
  --shadow: 0 1px 2px rgba(80, 30, 40, .06), 0 6px 20px rgba(80, 30, 40, .06);
  --radius: 18px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --lcd-bg: #b8c9a3;
  --lcd-ink: #25321c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171214;
    --surface: #231b1e;
    --surface-2: #2c2226;
    --surface-3: #3a2c31;
    --text: #f6ecee;
    --muted: #b19ca1;
    --line: #3a2d31;
    --accent: #ff6f8a;
    --accent-2: #f05aa6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --lcd-bg: #8fa47a;
    --lcd-ink: #17200f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100vh; font-size: 56px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ---------- Layout */
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 5;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  display: flex; align-items: center; gap: 10px;
}
.top h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; flex: 1; }
.top .sub { color: var(--muted); font-size: 14px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2);
  display: grid; place-items: center; font-size: 18px; flex: none;
}
main { padding: 4px 16px calc(var(--tab-h) + var(--safe-b) + 28px); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.section-title .link-btn { text-decoration: none; }
.section-title button, .section-title a { text-transform: none; letter-spacing: 0; font-weight: 600; }

/* ---------- Tab-Leiste */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar .inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tab-h); }
.tab {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; color: var(--muted); font-weight: 600; position: relative; text-decoration: none;
}
.tab .ico { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .7; transition: transform .15s; }
.tab.active { color: var(--text); }
.tab.active .ico { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }
.tab .dot { position: absolute; top: 8px; right: calc(50% - 18px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 800; }
.tab.pager .ico {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; filter: none; opacity: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 26px;
  margin-top: -26px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); border: 4px solid var(--bg);
}

/* ---------- Bausteine */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card.tight { padding: 6px 0; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > * + * { margin-top: 10px; }
.btn {
  border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 700; background: var(--surface-2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; border-radius: 11px; font-size: 14px; }
.btn:disabled { opacity: .5; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; outline: none;
  font-size: 16px; /* verhindert Zoom auf iOS */
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: none; min-height: 90px; }
label.field { display: block; }
label.field > span, .field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 4px 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.addbar { display: flex; gap: 8px; background: var(--surface); padding: 6px; border-radius: 16px; box-shadow: var(--shadow); }
.addbar .input { border: 0; background: transparent; padding: 10px; }
.addbar .btn { padding: 10px 16px; }

.seg { display: flex; background: var(--surface-2); border-radius: 13px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip:has(input:checked), .chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.person-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.warn { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.today { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------- Listen */
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 52px; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item.done .title { text-decoration: line-through; color: var(--muted); }
.check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: none; flex: none; display: grid; place-items: center;
  color: #fff; font-size: 14px; transition: all .15s; padding: 0;
}
.check.on { background: var(--ok); border-color: var(--ok); }
.del { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 6px 4px; opacity: .6; }
.tap { cursor: pointer; }

/* ---------- Home */
.hero {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 24px; padding: 20px; margin-bottom: 12px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 30%, transparent); position: relative; overflow: hidden;
}
.hero::after { content: "❤"; position: absolute; right: -10px; bottom: -40px; font-size: 140px; opacity: .14; transform: rotate(-12deg); }
.hero .num { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.hero .lbl { opacity: .9; font-weight: 600; }
.hero .detail { margin-top: 8px; font-size: 14px; opacity: .85; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; border: 0; text-align: left; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 0; border-radius: 16px; padding: 14px 8px; box-shadow: var(--shadow); text-align: center; font-weight: 700; font-size: 13px; }
.tile .e { font-size: 28px; display: block; margin-bottom: 4px; }
.mood-big { font-size: 40px; line-height: 1; }
.mood-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 10px -16px -4px; padding: 0 16px 4px; }
.mood-row button { flex: none; border: 0; background: var(--surface-2); border-radius: 14px; width: 52px; height: 52px; font-size: 26px; }
.mood-row button.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); outline: 2px solid var(--accent); }
.banner { border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; background: color-mix(in srgb, var(--warn) 13%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.banner b { display: block; margin-bottom: 4px; }
.banner ol { margin: 6px 0 0; padding-left: 20px; }
.cd-list { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 8px; }
.cd { flex: none; min-width: 120px; background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.cd .n { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.cd .t { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- Kalender */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-head h2 { margin: 0; font-size: 20px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid .wd { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.day {
  border: 0; background: none; aspect-ratio: 1 / 1.05; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 7px; font-weight: 600; font-size: 15px; gap: 3px;
}
.day.other { color: var(--muted); opacity: .45; }
.day.today .n { background: var(--accent); color: #fff; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; margin-top: -4px; }
.day.sel { background: var(--surface-2); }
.day .dots { display: flex; gap: 2px; height: 6px; }
.day .dots i { width: 6px; height: 6px; border-radius: 50%; }
.ev { display: flex; gap: 12px; padding: 12px 16px; align-items: stretch; }
.ev + .ev { border-top: 1px solid var(--line); }
.ev .bar { width: 4px; border-radius: 4px; flex: none; }
.ev .time { font-size: 13px; color: var(--muted); font-weight: 700; min-width: 48px; }

/* ---------- Pager */
.pager-device {
  background: linear-gradient(160deg, #3a3f47, #1d2026); border-radius: 28px; padding: 18px; color: #cfd6df;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08), 0 16px 36px rgba(0, 0, 0, .25); margin-bottom: 14px; position: relative;
}
.pager-device .brand { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .25em; font-weight: 800; opacity: .7; margin-bottom: 10px; }
.pager-device .led { width: 10px; height: 10px; border-radius: 50%; background: #444; box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.pager-device .led.on { background: #ff3b5c; box-shadow: 0 0 10px #ff3b5c; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.lcd {
  background: var(--lcd-bg); color: var(--lcd-ink); border-radius: 10px; padding: 12px 14px; min-height: 96px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; box-shadow: inset 0 3px 8px rgba(0, 0, 0, .35);
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.04) 0 1px, transparent 1px 3px);
}
.lcd .l1 { font-size: 12px; display: flex; justify-content: space-between; opacity: .8; }
.lcd .l2 { font-size: 22px; font-weight: 700; margin-top: 6px; word-break: break-word; line-height: 1.2; }
.lcd .l3 { font-size: 12px; margin-top: 6px; opacity: .8; }
.beep {
  display: block; margin: 16px auto 2px; width: 120px; height: 120px; border-radius: 50%; border: 0; font-weight: 900; letter-spacing: .1em; font-size: 20px;
  background: radial-gradient(circle at 35% 30%, #ff8aa0, var(--accent) 45%, var(--accent-2)); color: #fff;
  box-shadow: 0 8px 0 #9b1f55, 0 14px 30px rgba(232, 67, 147, .5); transition: transform .08s, box-shadow .08s;
}
.beep:active, .beep.press { transform: translateY(6px); box-shadow: 0 2px 0 #9b1f55, 0 6px 14px rgba(232, 67, 147, .5); }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset { border: 0; background: var(--surface); border-radius: 14px; padding: 12px; text-align: left; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.preset .e { font-size: 22px; }
.preset small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; font-family: ui-monospace, Menlo, monospace; }
.shake { animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px) rotate(-1deg); } 40%, 80% { transform: translateX(6px) rotate(1deg); } }
.msg { display: flex; margin: 6px 0; }
.msg.mine { justify-content: flex-end; }
.msg .bubble { max-width: 78%; padding: 8px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); font-size: 15px; }
.msg.mine .bubble { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.msg .meta { font-size: 11px; opacity: .7; margin-top: 2px; }

/* ---------- Zettel */
.notes { columns: 2; column-gap: 10px; }
.note { break-inside: avoid; border-radius: 4px 16px 16px 16px; padding: 14px; margin-bottom: 10px; color: #3b2a1a; box-shadow: var(--shadow); position: relative; white-space: pre-wrap; word-break: break-word; }
.note .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; opacity: .75; }
.note .heart { border: 0; background: rgba(255, 255, 255, .5); border-radius: 999px; padding: 3px 8px; font-size: 13px; color: inherit; }

/* ---------- Date-Glas */
.jar { text-align: center; padding: 22px 16px; }
.jar .glass { font-size: 72px; display: inline-block; }
.jar .pick { font-size: 22px; font-weight: 800; margin: 10px 0 4px; min-height: 30px; }

/* ---------- Haushalt */
.chore { display: flex; align-items: center; gap: 12px; }
.chore .who { font-weight: 800; }

/* ---------- Sheet (Modal von unten) */
.backdrop { position: fixed; inset: 0; background: rgba(20, 10, 14, .42); z-index: 50; opacity: 0; transition: opacity .2s; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-width: 560px; margin: 0 auto; background: var(--bg);
  border-radius: 24px 24px 0 0; padding: 10px 16px calc(var(--safe-b) + 18px); max-height: 92vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .9, .3, 1);
}
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; background: var(--line); border-radius: 3px; margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.toggle + .toggle { border-top: 1px solid var(--line); }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; background: var(--line); border-radius: 15px; position: relative; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 9;
  width: 56px; height: 56px; border-radius: 50%; border: 0; font-size: 28px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}

#toast {
  position: fixed; left: 16px; right: 16px; top: calc(var(--safe-t) + 12px); z-index: 100; margin: 0 auto; width: fit-content; max-width: 528px;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-weight: 700; font-size: 14px;
  transform: translateY(calc(-100% - 60px)); transition: transform .25s; text-align: center; pointer-events: none;
}
#toast.show { transform: none; }

/* ---------- Willkommen */
.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-t) + 24px) 20px 32px; max-width: 440px; margin: 0 auto; }
.welcome .logo { font-size: 64px; text-align: center; }
.welcome h1 { text-align: center; font-size: 34px; margin: 6px 0 4px; letter-spacing: -.02em; }
.welcome p.lead { text-align: center; color: var(--muted); margin: 0 0 24px; }
.code-box { font-family: ui-monospace, Menlo, monospace; font-size: 30px; font-weight: 800; letter-spacing: .12em; text-align: center; padding: 18px; background: var(--surface); border-radius: 16px; border: 2px dashed var(--accent); user-select: all; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.color-row button.on { border-color: var(--text); }

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

form.allday .timed-only { display: none; }
.swatch { display: block; width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
input:checked + .swatch { border-color: var(--text); }
.chip input[type=date] { border: 0; background: none; }
.tab.pager .dot { top: -18px; right: calc(50% - 30px); }
.card > .banner:last-child { margin-bottom: 0; }
.note .heart { background: rgba(0, 0, 0, .07); }
