/* ══════════════════════════════════════════════
   Rezepte — Design-System
   ══════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #e8590c;
  --accent-soft: #fdf0e7;
  --bg: #f4f4f6;
  --card: #ffffff;
  --card-2: #f4f4f6;
  --text: #16161a;
  --sub: #6b6b73;
  --hint: #a8a8b0;
  --sep: #e6e6ea;
  --green: #1f9254;
  --red: #d63a2f;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.05);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 52px;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #ff8a3d;
    --accent-soft: #3a2314;
    --bg: #000000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --text: #f2f2f5;
    --sub: #9a9aa2;
    --hint: #6b6b73;
    --sep: #2e2e33;
    --green: #34c77b;
    --red: #ff6b5e;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --accent: #ff8a3d;
  --accent-soft: #3a2314;
  --bg: #000000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --text: #f2f2f5;
  --sub: #9a9aa2;
  --hint: #6b6b73;
  --sep: #2e2e33;
  --green: #34c77b;
  --red: #ff6b5e;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--accent); }
::selection { background: var(--accent); color: #fff; }

/* ── Layout ───────────────────────────────── */
#app { max-width: 620px; margin: 0 auto; }

.screen { display: none; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.screen.on { display: block; }

.hdr {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: calc(var(--safe-t) + 10px) 16px 8px;
}
.hdr-row { display: flex; align-items: center; gap: 10px; min-height: 38px; }
.hdr h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; flex: 1; }
.hdr-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; transition: transform .1s;
}
.hdr-btn:active { transform: scale(.9); }

.body { padding: 4px 16px 0; }

/* ── Tabbar ───────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex;
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: .5px solid var(--sep);
}
.tabbar-inner { display: flex; width: 100%; max-width: 620px; margin: 0 auto; }
.tbtn {
  flex: 1; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--hint); font-size: 10px; font-weight: 600; letter-spacing: .1px;
  position: relative;
}
.tbtn .ic { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .55; transition: all .15s; }
.tbtn.on { color: var(--accent); }
.tbtn.on .ic { filter: none; opacity: 1; transform: translateY(-1px); }
.tbtn .badge {
  position: absolute; top: 4px; left: 50%; margin-left: 6px;
  min-width: 17px; height: 17px; padding: 0 5px;
  background: var(--accent); color: #fff;
  border-radius: 9px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tbtn .badge[hidden] { display: none; }

/* ── Search ───────────────────────────────── */
.search-wrap { position: relative; margin: 8px 0 12px; }
.search {
  width: 100%; height: 38px; padding: 0 34px 0 34px;
  background: var(--card); color: var(--text);
  border: none; border-radius: 11px; font-size: 16px;
  box-shadow: var(--shadow); outline: none;
}
.search::placeholder { color: var(--hint); }
.search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--hint); font-size: 14px; pointer-events: none; }
.search-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; color: var(--hint); font-size: 15px; display: none; }
.search-wrap.filled .search-x { display: block; }

