:root {
  --bg: #0a0e12;
  --panel: #121922;
  --text: #e8eef5;
  --muted: #7a8fa3;
  --accent: #2ee6a8;
  --accent-dim: rgba(46, 230, 168, 0.35);
  --diesel: #6cb3ff;
  --diesel-dim: rgba(108, 179, 255, 0.4);
  --gold: #f4d06f;
  --gold-dim: rgba(244, 208, 111, 0.45);
  --shadow: rgba(0, 0, 0, 0.45);
  --dock-glow: rgba(46, 230, 168, 0.12);
  font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0.65rem;
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.97) 0%, rgba(18, 25, 34, 0.88) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 6px 24px var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar .meta {
  font-size: 0.72rem;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 10rem;
  line-height: 1.35;
}

.topbar .badge {
  font-size: 0.68rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(46, 230, 168, 0.12);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  font-variant-numeric: tabular-nums;
}

/* —— Preispuls FAB —— */
.pulse-fab {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 1100;
  border: none;
  cursor: pointer;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #061210;
  background: linear-gradient(135deg, #2ee6a8 0%, #1bc4cf 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 8px 28px rgba(27, 196, 207, 0.35),
    0 4px 12px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pulse-fab:hover {
  transform: translateY(-2px);
}

.pulse-fab[aria-expanded="true"] {
  background: linear-gradient(135deg, #1bc4cf 0%, #2ee6a8 100%);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 4px 20px var(--dock-glow);
}

/* —— Dock —— */
.pulse-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  max-height: min(88vh, 640px);
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.pulse-dock.is-open {
  transform: translateY(0);
  pointer-events: auto;
}

.pulse-grabber {
  height: 10px;
  margin: 0 auto;
  width: 48px;
  border-radius: 6px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  opacity: 0.7;
  flex-shrink: 0;
}

.pulse-inner {
  position: relative;
  border-radius: 22px 22px 0 0;
  padding: 0.5rem 1rem 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  background:
    linear-gradient(160deg, rgba(30, 42, 58, 0.96) 0%, rgba(10, 14, 18, 0.98) 55%),
    var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: none;
  box-shadow:
    0 -12px 48px var(--dock-glow),
    0 -4px 0 rgba(46, 230, 168, 0.15) inset;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: inherit;
}

.pulse-head h2 {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 0%, #8fe8cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pulse-tag {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.pulse-ladder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 520px) {
  .pulse-ladder {
    grid-template-columns: 1fr;
  }
}

.ladder-title {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
}

.ladder-title .wave {
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.6;
}

.ladder-super .wave {
  color: #ffd166;
}

.ladder-diesel .wave {
  color: var(--diesel);
}

.ladder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ladder-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ladder-item:hover,
.ladder-item:focus-visible {
  border-color: var(--accent-dim);
  background: rgba(46, 230, 168, 0.06);
  outline: none;
}

.ladder-rank {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent);
  width: 1.1rem;
  flex-shrink: 0;
}

.ladder-main {
  flex: 1;
  min-width: 0;
}

.ladder-brand {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ladder-sub {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ladder-price {
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  flex-shrink: 0;
}

.pulse-chart-wrap {
  margin-top: 0.25rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chart-title {
  margin: 0 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pulse-chart-hint {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  color: var(--muted);
  min-height: 1.1em;
}

.chart-canvas-box {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(46, 230, 168, 0.08), transparent),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

#trendCanvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.5rem;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chart-legend .lg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-legend .lg i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.lg-e5 i {
  background: linear-gradient(135deg, #ffd166, #ff9f1c);
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.45);
}

.lg-di i {
  background: linear-gradient(135deg, #6cb3ff, #3d7dff);
  box-shadow: 0 0 10px rgba(108, 179, 255, 0.45);
}

/* Leaflet: schmale Preis-Tags */
.leaflet-div-icon.price-marker-wrap {
  background: transparent !important;
  border: none !important;
}

.price-marker-wrap {
  transform: translate(-50%, -100%);
  margin-top: -4px;
}

.price-marker.slim {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.2rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(18, 25, 34, 0.94);
  border: 1px solid rgba(46, 230, 168, 0.55);
  box-shadow: 0 3px 12px var(--shadow);
  font-weight: 700;
  font-size: 10px;
  line-height: 1.1;
  color: var(--text);
  pointer-events: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.price-marker.slim .pfx {
  font-size: 8px;
  font-weight: 800;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

.price-marker.slim .pfx:first-of-type {
  color: #ffd166;
}

.price-marker.slim .pfx:last-of-type {
  color: var(--diesel);
}

.price-marker.slim .num {
  color: var(--text);
}

.price-marker.slim .sep {
  opacity: 0.35;
  font-weight: 400;
  padding: 0 1px;
}

.price-marker.slim.marker-deal {
  border-color: var(--accent-dim);
  box-shadow: 0 0 12px rgba(46, 230, 168, 0.2);
}

.price-marker.slim.marker-royal {
  border-color: var(--gold-dim);
  box-shadow:
    0 0 14px rgba(244, 208, 111, 0.35),
    0 0 0 1px rgba(244, 208, 111, 0.25) inset;
}

.price-marker .na {
  color: var(--muted);
  font-weight: 500;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-control-attribution {
  background: rgba(10, 14, 18, 0.78) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
  max-width: 58vw;
}

.leaflet-control-attribution a {
  color: var(--accent) !important;
}

@media (min-width: 768px) {
  .topbar h1 {
    font-size: 1rem;
  }

  .price-marker.slim {
    font-size: 11px;
    padding: 2px 7px;
  }

  .price-marker.slim .pfx {
    font-size: 9px;
  }
}
