:root {
  --bg: #f4efe6;
  --panel: rgba(255, 250, 241, 0.88);
  --panel-strong: #fff8ef;
  --panel-soft: rgba(255, 255, 255, 0.62);
  --text: #172321;
  --muted: #5f6d66;
  --line: rgba(23, 35, 33, 0.12);
  --accent: #db6c32;
  --accent-2: #1f8a70;
  --shadow: 0 20px 55px rgba(48, 52, 44, 0.12);
  --input-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  --range-track: linear-gradient(90deg, rgba(219, 108, 50, 0.24), rgba(31, 138, 112, 0.28));
  --range-thumb: linear-gradient(135deg, #db6c32, #f3ab4b);
  --range-progress: 27%;
  --page-background:
    radial-gradient(circle at top left, rgba(219, 108, 50, 0.2), transparent 28%),
    radial-gradient(circle at right, rgba(31, 138, 112, 0.16), transparent 30%),
    linear-gradient(160deg, #f6efe2 0%, #eef5ef 48%, #e5f1ef 100%);
}

:root[data-theme="dark"] {
  --bg: #12181d;
  --panel: rgba(16, 24, 29, 0.84);
  --panel-strong: #1b242b;
  --panel-soft: rgba(19, 27, 33, 0.92);
  --text: #eef4f2;
  --muted: #9aacb1;
  --line: rgba(196, 218, 212, 0.16);
  --accent: #ff8a4c;
  --accent-2: #43b497;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
  --input-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  --range-track: linear-gradient(90deg, rgba(255, 138, 76, 0.34), rgba(67, 180, 151, 0.38));
  --range-thumb: linear-gradient(135deg, #ff8a4c, #ffb45f);
  --page-background:
    radial-gradient(circle at top left, rgba(255, 138, 76, 0.18), transparent 28%),
    radial-gradient(circle at right, rgba(67, 180, 151, 0.14), transparent 32%),
    linear-gradient(160deg, #10161b 0%, #172028 52%, #131c23 100%);
}

* {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  background: var(--page-background);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background: transparent;
  padding-top: env(safe-area-inset-top);
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--page-background);
  pointer-events: none;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 max(40px, env(safe-area-inset-bottom));
}

.hero {
  padding: 8px 0 32px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.hero-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 10px;
}

.eyebrow,
.status-label,
.station-brand,
.results-count {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  color: var(--text);
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3 {
  color: #eef4f2;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.8rem, 8vw, 5.4rem);
  line-height: 0.94;
  margin-top: 10px;
}

.hero-copy {
  max-width: 62ch;
  margin: 18px 0 0;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--muted);
}

.market-highlight {
  margin-top: 24px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(219, 108, 50, 0.14), rgba(243, 171, 75, 0.08)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

:root[data-theme="dark"] .market-highlight {
  border-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 138, 76, 0.18), rgba(67, 180, 151, 0.08)),
    rgba(16, 24, 29, 0.84);
}

.market-highlight-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--muted);
}

.market-highlight-main {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-top: 12px;
}

.market-highlight-title {
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1.02;
}

.market-highlight-copy {
  margin: 10px 0 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.market-highlight-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 14px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), #f3ab4b);
  color: #ffffff;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 14px 32px rgba(219, 108, 50, 0.22);
}

@media (display-mode: standalone) {
  .market-highlight {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 22px;
  }

  .market-highlight-main {
    gap: 14px;
    margin-top: 8px;
  }

  .market-highlight-label {
    font-size: 0.68rem;
  }

  .market-highlight-title {
    font-size: clamp(1.15rem, 2.2vw, 1.7rem);
  }

  .market-highlight-copy {
    margin-top: 6px;
    font-size: 0.92rem;
    line-height: 1.3;
  }

  .market-highlight-price {
    min-width: 104px;
    padding: 10px 12px;
    border-radius: 18px;
    font-size: clamp(1.05rem, 2.1vw, 1.4rem);
  }
}

.dashboard {
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  min-width: 0;
}

:root[data-theme="dark"] .panel {
  border-color: rgba(255, 255, 255, 0.08);
}

.controls-panel,
.results-panel {
  padding: 24px;
}