/* ── Chips ────────────────────────────────── */
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 16px 12px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 13px; border-radius: 15px;
  background: var(--card); color: var(--sub);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  box-shadow: var(--shadow); transition: all .12s;
}
.chip.on { background: var(--accent); color: #fff; box-shadow: none; }
.chip:active { transform: scale(.95); }

/* ── Recipe grid ──────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
@media (max-width: 359px) { .grid { grid-template-columns: 1fr; } }

.rcard {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-align: left; width: 100%;
  transition: transform .12s; position: relative; display: block;
}
.rcard:active { transform: scale(.975); }
.rcard-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--card-2); }
.rcard-ph {
  width: 100%; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center; font-size: 40px;
  background: linear-gradient(135deg, var(--accent-soft), var(--card-2));
}
.rcard-b { padding: 10px 12px 12px; }
.rcard-t { font-size: 14.5px; font-weight: 700; line-height: 1.28; letter-spacing: -.2px; }
.rcard-m { font-size: 12px; color: var(--sub); margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; }
.rcard-fav { position: absolute; top: 8px; right: 8px; font-size: 15px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }

/* ── Empty ────────────────────────────────── */
.empty { padding: 60px 24px; text-align: center; }
.empty-ic { font-size: 54px; margin-bottom: 14px; opacity: .85; }
.empty h2 { font-size: 19px; font-weight: 700; margin-bottom: 7px; }
.empty p { font-size: 14.5px; color: var(--sub); line-height: 1.55; }
.empty .btn { margin-top: 20px; display: inline-flex; }

/* ── Buttons ──────────────────────────────── */
.btn {
  height: 46px; padding: 0 20px; border-radius: 13px;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 650; letter-spacing: -.1px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: opacity .1s, transform .1s;
}
.btn:active { opacity: .75; transform: scale(.985); }
.btn:disabled { opacity: .45; }
.btn.full { width: 100%; }
.btn.sec { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.btn.on-card { background: var(--card-2); color: var(--text); }   /* für Buttons innerhalb einer Karte */
.btn.ghost { background: none; color: var(--accent); box-shadow: none; }
.btn.danger { background: none; color: var(--red); }
.btn.sm { height: 38px; font-size: 14.5px; padding: 0 15px; border-radius: 11px; }
.btn.icon-btn {
  width: 52px; padding: 0; font-size: 19px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
}

/* ── Cards / rows ─────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.card-pad { padding: 16px; }
.sec-lbl {
  font-size: 11.5px; font-weight: 700; color: var(--hint);
  text-transform: uppercase; letter-spacing: .7px;
  margin: 22px 0 8px 4px;
}
.sec-lbl:first-child { margin-top: 6px; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: .5px solid var(--sep);
  width: 100%; text-align: left; font-size: 16px;
}
.row:last-child { border-bottom: none; }
.row-ic { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.row-t { flex: 1; }
.row-v { color: var(--sub); font-size: 15px; }
.row-arrow { color: var(--hint); font-size: 13px; }

/* ── Inputs ───────────────────────────────── */
.field {
  width: 100%; min-height: 46px; padding: 12px 14px;
  background: var(--card); color: var(--text);
  border: 1.5px solid transparent; border-radius: 13px;
  font-size: 16px; outline: none; box-shadow: var(--shadow);
  -webkit-appearance: none;
}
.field:focus { border-color: var(--accent); }
.field::placeholder { color: var(--hint); }
textarea.field { min-height: 130px; line-height: 1.5; resize: vertical; }

/* ── Segmented ────────────────────────────── */
.seg { display: flex; background: var(--card-2); border-radius: 10px; padding: 2px; margin-bottom: 14px; }
.seg button {
  flex: 1; height: 32px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--sub); transition: all .15s;
}
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.14); }

/* ── Sheet (fullscreen modal) ─────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.32,.72,0,1);
  visibility: hidden;
}
.sheet.on { transform: translateY(0); visibility: visible; }
.sheet-inner { max-width: 620px; margin: 0 auto; padding-bottom: calc(var(--safe-b) + 40px); }
.sheet-hdr {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 10px) 12px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.sheet-hdr.on-image {
  background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  position: absolute; left: 0; right: 0;
}
.sheet-hdr.on-image .sheet-x, .sheet-hdr.on-image .hdr-btn {
  background: rgba(0,0,0,.42); color: #fff; backdrop-filter: blur(8px);
}
.sheet-x {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--card-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sheet-title { flex: 1; font-size: 16px; font-weight: 700; text-align: center; padding: 0 4px; }
.sheet-body { padding: 6px 16px 0; }

/* ── Recipe detail ────────────────────────── */
.hero { position: relative; }
.hero img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
.hero-ph { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; font-size: 64px; background: linear-gradient(135deg, var(--accent-soft), var(--card-2)); }
.hero-fade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.35) 0%, transparent 28%); pointer-events: none; }

