:root {
  --ink: #18352b;
  --ink-soft: #5d7069;
  --green: #18a667;
  --green-dark: #0b7046;
  --mint: #d9f6e8;
  --cream: #f4f1e8;
  --paper: #fffdf8;
  --line: #dfe5df;
  --orange: #ee8b4b;
  --shadow: 0 28px 70px rgba(21, 52, 40, 0.13);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, select, input[type="range"] { cursor: pointer; }
a { color: inherit; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 96px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.brand-mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
}

.brand-mark img { width: 27px; height: 27px; object-fit: contain; }

.source-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border: 1px solid rgba(24, 53, 43, 0.14);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.42);
}

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(24, 166, 103, .13); }

.hero {
  position: relative;
  width: min(1050px, calc(100% - 40px));
  margin: 54px auto 62px;
  text-align: center;
}

.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
}
.hero::before { width: 230px; height: 230px; left: -90px; top: -65px; background: rgba(30, 168, 106, .10); }
.hero::after { width: 150px; height: 150px; right: -45px; bottom: -20px; background: rgba(238, 139, 75, .10); }

.eyebrow {
  margin: 0 0 15px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 900px;
  margin: 0 auto;
  font-family: "Manrope", sans-serif;
  font-size: clamp(42px, 6.2vw, 77px);
  line-height: 1.03;
  letter-spacing: -4px;
}

h1 em { color: var(--green); font-style: normal; }

.hero-copy {
  max-width: 570px;
  margin: 25px auto 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.65;
}

.calculator {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 120px;
  display: grid;
  grid-template-columns: 1.18fr .82fr;
  overflow: visible;
  border: 1px solid rgba(24, 53, 43, .1);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.form-panel { padding: 48px 52px 52px; }

.section-heading { display: flex; gap: 17px; align-items: flex-start; margin-bottom: 30px; }
.section-heading > span {
  width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center;
  border-radius: 10px; color: var(--green-dark); background: var(--mint); font-size: 12px; font-weight: 800;
}
.section-heading h2 { margin-bottom: 4px; font-family: "Manrope"; font-size: 21px; letter-spacing: -.5px; }
.section-heading p { margin-bottom: 0; color: var(--ink-soft); font-size: 13px; }
.section-heading.compact { margin-bottom: 28px; }

.field { margin-bottom: 25px; }
.field > label, .fuel-field legend, .range-top label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.fuel-field { padding: 0; border: 0; }

.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 17px; top: 13px; color: var(--green-dark); font-size: 22px; pointer-events: none; }
select {
  width: 100%; height: 52px; padding: 0 45px 0 16px; appearance: none;
  border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fff; outline: none;
}
select:focus, .number-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24, 166, 103, .13); }
select:disabled { cursor: not-allowed; color: #91a099; background: #f3f5f2; }

.vehicle-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.vehicle-field-wide { grid-column: 1 / -1; }
.vehicle-data-status, .consumption-estimate {
  margin: -10px 0 25px; padding: 11px 13px; border-radius: 11px;
  color: var(--green-dark); background: rgba(217,246,232,.55); font-size: 10px; line-height: 1.5;
}
.vehicle-data-status.error { color: #a33b2f; background: #fff0ec; }
.consumption-estimate { margin: 14px 0 0; color: var(--ink-soft); background: #f1f4f1; }
.vehicle-source { display: inline-block; margin: -13px 0 25px; color: var(--green-dark); font-size: 10px; font-weight: 700; }

.fuel-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fuel-option {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 52px;
  border: 1px solid var(--line); border-radius: 13px; color: var(--ink-soft); background: #fff; transition: .2s ease;
}
.fuel-option:hover { border-color: #9fc9b5; transform: translateY(-1px); }
.fuel-option strong { color: inherit; }
.fuel-option.active { border-color: var(--green); color: var(--green-dark); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }

.divider { height: 1px; margin: 36px 0 31px; background: var(--line); }

.distance-modes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 24px; padding: 5px;
  border-radius: 13px; background: #edf1ed;
}
.distance-mode { padding: 10px 12px; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; font-size: 12px; font-weight: 700; }
.distance-mode.active { color: var(--green-dark); background: #fff; box-shadow: 0 2px 8px rgba(24,53,43,.09); }

.route-panel { margin-bottom: 22px; }
.place-field { position: relative; margin-bottom: 13px; }
.place-field > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 700; }
.place-search input { width: 100%; min-width: 0; height: 45px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); outline: none; background: #fff; }
.place-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24,166,103,.13); }
.place-results { position: absolute; z-index: 1001; top: 70px; width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 12px 30px rgba(24,53,43,.15); }
.place-result { display: block; width: 100%; padding: 11px 13px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: #fff; font-size: 11px; line-height: 1.4; text-align: left; }
.place-result:last-child { border-bottom: 0; }
.place-result:hover, .place-result.active { background: var(--mint); }
#route-map {
  position: relative; height: 220px; margin-top: 17px; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line); border-radius: 15px; background: #e8eee9;
}

