@font-face {
  font-family: "Roboto Narrow";
  src: url("../assets/fonts/RobotoNarrow-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  color-scheme: light;
  font: 16px/1.45 "Roboto Narrow", "Arial Narrow", sans-serif;
  font-stretch: 85%;
  background: var(--canvas);
  color: var(--ink);
  --navy: #082d54;
  --navy-deep: #061f3d;
  --navy-soft: #eaf0f7;
  --navy-line: #c8d5e4;
  --accent: #ff5500;
  --accent-pressed: #f85a0a;
  --accent-soft: #fff1e9;
  --accent-strong: #b84000;
  --ink: #10243b;
  --muted: #52657a;
  --muted-light: #596b80;
  --line: #d8e1eb;
  --line-strong: #c4d0dd;
  --canvas: #f5f7fb;
  --canvas-glow: #e5edf6;
  --canvas-overlay: rgb(245 247 251 / 94%);
  --surface: #fff;
  --white: #fff;
  --transparent: transparent;
  --danger: #a33b32;
  --danger-soft: #fbece9;
  --danger-ink: #8b3a18;
  --focus: #b84000;
  --shadow-brand: 0 5px 12px rgb(8 45 84 / 14%);
  --shadow-accent: 0 8px 18px rgb(255 85 0 / 20%);
  --shadow-card: 0 16px 38px rgb(8 45 84 / 8%);
}

* { box-sizing: border-box; }

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: radial-gradient(700px 380px at 50% -190px, var(--canvas-glow) 0, transparent 74%), var(--canvas);
}

