body {
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  background-color: #111;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  cursor: url('map-marker-radius.png'), auto !important;
}

#logo {
  font-family: 'Magz', sans-serif;
  font-size: 5em;
  color: #f542da;
  text-shadow: 2px 2px #88eeff;
  animation-name: logo-color;
  animation-duration: 2s;
  animation-direction: alternate;
  animation-iteration-count: infinite;
  position: absolute;
  top: 50px;
  left: 50px;
  margin: 0;
  z-index: 2;
}

@keyframes logo-color {
  from {
    color: #f542da;
  }
  to {
    color: #8d42f5;
  }
}

.fuel-discounts {
  color: white;
  position: absolute;
  top: 150px;
  left: 50px;
  font-family: 'Magz', sans-serif;
  z-index: 2;
}

.inputs {
  position: absolute;
  top: 175px;
  left: 50px;
  padding: 0;
  margin: 0;
  z-index: 2;
}

.field-label {
  display: block;
  font-family: 'Magz', sans-serif;
  font-size: 0.8rem;
  color: rgba(136, 238, 255, 0.7);
  margin-top: 0.5rem;
  margin-bottom: 0.15rem;
}

/* Inline "?" help icon inside a field label */
.field-help-btn {
  font-family: 'Magz', sans-serif;
  font-size: 0.7rem;
  color: #88eeff;
  background: rgba(136, 238, 255, 0.08);
  border: 1px solid rgba(136, 238, 255, 0.35);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  line-height: 1;
  padding: 0;
  margin-left: 0.35rem;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.field-help-btn:hover {
  color: #f542da;
  border-color: rgba(245, 66, 218, 0.5);
  box-shadow: 0 0 8px rgba(245, 66, 218, 0.25);
}

.inputs input {
  background: rgba(8, 6, 23, 0.7);
  border: 1px solid rgba(136, 238, 255, 0.3);
  border-radius: 6px;
  color: #fff;
  font-family: 'Magz', sans-serif;
  font-size: 1rem;
  padding: 0.45rem 0.7rem;
  width: 14rem;
  display: block;
  margin-bottom: 0.4rem;
  outline: none;
}

.inputs input:focus {
  border-color: rgba(136, 238, 255, 0.7);
  box-shadow: 0 0 8px rgba(136, 238, 255, 0.2);
}

/* Directions A (origin) / B (destination) address fields come from the Mapbox
   Geocoder plugin, whose CSS loads after this file. Its default is light text
   on a white field, which is unreadable against our theme — force a dark field
   with white text. !important is needed to beat the later-loaded plugin rules. */
.mapboxgl-ctrl-geocoder {
  background: #000 !important;
  border: 1px solid rgba(136, 238, 255, 0.3) !important;
  box-shadow: none !important;
}
.mapboxgl-ctrl-geocoder input,
.mapboxgl-ctrl-geocoder--input {
  background: #000 !important;
  color: #fff !important;
}
.mapboxgl-ctrl-geocoder input::placeholder,
.mapboxgl-ctrl-geocoder--input::placeholder {
  color: rgba(255, 255, 255, 0.5) !important;
}
.mapboxgl-ctrl-geocoder--icon {
  fill: #88eeff !important;
}
/* Autocomplete suggestions drop-down: keep it dark and readable too. */
.mapboxgl-ctrl-geocoder .suggestions {
  background: #000 !important;
  border: 1px solid rgba(136, 238, 255, 0.3) !important;
}
.mapboxgl-ctrl-geocoder .suggestions > li > a {
  color: #fff !important;
}
.mapboxgl-ctrl-geocoder .suggestions > .active > a,
.mapboxgl-ctrl-geocoder .suggestions > li > a:hover {
  background: rgba(136, 238, 255, 0.15) !important;
}

::placeholder {
  font-family: 'Magz', sans-serif;
  font-size: 0.9rem;
  color: rgba(136, 238, 255, 0.45);
  padding-left: 0;
}

.fuel-discounts: {
}

.calculate-panel {
  margin-top: 1.25rem;
  width: 100%;
  display: flex;
  gap: 0.6rem;
  justify-content: flex-start;
  pointer-events: none;
}

#btn {
  font-family: 'Magz', sans-serif;
  font-size: 1.25rem;
  color: #88eeff;
  background: linear-gradient(135deg, rgba(8, 6, 23, 0.94), rgba(35, 22, 67, 0.92));
  border: 1px solid rgba(136, 238, 255, 0.9);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(136, 238, 255, 0.32), inset 0 0 10px rgba(245, 66, 218, 0.18);
  min-width: 11rem;
  min-height: 2.6rem;
  padding: 0.45rem 1.25rem;
  cursor: pointer;
  pointer-events: auto;
  transition: color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

#btn:hover {
  color: #f542da;
  border-color: #f542da;
  box-shadow: 0 0 20px rgba(245, 66, 218, 0.4), inset 0 0 12px rgba(136, 238, 255, 0.16);
  transform: translateY(-1px);
}

