:root {
  --bg: #F6F3EE; --card: #FFFFFF; --ink: #17150F; --muted: #7A756B; --line: #E7E2D9;
  --soft: #EDE8DF; --accent: #FF4D2E; --accent-ink: #FFFFFF; --ok: #1F9D62; --shadow: 0 18px 40px -18px rgba(40, 30, 10, .35);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121110; --card: #1D1C1A; --ink: #F4F1EA; --muted: #9C968A; --line: #2E2C28; --soft: #262421; --shadow: 0 18px 40px -18px rgba(0, 0, 0, .8); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

#app { height: 100%; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--sat) + 10px) 20px 6px; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: -.045em; }
.brand b { color: var(--accent); font-weight: 800; }
.icon-btn { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 10px; border-radius: 19px; background: var(--soft); font-size: 14px; font-weight: 600; }
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view.scroll { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 20px 28px; }

/* Tabs */
.tabs { display: flex; padding: 6px 12px calc(var(--sab) + 6px); border-top: 1px solid var(--line); background: var(--bg); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.tabs button.on { color: var(--ink); }
.tabs button.on svg { color: var(--accent); }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 11px/18px -apple-system, sans-serif; font-style: normal; }

/* Chips */
.chips { display: flex; gap: 8px; padding: 6px 20px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* Kartenstapel */
.deck { flex: 1; min-height: 0; position: relative; margin: 0 20px; }
.card { position: absolute; inset: 0; border-radius: 26px; overflow: hidden; background: var(--soft); box-shadow: var(--shadow); touch-action: none; will-change: transform; transform-origin: 50% 90%; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.45) 30%, rgba(0,0,0,0) 58%); pointer-events: none; }
.card .txt { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px; color: #fff; z-index: 1; pointer-events: none; }
.card .meta { display: flex; gap: 6px; margin-bottom: 10px; }
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; background: rgba(255,255,255,.2); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 12px; font-weight: 700; color: #fff; }
.card h2 { font-size: 30px; line-height: 1.08; font-weight: 800; letter-spacing: -.03em; }
.card p { margin-top: 8px; font-size: 15px; line-height: 1.4; opacity: .92; }
.stamp { position: absolute; top: 26px; z-index: 2; padding: 6px 14px; border-radius: 12px; border: 3px solid; font-size: 22px; font-weight: 800; letter-spacing: .04em; opacity: 0; pointer-events: none; }
.stamp.yes { left: 22px; color: #3BE28C; transform: rotate(-12deg); }
.stamp.no { right: 22px; color: #FF6B55; transform: rotate(12deg); }
.card.anim { transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.deck-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 30px; border-radius: 26px; border: 1.5px dashed var(--line); }
.deck-empty h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.deck-empty p { color: var(--muted); }

.deck-actions { flex: none; display: flex; justify-content: center; align-items: center; gap: 22px; padding: 16px 0 14px; }
.round { width: 62px; height: 62px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: 0 8px 20px -10px rgba(40,30,10,.4); border: 1px solid var(--line); transition: transform .12s; }
.round:active { transform: scale(.92); }
.round.nope { color: var(--muted); }
.round.like { color: var(--accent); }
.round.info { width: 46px; height: 46px; color: var(--ink); }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 54px; padding: 0 22px; border-radius: 18px; background: var(--ink); color: var(--bg); font-size: 16px; font-weight: 700; width: 100%; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--soft); color: var(--ink); }
.btn.small { height: 42px; border-radius: 14px; font-size: 14px; width: auto; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.link { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Überschriften in Listenansichten */
.h-page { font-size: 30px; font-weight: 800; letter-spacing: -.035em; margin: 6px 0 4px; }
.sub { color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 20px; font-weight: 800; margin-bottom: 6px; letter-spacing: -.02em; }
.empty .big { font-size: 44px; margin-bottom: 10px; }

/* Gemerkt */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { position: relative; aspect-ratio: 3/4; border-radius: 20px; overflow: hidden; background: var(--soft); text-align: left; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,0) 60%); }
.tile b { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1; color: #fff; font-size: 16px; line-height: 1.15; font-weight: 800; letter-spacing: -.015em; }
.tile .match { position: absolute; left: 10px; top: 10px; z-index: 1; background: var(--accent); }
.tile .rm { position: absolute; right: 8px; top: 8px; z-index: 2; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; display: grid; place-items: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* Rezeptseite */
.page { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; transform: translateY(100%); transition: transform .34s cubic-bezier(.2,.8,.2,1); }
.page.open { transform: none; }
.page-inner { max-width: 520px; margin: 0 auto; padding-bottom: calc(var(--sab) + 110px); }
.hero { position: relative; aspect-ratio: 1/1; background: var(--soft); }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.close { position: fixed; top: calc(var(--sat) + 12px); z-index: 22; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); left: max(16px, calc(50% - 244px)); }
.body { padding: 22px 20px 0; }
.body h1 { font-size: 32px; line-height: 1.06; font-weight: 800; letter-spacing: -.035em; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 14px; }
.fact { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--soft); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; }
.lead { font-size: 17px; line-height: 1.45; color: var(--muted); }
.h-sec { font-size: 21px; font-weight: 800; letter-spacing: -.025em; margin: 30px 0 4px; }
.h-note { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.ing li span:first-child { flex: none; width: 84px; font-weight: 700; }
.steps { list-style: none; padding: 0; margin: 8px 0 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 18px 44px; font-size: 16px; line-height: 1.5; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.media { margin: 26px 0 0; border-radius: 20px; overflow: hidden; background: var(--soft); position: relative; }
.media img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.media.video { aspect-ratio: 16/9; }
.media.video img { aspect-ratio: 16/9; height: 100%; }
.media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.18); }
.play i { width: 68px; height: 68px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 30px -8px rgba(0,0,0,.6); }
.cap { font-size: 12px; color: var(--muted); margin-top: 8px; }
.daybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; padding: 12px 16px calc(var(--sab) + 12px); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.daybar > div { max-width: 488px; margin: 0 auto; }
.daybar small { display: block; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.daybar .row { display: flex; gap: 10px; }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; max-height: 92%; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 20px calc(var(--sab) + 20px); transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.sheet-wrap.open .scrim { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.sheet .sub { margin-top: 4px; }
.lbl { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 24px 0 8px; display: flex; justify-content: space-between; }

/* Abhak-Zeilen */
.rows { background: var(--card); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.rowi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 16px; }
.rowi:last-child { border-bottom: 0; }
.rowi .box { flex: none; width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; transition: all .15s; }
.rowi .t { flex: 1; min-width: 0; }
.rowi .t b { font-weight: 700; }
.rowi .tag { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rowi.have .t { color: var(--muted); text-decoration: line-through; }
.rowi.have .box { background: var(--soft); border-color: var(--soft); color: var(--muted); }
.rowi.done .t { color: var(--muted); text-decoration: line-through; }
.rowi.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.rowi .x { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.add { display: flex; gap: 8px; margin-top: 10px; }
.add input, .field { flex: 1; min-width: 0; height: 50px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); padding: 0 16px; font-size: 16px; outline: none; -webkit-user-select: text; user-select: text; }
.add input:focus, .field:focus { border-color: var(--ink); }
.add button { flex: none; width: 50px; height: 50px; border-radius: 16px; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.seg { display: flex; gap: 10px; }
.seg button { flex: 1; height: 64px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); font-size: 17px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .15s; }
.seg button.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.seg.sm button { height: 48px; font-size: 15px; border-radius: 15px; }
.mt { margin-top: 22px; }
.center { text-align: center; }

/* Einkauf */
.list-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 18px 16px 12px; margin-bottom: 18px; }
.list-card.mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.list-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 0 4px; }
.list-head .day { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.list-head h3 { font-size: 21px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin-top: 2px; text-align: left; }
.who { flex: none; height: 28px; padding: 0 11px; border-radius: 14px; background: var(--soft); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; white-space: nowrap; }
.mine .who { background: var(--accent); color: var(--accent-ink); }
.prog { height: 6px; border-radius: 3px; background: var(--soft); margin: 14px 4px 6px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .3s; }
.prog-t { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 4px 8px; }
.list-card .rows { border: 0; border-radius: 0; background: none; }
.list-card .rowi { padding: 10px 4px; }
.list-foot { display: flex; justify-content: space-between; padding: 10px 4px 4px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 96px); transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-size: 14px; font-weight: 700; max-width: 86%; text-align: center; box-shadow: var(--shadow); animation: pop .25s ease; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } }
.note { font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 10px; }
.note b { color: var(--ink); }
.status { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); }
.onb { text-align: center; padding-top: 10px; }
.onb .brand { font-size: 44px; margin: 6px 0 6px; }
