:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5f6672;
  --line: #e5e7eb;
  --accent: #0f9d58;       /* nur für die Hauptaktion und die Marke */
  --accent-dark: #0b7a44;
  --selected: #16181d;     /* gewählte Tankstelle auf der Karte */
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  --panel-w: 400px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Grundlayout: Desktop = Seitenleiste links, Karte rechts ---------- */
.app {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  height: 100vh;
}
.panel {
  grid-column: 1;
  grid-row: 1;
  background: var(--card);
  overflow-y: auto;
  padding: 88px 24px 24px;
  border-right: 1px solid var(--line);
  z-index: 2;
}
.map-area { grid-column: 2; grid-row: 1; position: relative; min-height: 0; }
.map { position: absolute; inset: 0; z-index: 0; }
.handle { display: none; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0;
  width: var(--panel-w);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--card);
  z-index: 5;
}
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }

/* ---------- Suche + Spritsorte ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  background: var(--bg);
  border-radius: 12px;
  color: var(--muted);
}
.search input {
  flex: 1; min-width: 0; width: 0;
  border: 0; background: transparent;
  font: inherit; color: var(--text);
  outline: none;
}
.search:focus-within { box-shadow: 0 0 0 2px var(--text); }
.search { padding-right: 4px; }
.search-locate {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: var(--card); color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); cursor: pointer;
}
.search-locate:hover { color: var(--accent-dark); }

.chips { display: flex; gap: 8px; margin: 16px 0 8px; }
.chip {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font: inherit; font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.chip[aria-checked="true"] { background: var(--text); border-color: var(--text); color: #fff; }

.notice {
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff7e0;
  border: 1px solid #f3d98b;
  font-size: 0.9rem;
}

.section-title { font-size: 1rem; margin: 24px 0 8px; }

/* ---------- Liste ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  border-radius: 8px;
}
.list li:hover { background: var(--bg); }
.list li.active { background: var(--bg); box-shadow: inset 3px 0 0 var(--selected); }
.list .name { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 0.85rem; grid-column: 1; }
.list .open { color: #0b7a44; }
.list .closed { color: #b42318; }
.list .price { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; }
.list .price b {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}
.list .price small { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.list .empty { color: var(--muted); cursor: default; display: block; }

/* ---------- Karte der gewählten Tankstelle (über der Karte) ---------- */
.station-card {
  position: absolute;
  left: 24px; bottom: 24px;
  width: min(420px, calc(100% - 48px));
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px 20px;
  z-index: 3;
  max-height: calc(100% - 48px);
  overflow-y: auto;
}
.card-loading { margin: 0; color: var(--muted); }
.card-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
}
.card-label.neutral { color: var(--muted); }
.card-label.closed { color: #b42318; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 4px; }
.card-name { font-size: 1.15rem; font-weight: 700; margin: 0; }
.card-addr { color: var(--muted); font-size: 0.9rem; margin: 2px 0 0; }
.card-price { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; text-align: right; }
.card-price small { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 16px; color: var(--muted); font-size: 0.92rem; }
.card-meta b { color: var(--text); }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
button.btn { width: 100%; border: 0; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.btn-primary:hover { background: var(--accent-dark); }
.status {
  border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; cursor: pointer;
  min-height: 24px;
}
.status.is-open { color: #0b7a44; }
.status.is-closed { color: #b42318; }
.status[aria-expanded="true"] span { display: inline-block; transform: rotate(180deg); }
.hours-list { margin: -8px 0 12px; padding: 8px 12px; background: var(--bg); border-radius: 10px; font-size: 0.88rem; }
.hours-list table { width: 100%; border-collapse: collapse; }
.hours-list td { padding: 2px 0; }
.hours-list td:last-child { text-align: right; }
.hours-list tr.today { font-weight: 700; }
.hours-list .muted { margin: 0; color: var(--muted); }
.info { margin: -4px 0 12px; font-size: 0.92rem; }
.detour { background: var(--bg); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; font-size: 0.9rem; }
.detour p { margin: 0; }
.detour summary {
  list-style: none; cursor: pointer; font-weight: 700; display: flex; justify-content: space-between; align-items: center;
  min-height: 28px;
}
.detour summary::-webkit-details-marker { display: none; }
.detour summary::after { content: "▾"; color: var(--muted); }
.detour[open] summary::after { content: "▴"; }
.detour-body { margin-top: 6px; }
.detour .yes { color: #0b7a44; }
.detour .no { color: #b42318; }
.detour .fineprint { margin-top: 4px; font-size: 0.75rem; }
.services { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; }
.services li { font-size: 0.8rem; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.alt-pick {
  display: block; width: 100%; margin-top: 8px; padding: 10px 12px;
  text-align: left; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.alt-pick:hover { border-color: var(--text); }
.alt-pick span { display: block; }
.alt-pick-label { font-size: 0.75rem; font-weight: 700; color: #0b7a44; }
.alt-pick-row { display: flex !important; justify-content: space-between; gap: 8px; }
.alt-pick-sub { font-size: 0.82rem; color: var(--muted); }

/* "In diesem Bereich suchen" */
.area-btn {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 4; height: 44px; padding: 0 20px;
  border: 0; border-radius: 999px; background: var(--card); color: var(--text);
  font: inherit; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap;
}
.area-btn:hover { background: var(--bg); }
.alt-link { display: block; text-align: center; margin-top: 8px; color: var(--muted); font-size: 0.88rem; }

/* ---------- Preisschilder ---------- */
.price-tag-icon { background: none; border: 0; }
.price-tag {
  position: relative;
  display: inline-block;
  transform: translate(-50%, calc(-100% - 7px));
  padding: 4px 8px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 2px solid #fff;
  cursor: pointer;
}
.price-tag::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -8px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--c, #0f9d58);
  border-bottom: 0;
}
.price-tag.closed { background: #8a9099; --c: #8a9099; font-weight: 700; }
/* Geschlossen: eigenes Schlaf-Zeichen (zzz) direkt neben dem Preis, sieht überall gleich aus */
.price-tag.closed { display: inline-flex; align-items: center; gap: 4px; }
.closed-mark { display: block; flex: none; color: #fff; }
.price-tag.selected { background: var(--selected) !important; --c: var(--selected); font-size: 15px; padding: 6px 10px; }

.me-dot {
  width: 16px; height: 16px;
  background: #2563eb;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.2);
}

/* ---------- Wochenübersicht ---------- */
.today { background: var(--bg); border-radius: 12px; padding: 16px; margin-bottom: 24px; }
.today-label { margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.week-verdict.small { font-size: 1.05rem; }
.strip-wrap { position: relative; margin-top: 28px; }
.strip { display: flex; height: 32px; border-radius: 8px; overflow: hidden; }
.strip span { flex: 1; }
.now { position: absolute; top: -22px; z-index: 2; transform: translateX(-50%); font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.now::after { content: ""; position: absolute; left: 50%; top: 18px; height: 38px; border-left: 2px solid var(--selected); }
.now.edge-left { transform: none; }
.now.edge-left::after { left: 0; }
.now.edge-right { transform: translateX(-100%); }
.now.edge-right::after { left: auto; right: 0; }
.hours { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.week { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--line); }
.week-verdict { font-size: 1.25rem; font-weight: 700; margin: 0; }
.week-sub { color: var(--muted); margin: 4px 0 16px; }
.today-section { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--line); }
.today-section .today { margin-bottom: 0; }
.week-box { background: var(--bg); border-radius: 12px; padding: 14px 14px 12px; margin-bottom: 12px; }
.day-bars { display: grid; gap: 4px; }
.day-row {
  display: grid; grid-template-columns: 32px 1fr 72px; gap: 8px; align-items: center;
  width: 100%; min-height: 36px; padding: 4px 8px; margin: 0 -8px; box-sizing: content-box;
  border: 0; border-radius: 8px; background: transparent; font: inherit; color: var(--text);
  text-align: left; cursor: pointer;
}
.day-row:hover { background: rgba(0, 0, 0, 0.04); }
.day-row.selected { background: var(--card); box-shadow: inset 0 0 0 2px var(--selected); }
.day-name { font-weight: 600; color: var(--muted); }
.day-row.selected .day-name { color: var(--text); font-weight: 800; }
.day-bar { height: 22px; border-radius: 6px; background: #d6dae0; }
.day-bar.best { background: var(--accent); }
.day-row.selected .day-bar:not(.best) { background: #9aa1ab; }
.day-val { text-align: right; font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.day-val.best { color: var(--accent-dark); }
.slot-cols { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.slot-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.slot-col b { font-size: 0.8rem; margin-bottom: 4px; white-space: nowrap; }
.slot-col.best b { color: var(--accent-dark); }
.slot-col i { display: block; width: 100%; border-radius: 6px 6px 0 0; background: #d6dae0; }
.slot-col.best i { background: var(--accent); }
.slot-axis { display: flex; gap: 6px; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.slot-axis span { flex: 1; text-align: center; }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.75rem; color: var(--muted); }
.legend i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, hsl(140,70%,38%), hsl(70,70%,38%), hsl(0,70%,38%)); }
.fineprint { font-size: 0.78rem; color: var(--muted); margin: 8px 0 0; }

.footer { margin-top: 32px; color: var(--muted); font-size: 0.78rem; }
.footer a { color: inherit; }

/* ---------- Handy: Karte oben, Bereich darunter wie ein Sheet ---------- */
@media (max-width: 860px) {
  .app { display: block; height: auto; }
  .topbar {
    position: absolute;
    width: auto;
    left: 16px; right: 16px; top: 12px;
    height: 52px;
    padding: 0 8px 0 16px;
    border-radius: 14px;
    box-shadow: var(--shadow);
  }
  /* Karte oben, die Infokarte direkt darunter (überlappt leicht), damit die Preisschilder frei bleiben */
  .map-area { height: auto; min-height: 0; }
  .area-btn { top: 76px; }
  .map { position: relative; height: 42vh; height: 42svh; min-height: 300px; }
  .station-card { position: relative; left: auto; right: auto; bottom: auto; width: auto; margin: -24px 16px 0; max-height: none; overflow: visible; }
  .panel {
    position: relative;
    margin-top: 16px;
    border-radius: 20px 20px 0 0;
    border-right: 0;
    padding: 8px 16px 24px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }
  .handle { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
}

/* Vollbild-Knöpfe nur am Handy */
.map-expand, .map-close { display: none; }

@media (max-width: 860px) {
  .map-expand, .map-close {
    position: absolute; z-index: 4;
    align-items: center; gap: 6px;
    height: 40px; padding: 0 14px;
    border: 0; border-radius: 999px;
    background: var(--card); color: var(--text);
    font: inherit; font-size: 0.88rem; font-weight: 700;
    box-shadow: var(--shadow); cursor: pointer;
  }
  .map-expand { display: flex; right: 16px; top: 76px; }
  /* Vollbild: Karte füllt den Bildschirm, Infokarte schwebt unten */
  body.map-full { overflow: hidden; }
  .map-full .map-area { position: fixed; inset: 0; z-index: 1000; background: var(--bg); }
  .map-full .map { position: absolute; inset: 0; height: auto; min-height: 0; }
  .map-full .map-expand { display: none; }
  .map-full .map-close { display: flex; right: 16px; top: 76px; }
  .map-full .area-btn { left: 16px; transform: none; }
  .map-full .station-card {
    position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    margin: 0; max-height: 38svh; overflow-y: auto; z-index: 3; padding: 12px 16px 16px;
  }
  /* Im Vollbild nur das Wichtigste, damit die Karte frei bleibt */
  .map-full .station-card .info,
  .map-full .station-card .detour,
  .map-full .station-card .services,
  .map-full .station-card .hours-list,
  .map-full .station-card .card-addr { display: none; }
  .map-full .station-card .card-meta { margin: 8px 0 12px; }
  .map-full .station-card .card-price { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .list li, .chip, .btn { transition: background-color 150ms ease; }
}

/* ---------- Karten-App wählen ---------- */
.maps-dialog {
  border: 0; border-radius: 20px; padding: 24px; width: min(360px, calc(100% - 32px));
  box-shadow: var(--shadow); color: var(--text);
}
.maps-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.maps-dialog h2 { margin: 0 0 16px; font-size: 1.15rem; }
.maps-options { display: grid; gap: 8px; }
.maps-option {
  height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  font: inherit; font-weight: 700; text-align: left; padding: 0 16px; cursor: pointer;
}
.maps-option:hover { border-color: var(--text); }
.maps-remember { display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; font-size: 0.92rem; }
.maps-remember input { width: 20px; height: 20px; }
.maps-cancel { width: 100%; height: 44px; border: 0; background: transparent; font: inherit; color: var(--muted); cursor: pointer; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--text); text-decoration: underline; cursor: pointer; }

/* ---------- Menü ---------- */
.menu-sheet {
  margin: 0 0 0 auto; padding: 0;
  width: min(380px, 100%); height: 100%; max-height: 100%; max-width: 100%;
  border: 0; background: var(--card); color: var(--text);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
}
.menu-sheet::backdrop { background: rgba(0, 0, 0, 0.4); }
.menu-head {
  position: sticky; top: 0; background: var(--card); z-index: 1;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  height: 64px; padding: 0 12px; border-bottom: 1px solid var(--line);
}
.menu-head h2 { margin: 0; font-size: 1.1rem; text-align: center; }
.menu-back, .menu-close {
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
  font: inherit; font-size: 1.4rem; color: var(--text); cursor: pointer;
}
.menu-back:hover, .menu-close:hover { background: var(--bg); }
.menu-close { grid-column: 3; font-size: 1.1rem; }
.menu-view { padding: 8px 16px 24px; }
.menu-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  height: 56px; padding: 0 8px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; font: inherit; font-size: 1.05rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.menu-item:hover { background: var(--bg); }
.menu-item span:last-child { color: var(--muted); font-size: 1.4rem; }
.menu-links { margin: 24px 8px 0; font-size: 0.85rem; color: var(--muted); }
.menu-links a { color: inherit; }
.news-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.news-item h3 { margin: 2px 0 4px; font-size: 1rem; }
.news-item p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.news-item .news-date { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-dark); }
.setting { border: 0; margin: 16px 0 0; padding: 0; }
.setting legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.setting-options { display: grid; gap: 8px; }
.setting-option {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.setting-option:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.setting-option input { width: 18px; height: 18px; accent-color: var(--text); }
.setting-note { margin: 0; color: var(--muted); }
.menu-back[hidden] { display: block; visibility: hidden; }

.setting-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.setting-field { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.field-unit {
  display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 0.9rem; white-space: nowrap;
}
.field-unit:focus-within { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.field-unit input { width: 0; flex: 1; min-width: 0; border: 0; outline: none; font: inherit; font-size: 1.05rem; font-weight: 700; color: var(--text); background: transparent; }
.setting-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }
.chips-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chips-row .setting-option { justify-content: center; padding: 0 6px; gap: 6px; font-size: 0.9rem; white-space: nowrap; }
.chips-row .setting-option input { position: absolute; opacity: 0; pointer-events: none; }
.chips-row .setting-option { position: relative; }
.setting-switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; margin-top: 8px; cursor: pointer; }
.setting-switch input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative;
  width: 48px; height: 28px; border-radius: 999px; background: #c9ced6; cursor: pointer; transition: background-color 150ms;
}
.setting-switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform 150ms;
}
.setting-switch input:checked { background: var(--accent); }
.setting-switch input:checked::after { transform: translateX(20px); }
.reset-btn { margin-top: 24px; width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: transparent; font: inherit; color: var(--muted); cursor: pointer; }
.reset-btn:hover { border-color: var(--text); color: var(--text); }
.filter-note { margin: -4px 0 8px; font-size: 0.85rem; color: var(--muted); }