.det-head { padding: 18px 16px 0; }
.det-src { font-size: 11.5px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .7px; }
.det-title { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.6px; margin: 5px 0 12px; }
.det-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.pill { font-size: 12.5px; font-weight: 600; color: var(--sub); background: var(--card); padding: 5px 11px; border-radius: 14px; box-shadow: var(--shadow); }

/* ── Portions ─────────────────────────────── */
.pbox {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
}
.pbox-l { font-size: 16px; font-weight: 650; }
.pbox-s { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--card-2); border-radius: 12px; padding: 3px; }
.stepper button {
  width: 36px; height: 34px; border-radius: 10px;
  font-size: 20px; font-weight: 400; color: var(--accent);
  display: flex; align-items: center; justify-content: center; line-height: 1;
  transition: background .1s;
}
.stepper button:active { background: var(--card); }
.stepper button:disabled { color: var(--hint); }
.stepper .val { min-width: 34px; text-align: center; font-size: 17px; font-weight: 750; }

/* ── Ingredients ──────────────────────────── */
.ing-group { font-size: 13px; font-weight: 700; color: var(--accent); padding: 14px 16px 4px; }
.ing {
  display: grid; grid-template-columns: 22px 88px 1fr; gap: 10px; align-items: baseline;
  padding: 11px 16px; border-bottom: .5px solid var(--sep);
  width: 100%; text-align: left;
}
.ing:last-child { border-bottom: none; }
.ing-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.7px solid var(--sep); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; transition: all .12s; align-self: center;
}
.ing.done .ing-check { background: var(--green); border-color: var(--green); }
.ing.done .ing-name, .ing.done .ing-amt { opacity: .38; text-decoration: line-through; }
.ing-amt { font-size: 15px; font-weight: 700; color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
.ing-name { font-size: 15.5px; line-height: 1.35; }
.ing-note { color: var(--sub); font-size: 13.5px; }

/* ── Steps ────────────────────────────────── */
.step { display: flex; gap: 13px; padding: 14px 16px; border-bottom: .5px solid var(--sep); }
.step:last-child { border-bottom: none; }
.step-n {
  width: 25px; height: 25px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.step-t { font-size: 15.5px; line-height: 1.55; flex: 1; }
.timer-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 7px; border-radius: 7px; font-weight: 700;
  font-size: 14px; white-space: nowrap;
}

/* ── Cook mode ────────────────────────────── */
#cook {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: none; flex-direction: column;
}
#cook.on { display: flex; }
.cook-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
}
.cook-prog { flex: 1; height: 4px; background: var(--sep); border-radius: 2px; overflow: hidden; }
.cook-prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .25s; }
.cook-main {
  flex: 1; overflow-y: auto; padding: 10px 24px 20px;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 620px; width: 100%; margin: 0 auto;
}
.cook-count { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .8px; text-transform: uppercase; margin-bottom: 14px; }
.cook-text { font-size: 25px; line-height: 1.42; font-weight: 550; letter-spacing: -.4px; }
.cook-ings { margin-top: 26px; }
.cook-ings .sec-lbl { margin-left: 0; }
.cook-ing { font-size: 15.5px; padding: 7px 0; border-bottom: .5px solid var(--sep); display: flex; gap: 10px; }
.cook-ing b { color: var(--accent); min-width: 78px; font-variant-numeric: tabular-nums; }
.cook-nav {
  display: flex; gap: 12px; padding: 12px 16px calc(var(--safe-b) + 14px);
  max-width: 620px; width: 100%; margin: 0 auto;
}
.cook-nav .btn { flex: 1; height: 52px; font-size: 17px; }

/* ── Timer bar ────────────────────────────── */
#timerbar {
  position: fixed; left: 12px; right: 12px; z-index: 210;
  bottom: calc(var(--safe-b) + 12px);
  max-width: 596px; margin: 0 auto;
  background: var(--accent); color: #fff;
  border-radius: 15px; padding: 12px 16px;
  display: none; align-items: center; gap: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.28);
}
#timerbar.on { display: flex; }
#timerbar .tt { flex: 1; font-size: 13px; opacity: .9; }
#timerbar .tv { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#timerbar button { color: #fff; font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.2); }