#btn:disabled {
  color: rgba(136, 238, 255, 0.55);
  border-color: rgba(136, 238, 255, 0.45);
  cursor: wait;
}

#car {
  width: 5.5rem;
  height: 2.4rem;
  position: absolute;
  bottom: 0.35rem;
  left: -100px;
  animation-name: car;
  animation-duration: 6s;
  animation-iteration-count: infinite;
  filter: drop-shadow(0 0 8px #88eeff);
  z-index: 3;
  pointer-events: none;
}

.car-body {
  width: 5.5rem;
  height: 1.35rem;
  position: absolute;
  bottom: 0.45rem;
  left: 0;
  background: linear-gradient(90deg, #f542da, #8d42f5);
  border: 2px solid #88eeff;
  border-radius: 1.1rem 1.6rem 0.55rem 0.55rem;
  box-shadow: 0 0 12px rgba(245, 66, 218, 0.75);
}

.car-window {
  width: 1.8rem;
  height: 0.9rem;
  position: absolute;
  bottom: 1.45rem;
  left: 1.7rem;
  background: #88eeff;
  border: 2px solid #111;
  border-radius: 0.8rem 0.8rem 0.2rem 0.2rem;
}

.car-wheel {
  width: 0.9rem;
  height: 0.9rem;
  position: absolute;
  bottom: 0;
  background: #111;
  border: 2px solid #88eeff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #f542da;
}

.car-wheel-left {
  left: 0.9rem;
}

.car-wheel-right {
  right: 0.9rem;
}


/* ── Reset button ── */
#btn2 {
  font-family: 'Magz', sans-serif;
  font-size: 1.25rem;
  color: rgba(136, 238, 255, 0.6);
  background: rgba(8, 6, 23, 0.7);
  border: 1px solid rgba(136, 238, 255, 0.35);
  border-radius: 999px;
  min-width: 6rem;
  min-height: 2.6rem;
  padding: 0.45rem 1rem;
  cursor: pointer;
  pointer-events: auto;
  transition: color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
#btn2:hover {
  color: #f542da;
  border-color: rgba(245, 66, 218, 0.5);
}

/* ── Help button ── */
#help-btn {
  font-family: 'Magz', sans-serif;
  font-size: 1.3rem;
  color: #88eeff;
  background: rgba(8, 6, 23, 0.82);
  border: 1px solid rgba(136, 238, 255, 0.35);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 10px;
  right: 320px;
  z-index: 50;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, color 0.2s;
  padding: 0;
  line-height: 1;
}
#help-btn:hover {
  color: #f542da;
  border-color: rgba(245, 66, 218, 0.5);
  box-shadow: 0 0 12px rgba(245, 66, 218, 0.25);
}

/* ── Help modal overlay ── */
#help-modal,
#efficiency-modal {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ── Modal card ── */
#help-modal-card,
#efficiency-modal-card {
  background: rgba(8, 6, 23, 0.97);
  border: 1px solid rgba(136, 238, 255, 0.18);
  border-radius: 14px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 30px rgba(136, 238, 255, 0.06);
  max-width: 500px;
  width: calc(100% - 40px);
  padding: 28px 30px;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #c4c4c8;
  line-height: 1.55;
  max-height: 90vh;
  overflow-y: auto;
}

.hm-title {
  font-family: 'Magz', sans-serif;
  font-size: 2rem;
  color: #f542da;
  text-shadow: 1px 1px #88eeff;
  margin-bottom: 4px;
}

.hm-subtitle {
  font-size: 12px;
  color: #52525b;
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

.hm-body {
  font-size: 14px;
  margin: 0 0 18px;
}

.hm-body strong {
  color: #fff;
}

.hm-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3f3f46;
  margin-bottom: 10px;
}

.hm-steps {
  font-size: 13px;
  margin: 0 0 18px;
  padding-left: 20px;
}

.hm-steps li {
  margin-bottom: 6px;
}