.controls-panel.collapsed .filters-grid {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field span {
  font-size: 0.92rem;
  color: var(--text);
}

:root[data-theme="dark"] .field span {
  color: #eef4f2;
}

.slider-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.slider-heading strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.fuel-field {
  align-content: start;
}

.location-field {
  align-content: start;
}

.fuel-picker {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.fuel-picker select {
  flex: 1;
}

input,
select,
.ghost-button {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
}

input,
select {
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--input-shadow);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select {
  background: rgba(19, 27, 33, 0.6);
  color: #eef4f2;
}

.station-calculator {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(23, 35, 33, 0.08);
  border-radius: 20px;
  background: rgba(31, 138, 112, 0.08);
}

:root[data-theme="dark"] .station-calculator {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(67, 180, 151, 0.12);
}

.station-calculator-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.input-with-unit {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-with-unit > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 16px 16px 0;
  background: rgba(31, 138, 112, 0.12);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

:root[data-theme="dark"] .input-with-unit > span {
  background: rgba(67, 180, 151, 0.2);
  color: #eef4f2;
}

.station-calculator-results {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: baseline;
  margin-top: 12px;
}

.station-calculator-results span {
  color: var(--muted);
  font-weight: 700;
}

.station-calculator-results strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  color: var(--text);
}

:root[data-theme="dark"] .station-calculator-results strong {
  color: #eef4f2;
}

input:focus,
select:focus,
.ghost-button:focus {
  outline: 2px solid rgba(219, 108, 50, 0.35);
  outline-offset: 2px;
}

.ghost-button {
  cursor: pointer;
  background: transparent;
  font-weight: 700;
  color: var(--text);
}

:root[data-theme="dark"] .ghost-button {
  color: #eef4f2;
}

.inline-button {
  white-space: nowrap;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  flex-shrink: 0;
  box-shadow: none;
  border-radius: 0;
  margin-top: 8px;
}

:root[data-theme="dark"] .theme-toggle {
  color: #eef4f2;
}

.theme-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: opacity 160ms ease, transform 160ms ease, color 160ms ease;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-moon svg {
  fill: currentColor;
  stroke: none;
}

:root[data-theme="light"] .theme-icon-sun,
:root:not([data-theme="dark"]) .theme-icon-sun {
  opacity: 0.92;
  transform: scale(1);
  color: var(--accent);
}

:root[data-theme="light"] .theme-icon-moon,
:root:not([data-theme="dark"]) .theme-icon-moon {
  opacity: 0;
  transform: scale(0.72);
}

:root[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: scale(0.72);
}

:root[data-theme="dark"] .theme-icon-moon {
  opacity: 0.92;
  transform: scale(1);
  color: #ffd27d;
}

.field-hint {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}

.checkbox-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

:root[data-theme="dark"] .checkbox-field {
  color: #eef4f2;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.filters-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  background: var(--panel-strong);
  color: var(--text);
}

:root[data-theme="dark"] .filters-toggle {
  background: rgba(19, 27, 33, 0.7);
  color: #eef4f2;
}

.filters-summary {
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 600;
}

.slider-field {
  grid-column: 1 / -1;
}

.apply-filter-button {
  justify-self: start;
  background: var(--panel-strong);
}

:root[data-theme="dark"] .apply-filter-button {
  background: rgba(19, 27, 33, 0.7);
}

.range-input {
  appearance: none;
  width: 100%;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.range-input::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--range-progress), rgba(127, 144, 138, 0.2) var(--range-progress), rgba(127, 144, 138, 0.2) 100%);
}

.range-input::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(127, 144, 138, 0.2);
}

.range-input::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: var(--range-thumb);
  box-shadow: 0 8px 24px rgba(23, 35, 33, 0.22);
}

:root[data-theme="dark"] .range-input::-webkit-slider-thumb {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.44);
}

.range-input::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: var(--range-thumb);
  box-shadow: 0 8px 24px rgba(23, 35, 33, 0.22);
}

:root[data-theme="dark"] .range-input::-moz-range-thumb {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.44);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.results-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  min-width: 0;
}

.station-card {
  padding: 20px;
  background: var(--panel-soft);
  border: 1px solid rgba(23, 35, 33, 0.08);
  border-radius: 24px;
  min-width: 0;
}

