/* Spracheingabe im Kalorien-Tracker (sprach-tracker.js). Hell wie die Blätter der App, für Legacy und Balance
   gleich: weißer Grund, Schrift #0f2a1f, Lime als Fläche, Grün (#0f4a37) für Linien und Hervorhebung. */

.sp {
  --sp-ink: #0f2a1f;
  --sp-muted: #5b6b63;
  --sp-line: #dfe5df;
  --sp-panel: #f2f4ef;
  --sp-fill: #d1f843;
  --sp-on-fill: #062219;
  --sp-accent: #0f4a37;
  --sp-error: #c0392b;
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--sp-ink);
}
.sp[hidden] { display: none; }
html.sp-offen, html.sp-offen body { overflow: hidden; }
.sp-hinter { position: absolute; inset: 0; background: rgba(4, 20, 14, 0.55); }
.sp-blatt {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: #fff;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
}
@media (min-width: 720px) {
  .sp { align-items: center; padding: 24px; }
  .sp-blatt { border-radius: 26px; max-height: 86vh; }
}
.sp :is(h2, p) { margin: 0; }
.sp button { font: inherit; color: inherit; cursor: pointer; }
.sp button:disabled { cursor: default; }
.sp :is(button, input, textarea):focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
.sp-unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sp-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sp-kopf h2 { font-size: 21px; font-weight: 900; letter-spacing: -0.4px; }
.sp-zu { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--sp-panel); }

