/* Blend – Styles. Schriften lokal eingebunden (keine Anfragen an Google). */
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --papier: #f2f5f0;
  --flaeche: #ffffff;
  --tinte: #1e2b23;
  --tinte-leise: #56635a;
  --linie: #d3dbd0;
  --kirsche: #a3123a;
  --kirsche-tief: #7c0d2c;
  --kirsche-hauch: #f8e7ec;
  --matcha: #5e7f2e;
  --warn-grund: #fff3d9;
  --warn-linie: #d9a441;
  --schrift-titel: "Bricolage", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --schrift-text: "Atkinson", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #141b17;
    --flaeche: #1d2620;
    --tinte: #e6ece7;
    --tinte-leise: #a5b2a8;
    --linie: #34413a;
    --kirsche: #e5577a;
    --kirsche-tief: #f07b97;
    --kirsche-hauch: #3a1d26;
    --matcha: #9cc25e;
    --warn-grund: #3a2f17;
    --warn-linie: #a17a2c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font: 400 1.0625rem/1.55 var(--schrift-text);
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(96px + env(safe-area-inset-bottom));
}

h1, h2, h3 { font-family: var(--schrift-titel); line-height: 1.15; margin: 0; }
h1 { font-weight: 800; font-size: 2.6rem; letter-spacing: -0.03em; }
h2 { font-weight: 700; font-size: 1.4rem; letter-spacing: -0.01em; margin: 28px 0 10px; }
h3 { font-weight: 700; font-size: 1.1rem; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.leise { color: var(--tinte-leise); font-size: 0.95rem; }
.klein { font-size: 0.85rem; color: var(--tinte-leise); }

.kopf { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.kopf .haushalt { color: var(--tinte-leise); font-size: 0.95rem; }

/* Formulare */
label { display: block; font-weight: 700; margin: 14px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--flaeche);
  border: 1.5px solid var(--linie);
  border-radius: 10px;
  padding: 11px 12px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--kirsche);
  outline-offset: 2px;
}

button { font: inherit; color: inherit; cursor: pointer; }
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  background: var(--flaeche); border: 1.5px solid var(--linie); border-radius: 12px;
  font-weight: 700;
}
.knopf-haupt {
  width: 100%; min-height: 54px; margin-top: 18px;
  background: var(--kirsche); border-color: var(--kirsche); color: #fff;
  font-family: var(--schrift-titel); font-size: 1.15rem; letter-spacing: 0.01em;
}
.knopf-haupt:hover { background: var(--kirsche-tief); border-color: var(--kirsche-tief); }
.knopf-haupt[disabled] { opacity: 0.55; cursor: progress; }
.knopf-text { background: none; border: none; padding: 6px 4px; color: var(--kirsche); font-weight: 700; min-height: 0; }
.knopf-reihe { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.knopf-reihe .knopf { flex: 1 1 140px; }

/* Ziele */
.ziele { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ziel {
  text-align: left; padding: 14px 14px 12px;
  background: var(--flaeche); border: 1.5px solid var(--linie); border-radius: 14px;
}
.ziel strong { display: block; font-family: var(--schrift-titel); font-size: 1.05rem; margin-bottom: 2px; }
.ziel span { color: var(--tinte-leise); font-size: 0.9rem; }
.ziel[aria-pressed="true"] { border-color: var(--kirsche); background: var(--kirsche-hauch); box-shadow: inset 0 0 0 1px var(--kirsche); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px;
  background: var(--flaeche); border: 1.5px solid var(--linie); font-weight: 700; font-size: 0.95rem;
}
.chip[aria-pressed="true"] { background: var(--tinte); border-color: var(--tinte); color: var(--papier); }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--linie); }
.liste li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--linie); }
.liste .name { flex: 1; }
.liste input[type="number"] { width: 92px; padding: 7px 8px; text-align: right; }
.liste .einheit { width: 34px; color: var(--tinte-leise); font-size: 0.9rem; }
.marke-fehlt { font-size: 0.8rem; font-weight: 700; color: var(--kirsche); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; }
.erledigt .name { text-decoration: line-through; color: var(--tinte-leise); }
.loeschen { background: none; border: none; color: var(--tinte-leise); font-size: 1.3rem; line-height: 1; padding: 6px 8px; }

.zeile-form { display: grid; grid-template-columns: 1fr 96px auto; gap: 8px; align-items: end; }
.zeile-form label { margin-top: 0; }