/* Leaflet core fallback: keeps the map usable if the CDN stylesheet is blocked. */
#route-map .leaflet-pane,
#route-map .leaflet-tile,
#route-map .leaflet-marker-icon,
#route-map .leaflet-marker-shadow,
#route-map .leaflet-tile-container,
#route-map .leaflet-pane > svg,
#route-map .leaflet-pane > canvas,
#route-map .leaflet-zoom-box {
  position: absolute; top: 0; left: 0;
}
#route-map .leaflet-pane { z-index: 400; }
#route-map .leaflet-tile-pane { z-index: 200; }
#route-map .leaflet-overlay-pane { z-index: 400; }
#route-map .leaflet-shadow-pane { z-index: 500; }
#route-map .leaflet-marker-pane { z-index: 600; }
#route-map .leaflet-tooltip-pane { z-index: 650; }
#route-map .leaflet-popup-pane { z-index: 700; }
#route-map .leaflet-map-pane canvas { z-index: 100; }
#route-map .leaflet-map-pane svg { z-index: 200; }
#route-map .leaflet-tile,
#route-map .leaflet-marker-icon,
#route-map .leaflet-marker-shadow { user-select: none; -webkit-user-drag: none; }
#route-map .leaflet-tile { visibility: hidden; }
#route-map .leaflet-tile-loaded { visibility: inherit; }
#route-map .leaflet-overlay-pane svg { max-width: none !important; max-height: none !important; }
#route-map .leaflet-control-container .leaflet-bottom { position: absolute; z-index: 1000; bottom: 0; pointer-events: none; }
#route-map .leaflet-control-container .leaflet-right { right: 0; }
#route-map .leaflet-control { position: relative; z-index: 800; pointer-events: auto; }
#route-map .leaflet-control-attribution { margin: 0; padding: 2px 6px; color: #52675e; background: rgba(255,255,255,.84); font-size: 8px; }
#route-map .leaflet-control-attribution a { color: var(--green-dark); }
.route-status { margin: 9px 2px 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.route-status.error { color: #a33b2f; }
.route-status.success { color: var(--green-dark); font-weight: 700; }

.round-trip { display: flex; align-items: flex-start; gap: 11px; margin: 24px 0 27px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; background: rgba(217,246,232,.35); }
.round-trip input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--green); }
.round-trip span { display: flex; flex-direction: column; }
.round-trip strong { font-size: 12px; }
.round-trip small { margin-top: 2px; color: var(--ink-soft); font-size: 10px; }

.range-field + .range-field { margin-top: 27px; }
.range-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.range-top label { margin: 0; }
.number-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.number-input input { width: 72px; padding: 8px 5px 8px 12px; border: 0; color: var(--ink); font-weight: 700; text-align: right; outline: 0; background: transparent; }
.number-input span { padding-right: 11px; color: var(--ink-soft); font-size: 11px; white-space: nowrap; }

