:root {
  --bg: #161a22;
  --karte: #252831;
  --karte2: #1a1d25;
  --linie: #333743;
  --text: #eceef2;
  --leise: #9a9fab;
  --kcal: #82b8f8;
  --eiweiss: #f2b453;
  --kh: #5bb8ad;
  --fett: #b981e0;
  --rot: #f87171;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: var(--text); }

/* Seiten: immer nur eine sichtbar, umgeschaltet über die Leiste unten */
.seiten { position: fixed; inset: 0; }
.seite { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: none;
  background: linear-gradient(180deg, #1f2533 0, var(--bg) 320px) no-repeat, var(--bg); }
.seite.aktiv { display: block; }
.innen, .login {
  max-width: 520px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 120px);
}

/* Logo: Macro³ – die 3 hochgestellt wie bei einer Potenz */
.logo { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.logo sup { font-size: 0.55em; color: var(--kcal); margin-left: 1px; vertical-align: super; line-height: 0; }
.logo.gross { font-size: 48px; text-align: center; margin: 18vh 0 32px; }

.kopf { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 16px; }
.datum { display: flex; align-items: center; gap: 4px; }
.datum button { width: 36px; height: 36px; border-radius: 50%; font-size: 24px; line-height: 1; color: var(--leise); }
.datum button:disabled { opacity: 0.25; }
.chip { background: var(--karte); border: 1px solid var(--linie); border-radius: 999px; padding: 6px 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }

/* Balken (wie Vorlage: Kalorien-Karte + Makro-Karte mit drei Spalten) */
.balken { display: grid; gap: 12px; cursor: pointer; }
.karteB { background: var(--karte); border-radius: 22px; padding: 22px 22px 24px; }
.karteB .titel { font-size: 17px; margin-bottom: 8px; }
.kcalZeile { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.gross { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.vonZiel { color: var(--leise); font-size: 16px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.uebrig { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.uebrig span { font-size: 15px; font-weight: 500; color: var(--leise); margin-left: 4px; }
.makros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.makros { align-items: end; }
.makro .titel { font-size: 14px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.makro .wert { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 12px; white-space: nowrap; }
.makro .wert .vonZiel { font-size: 13px; margin-left: 3px; font-weight: 500; }
.spur { display: flex; height: 12px; background: var(--karte2); border-radius: 999px; overflow: hidden; }
.fuell { height: 100%; min-width: 12px; border-radius: inherit; transition: width .35s ease; }
.fuell.null { min-width: 0; }
.ueber .uebrig { color: var(--rot); }

/* Plus */
.plusZone { display: flex; justify-content: center; margin: 28px 0; }
.plus {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--kcal); color: #0b1a2e; font-size: 52px; font-weight: 300; line-height: 1;
  box-shadow: 0 10px 30px rgba(130, 184, 248, .25);
  transition: transform .1s;
}
.plus:active { transform: scale(.93); }

h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 0 0 8px; font-weight: 700; }

/* Liste */
.liste { list-style: none; margin: 0; padding: 0; background: var(--karte); border-radius: var(--radius); overflow: hidden; }
.liste:empty { display: none; }
.liste li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--linie); }
.liste li:last-child { border-bottom: 0; }
.liste .mitte { flex: 1; min-width: 0; }
.liste .titel { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .klein { font-size: 13px; color: var(--leise); }
.liste .kcal { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.liste .weg { width: 32px; height: 32px; border-radius: 50%; color: var(--leise); font-size: 20px; }
.leer { color: var(--leise); text-align: center; margin: 12px 0; }

.gewichtBox { margin-top: 28px; }
#gewichtKurve { background: var(--karte); border-radius: var(--radius); padding: 14px; }
#gewichtKurve svg { display: block; width: 100%; height: 90px; }
.kurveInfo { display: flex; justify-content: space-between; font-size: 13px; color: var(--leise); margin-top: 6px; }

/* Unteres Blatt */
.schleier { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 10; }
.blatt {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-width: 560px; margin: 0 auto; max-height: 88vh; overflow-y: auto;
  background: var(--karte); border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 20px);
}
@keyframes hoch { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.blatt .griff { width: 40px; height: 5px; border-radius: 3px; background: var(--linie); margin: 0 auto 14px; }
.blatt h3 { margin: 0 0 14px; font-size: 20px; }
.blatt .unter { color: var(--leise); font-size: 14px; margin: -8px 0 14px; }

.feld { width: 100%; background: var(--karte2); border: 1px solid var(--linie); border-radius: 12px; padding: 13px 14px; font-size: 17px; outline: none; }
.feld:focus { border-color: var(--kcal); }
label.beschr { display: block; font-size: 13px; color: var(--leise); margin: 12px 0 5px; }
.raster2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.raster2 label.beschr { margin-top: 0; }

.knopf { display: block; width: 100%; background: var(--kcal); color: #0b1a2e; font-weight: 700; border-radius: 14px; padding: 14px; font-size: 17px; margin-top: 16px; }
.knopf.zweit { background: var(--karte2); color: var(--text); border: 1px solid var(--linie); }
.knopf:disabled { opacity: .5; }
.knopf.scan { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 14px; padding: 16px; font-size: 18px; }
.link { color: var(--leise); text-decoration: underline; font-size: 14px; padding: 8px 0; display: block; margin: 8px auto 0; }

.treffer { list-style: none; padding: 0; margin: 10px 0 0; }
.treffer li button { display: flex; width: 100%; text-align: left; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--linie); }
.treffer .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.treffer .k { color: var(--leise); font-size: 14px; white-space: nowrap; }
.treffer .neu { color: var(--kcal); font-weight: 600; }
.zwischen { font-size: 13px; color: var(--leise); margin: 14px 0 0; }

.schnell { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.schnell button { background: var(--karte2); border: 1px solid var(--linie); border-radius: 999px; padding: 7px 13px; font-size: 14px; }
.vorschau { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; text-align: center; }
.vorschau div { background: var(--karte2); border-radius: 12px; padding: 10px 4px; }
.vorschau b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.vorschau span { font-size: 12px; color: var(--leise); }
.fehler { color: var(--rot); font-size: 14px; min-height: 1em; margin: 8px 0 0; }

/* Kamera */
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.zielrahmen {
  position: absolute; left: 10%; right: 10%; top: 36%; height: 22%;
  border: 3px solid var(--kcal); border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.45);
}
.scanHinweis { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 24px); text-align: center; font-weight: 600; text-shadow: 0 1px 4px #000; padding: 0 16px; }
.scanKnoepfe { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 20px); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scanKnoepfe .knopf { margin: 0; }

.login form { display: grid; gap: 4px; max-width: 280px; margin: 0 auto; }
.login input { text-align: center; font-size: 22px; letter-spacing: .2em; background: var(--karte); border: 1px solid var(--linie); border-radius: 14px; padding: 14px; outline: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 104px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 30;
  max-width: calc(100% - 32px); text-align: center;
}

/* Eintragen (wie Vorlage) */
.blattKopf { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; margin: -4px -4px 8px; font-size: 17px; font-weight: 600; text-align: center; }
.blattKopf .zurueck { font-size: 26px; text-align: left; padding: 4px; }
.blattKopf .aufz { color: var(--kcal); font-weight: 700; padding: 6px 4px; }
.lmKopf { padding: 8px 0 16px; border-bottom: 1px solid var(--linie); margin-bottom: 6px; }
.lmName { font-size: 26px; font-weight: 800; line-height: 1.2; }
.lmUnter { color: var(--leise); font-size: 15px; margin-top: 4px; }
.eZeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 17px; }
.eFeld { position: relative; display: block; }
.feld.klein { width: 120px; text-align: right; color: var(--kcal); background: transparent; border-color: #4a4f5c; padding: 11px 14px; }
.eFeld .einheit { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--kcal); pointer-events: none; font-size: 17px; }
.eFeld:has(.einheit) .feld.klein { padding-right: 34px; }
.naehr { display: grid; grid-template-columns: 96px repeat(3, minmax(0, 1fr)); align-items: center; gap: 4px; margin-top: 18px; text-align: center; }
.ring { width: 92px; height: 92px; }
.ringZahl { font-size: 21px; font-weight: 800; fill: var(--text); }
.ringEinheit { font-size: 11px; fill: var(--text); }
.spalte .proz { font-size: 14px; font-weight: 600; }
.spalte .g { font-size: 19px; font-weight: 600; margin: 2px 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.spalte .n { font-size: 12px; color: var(--leise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fortschritt (wie Vorlage) */
.kopf2 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kopf2 h1 { font-size: 20px; margin: 0; }
.rund { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--linie); font-size: 22px; display: grid; place-items: center; }
.rund.leer { visibility: hidden; }
.reiter { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--linie); margin: 0 -16px; }
.reiter button { padding: 14px 4px 12px; color: var(--leise); font-size: 16px; border-bottom: 3px solid transparent; }
.reiter button.an { color: var(--text); font-weight: 700; border-bottom-color: var(--kcal); }
.zeitraum { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; text-align: center; background: var(--karte); margin: 0 -16px 12px; border-bottom: 1px solid var(--linie); }
.zeitraum > button { height: 72px; font-size: 30px; color: var(--leise); font-weight: 300; }
.zeitraum > button:disabled { opacity: .25; }
.zeitraum > div { border-left: 1px solid var(--linie); border-right: 1px solid var(--linie); padding: 8px 0; }
.ansicht { color: var(--leise); font-size: 15px; padding: 2px 8px; }
.zeitraumText { font-size: 19px; font-weight: 500; }
.karteF { background: var(--karte); border-radius: 18px; padding: 16px 10px 8px; }
#diagramm svg { display: block; width: 100%; height: auto; }
.dAchse { fill: var(--leise); font-size: 11px; }
.dTag { fill: var(--leise); font-size: 11px; }
.dGitter { stroke: var(--linie); stroke-width: 1; }
.dZiel { stroke: var(--text); stroke-width: 2; opacity: .85; }
.leerF { color: var(--leise); text-align: center; padding: 48px 0; }
.kennzahlen { list-style: none; margin: 12px 0 0; padding: 0; background: var(--karte); border-radius: 18px; overflow: hidden; }
.kennzahlen li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--linie); font-size: 16px; }
.kennzahlen li:last-child { border-bottom: 0; }
.kennzahlen .w { color: var(--leise); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kennzahlen .w.blau { color: var(--kcal); }
.kennzahlen button.zeileK { padding: 0; font-size: inherit; display: flex; width: 100%; justify-content: space-between; text-align: left; }
.punktF { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }

/* Makrorechner */
.rechnerKnopf { margin: 0 0 4px; }
.raster3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.wahl { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.wahl button { background: var(--karte2); border: 1px solid var(--linie); border-radius: 12px; padding: 11px 12px; text-align: left; }
.wahl button.an { border-color: var(--kcal); background: rgba(130, 184, 248, .12); }
.wahl .t { display: block; font-weight: 600; font-size: 15px; }
.wahl .u { display: block; font-size: 12px; color: var(--leise); margin-top: 1px; }
.ergebnis { margin-top: 18px; padding: 16px; background: var(--karte2); border-radius: 14px; }
.ergebnis .vorschau { grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.ergebnis .vorschau div { background: var(--karte); }
.ergKcal { text-align: center; }
.ergKcal b { font-size: 34px; font-weight: 800; }
.ergKcal span { color: var(--leise); }
.ergInfo { font-size: 13px; color: var(--leise); text-align: center; margin: 10px 0 0; }
.leerF.klein { padding: 8px 0; margin: 0; }

/* Kalender */
.datum .datumKnopf { width: auto; height: auto; min-width: 84px; font-size: 16px; line-height: 1.3; color: var(--text); text-align: center; font-weight: 600; padding: 6px 8px; border-radius: 10px; white-space: nowrap; }
.datumKnopf:active { background: var(--karte); }
.kalKopf { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.kalPfeil { width: 44px; height: 44px; font-size: 28px; color: var(--leise); }
.kalPfeil:disabled { opacity: .25; }
.kalRaster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.kalWt { font-size: 12px; color: var(--leise); padding: 4px 0 6px; }
.kalTag { position: relative; aspect-ratio: 1; border-radius: 50%; font-size: 16px; font-variant-numeric: tabular-nums; max-height: 48px; }
.kalTag:disabled { opacity: .25; }
.kalTag.heute { color: var(--kcal); font-weight: 800; }
.kalTag.gewaehlt { background: var(--kcal); color: #0b1a2e; font-weight: 800; }
.kalTag.hatDaten::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--kh); }
.kalTag.gewaehlt.hatDaten::after { background: #0b1a2e; }

/* Rezepte */
.plusKnoepfe { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin: 12px 0 4px; }
.plusKnoepfe.eins { grid-template-columns: 1fr; }
.plusKnoepfe .knopf.scan { margin: 0; }
.rzMarke { display: inline-block; font-size: 11px; font-weight: 700; color: #0b1a2e; background: var(--kh); border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: 2px; }
.zutaten { list-style: none; margin: 0 0 4px; padding: 0; }
.zutaten:empty::before { content: 'Noch keine Zutaten'; display: block; color: var(--leise); font-size: 14px; padding: 6px 0; }
.zutaten li { display: grid; grid-template-columns: 1fr auto 70px 28px; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--linie); }
.zutaten .zn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zutaten .zg { display: flex; align-items: center; gap: 4px; color: var(--leise); }
.zutaten .zk { color: var(--leise); font-size: 13px; text-align: right; white-space: nowrap; }
.zutaten .weg { width: 28px; height: 28px; color: var(--leise); font-size: 20px; }
.feld.mini { width: 64px; padding: 7px 8px; font-size: 15px; text-align: right; }

/* Balken mit rotem Teil über dem Ziel */
.fuell.teil1 { border-radius: 999px 0 0 999px; min-width: 0; }
.fuell.teil2 { border-radius: 0 999px 999px 0; min-width: 4px; margin-left: 2px; }
.ueber .vonZiel { color: var(--rot); }
.wahl.drei { grid-template-columns: repeat(3, 1fr); }
.wahl.drei button { text-align: center; padding: 11px 6px; }

/* Plus aus zwei Strichen statt Schriftzeichen – sitzt so immer genau mittig */
.plus { position: relative; }
.plus::before, .plus::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 34px; height: 4px; margin: -2px 0 0 -17px;
  background: #0b1a2e; border-radius: 2px;
}
.plus::after { transform: rotate(90deg); }

/* Gewicht eintragen (wie FatFight) */
.kgTitel { text-align: center; }
.kgEingabe { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 4px; }
.kgBox { position: relative; }
.kgFeld { width: 180px; font-size: 48px; font-weight: 800; text-align: center; background: var(--karte2); color: var(--text);
  border: 2px solid var(--linie); border-radius: 14px; padding: 6px 28px 6px 0; outline: none; font-variant-numeric: tabular-nums; }
.kgFeld::placeholder { color: #4a4f5e; }
.kgFeld:focus { border-color: var(--kcal); }
.kgBox span { position: absolute; right: 11px; bottom: 15px; font-size: 16px; color: var(--leise); pointer-events: none; }
.kgStep { flex: none; width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--linie); background: var(--karte2);
  font-size: 26px; font-weight: 500; line-height: 1; display: grid; place-items: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.kgStep:active { background: var(--kcal); border-color: var(--kcal); color: #0b1a2e; }
.kgZuletzt { text-align: center; font-size: 14px; color: var(--leise); margin: 6px 0 0; min-height: 20px; }
.kgZuletzt .gut { color: #5fc48a; }
.kgZuletzt .schlecht { color: var(--rot); }
.chip.fehlt { background: var(--kcal); color: #0b1a2e; border-color: var(--kcal); }

/* Plus: blauer Kreis, kleines leuchtend weißes Kreuz */
.plus::before, .plus::after { width: 24px; height: 3px; margin: -1.5px 0 0 -12px; background: #ffffff; border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,255,255,.9), 0 0 14px rgba(255,255,255,.6); }

/* Leiste unten (wie Vorlage) */
.leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 12px;
  max-width: 560px; margin: 0 auto; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(180deg, rgba(22,26,34,0) 0, rgba(22,26,34,.92) 35%); }
.tabs { --pos: 0; position: relative; flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); height: 72px; padding: 4px;
  background: #21242f; border: 1px solid #3a3f55; border-radius: 999px; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.markierung { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 999px;
  background: #41444f; transform: translateX(calc(var(--pos) * 100%)); transition: transform .22s cubic-bezier(.3,.7,.2,1); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text); font-size: 13px; font-weight: 500; }
.tab svg { width: 24px; height: 24px; }
.tab:not(.an) { opacity: .85; }
.leiste .plus { flex: none; width: 72px; height: 72px; box-shadow: 0 8px 24px rgba(130,184,248,.3); }
.plusZone { display: none; }
.kopf2 { justify-content: center; padding: 6px 0 4px; }

/* Mehr */
.mehrListe { list-style: none; margin: 8px 0 0; padding: 0; background: var(--karte); border-radius: 18px; overflow: hidden; }
.mehrListe li + li { border-top: 1px solid var(--linie); }
.mehrListe button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 16px; text-align: left; }
.mehrListe .mi { font-size: 22px; width: 28px; text-align: center; }
.mehrListe .mt { flex: 1; font-size: 16px; font-weight: 600; }
.mehrListe small { display: block; font-size: 13px; font-weight: 400; color: var(--leise); margin-top: 1px; }
.mehrListe .mp { color: var(--leise); font-size: 22px; }

/* Abstand Balken → Liste, seit das Plus unten in der Leiste sitzt */
#balken + section { margin-top: 26px; }

/* Mahlzeiten */
.mahlzeiten { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.mahlzeiten:empty { display: none; }
.mzKopf { display: flex; align-items: baseline; gap: 8px; padding: 0 4px 6px; }
.mzName { font-weight: 700; font-size: 15px; }
.mzZeit { color: var(--leise); font-size: 13px; }
.mzKcal { margin-left: auto; color: var(--leise); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Plus mittig, schwebt über der Leiste (Leiste über die ganze Breite) */
.leiste { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 0;
  background: linear-gradient(180deg, rgba(22,26,34,0) 0, rgba(22,26,34,.9) 40%, #161a22 62%); }
.leiste .tabs { flex: none; }
.leiste .plus { order: -1; align-self: center; width: 66px; height: 66px; }
.innen { padding-bottom: calc(env(safe-area-inset-bottom) + 190px); }
.toast { bottom: calc(env(safe-area-inset-bottom) + 186px); }

/* Leiste mit Plus in der Mitte: Heute | Fortschritt | + | Gewicht | Mehr */
.tabs { grid-template-columns: repeat(5, 1fr); }
.markierung { width: calc((100% - 8px) / 5); }
.tab { font-size: 11.5px; letter-spacing: -0.01em; white-space: nowrap; }
.tabs .plus { order: 0; align-self: center; justify-self: center; width: 58px; height: 58px; position: relative; z-index: 1;
  box-shadow: 0 4px 16px rgba(130,184,248,.35); }
.tabs .plus::before, .tabs .plus::after { width: 22px; margin-left: -11px; }
.innen { padding-bottom: calc(env(safe-area-inset-bottom) + 112px); }
.toast { bottom: calc(env(safe-area-inset-bottom) + 104px); }
.leiste { padding-top: 14px; background: linear-gradient(180deg, rgba(22,26,34,0) 0, rgba(22,26,34,.9) 30%, #161a22 55%); }

/* Seite Gewicht */
.gwKarte { padding: 18px 20px; }
.gwOben { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gwWert { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gwKnopf { width: auto; margin: 0; padding: 12px 22px; }
.gwInfo { color: var(--leise); font-size: 14px; margin-top: 6px; }
.gwInfo .gut, .kennzahlen .gut { color: #5fc48a; }
.gwInfo .schlecht, .kennzahlen .schlecht { color: var(--rot); }
.gwH2 { margin: 22px 0 8px; }
.kennzahlen .w b { font-weight: 600; }
.kennzahlen .gwKg { color: var(--text); }

/* Mahlzeiten aufklappbar */
.mahlzeit { background: var(--karte); border-radius: var(--radius); overflow: hidden; }
.mahlzeit .mzKopf { display: flex; align-items: center; gap: 8px; width: 100%; padding: 14px 16px; text-align: left; }
.mahlzeit .mzName { font-size: 16px; }
.mahlzeit .mzKcal { color: var(--text); font-size: 16px; font-weight: 700; }
.mzPfeil { color: var(--leise); font-size: 14px; transition: transform .2s; margin-left: 2px; }
.mahlzeit.offen .mzPfeil { transform: rotate(180deg); }
.mahlzeit .liste { border-radius: 0; border-top: 1px solid var(--linie); background: transparent; }

.mzLinks { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mahlzeit .mzName { white-space: nowrap; }
.mahlzeit .mzZeit { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mahlzeit .mzKcal { margin-left: 0; white-space: nowrap; }
.mzPfeil { font-size: 18px; width: 20px; text-align: center; }

/* Zielgewicht */
.zielKarte { display: block; width: 100%; text-align: left; padding: 18px 20px; margin-bottom: 12px; }
.zielOben { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.zielWert { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.zielRest { font-size: 15px; color: var(--leise); text-align: right; white-space: nowrap; }
.zielRest b { color: var(--text); font-size: 20px; }
.zielRest .gut { color: #5fc48a; }
.zielSpur { height: 12px; border-radius: 999px; background: var(--karte2); overflow: hidden; margin-top: 14px; }
.zielFuell { height: 100%; border-radius: inherit; background: #5fc48a; min-width: 12px; transition: width .35s; }
.zielSkala { display: flex; justify-content: space-between; font-size: 13px; color: var(--leise); margin-top: 6px; }
.zielLeer { display: flex; align-items: center; gap: 14px; }
.zielLeer .flagge { font-size: 26px; }
.zielLeer b { display: block; font-size: 16px; }
.zielLeer small { display: block; color: var(--leise); font-size: 13px; }
.zielLeer > span:nth-child(2) { flex: 1; }
.zielLeer .mp { color: var(--leise); font-size: 22px; }
.dZielGw { stroke: #5fc48a; stroke-width: 1.5; stroke-dasharray: 5 4; }
.dZielText { fill: #5fc48a; font-size: 11px; font-weight: 700; }

/* Gewicht-Knopf oben rechts mit Zielgewicht darunter */
.chip.mitZiel { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 5px 12px; border-radius: 16px; }
.chipZiel { font-size: 11.5px; font-weight: 600; color: #5fc48a; }
.chip.fehlt .chipZiel { color: #0b3a1f; }

.ergZiel { text-align: center; font-size: 14px; color: #5fc48a; font-weight: 600; margin: 0 0 8px; line-height: 1.4; }

/* Leiste fest am unteren Rand über die ganze Breite (schwebt nicht mehr) */
.leiste { left: 0; right: 0; bottom: 0; max-width: none; margin: 0; padding: 0; background: none; }
.leiste .tabs { height: calc(76px + env(safe-area-inset-bottom)); padding: 6px max(10px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0; border-width: 1px 0 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.35); }
.leiste .markierung { top: 6px; bottom: calc(6px + env(safe-area-inset-bottom)); left: max(10px, env(safe-area-inset-left));
  width: calc((100% - 2 * max(10px, env(safe-area-inset-left))) / 5); }
.innen { padding-bottom: calc(env(safe-area-inset-bottom) + 100px); }
.toast { bottom: calc(env(safe-area-inset-bottom) + 92px); }

/* Tagesziele mit Prozenten (wie MyFitnessPal) */
.zielListe { background: var(--karte2); border-radius: 14px; overflow: hidden; }
.zielZeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--linie); }
.zzName { font-size: 16px; white-space: nowrap; }
.mzG { color: var(--leise); margin-left: 4px; font-variant-numeric: tabular-nums; }
.kcalBox { display: flex; align-items: center; gap: 6px; color: var(--leise); }
.zielKcal { width: 96px; text-align: right; font-size: 18px; font-weight: 700; color: var(--kcal); background: transparent; border: 1px solid #4a4f5c; border-radius: 10px; padding: 7px 10px; outline: none; }
.zielKcal:focus { border-color: var(--kcal); }
.pzBox { display: flex; align-items: center; gap: 8px; }
.mzP { min-width: 48px; text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; }
.pzStep { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--linie); background: var(--karte); font-size: 20px; display: grid; place-items: center; touch-action: manipulation; }
.pzStep:active { background: var(--kcal); color: #0b1a2e; }
.pzSumme { display: flex; justify-content: space-between; padding: 12px 14px; font-size: 15px; color: var(--leise); }
.pzSumme b { color: #5fc48a; font-size: 17px; }
.pzSumme.falsch b { color: var(--rot); }
/* Hauptknopf eines Fensters bleibt unten sichtbar */
.blattFuss { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 8px -16px calc(-20px - env(safe-area-inset-bottom));
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(37,40,49,0) 0, var(--karte) 22%); z-index: 2; }

/* iPhone-Home-Bildschirm-Fehler (durchsichtige Statusleiste): iOS meldet den unteren Rand zu hoch, unter einer
   „bottom: 0“-Leiste bleibt ein Streifen. Der Hintergrund der Leiste läuft deshalb weit nach unten weiter. */
.leiste .tabs::after { content: ''; position: absolute; left: -1px; right: -1px; top: 100%; height: 200px; background: #21242f; pointer-events: none; }

/* Grundfarbe der Seite = Farbe der Leiste: füllt den Streifen, den iOS unter der Leiste frei lässt.
   Die Seiten selbst haben ihren eigenen Hintergrund und decken den Rest ab. */
html { background: #21242f; }
body { background: transparent; }

/* Runterziehen zum Aktualisieren: Ladekreis wie bei FatFight */
html, body { overscroll-behavior-y: contain; }
.ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) - 30px); z-index: 50; width: 38px; height: 38px; border-radius: 50%;
  background: var(--karte2); border: 1px solid var(--linie); box-shadow: 0 4px 14px rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
  transform: translate3d(-50%, 0, 0); opacity: 0; will-change: transform, opacity; transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .25s; pointer-events: none; }
.ptr.ziehend { transition: none; }
.ptr span { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--linie); border-top-color: var(--leise); will-change: transform; }
.ptr.bereit span { border-top-color: var(--kcal); }
.ptr.dreht span { border-top-color: var(--kcal); animation: ptrDreh .7s linear infinite; }
@keyframes ptrDreh { to { transform: rotate(360deg); } }

/* Statusleiste ist jetzt „black“ statt durchsichtig: mit „black-translucent“ legte iOS das App-Fenster um die
   Statusleisten-Höhe zu kurz an (Streifen unter der Leiste, nichts darunter zeichenbar). */

/* Scanner: waagrechter Leuchtstrich zur Orientierung, Notlösung über „Abbrechen“ */
.zielrahmen { overflow: hidden; }
.scanLinie { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px;
  background: #ff3b30; box-shadow: 0 0 10px 2px rgba(255,59,48,.75); animation: scanPuls 1.4s ease-in-out infinite; }
@keyframes scanPuls { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.scanKnoepfe { grid-template-columns: 1fr; }
.knopf.tabelle { background: #fff; color: #0b1a2e; font-size: 15px; }

/* ---------- Weiche Bewegungen ---------- */
/* Unteres Fenster: von ganz unten herein- und hinausgleiten, Hintergrund blendet mit */
.blatt { will-change: transform; box-shadow: 0 400px 0 0 var(--karte); }
.blatt.oeffnet { animation: blattHoch .34s cubic-bezier(.2,.9,.25,1); }
.blatt.schliesst { animation: blattRunter .23s cubic-bezier(.4,0,1,1) forwards; }
@keyframes blattHoch { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes blattRunter { from { transform: translateY(0); } to { transform: translateY(100%); } }
.schleier.oeffnet { animation: schleierEin .3s ease-out; }
.schleier.schliesst { animation: schleierAus .23s ease-in forwards; }
@keyframes schleierEin { from { opacity: 0; } to { opacity: 1; } }
@keyframes schleierAus { from { opacity: 1; } to { opacity: 0; } }
/* Seitenwechsel über die Leiste */
.seite.aktiv { animation: seiteEin .2s ease-out; }
@keyframes seiteEin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Mahlzeit und Messungen aufklappen */
.mahlzeit .liste:not([hidden]), .gwVerlauf .kennzahlen:not([hidden]) { animation: aufklappen .22s ease-out; }
@keyframes aufklappen { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* Hinweis unten */
.toast.rein { animation: toastEin .22s cubic-bezier(.2,.9,.25,1); }
.toast.weg { animation: toastAus .2s ease-in forwards; }
@keyframes toastEin { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastAus { to { opacity: 0; transform: translate(-50%, 8px); } }
/* Scanner blendet ein */
.scanner:not([hidden]) { animation: schleierEin .2s ease-out; }
/* Tasten geben beim Drücken leicht nach */
.knopf, .tab, .wahl button, .treffer button, .mzKopf, .chip { transition: transform .12s ease, background-color .15s; }
.knopf:active, .wahl button:active, .chip:active { transform: scale(.97); }
.tab:active svg { transform: scale(.9); }
.tab svg { transition: transform .12s ease; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* 🔥 Streak neben dem Logo */
.logoBox { display: flex; align-items: center; gap: 6px; }
.streak { font-size: 15px; font-weight: 800; color: #ff9f0a; padding: 3px 7px 3px 5px; border-radius: 999px; background: rgba(255,159,10,.12);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.streak.aus { filter: grayscale(1); opacity: .55; }
.streak:not(.aus) { animation: flamme 2.4s ease-in-out infinite; }
@keyframes flamme { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* Kopfzeile mit Streak: etwas enger, damit alles in eine Zeile passt */
.kopf { gap: 2px; }
.logo { font-size: 21px; }
.datum { gap: 0; }
.datum button { width: 28px; }
.datum .datumKnopf { min-width: 62px; padding: 6px 4px; }
.chip.mitZiel { padding: 5px 9px; }

/* Drag & Drop der Einträge */
.ziehbar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ziehbar.gezogen { opacity: .3; }
.zugGeist { position: fixed; z-index: 40; pointer-events: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--karte2); border: 1px solid var(--kcal); border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.5); list-style: none; }
.zugGeist .mitte { flex: 1; min-width: 0; }
.zugGeist .titel { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zugGeist .klein { font-size: 13px; color: var(--leise); }
.zugGeist .kcal { font-weight: 700; }
.zugGeist .weg { display: none; }
.mahlzeit.zielHell { outline: 2px solid var(--kcal); outline-offset: 2px; background: rgba(130,184,248,.08); }
.neuZone { list-style: none; border: 2px dashed var(--linie); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--leise); font-weight: 600; }
.neuZone.zielHell { border-color: var(--kcal); color: var(--kcal); background: rgba(130,184,248,.08); }
body.zieht, body.zieht * { cursor: grabbing; }

.liste li.alsRezept { padding: 8px 14px 12px; border-bottom: 0; }
.alsRezept button { width: 100%; padding: 10px; border-radius: 12px; border: 1px dashed var(--linie); color: var(--kcal); font-weight: 600; font-size: 15px; }
.alsRezept button:active { background: rgba(130,184,248,.08); }

/* Kopfzeile: Datum genau in der Bildschirmmitte, links Logo + Streak, rechts Gewicht */
.kopf { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.kopf .logoBox { justify-self: start; min-width: 0; }
.kopf .datum { justify-self: center; }
.kopf .chip { justify-self: end; }

.link.rot { color: var(--rot); }
.ziehbar { cursor: pointer; }

/* Gesamtkalorien einer Mahlzeit hervorgehoben, einzelne Lebensmittel dezenter */
.mahlzeit .mzKcal { display: inline-flex; align-items: baseline; gap: 1px; padding: 5px 11px; border-radius: 999px;
  background: rgba(130,184,248,.14); color: var(--kcal); white-space: nowrap; }
.mahlzeit .mzKcal b { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mahlzeit .mzKcal small { font-size: 13px; font-weight: 600; margin-left: 3px; }
.mahlzeit .liste .kcal { font-size: 15px; font-weight: 600; color: #c3c8d2; }