/* ── Shopping ─────────────────────────────── */
.shop-cat { font-size: 12.5px; font-weight: 700; color: var(--accent); padding: 15px 16px 6px; letter-spacing: .3px; }
.shop-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: .5px solid var(--sep);
  width: 100%; text-align: left;
}
.shop-item:last-child { border-bottom: none; }
.shop-box {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  border: 1.7px solid var(--sep);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; transition: all .12s;
}
.shop-item.done .shop-box { background: var(--green); border-color: var(--green); }
.shop-item.done .shop-name { opacity: .35; text-decoration: line-through; }
.shop-name { flex: 1; font-size: 16px; line-height: 1.3; }
.shop-qty { font-size: 14.5px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.shop-src { font-size: 12px; color: var(--hint); display: block; margin-top: 2px; }
.shop-add { display: flex; gap: 8px; margin-bottom: 14px; }
.shop-add .field { flex: 1; box-shadow: none; background: var(--card); }

/* ── Plan ─────────────────────────────────── */
.day { margin-bottom: 12px; }
.day-h { display: flex; align-items: baseline; gap: 8px; padding: 0 4px 7px; }
.day-n { font-size: 16px; font-weight: 750; }
.day-d { font-size: 13px; color: var(--sub); }
.day-h.today .day-n { color: var(--accent); }
.day-slot {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  width: 100%; text-align: left;
}
.day-slot.empty-slot { background: none; box-shadow: none; border: 1.5px dashed var(--sep); color: var(--hint); font-size: 14.5px; justify-content: center; padding: 14px; }
.day-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--card-2); }
.day-ph { width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--accent-soft); }
.day-t { flex: 1; font-size: 15.5px; font-weight: 650; line-height: 1.3; }
.day-x { color: var(--hint); font-size: 17px; padding: 4px 6px; }

/* ── Toast ────────────────────────────────── */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); z-index: 300;
  background: rgba(28,28,30,.95); color: #fff;
  padding: 11px 18px; border-radius: 22px;
  font-size: 14.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .22s;
  backdrop-filter: blur(10px); max-width: 90vw; text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Loading / error ──────────────────────── */
.loading { padding: 50px 20px; text-align: center; color: var(--sub); font-size: 15px; }
.spin {
  width: 30px; height: 30px; margin: 0 auto 14px;
  border: 3px solid var(--sep); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.errbox {
  background: var(--card); border-radius: var(--radius); padding: 22px 20px;
  text-align: center; box-shadow: var(--shadow);
}
.errbox .ei { font-size: 34px; margin-bottom: 9px; }
.errbox strong { display: block; color: var(--red); font-size: 16px; margin-bottom: 5px; }
.errbox p { font-size: 14px; color: var(--sub); line-height: 1.5; white-space: pre-line; }

.tip { font-size: 13px; color: var(--sub); line-height: 1.5; text-align: center; padding: 10px 6px 0; }

/* ── Upload zone ──────────────────────────── */
.uz {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 16px; background: var(--card); border: 1.5px dashed var(--sep);
  border-radius: var(--radius); text-align: center; margin-bottom: 10px;
}
.uz:active { opacity: .7; }
.uz-ic { font-size: 36px; margin-bottom: 9px; }
.uz-t { font-size: 15.5px; font-weight: 650; margin-bottom: 4px; }
.uz-s { font-size: 13px; color: var(--sub); }

/* ── Tag input ────────────────────────────── */
.taglist { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tagpill {
  font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 13px;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
}
.tagpill b { font-weight: 700; opacity: .6; }

.fab {
  position: fixed; right: 16px; z-index: 50;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 27px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 22px rgba(232,89,12,.42);
  transition: transform .12s;
}
.fab:active { transform: scale(.9); }
