/* Rezeptplaner – Gestaltung
   Basilikumgrün als Grundton, Safran markiert "heute" und Favoriten. */

@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --papier: #f7f8f4;
  --flaeche: #ffffff;
  --flaeche-2: #edf1ea;
  --linie: #dce2d8;
  --tinte: #1e2420;
  --tinte-2: #5e6a62;
  --basilikum: #2f6b4f;
  --basilikum-hell: #e3eee7;
  --auf-basilikum: #ffffff;
  --safran: #e9a92a;
  --safran-hell: #fcefd2;
  --tomate: #c8432f;

  --kopfschrift: 'Bricolage', ui-rounded, system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --tab-hoehe: 58px;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #161b18;
    --flaeche: #1e2420;
    --flaeche-2: #252c27;
    --linie: #333b35;
    --tinte: #e9eee8;
    --tinte-2: #a1aea5;
    --basilikum: #7dbb97;
    --basilikum-hell: #22342a;
    --auf-basilikum: #10231a;
    --safran: #f2c14e;
    --safran-hell: #3a3020;
    --tomate: #f07a66;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font: 16px/1.45 var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.sheet-offen { overflow: hidden; }

h1, h2, h3 { font-family: var(--kopfschrift); font-weight: 650; margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; font-family: var(--text); font-weight: 600; color: var(--tinte-2); margin: 14px 0 4px; }
a { color: var(--basilikum); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--safran); outline-offset: 2px; border-radius: 8px; }

/* ---------- Grundgerüst ---------- */
.ansicht {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--oben) 16px calc(var(--tab-hoehe) + var(--unten) + 32px);
}

.kopf {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -16px;
  padding: calc(var(--oben) + 10px) 16px 10px;
  margin-top: calc(-1 * var(--oben));
  background: color-mix(in srgb, var(--papier) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.kopf-klein { font-size: 18px; text-align: center; flex: 1; }
.kopf-aktionen { display: flex; align-items: center; gap: 8px; }
.rund-platz { width: 44px; }

.tabs {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  height: calc(var(--tab-hoehe) + var(--unten));
  padding-bottom: var(--unten);
  background: color-mix(in srgb, var(--flaeche) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--linie);
}
.tabs a {
  flex: 0 1 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tinte-2);
  text-decoration: none;
}
.tabs a.aktiv { color: var(--basilikum); }
.tabs a.aktiv svg { stroke-width: 2.3; }

/* ---------- Bedienelemente ---------- */
.rund {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--flaeche-2);
  color: var(--tinte);
  text-decoration: none;
  font-size: 22px;
}
.rund:disabled { opacity: 0.35; }
.rund.betont { background: var(--basilikum); color: var(--auf-basilikum); }
.rund.favorit-an { color: var(--safran); }

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--basilikum);
  color: var(--auf-basilikum);
  font-weight: 600;
  text-decoration: none;
}
.knopf:disabled { opacity: 0.5; }
.knopf.leise { background: var(--flaeche-2); color: var(--tinte); }
.knopf.gefahr { color: var(--tomate); }
.knopf.klein { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: 15px; }
.knopf.breit { width: 100%; margin-top: 12px; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.knopfreihe > * { flex: 1 1 auto; }
.knopfreihe.unten { margin-top: 36px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; }
.chips.scrollbar-aus { margin: 0 -16px; padding: 2px 16px; }
.chip {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--tinte);
  font-size: 15px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.chip.aktiv { background: var(--basilikum); border-color: var(--basilikum); color: var(--auf-basilikum); }

.eingabe {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  font-size: 16px; /* verhindert das Hineinzoomen auf dem iPhone */
}
textarea.eingabe { line-height: 1.5; resize: vertical; }
.eingabe:focus { outline: 2px solid var(--basilikum); outline-offset: -1px; }

.feld { display: block; border: 0; padding: 0; margin: 0 0 18px; }
.feld > span, .feld > legend { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; padding: 0; }
.feld small { display: block; color: var(--tinte-2); font-size: 14px; margin-top: 6px; }
.feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
}
.stepper span { min-width: 104px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper strong { font-family: var(--kopfschrift); font-size: 20px; }

.segment { display: flex; gap: 4px; padding: 4px; background: var(--flaeche-2); border-radius: 14px; margin-bottom: 16px; }
.segment button { flex: 1; min-height: 42px; border: 0; border-radius: 10px; background: transparent; font-weight: 500; }
.segment button.aktiv { background: var(--flaeche); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); font-weight: 600; }