input[type="range"] { --value: 20%; width: 100%; height: 5px; margin: 0; appearance: none; border-radius: 10px; background: linear-gradient(to right, var(--green) var(--value), #dce6e0 var(--value)); }
input[type="range"]::-webkit-slider-thumb { width: 19px; height: 19px; appearance: none; border: 4px solid #fff; border-radius: 50%; background: var(--green); box-shadow: 0 1px 5px rgba(10, 64, 41, .35); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 4px solid #fff; border-radius: 50%; background: var(--green); box-shadow: 0 1px 5px rgba(10, 64, 41, .35); }
.range-labels { display: flex; justify-content: space-between; margin-top: 8px; color: #90a099; font-size: 10px; }

.result-panel {
  position: relative; min-height: 620px; padding: 48px 45px;
  color: #f6fff9; background: var(--ink); overflow: visible;
  border-radius: 0 27px 27px 0;
  background:
    radial-gradient(circle 175px at calc(100% + 5px) 25px, rgba(68, 207, 140, .12) 99%, transparent 100%),
    radial-gradient(circle 125px at -25px calc(100% + 25px), rgba(68, 207, 140, .08) 99%, transparent 100%),
    var(--ink);
}
.result-panel-content { position: relative; z-index: 1; display: flex; flex-direction: column; }
.result-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result-label { margin: 0; color: #a6bbb2; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.result-status { display: flex; gap: 7px; align-items: center; color: #9db2a9; font-size: 11px; }
.result-status i { width: 7px; height: 7px; border-radius: 50%; background: #71877e; }
.result-status.loading i { background: #f5bd67; animation: pulse 1s infinite alternate; }
.result-status.success i { background: #49d791; box-shadow: 0 0 0 4px rgba(73, 215, 145, .13); }
.result-status.error i { background: #ff8a74; }
@keyframes pulse { to { opacity: .35; } }

.total-price { display: flex; align-items: flex-start; gap: 8px; margin-top: 48px; }
.total-price > span { font-family: "Manrope"; font-size: clamp(62px, 7vw, 88px); font-weight: 800; line-height: .95; letter-spacing: -5px; }
.total-price small { margin-top: 8px; color: #a6bbb2; font-size: 26px; }
.result-summary { min-height: 42px; margin: 18px 0 34px; color: #a6bbb2; font-size: 13px; line-height: 1.6; }

.receipt { border: 1px solid rgba(255,255,255,.12); border-radius: 17px; background: rgba(255,255,255,.045); }
.receipt > div { display: flex; justify-content: space-between; gap: 15px; padding: 15px 18px; color: #a6bbb2; font-size: 12px; }
.receipt strong { color: #f6fff9; font-size: 13px; }
.receipt-total { margin: 0 10px 10px; border-top: 1px dashed rgba(255,255,255,.17); border-radius: 0 0 10px 10px; background: rgba(255,255,255,.05); }
.receipt-total strong { color: #65e4a8; }

.retry-button { margin-top: 18px; padding: 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 11px; color: #fff; background: transparent; }
.retry-button:hover { background: rgba(255,255,255,.08); }
.update-note { margin: auto 0 0; padding-top: 25px; color: #799087; font-size: 10px; line-height: 1.5; }

.how-it-works { width: min(1120px, calc(100% - 40px)); margin: 0 auto 110px; }
.how-it-works > div:first-child { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 35px; }
.how-it-works .eyebrow { margin-bottom: 8px; }
.how-it-works h2 { max-width: 460px; margin: 0; font-family: "Manrope"; font-size: 38px; letter-spacing: -1.7px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps article { padding: 25px; border: 1px solid rgba(24,53,43,.1); border-radius: 18px; background: rgba(255,255,255,.43); }
.steps article > span { display: grid; place-items: center; width: 29px; height: 29px; margin-bottom: 30px; border-radius: 50%; color: var(--green-dark); background: var(--mint); font-size: 12px; font-weight: 800; }
.steps h3 { margin-bottom: 8px; font-family: "Manrope"; font-size: 16px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }

footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 38px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid rgba(24,53,43,.12); color: var(--ink-soft); font-size: 11px; }
.footer-brand { font-size: 16px; }
.footer-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.footer-brand .brand-mark img { width: 21px; height: 21px; }
footer p { margin: 0; text-align: center; }
footer a:hover { color: var(--green-dark); }

@media (min-width: 821px) {
  .result-panel-content {
    position: sticky;
    top: 24px;
    min-height: min(524px, calc(100vh - 48px));
  }
}

@media (max-width: 820px) {
  .hero { margin-top: 35px; }
  h1 { letter-spacing: -2.7px; }
  .calculator { grid-template-columns: 1fr; }
  .result-panel { min-height: 520px; border-radius: 0 0 27px 27px; }
  .steps { grid-template-columns: 1fr; }
  .steps article { display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; }
  .steps article > span { grid-row: 1 / 3; margin: 0; }
  .steps h3 { margin-top: 3px; }
  footer { flex-direction: column; }
}

@media (max-width: 560px) {
  .site-header { height: 76px; }
  .source-link { padding: 9px 11px; }
  .hero { margin: 38px auto 44px; }
  .hero-copy { font-size: 16px; }
  .calculator { width: calc(100% - 24px); margin-bottom: 85px; border-radius: 21px; }
  .form-panel, .result-panel { padding: 34px 23px; }
  .fuel-options { gap: 6px; }
  .fuel-option { flex-direction: column; gap: 0; font-size: 12px; }
  .total-price { margin-top: 38px; }
  .how-it-works { width: calc(100% - 32px); }
  .how-it-works > div:first-child { display: block; }
  .how-it-works .eyebrow { margin-bottom: 12px; }
  .how-it-works h2 { font-size: 31px; }
  .result-top { align-items: flex-start; }
  .distance-mode { padding-inline: 6px; }
  #route-map { height: 190px; }
  .vehicle-fields { grid-template-columns: 1fr; }
  .vehicle-field-wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
