:root {
  color-scheme: light dark;
  --bg: #edf6f1;
  --surface: rgba(255, 255, 255, .88);
  --surface-strong: #fff;
  --text: #10231b;
  --muted: #64736d;
  --line: rgba(16, 35, 27, .1);
  --brand: #057a55;
  --brand-2: #2fc48e;
  --brand-dark: #034b36;
  --soft: #d8f3e7;
  --danger: #b94934;
  --shadow: 0 22px 60px rgba(4, 55, 39, .12);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 95% 0, rgba(5, 122, 85, .18), transparent 26rem),
    radial-gradient(circle at 5% 22%, rgba(255, 204, 102, .22), transparent 18rem),
    linear-gradient(180deg, #f7fbf8 0, var(--bg) 46%);
}

button, select { font: inherit; }

a { color: inherit; }

.app-shell {
  width: min(780px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 32px;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 14px;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: -.035em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand-dark));
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(5, 122, 85, .24);
}

.ghost-button,
.footer button {
  min-height: 42px;
  padding: 0 14px;
  color: var(--brand);
  background: var(--soft);
  border: 0;
  border-radius: 14px;
  font-weight: 800;
}

.hero-card,
.controls,
.status-card,
.best-card,
.station-card,
.empty-state,
.install-guide {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  display: grid;
  gap: 24px;
  margin-top: 12px;
  padding: clamp(26px, 7vw, 46px);
  overflow: hidden;
  border-radius: 34px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 16px;
  padding: 7px 11px;
  color: var(--brand-dark);
  background: var(--soft);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(3.1rem, 12vw, 5.7rem);
  line-height: .93;
  letter-spacing: -.075em;
}

.lead {
  max-width: 570px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.location-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  width: min(100%, 330px);
  color: #fff;
  background: linear-gradient(135deg, #08a875, var(--brand-dark));
  border: 0;
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(5, 122, 85, .3);
  font-weight: 900;
}

.location-button:disabled { opacity: .72; }

.install-guide {
  margin-top: 16px;
  padding: clamp(18px, 4vw, 26px);
  border-radius: 28px;
}

.install-guide[hidden] { display: none; }

.install-guide-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.guide-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: .76rem;
  font-weight: 950;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.install-guide h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  line-height: 1.02;
  letter-spacing: -.055em;
}

.install-guide p {
  max-width: 520px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.58;
}

.home-preview {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 92px;
  padding: 13px 12px 11px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(5, 122, 85, .08), rgba(5, 122, 85, .02));
  border: 1px solid var(--line);
  border-radius: 24px;
}

.home-preview span {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand-dark));
  border-radius: 17px;
  box-shadow: 0 12px 26px rgba(5, 122, 85, .25);
  font-size: 1.35rem;
}

.home-preview strong {
  font-size: .72rem;
  max-width: 76px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.install-steps li {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 156px;
  padding: 15px;
  background: rgba(5, 122, 85, .07);
  border: 1px solid rgba(5, 122, 85, .1);
  border-radius: 20px;
}

.step-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 13px;
  font-weight: 950;
}

.share-icon {
  position: relative;
  font-size: 1.35rem;
}

.share-icon::after {
  position: absolute;
  inset: 21px 9px 8px;
  content: "";
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 2px;
}

.install-steps strong {
  display: block;
  margin-bottom: 5px;
  letter-spacing: -.015em;
}

.install-steps small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.controls {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 26px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 6px;
  background: rgba(5, 122, 85, .08);
  border-radius: 17px;
}

.segmented button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 13px;
  font-size: .88rem;
  font-weight: 850;
}

.segmented button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(5, 122, 85, .23);
}

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

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 47px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 15px;
  font-weight: 800;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 750;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 16px;
  padding: 16px 18px;
  color: var(--muted);
  border-radius: 21px;
  font-size: .95rem;
  font-weight: 700;
}

.status-card.error {
  color: var(--danger);
  background: #ffe4de;
}