.hm-steps strong {
  color: #88eeff;
}

.hm-discounts {
  margin-bottom: 20px;
}

.hm-discount-row {
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hm-tag {
  font-size: 11px;
  font-weight: 600;
  background: rgba(136, 238, 255, 0.08);
  color: #88eeff;
  border: 1px solid rgba(136, 238, 255, 0.2);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.hm-attribution {
  font-size: 12px;
  color: #71717a;
  margin: 0 0 22px;
  line-height: 1.5;
}

.hm-attribution a {
  color: #88eeff;
  text-decoration: none;
}

.hm-attribution a:hover {
  text-decoration: underline;
}

.hm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.hm-chip {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #71717a;
  border-radius: 999px;
  padding: 3px 10px;
}

.hm-close {
  font-family: 'Magz', sans-serif;
  font-size: 1.2rem;
  color: #080617;
  background: #88eeff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, box-shadow 0.2s;
}

.hm-close:hover {
  background: #a8f4ff;
  box-shadow: 0 0 16px rgba(136, 238, 255, 0.4);
}

/* ── Fuel efficiency reference rows ── */
.hm-efficiency {
  margin-bottom: 22px;
  border: 1px solid rgba(136, 238, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.hm-eff-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding: 10px 14px;
}

.hm-eff-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.hm-eff-type {
  color: #c4c4c8;
}

.hm-eff-val {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #88eeff;
  white-space: nowrap;
}

.hm-eff-val::after {
  content: ' L/100km';
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #71717a;
}

@keyframes car {
  0% {
    left: -100px;
  }
  50% {
    left: 200px;
  }
  100% {
    left: 3000px;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   Mobile layout (phones / small tablets)

   Desktop scatters absolutely-positioned panels across the screen, which
   overlap and overflow on a phone. Here we collapse everything into a clean
   stack: full-width route search docked at the top, the map filling the
   middle, and the fuel controls as a scrollable bottom sheet. The big logo,
   the help button, and the verbose turn-by-turn instructions are hidden to
   reclaim space (the help modal still auto-opens on load).
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body,
  #map {
    height: 100vh;
    height: 100dvh; /* avoids the gap left by the mobile URL bar */
  }

  /* Reclaim space: the logo and help button add clutter we can't afford. */
  #logo,
  #help-btn,
  #car {
    display: none !important;
  }

  /* Route search (Mapbox Directions): dock full-width at the top... */
  .mapboxgl-ctrl-top-right {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .directions-control.directions-control-directions {
    float: none;
    margin: 8px auto !important;
    width: calc(100% - 16px) !important;
    min-width: 0 !important;
    max-width: 520px !important;
  }
  .directions-control-inputs {
    width: 100%;
    box-sizing: border-box;
  }
  .directions-control-inputs .mapboxgl-ctrl-geocoder {
    width: 100%;
    max-width: none;
  }
  /* ...but drop the long turn-by-turn list and route summary. */
  .directions-control-instructions,
  .mapbox-directions-instructions {
    display: none !important;
  }

  /* Fuel controls: a docked, scrollable bottom sheet. */
  .controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    max-height: 50vh;
    overflow-y: auto;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(8, 6, 23, 0.94);
    border-top: 1px solid rgba(136, 238, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .controls .fuel-discounts,
  .controls .inputs {
    position: static;
    top: auto;
    left: auto;
  }

  /* Loyalty checkboxes: a compact wrapping row. */
  .controls .fuel-discounts {
    font-size: 0.9rem;
    line-height: 1.9;
    margin-bottom: 10px;
  }
  .controls .fuel-discounts input {
    margin: 0 4px 0 0;
    vertical-align: middle;
  }
  .controls .fuel-discounts input + input {
    margin-left: 14px;
  }

  /* Fields as label/control pairs in a two-column grid to save height. */
  .controls .inputs {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 12px;
  }
  .controls .inputs .field-label {
    margin: 0;
  }
  .controls .inputs input,
  .controls .inputs select {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    font-size: 16px; /* >=16px stops iOS from zooming on focus */
  }
  .controls .inputs select {
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
  }

  /* Buttons span the full width of the sheet and share the row evenly. */
  .controls .calculate-panel {
    grid-column: 1 / -1;
    margin-top: 10px;
    gap: 8px;
  }
  .controls .calculate-panel #btn {
    flex: 2;
    min-width: 0;
  }
  .controls .calculate-panel #btn2 {
    flex: 1;
    min-width: 0;
  }
}