button { font: inherit; }

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.app-shell.is-searching {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-shell.is-searching .legal-links { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  margin-bottom: 16px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: block;
  flex: 0 0 auto;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: var(--shadow-brand);
}

.brand-copy { display: grid; gap: 0; }
.brand-copy strong { color: var(--navy-deep); font-size: 19px; line-height: 1.2; }
.brand-copy span { color: var(--muted); font-size: 13px; }
.gear-button {
  width: 48px;
  height: 48px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  color: var(--navy-deep);
  font-size: 25px;
  line-height: 1;
  touch-action: manipulation;
}
.gear-button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.gear-button[hidden] { display: none !important; }

.source-credit { display: block; margin: auto 0 0; padding-top: 8px; color: var(--muted); font-size: 12px; text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
.legal-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: auto 0 0; padding-top: 8px; }
.legal-links .source-credit { display: inline-block; margin: 0; padding: 0; }

.screen { flex: 1; }
.screen[hidden] { display: none !important; }

.setup-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 0 18px;
}
.setup-content { width: 100%; }
.setup-screen h1 { max-width: 15ch; }
.setup-screen .intro { margin-bottom: 24px; }
.fuel-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fuel-fieldset legend { margin-bottom: 10px; color: var(--navy-deep); font-size: 14px; font-weight: 750; }
.ready-screen { display: flex; flex-direction: column; justify-content: center; padding: 4px 0 18px; }
.ready-content { width: 100%; }
.ready-screen h1 { max-width: 15ch; margin-bottom: 12px; color: var(--navy-deep); font-size: clamp(30px, 8vw, 42px); line-height: 1.05; }
.ready-fuel-summary { margin: 0 0 24px; color: var(--muted); }
.price-age { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.price-age.is-stale { color: var(--navy); }
.fuel-options { display: grid; gap: 10px; max-height: min(36vh, 340px); overflow-y: auto; padding: 3px; overscroll-behavior: contain; }
.fuel-option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  padding: 13px 15px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  font-weight: 720;
  touch-action: manipulation;
}
.fuel-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fuel-option input { width: 22px; height: 22px; margin: 0 12px 0 0; accent-color: var(--accent); }
.fuel-option:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.consumption-field { margin-top: 22px; }
.consumption-field > label { display: block; color: var(--navy-deep); font-size: 14px; font-weight: 700; }
.number-control {
  display: flex;
  align-items: center;
  width: min(100%, 260px);
  min-height: 54px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--white);
}
.number-control:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.number-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: var(--transparent);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.number-control span { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.field-hint { margin: 6px 0 0; color: var(--muted-light); font-size: 13px; }
.setup-actions { position: sticky; bottom: 0; margin-top: 24px; padding: 10px 0 max(4px, env(safe-area-inset-bottom)); background: var(--canvas-overlay); }
.setup-button-row { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.setup-button-row .button { width: 100%; min-height: 58px; }
.form-error { min-height: 0; margin: 0 0 8px; color: var(--danger); font-size: 13px; }
.form-error:empty { display: none; }
.eyebrow {
  margin: 0 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; color: var(--ink); font-size: clamp(30px, 8vw, 43px); line-height: 1.08; letter-spacing: -.04em; }

.intro {
  max-width: 34ch;
  margin: 15px 0 27px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.button {
  min-height: 56px;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: .025em;
  line-height: 1.2;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, background-color .16s ease, opacity .16s ease;
}

.button:active:not(:disabled) { transform: scale(.985); }
.button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.button:disabled { cursor: wait; opacity: .55; }

.button-primary {
  width: 100%;
  min-height: 64px;
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: var(--shadow-accent);
}

.button-primary:active:not(:disabled) { background: var(--accent-pressed); }
.button-secondary { background: var(--navy-soft); color: var(--navy-deep); border-color: var(--navy-line); }
.button-quiet { display: block; margin: 18px auto 0; min-height: 48px; padding: 10px 14px; background: var(--transparent); color: var(--navy); }
.button-primary:hover,
.button-primary:active:not(:disabled),
.button-primary:focus,
.button-primary:focus-visible {
  color: #FFFFFF;
  font-weight: 700;
}


@media (max-width: 350px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
}

.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px 8px 80px;
  text-align: center;
}

.loading-screen {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 12px 0 max(10px, env(safe-area-inset-bottom));
  text-align: center;
}

.loading-screen.has-ad,
.loading-screen.has-fallback {
  grid-template-rows: minmax(120px, 1fr) minmax(190px, 2fr);
}

.loading-progress {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 8px;
}

.loading-screen #loading-message {
  max-width: 18ch;
  margin: 0;
  color: var(--navy-deep);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
}

.loading-ad {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: clamp(12px, 3vw, 18px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.loading-ad[hidden], .loading-ad-link[hidden], .loading-ad-label[hidden] { display: none !important; }
.loading-ad-title { margin: 0; color: var(--navy-deep); font-size: 16px; font-weight: 800; }
.loading-ad-link { display: flex; min-height: 0; align-items: center; justify-content: center; overflow: hidden; border-radius: 12px; background: var(--canvas); }
.loading-ad-link[aria-disabled="true"] { pointer-events: none; }
.loading-ad-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.loading-ad-label { justify-self: center; padding: 3px 9px; border-radius: 999px; background: var(--navy-soft); color: var(--navy-deep); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.loading-brand-fallback {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.loading-brand-fallback[hidden] { display: none !important; }
.loading-brand-fallback-image {
  display: block;
  width: min(68vw, 34vh, 280px);
  max-width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 20%;
  pointer-events: none;
  user-select: none;
}

.loader-ring {
  width: 66px;
  height: 66px;
  border: 6px solid var(--navy-soft);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: gasofa-spin .78s linear infinite;
}

@media (max-height: 620px) {
  .loading-screen.has-ad,
  .loading-screen.has-fallback { grid-template-rows: minmax(105px, 1fr) minmax(150px, 2fr); }
  .loading-progress { gap: 10px; }
  .loader-ring { width: 54px; height: 54px; border-width: 5px; }
  .loading-screen #loading-message { font-size: 18px; }
}

@keyframes gasofa-spin { to { transform: rotate(360deg); } }

.error-symbol {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-size: 27px;
  font-weight: 800;
}

.error-screen h1 { max-width: 18ch; font-size: clamp(25px, 7vw, 34px); }
.error-screen .button { width: 100%; }

.result-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0 26px;
}

.recommendation-card {
  padding: clamp(22px, 6vw, 32px);
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.price-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0 0 9px;
  color: var(--navy-deep);
  font-variant-numeric: tabular-nums;
}

.price-value { font-size: clamp(48px, 14vw, 70px); font-weight: 900; line-height: 1; letter-spacing: -.065em; }
.price-unit { color: var(--accent-strong); font-size: 18px; font-weight: 750; }
.station-name { margin: 0; font-size: clamp(25px, 7vw, 34px); line-height: 1.14; }
.station-distance { margin: 11px 0 25px; color: var(--muted); font-size: 17px; font-weight: 600; }
.button-navigation { min-height: 64px; font-size: 16px; }

.option-navigation {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  margin-top: 14px;
}

.option-navigation .button { min-height: 48px; padding: 10px 12px; font-size: 12px; }
.option-navigation [hidden] { display: none !important; }
.option-position {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 350px) {
  .app-shell { padding-right: 16px; padding-left: 16px; }
  .recommendation-card { padding: 20px 17px; }
  .option-navigation .button { padding-right: 8px; padding-left: 8px; font-size: 11px; }
  .setup-screen h1 { font-size: 30px; }
}

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