/* Ergebnis */
.ergebnis { margin-top: 26px; padding-top: 22px; border-top: 2px solid var(--tinte); }
.ergebnis-kopf { display: grid; grid-template-columns: 112px 1fr; gap: 18px; align-items: end; }
.ergebnis-kopf h2 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 800; }
.glas { width: 112px; height: 172px; display: block; }
.glas .schicht { transform-origin: 50% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .glas .schicht { animation: fuellen 900ms cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes fuellen { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.zutaten { list-style: none; padding: 0; margin: 0; }
.zutaten li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.punkt { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.zutaten .menge { font-variant-numeric: tabular-nums; color: var(--tinte-leise); }

ol.schritte { padding-left: 1.4em; margin: 0; }
ol.schritte li { margin-bottom: 10px; padding-left: 4px; }
ol.schritte li::marker { font-family: var(--schrift-titel); font-weight: 800; color: var(--kirsche); }

.kasten { border-radius: 12px; padding: 13px 15px; margin: 14px 0; border: 1.5px solid var(--linie); background: var(--flaeche); }
.kasten-warn { background: var(--warn-grund); border-color: var(--warn-linie); }
.kasten-frage { background: var(--kirsche-hauch); border-color: var(--kirsche); }
.kasten-notfall { border: 2px solid var(--kirsche); background: var(--flaeche); font-size: 1.1rem; }
.kasten p:last-child { margin-bottom: 0; }

.claims { padding-left: 1.1em; margin: 0; }
.claims li { margin-bottom: 6px; }

.laden { display: flex; gap: 12px; align-items: center; margin-top: 18px; color: var(--tinte-leise); }
.laden-punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--kirsche); }
@media (prefers-reduced-motion: no-preference) {
  .laden-punkt { animation: pochen 1.1s ease-in-out infinite; }
}
@keyframes pochen { 50% { transform: scale(0.55); opacity: 0.5; } }

/* Navigation */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--flaeche); border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs .innen { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
nav.tabs button {
  background: none; border: none; padding: 9px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 0.8rem; font-weight: 700; color: var(--tinte-leise);
}
nav.tabs button svg { width: 24px; height: 24px; }
nav.tabs button[aria-current="page"] { color: var(--kirsche); }

/* Dialog */
dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  border: none; border-radius: 16px; padding: 20px 18px;
  background: var(--papier); color: var(--tinte);
}
dialog::backdrop { background: rgba(10, 16, 12, 0.5); }
dialog h2 { margin-top: 0; }
fieldset { border: none; padding: 0; margin: 14px 0 0; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.schalter { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--linie); font-weight: 400; margin: 0; }
.schalter input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--kirsche); flex: none; }

/* Hinweise */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--tinte); color: var(--papier); padding: 10px 16px; border-radius: 10px;
  font-weight: 700; z-index: 20; max-width: calc(100vw - 32px);
}
.fehler { color: var(--kirsche); font-weight: 700; margin-top: 10px; }

.anmeldung { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; }
.anmeldung h1 { font-size: 3.4rem; }
.anmeldung .unterzeile { font-size: 1.15rem; color: var(--tinte-leise); margin-bottom: 18px; }

@media (max-width: 380px) {
  .ziele { grid-template-columns: 1fr; }
  .ergebnis-kopf { grid-template-columns: 90px 1fr; }
  .glas { width: 90px; height: 140px; }
}

/* Scan */
.scan-knoepfe { margin: 4px 0 8px; }
.scan-ergebnis { margin-top: 12px; }
.scan-ergebnis .liste li.scan-zeile { align-items: flex-start; }
.scan-zeile > input[type="checkbox"] { width: 22px; height: 22px; margin-top: 12px; accent-color: var(--kirsche); flex: none; }
.scan-felder { flex: 1; display: grid; gap: 6px; min-width: 0; }
.scan-menge { display: flex; align-items: center; gap: 8px; }
.scan-menge input { width: 110px; }
.ohne-abstand { margin-top: 0; }

/* Eigene Zutaten */
.neue-zutat select, .neue-zutat input[type="text"] { margin-bottom: 4px; }
.allergen-chips { display: flex; flex-wrap: wrap; gap: 6px; }
label.chip-check {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  padding: 6px 10px; border: 1.5px solid var(--linie); border-radius: 999px;
  background: var(--flaeche); font-weight: 400; font-size: 0.9rem; cursor: pointer;
}
label.chip-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--kirsche); }
label.chip-check:has(input:checked) { border-color: var(--kirsche); background: var(--kirsche-hauch); font-weight: 700; }
.marke-neu { font-size: 0.8rem; font-weight: 700; color: var(--matcha); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; }