:root[data-theme="dark"] .station-card {
  background: rgba(19, 27, 33, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

.station-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.station-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.station-heading > div {
  min-width: 0;
}

.station-logo {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 16px;
  border: 1px solid rgba(23, 35, 33, 0.08);
  background: rgba(255, 255, 255, 0.92);
  object-fit: contain;
  padding: 2px;
  box-shadow: 0 8px 22px rgba(23, 35, 33, 0.08);
}

:root[data-theme="dark"] .station-logo {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

.station-name {
  font-size: 1.4rem;
  margin-top: 6px;
  color: var(--text);
  overflow-wrap: anywhere;
}

:root[data-theme="dark"] .station-name {
  color: #eef4f2;
}

.station-address {
  margin: 10px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.price-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 10px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #f3ab4b);
  color: white;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.18rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.station-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  min-width: 0;
}

.station-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  min-width: 0;
}

.map-links {
  min-width: 0;
}

.map-toggle {
  display: inline-flex;
  align-items: center;
  list-style: none;
  user-select: none;
}

.map-toggle::-webkit-details-marker {
  display: none;
}

.map-links-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  min-width: 0;
}

.use-station-price-button {
  background: var(--panel-strong);
}

:root[data-theme="dark"] .use-station-price-button {
  background: rgba(19, 27, 33, 0.8);
}

.map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  max-width: 100%;
}

:root[data-theme="dark"] .map-link {
  background: rgba(19, 27, 33, 0.8);
  color: #eef4f2;
}

.map-link:hover {
  border-color: rgba(219, 108, 50, 0.45);
}

.distance-pill,
.schedule-pill,
.updated-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 138, 112, 0.12);
  color: var(--text);
  font-size: 0.92rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

:root[data-theme="dark"] .distance-pill,
:root[data-theme="dark"] .schedule-pill,
:root[data-theme="dark"] .updated-pill {
  background: rgba(67, 180, 151, 0.25);
  color: #eef4f2;
}

.updated-pill {
  background: rgba(23, 35, 33, 0.08);
}

:root[data-theme="dark"] .updated-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #eef4f2;
}

.distance-pill {
  background: rgba(219, 108, 50, 0.14);
}

:root[data-theme="dark"] .distance-pill {
  background: rgba(255, 138, 76, 0.25);
  color: #eef4f2;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(23, 35, 33, 0.16);
  border-radius: 24px;
}

.seo-panel {
  padding: 24px;
}

.seo-copy,
.faq-list {
  display: grid;
  gap: 14px;
}

.seo-copy h2,
.faq-panel h2 {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
}

.seo-copy p,
.faq-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.seo-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

:root[data-theme="dark"] .seo-links a {
  background: rgba(19, 27, 33, 0.8);
  color: #eef4f2;
}

.seo-links a:hover {
  border-color: rgba(219, 108, 50, 0.45);
}

.faq-item {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.faq-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

:root[data-theme="dark"] .empty-state {
  color: #9aacb1;
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100%, calc(100% - 20px));
  }

  .controls-panel,
  .results-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .filters-grid,
  .station-calculator-form {
    grid-template-columns: 1fr;
  }

  .filters-summary {
    max-width: 58%;
  }

  .fuel-picker {
    flex-direction: column;
  }

  .panel-header,
  .station-top,
  .hero-top,
  .market-highlight-main {
    flex-direction: column;
  }

  .hero-heading {
    gap: 12px;
  }

  .price-badge {
    min-width: 0;
    align-self: flex-start;
  }

  .market-highlight {
    padding: 20px;
    border-radius: 24px;
  }

  .market-highlight-price {
    min-width: 0;
    align-self: flex-start;
  }

  h1 {
    max-width: 9ch;
  }

  .station-name {
    font-size: 1.2rem;
  }

  .station-logo {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }
}

@media (max-width: 540px) {
  :root {
    --page-background:
      radial-gradient(circle at top left, rgba(219, 108, 50, 0.24), transparent 34%),
      radial-gradient(circle at right, rgba(31, 138, 112, 0.2), transparent 32%),
      linear-gradient(180deg, #f6efe2 0%, #eef5ef 52%, #e5f1ef 100%);
  }

  :root[data-theme="dark"] {
    --page-background:
      radial-gradient(circle at top left, rgba(255, 138, 76, 0.22), transparent 34%),
      radial-gradient(circle at right, rgba(67, 180, 151, 0.18), transparent 34%),
      linear-gradient(180deg, #10161b 0%, #172028 56%, #131c23 100%);
  }

  .hero {
    padding-top: 8px;
  }

  .theme-toggle {
    width: 24px;
    min-width: 24px;
    min-height: 24px;
    margin-top: 6px;
  }

  .hero-copy {
    font-size: 1rem;
  }

  input,
  select,
  .ghost-button {
    min-height: 52px;
  }
}
