:root {
  color-scheme: light;
  --page: #ececec;
  --card: #f4f4f4;
  --card-head: #f6f6f6;
  --border: #e2e2e2;
  --divider: #e6e6e6;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --bubble: #5aaee8;
  --green: #0f9d63;
  --link: #1f7ae0;
  --tier1: #7bbaf5;
  --tier2: #7b6ff0;
  --track-bg: #dcdcdc;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

/* Intro */
.intro { margin-bottom: 24px; }
.brand { display: inline-block; margin: 0 0 28px; line-height: 0; }
.brand img { display: block; width: 240px; max-width: 100%; height: auto; }
h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.2; font-weight: 700; }
.lede { margin: 0; max-width: 620px; color: var(--muted); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* Address search */
.search-card { padding: 20px 24px; }
.search-label { display: block; font-weight: 600; margin-bottom: 10px; }
.address-slot gmp-place-autocomplete,
.address-fallback {
  display: block;
  width: 100%;
}
.address-fallback {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
.address-slot gmp-place-autocomplete {
  color-scheme: light;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.search-status { margin: 10px 0 0; min-height: 1.45em; font-size: 14px; color: var(--muted); }
.search-status.is-error { color: #c0392b; }
.search-status strong { color: var(--text); }

/* Calculator card */
.calc { overflow: hidden; }

.calc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 14px 18px 24px;
  background: var(--card-head);
  border-bottom: 1px solid var(--divider);
}
.calc-head h2 { margin: 0; font-size: 17px; font-weight: 600; color: #555; }

.km-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 17px; }
.km-box {
  display: flex;
  align-items: center;
  width: 150px;
  padding: 0 14px;
  height: 46px;
  background: var(--card-head);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.km-box:focus-within { border-color: var(--bubble); box-shadow: 0 0 0 3px rgba(90, 174, 232, .2); }
.km-box { cursor: text; }
.km-box input {
  flex: none;
  max-width: 100%;
  min-width: 1ch;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  padding: 0;
}
.km-unit { color: var(--text); font-size: 17px; margin-left: 4px; }

.calc-body { padding: 28px 24px 16px; text-align: center; }

/* Visual track */
.viz { display: flex; align-items: flex-start; gap: 10px; padding: 0 12px 0 12px; }

.home {
  flex: none;
  width: 40px;
  height: 40px;
  margin-top: 53px;
  border-radius: 50%;
  background: #f8f8f8;
  border: 1px solid #e3e3e3;
  display: grid;
  place-items: center;
  color: #555;
}

.track-wrap { position: relative; flex: 1; height: 116px; min-width: 0; }

.track {
  position: absolute;
  left: 0; right: 0;
  top: 64px;
  height: 18px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}
.track::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px;
  top: 50%;
  border-top: 1.5px dashed rgba(255, 255, 255, .85);
}
.fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #86aef5 0%, #6cc0f5 32%, #7a8cf2 66%, #8a3fe0 100%);
  transition: width .5s ease;
}

.car {
  position: absolute;
  top: 46px;
  left: 0;
  transform: translateX(-50%);
  transition: left .5s ease;
  line-height: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15));
}

.bubble {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 9px 4px;
  background: var(--bubble);
  color: #fff;
  border-radius: 5px;
  white-space: nowrap;
  line-height: 1.25;
  transition: left .5s ease;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  margin-left: -5px;
  border: 5px solid transparent;
  border-bottom: 0;
  border-top-color: var(--bubble);
}
.bubble strong { font-size: 13px; font-weight: 700; }
.bubble span { font-size: 11px; font-weight: 600; }

.plus {
  position: absolute;
  top: 12px;
  transform: translateX(-50%);
  color: #9a9a9a;
  font-size: 14px;
  transition: left .5s ease;
}

.tick {
  position: absolute;
  top: 94px;
  transform: translateX(-50%);
  font-size: 13.5px;
  color: #666;
  white-space: nowrap;
  transition: left .5s ease;
}
#tick-0 { transform: none; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .fill, .car, .bubble, .plus, .tick { transition: none; }
}

/* Total & toggle */
.estimate-note { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.total { margin: 18px 0 4px; font-size: 16px; color: #555; font-weight: 500; }
.total strong { margin-left: 6px; font-size: 22px; color: var(--green); font-weight: 700; vertical-align: -1px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
}
.toggle:hover { background: rgba(31, 122, 224, .07); }
.toggle svg { transition: transform .2s ease; }
.toggle[aria-expanded="false"] svg { transform: rotate(180deg); }

/* Breakdown */
.breakdown { padding: 4px 12px 8px; }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 10px;
  border-bottom: 1px solid var(--divider);
  font-size: 14.5px;
  color: #666;
}
.swatch { flex: none; width: 14px; height: 14px; border-radius: 3px; }
.s1 { background: var(--tier1); }
.s2 { background: var(--tier2); }
.row-label { flex: 1; min-width: 0; }
.row-label strong { color: #555; font-weight: 600; margin-right: 6px; }
.row-amount { flex: none; color: #666; }
.row-total {
  justify-content: space-between;
  border-bottom: 0;
  padding-top: 20px;
  padding-bottom: 14px;
  font-size: 16px;
  color: var(--text);
}
.total-amount { font-size: 20px; color: var(--green); }

.fineprint { margin: 0; font-size: 13px; color: var(--muted); }

/* Mobile */
@media (max-width: 600px) {
  .page { padding: 24px 16px 40px; }
  h1 { font-size: 24px; }
  .brand { margin-bottom: 20px; }
  .brand img { width: 180px; }
  .lede { font-size: 15px; }
  .search-card { padding: 16px; }

  .calc-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; }
  .km-field { justify-content: space-between; font-size: 15px; }
  .km-box { width: 130px; height: 42px; }

  .calc-body { padding: 20px 12px 12px; }
  .viz { padding: 0; gap: 6px; }
  .home { width: 32px; height: 32px; margin-top: 57px; }
  .home svg { width: 18px; height: 18px; }
  .bubble { padding: 4px 7px 3px; }
  .bubble strong { font-size: 12px; }
  .bubble span { font-size: 10px; }
  .tick { font-size: 12px; }
  .car svg { width: 40px; height: 22.5px; }
  .car { top: 51px; }

  .breakdown { padding: 0 6px 6px; }
  .row { align-items: flex-start; font-size: 14px; padding: 12px 6px; }
  .swatch { margin-top: 3px; }
  .row-label strong { display: block; margin: 0 0 2px; }
  .total { font-size: 15px; }
}