.leer { color: var(--tinte-2); text-align: center; padding: 32px 12px; }
.leer p { margin: 0 0 8px; }
.hinweis { color: var(--tinte-2); margin: 0 0 12px; }
.fehler { color: var(--tomate); font-weight: 500; }
.fehler-leiste { margin: 0; padding: calc(var(--oben) + 8px) 16px 8px; background: var(--safran-hell); text-align: center; font-size: 14px; }
.scrollbar-aus { scrollbar-width: none; }
.scrollbar-aus::-webkit-scrollbar { display: none; }

.favorit-punkt { color: var(--safran); display: inline-flex; vertical-align: -3px; margin-left: 4px; }
.favorit-punkt svg { width: 16px; height: 16px; }

/* ---------- Wochenplan ---------- */
.woche-kopf { padding-bottom: 14px; }
.woche-titel { text-align: center; }
.woche-titel h1 { font-size: 34px; font-weight: 720; letter-spacing: -0.02em; }
.woche-titel p { margin: 2px 0 0; color: var(--tinte-2); font-size: 15px; }
.heute-leiste { display: flex; justify-content: center; margin: -4px 0 10px; }

.tage { list-style: none; margin: 0; padding: 0; }
.tag {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  padding: 12px 0 12px 4px;
  border-top: 1px solid var(--linie);
  position: relative;
}
.tag.wochenende .tag-zahl { color: var(--basilikum); }
.tag.heute::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: var(--safran);
}
.tag-kopf { display: flex; flex-direction: column; align-items: flex-start; padding-top: 2px; }
.tag-zahl { font-family: var(--kopfschrift); font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.tag-name { font-size: 14px; color: var(--tinte-2); margin-top: 3px; }
.tag.heute .tag-name { color: var(--tinte); font-weight: 650; }

.slots { display: grid; gap: 4px; }
.slot { display: grid; grid-template-columns: 52px 1fr 40px; align-items: start; gap: 6px; min-height: 40px; }
.slot-name { font-size: 13px; color: var(--tinte-2); padding-top: 10px; }
.eintraege { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.eintrag {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 11px;
  background: var(--basilikum-hell);
  text-align: left;
  font-weight: 550;
  line-height: 1.3;
}
.eintrag small { flex: none; font-weight: 500; color: var(--tinte-2); font-size: 13px; }
.eintrag.frei { background: transparent; border: 1px dashed var(--linie); font-weight: 450; color: var(--tinte-2); }
.platzhalter { height: 40px; border-radius: 11px; background: var(--flaeche-2); opacity: 0.5; }
.plus {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--tinte-2);
}
.plus:active { background: var(--flaeche-2); }
.plus svg { width: 22px; height: 22px; }

/* ---------- Auswahlliste im Blatt ---------- */
.auswahl { list-style: none; margin: 14px 0 0; padding: 0; }
.auswahl li + li { border-top: 1px solid var(--linie); }
.auswahl button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 2px;
  border: 0;
  background: transparent;
  text-align: left;
}
.auswahl-titel { flex: 1; font-weight: 500; }
.auswahl small { color: var(--tinte-2); }
.auswahl .favorit-punkt { margin: 0; }

/* ---------- Rezeptliste ---------- */
.filter { display: grid; gap: 10px; margin-bottom: 8px; }
.rezeptliste { list-style: none; margin: 0; padding: 0; }
.rezeptzeile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--linie);
}
.vorschau { width: 60px; height: 60px; flex: none; border-radius: 14px; object-fit: cover; background: var(--flaeche-2); }
.leer-bild {
  display: grid;
  place-items: center;
  font-family: var(--kopfschrift);
  font-size: 26px;
  font-weight: 700;
  color: var(--basilikum);
  background: var(--basilikum-hell);
}
.rezeptzeile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rezeptzeile-titel { font-weight: 600; font-size: 17px; line-height: 1.3; }
.meta { color: var(--tinte-2); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.idee { color: var(--tinte); background: var(--safran-hell); border-radius: 6px; padding: 0 6px; font-size: 13px; font-weight: 500; }

/* ---------- Rezept ---------- */
.fotos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 -16px 16px;
  padding: 0 16px;
}
.fotos img {
  flex: 0 0 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  scroll-snap-align: center;
  background: var(--flaeche-2);
}
.fotos img:only-child { flex-basis: 100%; }
.rezept-titel { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 8px; }
.mit-icon { display: inline-flex; align-items: center; gap: 4px; }
.icon-klein { width: 18px; height: 18px; }
.tag-label { background: var(--flaeche-2); border-radius: 6px; padding: 1px 8px; color: var(--tinte); }

