/* Auto Display Prototyp: Stile. Farben als Variablen, Tagmodus über data-modus. */
:root {
  --bg: #000;
  --fl-1: #111114;        /* Kachel oben */
  --fl-2: #09090b;        /* Kachel unten */
  --rand: rgba(255,255,255,0.07);
  --linie: #1c1c1f;
  --text: #f2f2f3;
  --text-2: #8e8e95;
  --text-3: #57575e;
  --live: #6fe3a1;        /* Akzentfarbe: Live-Wert */
  --regen: #ffc24b;       /* Zustand Regeneration */
  --rec: #ff5a52;         /* Aufzeichnung läuft */
  --fl-0: #121215;        /* Tastenleisten */
  --fl-aktiv: #26262c;    /* gedrückte Taste */
  --fl-3: #1a1a1f;        /* kleine Flächen, Schalter */
  --leer: #34343a;        /* Wert fehlt */
  --fuell: rgba(255,255,255,0.045);       /* Füllstand in Kacheln */
  --fuell-kante: rgba(255,255,255,0.10);
  --schatten: #000;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --w: 800px; --h: 480px; /* Android-Auto-Fläche des Discover Media (Annahme, noch zu messen) */
}
/* Tagmodus: helle Flächen, dunkle Schrift; Akzentfarben abgedunkelt, damit sie auf Weiß lesbar bleiben */
.bildschirm[data-modus="tag"] {
  --bg: #eef0f3; --fl-1: #ffffff; --fl-2: #f7f8fa; --rand: rgba(0,0,0,0.08); --linie: #e1e3e8;
  --text: #111216; --text-2: #5d6069; --text-3: #8d9099; --live: #10804a; --regen: #a86400; --rec: #d92d20;
  --fl-0: #ffffff; --fl-aktiv: #e4e6eb; --fl-3: #e9ebef; --leer: #c4c7ce;
  --fuell: rgba(16,128,74,0.07); --fuell-kante: rgba(16,128,74,0.22); --schatten: rgba(0,0,0,0.18);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: #141416; color: var(--text);
  font-family: system-ui, Roboto, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Rahmen: Bildschirm des Discover Media; wird bei kleinen Fenstern verkleinert */
.geraet { position: absolute; left: 50%; top: 50%; display: grid; justify-items: center; gap: 12px; transform: translate(-50%, -50%); }
.bildschirm { position: relative; width: var(--w); height: var(--h); background: var(--bg); color: var(--text); display: grid; grid-template-columns: 72px 1fr;
  overflow: hidden; border-radius: 6px; box-shadow: 0 0 0 14px #050505, 0 0 0 15px #2a2a2e, 0 30px 80px #000;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
/* In der Android-App: Android Auto zeichnet seine Systemleiste selbst, daher ohne Leiste und Gehäuse */
.app-modus, .app-modus body { background: #000; }
.app-modus .leiste, .app-modus .hinweis { display: none; }
.app-modus .geraet { gap: 0; }
.app-modus .bildschirm { --w: 728px; grid-template-columns: 1fr; border-radius: 0; box-shadow: none; }
.hinweis { font-size: 12px; color: #6b6b72; margin-top: 18px; max-width: var(--w); text-align: center; line-height: 1.5; }

/* Systemleiste von Android Auto: gehört nicht zur App, nur angedeutet */
.leiste { background: #0d0d0f; border-right: 1px solid #18181b; display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 18px; color: #6b6b72; font-size: 13px; font-weight: 600; }
.leiste i { width: 34px; height: 34px; border-radius: 50%; background: #1b1b1f; display: block; }
.leiste i.aktiv { background: #23232a; box-shadow: inset 0 0 0 2px #3a3a42; }
.leiste .unten { margin-top: auto; }

/* Zeichenfläche der App */
.app { position: relative; display: grid; grid-template-rows: 60px 1fr; min-width: 0; }
.zahl { font-variant-numeric: tabular-nums; letter-spacing: -0.03em; font-weight: 650; line-height: 1; }
.einheit { white-space: nowrap; color: var(--text-2); font-size: 14px; font-weight: 500; letter-spacing: 0; margin-left: 5px; }
.label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; font-weight: 500; letter-spacing: 0.01em; }
.label svg.ic { width: 16px; height: 16px; }
.hinweis-klein { color: var(--text-3); font-size: 11px; font-weight: 500; }

/* Kopf: Status links, Aktionsleiste rechts (in Android Auto höchstens vier Tasten) */
.kopf { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 20px; font-size: 13px; color: var(--text-3); min-width: 0; }
.status { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.status .punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.status.rec { color: var(--text); font-weight: 600; }
.status.rec .punkt { background: var(--rec); box-shadow: 0 0 0 3px rgba(255,90,82,0.18); }
.regen { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 14px; white-space: nowrap;
  background: rgba(255, 194, 75, 0.12); color: var(--regen); font-weight: 650; font-size: 12px; letter-spacing: 0.03em;
  opacity: 0; transform: scale(0.95); transition: opacity 150ms ease-out, transform 150ms ease-out; }
.regen svg.ic { width: 15px; height: 15px; }
.regen.an { opacity: 1; transform: scale(1); transition-duration: 220ms; transition-timing-function: var(--ease-out); }
.aktionen { margin-left: auto; display: flex; gap: 2px; padding: 4px; border-radius: 26px; background: var(--fl-0);
  box-shadow: inset 0 0 0 1px var(--rand); }
.aktionen button, .rund { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 13px;
  border: 0; border-radius: 21px; background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform 120ms ease-out; }
.aktionen button:active, .rund:active, .kachel.tippbar:active { transform: scale(0.96); }
.aktionen button[aria-pressed="true"] { background: var(--fl-aktiv); color: var(--text); }
.aktionen .log { width: 42px; padding: 0; color: var(--text-2); }
.aktionen .log[aria-pressed="true"] { background: rgba(255,90,82,0.16); color: var(--rec); }
.aktionen .log svg.ic { fill: currentColor; stroke: none; width: 16px; height: 16px; }

/* Kartentasten rechts (in Android Auto die Map-Action-Strip, nur Symbole) */
.karte-tasten { position: absolute; right: 12px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; padding: 4px;
  border-radius: 26px; background: var(--fl-0); box-shadow: inset 0 0 0 1px var(--rand); z-index: 2; }
.rund { width: 44px; height: 44px; padding: 0; border-radius: 22px; color: var(--text); }
.rund svg.ic { width: 22px; height: 22px; }

/* Ansichten: ohne Übergang, das Bild wird einfach neu gezeichnet */
.ansicht { display: none; min-height: 0; padding: 2px 70px 16px 20px; }
.ansicht.sichtbar { display: grid; }
.kachel { position: relative; background: linear-gradient(180deg, var(--fl-1), var(--fl-2)); border-radius: 18px; padding: 14px 16px;
  box-shadow: inset 0 0 0 1px var(--rand), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; min-width: 0; transition: transform 120ms ease-out; }
.kachel.tippbar { cursor: pointer; }
.kachel > :not(.fuell) { position: relative; z-index: 1; }
.kachel .wechsel { position: absolute; }
.wechsel { position: absolute; top: 12px; right: 12px; display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--fl-3);
  font-size: 11px; font-weight: 650; color: var(--text-3); }
.wechsel span { padding: 2px 7px; border-radius: 7px; }
.wechsel span.an { background: var(--fl-aktiv); color: var(--text); }

/* A: Muscheldiagramm */
.a { grid-template-columns: 1fr 158px; gap: 14px; }
.a .links { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px; min-width: 0; min-height: 0; }
.karten { display: flex; gap: 3px; padding: 3px; border-radius: 17px; background: var(--fl-0); box-shadow: inset 0 0 0 1px var(--rand); justify-self: start; }
.karten button { height: 28px; padding: 0 10px; border: 0; border-radius: 14px; background: none; color: var(--text-2); font: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform 120ms ease-out; }
.karten button:active { transform: scale(0.96); }
.karten button[aria-pressed="true"] { background: var(--fl-aktiv); color: var(--text); }
.a .werte { display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.a .gross { font-size: 54px; }
.a .mittel { font-size: 34px; }
.a .klein { font-size: 14px; color: var(--text-2); }
.a .klein b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 650; }

/* B: Fahrzeugkarte und Kacheln */
.b { grid-template-columns: 236px 1fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; }
.auto { grid-row: span 2; justify-content: flex-start; gap: 10px; padding: 16px; }
.auto .name { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.auto .daten { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.auto img.golf { width: 112%; height: auto; margin: auto -6%; filter: brightness(0.82) contrast(1.05);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.auto canvas.golf3d { width: calc(100% + 32px); margin: auto -16px; flex: 1; min-height: 0; display: block; touch-action: none; cursor: grab; }
.auto.dreht canvas.golf3d { cursor: grabbing; }
.auto .zustand { display: grid; gap: 8px; }
.auto .zustand div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.auto .zustand b { margin-left: auto; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.auto .zustand .ist-regen b { color: var(--regen); }

/* C: Verlauf */
.c { grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 4px; }
.zeile { display: grid; grid-template-columns: 158px 1fr; align-items: center; gap: 14px; min-height: 0; height: 100%;
  border-bottom: 1px solid var(--linie); }
.zeile:last-child { border-bottom: 0; }
.zeile .zahl { font-size: 30px; margin-top: 6px; }
/* Canvas absolut in einer festen Box, sonst schaukelt sich die Höhe über die Pixelgröße auf */
.flaeche { position: relative; height: 100%; min-height: 0; }
.flaeche canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Tanken: eigener Bildschirm (in Android Auto eine eigene Vorlage, nur im Stand) */
.tanken { position: absolute; inset: 0; background: var(--bg); z-index: 5; display: none; grid-template-rows: 60px 1fr; }
.tanken.offen { display: grid; }
.tanken .kopf h2 { font-size: 17px; font-weight: 650; color: var(--text); }
.tanken .stand { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2);
  padding: 0 10px; height: 26px; border-radius: 13px; background: var(--fl-3); }
.tanken .inhalt { display: grid; grid-template-columns: 1fr 200px; gap: 14px; padding: 2px 20px 16px; min-height: 0; }
.formular { display: grid; grid-template-columns: 190px 1fr; grid-template-rows: 1fr auto auto; gap: 10px; min-height: 0; }
.feld { display: grid; gap: 6px; padding: 12px 14px; }
.feld input { width: 100%; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 30px; font-weight: 650;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; padding: 0; }
.feld input::placeholder { color: var(--leer); }
.feld:focus-within { box-shadow: inset 0 0 0 1.5px var(--live); }
.schalter { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; }
.schalter .knopf { width: 46px; height: 28px; border-radius: 14px; background: var(--fl-aktiv); position: relative; transition: background 150ms ease; }
.schalter .knopf::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #f2f2f3;
  transition: transform 180ms var(--ease-out); }
.schalter[aria-checked="true"] .knopf { background: #2f8f5b; }
.schalter[aria-checked="true"] .knopf::after { transform: translateX(18px); }
.speichern { grid-column: span 2; height: 52px; border: 0; border-radius: 16px; background: var(--text); color: var(--bg); font: inherit;
  font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: transform 120ms ease-out; }
.speichern:active { transform: scale(0.98); }
.gross-feld { justify-content: space-between; padding: 16px; }
.betrag { display: flex; align-items: baseline; gap: 4px; }
.betrag input { font-size: 50px; width: 4.2ch; field-sizing: content; min-width: 2.5ch; }
.betrag .einheit { font-size: 22px; }
.abgeleitet { padding: 14px 16px; gap: 9px; justify-content: flex-start; }
.abgeleitet .z { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.abgeleitet .z svg.ic { width: 16px; height: 16px; color: var(--text-3); }
.abgeleitet .z b { margin-left: auto; white-space: nowrap; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.fehler { grid-column: span 2; color: var(--rec); font-size: 13px; min-height: 16px; }
.liste { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; padding: 14px; justify-content: flex-start; }
.liste .ergebnis .zahl { font-size: 36px; margin-top: 6px; }
.liste ul { list-style: none; padding: 0; display: grid; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.liste li { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--linie); }
.liste li b { color: var(--text); font-weight: 600; }

/* Erweitert: alle OBD-Werte in Gruppen */
.erweitert .inhalt { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 2px 20px 16px; min-height: 0; }
.spalte { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.gruppe { padding: 11px 14px 4px; justify-content: flex-start; gap: 0; }
.gruppe h3 { font-size: 12px; font-weight: 650; color: var(--text-2); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.reihe { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; column-gap: 8px; padding: 6px 0;
  border-top: 1px solid var(--linie); }
.reihe:first-of-type { border-top: 0; }
.reihe svg.ic { width: 16px; height: 16px; color: var(--text-3); }
.reihe .name { font-size: 13px; color: var(--text-2); line-height: 1.15; min-width: 0; }
.reihe .name small { display: block; font-size: 10px; color: var(--text-3); letter-spacing: 0.02em; margin-top: 2px; }
.reihe .w { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; text-align: right; white-space: nowrap; }
.reihe .w i { font-style: normal; font-size: 11px; font-weight: 500; color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.reihe.leer .w { color: var(--leer); }
.reihe.ist-regen .w { color: var(--regen); }
.quelle { margin-left: auto; display: flex; gap: 12px; font-size: 11px; color: var(--text-3); }
.quelle span { display: inline-flex; align-items: center; gap: 5px; }
.quelle span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--q, var(--leer)); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }

/* Energie */
.bildschirm { --e-luft: #7cc0f2; --e-roll: #5aa2dc; }
.bildschirm[data-modus="tag"] { --e-luft: #3f8fd0; --e-roll: #2f76b4; }
.energie .kopf .zustand-text { margin-left: auto; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.energie .inhalt { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 10px; padding: 2px 20px 16px; min-height: 0; }
.fluss-kachel { padding: 12px 10px 10px 12px; }
.fluss-kachel canvas { width: 100%; height: 100%; display: block; }
.seite-rechts { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; min-height: 0; }
.kennzahl { padding: 12px 14px; gap: 4px; justify-content: flex-start; }
.kennzahl .riesig { font-size: 52px; margin: 2px 0; }
.kennzahl .hinweis-klein b, .widerstand-kachel b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.widerstand-kachel { padding: 12px 12px 8px 14px; gap: 6px; justify-content: flex-start; min-height: 0; }
.widerstand-kachel .paar { display: flex; gap: 12px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.widerstand-kachel .paar i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.widerstand-kachel .flaeche { flex: 1; min-height: 70px; }
.annahmen { font-size: 10px; line-height: 1.35; color: var(--text-3); padding: 0 2px; }

/* Rückmeldung unten */
.meldung { position: absolute; left: 50%; bottom: 18px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 0 16px; height: 40px;
  border-radius: 20px; background: var(--fl-1); color: var(--text); font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px var(--schatten), inset 0 0 0 1px var(--rand);
  opacity: 0; transform: translate(-50%, 8px) scale(0.97); pointer-events: none;
  transition: opacity 150ms ease-out, transform 150ms ease-out; }
.meldung.an { opacity: 1; transform: translate(-50%, 0) scale(1); transition-duration: 220ms; transition-timing-function: var(--ease-out); }
.meldung svg.ic { color: var(--live); }

@media (prefers-reduced-motion: reduce) {
  .regen, .regen.an, .meldung, .meldung.an { transform: translate(-50%, 0); }
  .regen, .regen.an { transform: none; }
  .aktionen button:active, .rund:active, .kachel.tippbar:active, .speichern:active { transform: none; }
  .fuell { transition: none; }
}

/* ---------- Überarbeitung nach Emil Kowalski (2026-11-13) ---------- */

/* Kennfeld: Titel der Karte als Text neben der Kartenauswahl statt frei im Diagramm */
.a .kopfzeile { display: flex; align-items: center; gap: 12px; min-width: 0; }
.karte-titel { padding-left: 50px; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Tanken: Speichern erst mit Betrag */
.speichern:disabled { opacity: 0.35; cursor: default; }
.speichern:disabled:active { transform: none; }

/* Erweitert: Symbole grau, Quelle als Punkt neben der PID */
.reihe .name small .q { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: var(--q); }

/* Werte-Kacheln: Zahl groß und mittig, Füllstand als schmaler Balken unten (Kontrast hinter der Zahl bleibt) */
.b .kachel:not(.auto) { justify-content: flex-start; padding-bottom: 26px; }
.b .kachel:not(.auto) > div:last-child { margin: auto 0; }
.b .kachel .zahl { font-size: 46px; white-space: nowrap; }
.b .kachel:not(.auto)::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 14px; height: 4px;
  border-radius: 2px; background: var(--fl-3); z-index: 0; }
.fuell { position: absolute; left: 16px; right: 16px; bottom: 14px; height: 4px; border-radius: 2px; background: var(--text-2);
  transform-origin: left; transform: scaleX(0); transition: transform 250ms linear; pointer-events: none; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .fuell { transition: none; } }

/* Tag und Nacht: ganze Fläche gleitet in 300 ms über (View Transition), statt hart umzuspringen */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 300ms; animation-timing-function: ease; }

/* Fahrzeugkarte nachts: weicher Lichtfleck hinter dem Golf, damit sich der dunkle Lack vom Schwarz abhebt */
.bildschirm:not([data-modus="tag"]) .auto canvas.golf3d { background: radial-gradient(ellipse 55% 42% at 50% 58%, rgba(170,180,200,0.13), transparent 72%); }
/* Zeile Reifen: antippen wechselt Sommer und Winter */
.auto .zustand .tippbar { cursor: pointer; border-radius: 8px; transition: transform 120ms ease-out; }
.auto .zustand .tippbar:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) { .auto .zustand .tippbar:active { transform: none; } }
