:root {
  color-scheme: dark;
  --bg: #10130f;
  --panel: #171c15;
  --panel-soft: #20271c;
  --text: #f2f6e9;
  --muted: #aeb8a4;
  --line: rgba(242, 246, 233, 0.12);
  --accent: #d9ff66;
  --accent-2: #4be6a7;
  --danger: #ff766b;
  --unknown: #8c9387;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) 1fr;
  height: 100vh;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(217, 255, 102, 0.16), transparent 34%),
    linear-gradient(180deg, #1b2118 0%, var(--panel) 100%);
  border-right: 1px solid var(--line);
}

.hero h1 {
  margin: 6px 0 10px;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.eyebrow,
.subtitle,
.stat-label,
.search-label {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.subtitle {
  margin: 0;
  line-height: 1.45;
}

.controls {
  display: grid;
  gap: 12px;
}

.search-label {
  font-size: 13px;
  font-weight: 700;
}

#station-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  outline: none;
}

#station-search:focus {
  border-color: rgba(217, 255, 102, 0.65);
  box-shadow: 0 0 0 4px rgba(217, 255, 102, 0.1);
}

.fuel-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip,
.fuel-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 800;
}

.filter-chip {
  padding: 8px 11px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.filter-chip:hover {
  border-color: rgba(217, 255, 102, 0.4);
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip.active {
  border-color: transparent;
  background: var(--accent);
  color: #1a200d;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stats > div,
.station-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
}

.stats > div {
  padding: 14px;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.stat-label {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.station-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 255, 102, 0.3) transparent;
}

.station-list::-webkit-scrollbar {
  width: 6px;
}

.station-list::-webkit-scrollbar-thumb {
  background: rgba(217, 255, 102, 0.3);
  border-radius: 999px;
}

.station-card {
  padding: 14px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.station-card:hover,
.station-card:focus-visible {
  border-color: rgba(217, 255, 102, 0.55);
  background: rgba(255, 255, 255, 0.075);
  transform: translateY(-1px);
  outline: none;
}

.station-card:active {
  transform: translateY(0);
}

.station-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.station-card address,
.popup-address {
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.fuel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  background: rgba(75, 230, 167, 0.14);
  color: #b9ffe4;
  font-size: 11px;
}

.fuel-badge.unknown {
  background: rgba(140, 147, 135, 0.2);
  color: #d6dbd0;
}

.fuel-badge.no-fuel {
  background: rgba(255, 118, 107, 0.12);
  color: #ffc2bd;
}

.fuel-badge.queue {
  background: rgba(255, 198, 92, 0.16);
  color: #ffe3ad;
}

.freshness-line,
.queue-line {
  margin-top: 8px;
  color: #d9ff66;
  font-size: 12px;
  font-weight: 800;
}

.freshness-line.stale,
.queue-line.muted {
  color: var(--muted);
}

.map-wrap {
  position: relative;
  min-width: 0;
  height: 100vh;
}

#map {
  width: 100%;
  height: 100vh;
  background: #d8dccf;
}

.status {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 500;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(16, 19, 15, 0.86);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.status.hidden {
  display: none;
}

.station-marker {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(16, 19, 15, 0.9);
  border-radius: 999px;
  background: #f7faee;
  color: #10130f;
  font-size: 11px;
  font-weight: 950;
  opacity: var(--marker-opacity, 1);
  box-shadow:
    0 0 0 4px rgba(16, 19, 15, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.25);
}

.station-marker.has-fuel {
  box-shadow:
    0 0 0 4px rgba(16, 19, 15, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.25),
    0 0 calc(6px + 16px * var(--freshness, 0)) rgba(217, 255, 102, calc(0.2 + 0.55 * var(--freshness, 0)));
}

.station-marker.has-update {
  background: #ffe3ad;
  box-shadow:
    0 0 0 4px rgba(16, 19, 15, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.25),
    0 0 calc(6px + 14px * var(--freshness, 0)) rgba(255, 198, 92, calc(0.2 + 0.45 * var(--freshness, 0)));
}

.station-marker img,
.list-brand-icon img {
  display: block;
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.brand-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #d9ff66, #4be6a7);
  color: #11170d;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.list-brand-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f7faee;
  overflow: hidden;
}

.list-brand-icon .brand-fallback {
  font-size: 8px;
}

.station-marker.unknown {
  background: var(--unknown);
  color: white;
}

.station-marker.no-fuel {
  background: #4a5040;
}

.station-marker.no-fuel img,
.station-marker.no-fuel .brand-fallback,
.station-marker.unknown img,
.station-marker.unknown .brand-fallback {
  filter: grayscale(1);
  opacity: 0.6;
}

.station-marker {
  transition: transform 0.15s ease;
}

.station-marker:hover {
  transform: scale(1.08);
}

.cluster-marker {
  display: grid;
  place-items: center;
  width: var(--size, 40px);
  height: var(--size, 40px);
  border: 2px solid rgba(16, 19, 15, 0.9);
  border-radius: 999px;
  background: #8c9387;
  color: #1a200d;
  font-weight: 950;
  font-size: 13px;
  box-shadow:
    0 0 0 4px rgba(16, 19, 15, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.35);
}

.cluster-marker.has-fuel {
  background: radial-gradient(circle at 30% 30%, #e4ffa3, var(--accent));
  box-shadow:
    0 0 0 4px rgba(217, 255, 102, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.35),
    0 0 calc(6px + 16px * var(--freshness, 0)) rgba(217, 255, 102, calc(0.2 + 0.55 * var(--freshness, 0)));
}

.cluster-marker.has-update {
  background: radial-gradient(circle at 30% 30%, #fff0c5, #ffc65c);
  box-shadow:
    0 0 0 4px rgba(255, 198, 92, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.35),
    0 0 calc(6px + 14px * var(--freshness, 0)) rgba(255, 198, 92, calc(0.2 + 0.45 * var(--freshness, 0)));
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #151a13;
  color: var(--text);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 16px;
}

.leaflet-popup-content {
  min-width: 220px;
  margin: 14px 16px;
}

.leaflet-popup-close-button {
  color: var(--muted) !important;
}

.leaflet-popup-close-button:hover {
  color: var(--text) !important;
}

.leaflet-control-zoom a {
  background: var(--panel-soft) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--accent) !important;
  color: #1a200d !important;
}

.leaflet-control-attribution {
  background: rgba(16, 19, 15, 0.75) !important;
  color: var(--muted) !important;
}

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

.popup-title {
  margin: 0 0 4px;
  font-size: 16px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 48vh 52vh;
  }

  .panel {
    order: 2;
    padding: 18px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .map-wrap {
    order: 1;
    height: 48vh;
  }

  #map {
    height: 48vh;
  }

  .hero h1 {
    font-size: 30px;
  }
}