.sp-lead { font-size: 17px; font-weight: 700; }
.sp-bsp { margin-top: 6px !important; font-size: 14.5px; line-height: 1.45; color: var(--sp-muted); }
.sp-klein { font-size: 13.5px; color: var(--sp-muted); }
.sp-fuss { margin-top: 18px !important; font-size: 12.5px; line-height: 1.45; color: var(--sp-muted); }
.sp-fehler { margin-top: 12px !important; padding: 10px 12px; border-radius: 12px; background: #fdecea; color: var(--sp-error); font-size: 14px; }
.sp-hinweis { margin-top: 12px !important; padding: 12px 14px; border-radius: 14px; background: var(--sp-panel); font-size: 14.5px; line-height: 1.45; }

.sp-mitte { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 26px 0 18px; text-align: center; }
.sp-mikro {
  display: grid; place-items: center;
  width: 96px; height: 96px;
  border: 0; border-radius: 50%;
  background: var(--sp-fill); color: var(--sp-on-fill) !important;
  box-shadow: 0 8px 24px rgba(15, 74, 55, 0.25);
}
.sp-mikro:hover { filter: brightness(1.04); }
.sp-mikro.is-an { background: #e5483b; color: #fff !important; animation: sp-puls 1.4s ease-out infinite; }
@keyframes sp-puls {
  0% { box-shadow: 0 0 0 0 rgba(229, 72, 59, 0.45); }
  100% { box-shadow: 0 0 0 26px rgba(229, 72, 59, 0); }
}
@media (prefers-reduced-motion: reduce) { .sp-mikro.is-an { animation: none; } }
.sp-uhr { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.sp-warten { margin: 34px 0 30px; }
.sp-kreis { width: 46px; height: 46px; border: 4px solid var(--sp-panel); border-top-color: var(--sp-accent); border-radius: 50%; animation: sp-dreh 0.9s linear infinite; }
@keyframes sp-dreh { to { transform: rotate(360deg); } }

.sp-link { display: inline-flex; align-items: center; gap: 6px; margin: 0 auto; padding: 8px 4px; border: 0; background: none; color: var(--sp-accent) !important; font-weight: 700; font-size: 14.5px; }
.sp-inhalt > .sp-link { display: flex; }
.sp-link--klein { margin: 4px 0 0; padding: 4px 0; font-size: 13.5px; }

.sp-tipp { display: grid; gap: 8px; margin-top: 12px; }
.sp-tipp textarea {
  width: 100%; box-sizing: border-box; padding: 12px 14px; resize: vertical;
  border: 1.2px solid var(--sp-line); border-radius: 14px; background: #fff; color: var(--sp-ink);
  font: inherit; font-size: 15.5px; line-height: 1.4;
}
.sp-tipp textarea:focus { border-color: var(--sp-accent); outline: 0; }

.sp-verstanden { padding: 12px 14px; border-radius: 16px; background: var(--sp-panel); }
.sp-verstanden p { margin-top: 2px !important; font-size: 15.5px; line-height: 1.45; font-style: italic; }

/* Vier feste Spalten: auf dem Handy eine Zeile, nichts rutscht um */
.sp-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.sp-chip { padding: 9px 4px; border: 1.2px solid var(--sp-line); border-radius: 999px; background: #fff; font-size: 13.5px !important; font-weight: 600; white-space: nowrap; }
.sp-chip.is-an { border-color: var(--sp-accent); background: var(--sp-accent); color: #fff !important; }

.sp-liste { display: grid; gap: 10px; margin-top: 14px; }
.sp-karte {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 8px 10px 10px; border: 1.2px solid var(--sp-line); border-radius: 18px; background: #fff;
}
.sp-bild { width: 52px; height: 52px; overflow: hidden; border-radius: 50%; background: var(--sp-panel); flex: none; }
.sp-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-bild--icon { display: grid; place-items: center; color: var(--sp-accent); }
.sp-text { display: grid; gap: 3px; min-width: 0; }
.sp-text strong { font-size: 15.5px; line-height: 1.3; overflow-wrap: anywhere; }
.sp-text > span:not(.sp-marke) { font-size: 14px; color: var(--sp-muted); line-height: 1.4; }
.sp-marke { justify-self: start; padding: 2px 8px; border-radius: 999px; background: var(--sp-fill); color: var(--sp-on-fill); font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; }
.sp-marke--grau { background: var(--sp-panel); color: var(--sp-muted); font-weight: 700; }
.sp-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sp-menge { font-size: 13.5px; color: var(--sp-muted); }
.sp-kcal { font-size: 15px; white-space: nowrap; }
.sp-weg { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--sp-muted) !important; }
.sp-weg:hover { background: var(--sp-panel); }

.sp-portion { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13.5px; font-weight: 600; }
.sp-portion button { display: grid; place-items: center; width: 28px; height: 28px; border: 1.2px solid var(--sp-line); border-radius: 50%; background: #fff; }
.sp-portion button:disabled { opacity: 0.4; }
.sp-portion span { min-width: 76px; text-align: center; }

.sp-kcal-feld { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; height: 40px; border: 1.2px solid var(--sp-line); border-radius: 12px; }
.sp-kcal-feld:focus-within { border-color: var(--sp-accent); }
.sp-kcal-feld input { width: 4.2ch; border: 0; outline: 0; background: none; font: inherit; font-weight: 800; font-size: 15px; text-align: right; color: var(--sp-ink); }
.sp-kcal-feld em { font-style: normal; font-size: 13px; color: var(--sp-muted); }

.sp-frage { grid-template-columns: minmax(0, 1fr) auto; border-color: var(--sp-accent); background: #f7fbe8; }
.sp-frage .sp-zwei, .sp-frage .sp-wahl { grid-column: 1 / -1; }
.sp-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-wahl { display: grid; gap: 8px; }
.sp-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border: 1.2px solid var(--sp-line); border-radius: 14px; background: #fff; text-align: left;
}
.sp-option:hover { border-color: var(--sp-accent); }
.sp-option .sp-bild { width: 40px; height: 40px; }
.sp-option span { font-size: 14.5px; font-weight: 600; }
.sp-option b { font-size: 13.5px; white-space: nowrap; }
.sp-suche { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; border: 1.2px solid var(--sp-line); border-radius: 12px; background: #fff; color: var(--sp-muted); }
.sp-suche:focus-within { border-color: var(--sp-accent); }
.sp-suche input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 15px; color: var(--sp-ink); }
.sp-treffer { display: grid; gap: 8px; }

.sp-aktionen { display: grid; gap: 10px; margin-top: 18px; }
.sp-primaer, .sp-zweit {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 10px 18px; box-sizing: border-box; border-radius: 999px;
  font-size: 16px !important; font-weight: 800;
}
.sp-primaer { border: 0; background: var(--sp-fill); color: var(--sp-on-fill) !important; }
.sp-primaer:disabled { opacity: 0.5; }
.sp-zweit { border: 1.2px solid var(--sp-accent); background: #fff; color: var(--sp-accent) !important; font-size: 15px !important; font-weight: 700; min-height: 46px; }
.sp-zwei .sp-zweit { padding: 8px 10px; font-size: 14px !important; }

@media (max-width: 380px) {
  .sp-karte { grid-template-columns: auto minmax(0, 1fr) auto; }
  .sp-karte .sp-kcal, .sp-karte .sp-kcal-feld { grid-column: 2; justify-self: start; }
  .sp-karte .sp-weg { grid-row: 1; grid-column: 3; }
}