.pulse {
  width: 10px;
  height: 10px;
  background: var(--brand-2);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(47, 196, 142, .15);
}

.best-card {
  margin-top: 16px;
  padding: 21px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .18), transparent 12rem),
    linear-gradient(145deg, #079c6d, #034b36);
  border: 0;
  border-radius: 28px;
}

.best-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #d7f5e9;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.best-price {
  margin-top: 13px;
  font-size: clamp(3rem, 13vw, 4.6rem);
  line-height: .94;
  font-weight: 950;
  letter-spacing: -.07em;
}

.best-bottom {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-top: 18px;
}

.best-bottom h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -.03em;
}

.best-bottom p {
  margin: 5px 0 0;
  color: #d0efe3;
  line-height: 1.5;
}

.route-button,
.mini-route {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.route-button {
  min-width: 86px;
  min-height: 46px;
  color: #063f2e;
  background: #ffcc66;
  border-radius: 15px;
  font-weight: 950;
}

.station-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.station-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 17px;
  border-radius: 24px;
}

.station-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.station-head h3 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -.02em;
}

.open-badge {
  padding: 5px 8px;
  color: var(--brand);
  background: var(--soft);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 900;
}

.open-badge.closed {
  color: var(--danger);
  background: #ffe4de;
}

.address {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}

.fuel-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.fuel-chip {
  padding: 6px 8px;
  color: var(--muted);
  background: rgba(5, 122, 85, .07);
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 850;
}

.fuel-chip.active {
  color: #fff;
  background: var(--brand);
}

.station-side {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 6px;
  min-width: 86px;
}

.station-price {
  color: var(--brand-dark);
  font-size: 1.22rem;
  white-space: nowrap;
}

.distance {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
}

.mini-route {
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--brand);
  border-radius: 13px;
  font-weight: 900;
}

.empty-state {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 22px;
  color: var(--muted);
  border-radius: 24px;
}

.empty-state strong { color: var(--text); }

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  justify-content: space-between;
  padding: 24px 2px 0;
  color: var(--muted);
  font-size: .84rem;
}

.footer a {
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
}

@media (max-width: 540px) {
  .app-shell { width: min(100% - 18px, 780px); padding-top: 8px; }
  .topbar { padding-top: 8px; }
  .ghost-button { padding: 0 11px; font-size: .86rem; }
  .hero-card { padding: 25px 20px; border-radius: 29px; }
  .install-guide { border-radius: 25px; }
  .install-guide-head { grid-template-columns: 1fr; }
  .home-preview { grid-template-columns: auto 1fr; justify-items: start; min-width: 0; }
  .install-steps { grid-template-columns: 1fr; }
  .install-steps li { grid-template-columns: 38px 1fr; min-height: 0; }
  .location-button { width: 100%; }
  .control-grid { grid-template-columns: 1fr; }
  .segmented { gap: 5px; }
  .segmented button { font-size: .8rem; }
  .station-card { grid-template-columns: 1fr; }
  .station-side { grid-template-columns: auto auto auto; justify-items: start; align-items: center; min-width: 0; }
  .best-bottom { align-items: start; flex-direction: column; }
  .route-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1713;
    --surface: rgba(23, 37, 31, .9);
    --surface-strong: #17251f;
    --text: #edf6f1;
    --muted: #a9b9b1;
    --line: rgba(225, 244, 235, .1);
    --brand: #35d39a;
    --brand-2: #6de7b9;
    --brand-dark: #079c6d;
    --soft: rgba(53, 211, 154, .13);
    --shadow: none;
  }

  body {
    background:
      radial-gradient(circle at 95% 0, rgba(53, 211, 154, .12), transparent 26rem),
      radial-gradient(circle at 5% 22%, rgba(255, 204, 102, .08), transparent 18rem),
      var(--bg);
  }

  .eyebrow { color: #72edbf; }
  .station-price { color: #67e7b7; }
  .status-card.error,
  .open-badge.closed { background: rgba(255, 128, 104, .13); }
}