.abschnitt { margin-top: 28px; }
.abschnitt > h2 { margin-bottom: 10px; }
.abschnitt-kopf { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.abschnitt-kopf .stepper { margin: 0; }
.zutaten { list-style: none; margin: 0; padding: 0; }
.zutaten li {
  display: grid;
  grid-template-columns: minmax(84px, 30%) 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--linie);
}
.menge { font-weight: 650; font-variant-numeric: tabular-nums; }
.schritte { margin: 0; padding: 0; list-style: none; counter-reset: schritt; }
.schritte li {
  counter-increment: schritt;
  position: relative;
  padding: 0 0 18px 44px;
  line-height: 1.55;
  max-width: 65ch;
}
.schritte li::before {
  content: counter(schritt);
  position: absolute;
  left: 0;
  top: -2px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--basilikum-hell);
  color: var(--basilikum);
  font-family: var(--kopfschrift);
  font-weight: 700;
}
.quelle p { margin: 0 0 4px; overflow-wrap: anywhere; }

/* ---------- Editor ---------- */
.foto-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.foto-kachel {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--flaeche-2);
}
.foto-kachel img { width: 100%; height: 100%; object-fit: cover; }
.foto-kachel.entfernt img { opacity: 0.25; }
.foto-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 17px;
  line-height: 1;
}
.foto-neu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px dashed var(--linie);
  color: var(--tinte-2);
  font-size: 13px;
  cursor: pointer;
}
.foto-neu input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---------- Mehr, Papierkorb, Anmeldung ---------- */
.mehr .abschnitt { padding-bottom: 6px; }
.version { color: var(--tinte-2); text-align: center; font-size: 13px; margin-top: 40px; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--linie);
}
.liste small { display: block; color: var(--tinte-2); }

.login {
  max-width: 400px;
  margin: 0 auto;
  padding: calc(var(--oben) + 12vh) 24px 40px;
}
.login-logo { border-radius: 18px; margin-bottom: 18px; }
.login h1 { font-size: 36px; font-weight: 720; letter-spacing: -0.02em; }
.login > p { color: var(--tinte-2); margin: 6px 0 28px; }

/* ---------- Blatt von unten ---------- */
.sheet-hintergrund {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(10 16 12 / 0.4);
  animation: einblenden 0.18s ease-out;
}
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--papier);
  border-radius: 22px 22px 0 0;
  padding-bottom: var(--unten);
  animation: hochfahren 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px 20px;
}
.sheet-kopf h2 { font-size: 20px; }
.sheet-inhalt { overflow-y: auto; padding: 4px 20px 20px; -webkit-overflow-scrolling: touch; }
@keyframes einblenden { from { opacity: 0; } }
@keyframes hochfahren { from { transform: translateY(40px); opacity: 0.6; } }

/* ---------- Hinweise ---------- */
.toast, .update-hinweis {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-hoehe) + var(--unten) + 12px);
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--tinte);
  color: var(--papier);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
  animation: einblenden 0.15s ease-out;
}
.toast button, .update-hinweis button {
  border: 0;
  background: none;
  color: var(--safran);
  font-weight: 650;
  padding: 4px 0;
}
.update-hinweis { bottom: auto; top: calc(var(--oben) + 10px); }

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

.sheet .chips { margin-top: 10px; }

/* ---------- Verschieben: Ziel wählen ---------- */
.ziel-woche { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.ziel-woche span { font-family: var(--kopfschrift); font-weight: 650; font-size: 18px; }
.ziel-tage { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.ziel-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 60px;
  padding: 6px 0;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  font-size: 13px;
  color: var(--tinte-2);
}
.ziel-tag strong { font-family: var(--kopfschrift); font-size: 20px; color: var(--tinte); }
.ziel-tag.heute { border-color: var(--safran); }
.ziel-tag.quelle { border-style: dashed; }
.ziel-tag.aktiv { background: var(--basilikum); border-color: var(--basilikum); color: var(--auf-basilikum); }
.ziel-tag.aktiv strong { color: var(--auf-basilikum); }
