:root {
  --bg: #07111f;
  --bg-2: #0b1828;
  --panel: rgba(15, 29, 46, 0.94);
  --panel-2: #101f31;
  --text: #f4f8fc;
  --muted: #9cafc4;
  --line: rgba(255,255,255,.09);
  --gas: #60a5fa;
  --gas-soft: rgba(96,165,250,.12);
  --eth: #34d399;
  --eth-soft: rgba(52,211,153,.12);
  --accent: #fbbf24;
  --danger: #fb7185;
  --radius: 22px;
  --shadow: 0 22px 62px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(96,165,250,.14), transparent 27rem),
    radial-gradient(circle at 92% 10%, rgba(52,211,153,.12), transparent 28rem),
    linear-gradient(180deg, var(--bg), #081521 55%, #07111f 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }

.shell {
  width: min(100%, 1180px);
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 28px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding-top: clamp(46px, 7vw, 86px);
  padding-bottom: 30px;
}
.hero__copy { min-width: 0; }
.hero h1 {
  margin: 6px 0 10px;
  max-width: 900px;
  font-size: clamp(2.35rem, 6vw, 5rem);
  line-height: .98;
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}
.hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.98rem, 1.7vw, 1.14rem);
}
.eyebrow {
  color: #b8c8d9;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .7rem;
  font-weight: 850;
}
.hero__badge {
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 320px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.hero__badge-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(251,191,36,.12);
  font-size: 1.25rem;
}
.hero__badge > div { min-width: 0; }
.hero__badge strong, .hero__badge span { display: block; }
.hero__badge span { color: var(--muted); font-size: .84rem; margin-top: 2px; }

main { display: grid; gap: 18px; padding-bottom: 28px; }
.panel, .result-card {
  min-width: 0;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19,36,56,.94), rgba(12,27,43,.96));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: clamp(18px, 3vw, 28px); }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  min-width: 0;
  margin-bottom: 22px;
}
.section-heading > div { min-width: 0; }
.section-heading--compact { margin-bottom: 16px; }
.section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.32rem, 3vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -.025em;
}

.button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  color: #07111f;
  background: #f4f8fc;
  font-weight: 850;
  transition: .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .segmented__button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(251,191,36,.36);
  outline-offset: 2px;
}
.button--ghost {
  flex: 0 0 auto;
  color: var(--text);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.fuel-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  background: rgba(255,255,255,.025);
}
.fuel-card--gas { background: linear-gradient(180deg, var(--gas-soft), rgba(255,255,255,.02)); }
.fuel-card--ethanol { background: linear-gradient(180deg, var(--eth-soft), rgba(255,255,255,.02)); }
.fuel-card legend { padding: 0 8px; font-weight: 900; }
.fuel-card--gas legend { color: var(--gas); }
.fuel-card--ethanol legend { color: var(--eth); }
.fuel-card label { display: block; min-width: 0; margin-top: 12px; }
.fuel-card label > span { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 6px; }
.input-prefix, .input-suffix {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 11px;
  background: rgba(4,12,22,.48);
}
.input-prefix:focus-within, .input-suffix:focus-within { border-color: rgba(251,191,36,.42); }
.input-prefix b, .input-suffix b { flex: 0 0 auto; color: #b9c7d7; font-size: .8rem; white-space: nowrap; }
input[type="number"] {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  padding: 11px 0;
  font-size: 16px;
  font-weight: 850;
}

.mode-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.segmented {
  display: inline-flex;
  min-width: 0;
  padding: 4px;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.segmented__button {
  min-height: 40px;
  border: 0;
  padding: 8px 14px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}
.segmented__button.is-active { background: #f4f8fc; color: #07111f; }

.dashboard { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 14px; }
.result-card { padding: 20px; min-height: 164px; }
.result-card--winner { background: linear-gradient(135deg, rgba(52,211,153,.19), rgba(14,29,45,.94) 58%); }
.result-card__label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 850; }
.winner-line { display: flex; min-width: 0; align-items: center; gap: 12px; margin-top: 10px; }
.winner-line > div { min-width: 0; }
.winner-icon { display: grid; flex: 0 0 auto; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: rgba(255,255,255,.08); font-size: 1.35rem; }
.winner-line h2 { margin: 0; font-size: 1.7rem; line-height: 1.1; overflow-wrap: anywhere; }
.winner-line p { margin: 3px 0 0; color: var(--muted); }
.winner-saving { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 850; color: #c5f6e6; }
.big-number { display: block; margin-top: 13px; font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1; letter-spacing: -.045em; }
.result-card > p { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }

.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fuel-result { position: relative; overflow: hidden; }
.fuel-result::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  filter: blur(20px);
  opacity: .14;
  transform: translate(40%, -40%);
  pointer-events: none;
}
.fuel-result--gas::after { background: var(--gas); }
.fuel-result--ethanol::after { background: var(--eth); }
.fuel-result__title { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fuel-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gas); box-shadow: 0 0 0 6px rgba(96,165,250,.1); }
.fuel-result--ethanol .fuel-dot { background: var(--eth); box-shadow: 0 0 0 6px rgba(52,211,153,.1); }
.fuel-result__title span, .fuel-result__title strong { display: block; }
.fuel-result__title > div > span { font-weight: 900; font-size: 1.16rem; }
.fuel-result__title strong { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.metric-list { margin: 0; }
.metric-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.metric-list dt { min-width: 0; color: var(--muted); }
.metric-list dd { min-width: 0; margin: 0; font-weight: 900; text-align: right; white-space: nowrap; }
.fuel-result--gas .metric-list dd { color: #c9e3ff; }
.fuel-result--ethanol .metric-list dd { color: #c5f6e6; }

.pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  border-radius: 999px;
  padding: 7px 11px;
  color: #d8e5f2;
  font-size: .78rem;
  font-weight: 850;
}
.pill--accent { color: #07111f; background: var(--accent); border-color: transparent; }
.table-wrap { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: #b9c7d7; background: rgba(255,255,255,.035); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
td { font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
td.gas { color: #c9e3ff; }
td.eth { color: #c5f6e6; }

.gauge-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: center; }
.range-label { color: var(--muted); font-size: .86rem; }
.range { width: 100%; accent-color: var(--accent); margin: 18px 0 8px; }
.range-scale { display: grid; grid-template-columns: repeat(5, 1fr); color: #8297ad; font-size: .74rem; }
.range-scale span:nth-child(2), .range-scale span:nth-child(3), .range-scale span:nth-child(4) { text-align: center; }
.range-scale span:last-child { text-align: right; }
.note { color: #7f93a8; font-size: .82rem; margin: 16px 0 0; }
.gauge-stats { display: grid; gap: 10px; min-width: 0; }
.gauge-stats > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: baseline;
  min-width: 0;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--line);
}
.gauge-stats span { min-width: 0; color: var(--muted); font-size: .82rem; }
.gauge-stats strong { min-width: 0; font-size: 1.08rem; white-space: nowrap; }

.insight-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.insight-panel > div { min-width: 0; }
.insight-panel h2 { margin: 4px 0 5px; line-height: 1.15; }
.insight-panel p { margin: 0; color: var(--muted); }
.footer { padding-top: 6px; padding-bottom: max(36px, env(safe-area-inset-bottom)); color: #72869b; font-size: .8rem; text-align: center; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 12px;
  color: #07111f;
  background: #f4f8fc;
  font-weight: 850;
  box-shadow: var(--shadow);
  transition: .22s ease;
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero__badge { width: min(100%, 390px); max-width: none; }
  .input-grid { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr 1fr; }
  .result-card--winner { grid-column: 1 / -1; }
  .gauge-layout { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  :root { --radius: 18px; --shadow: 0 15px 42px rgba(0,0,0,.19); }

  .shell { padding-inline: 12px; }
  .hero {
    gap: 16px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: 18px;
  }
  .hero h1 {
    margin-top: 5px;
    margin-bottom: 9px;
    font-size: clamp(2.1rem, 11vw, 3rem);
    line-height: 1;
    letter-spacing: -.045em;
  }
  .hero p { font-size: .93rem; line-height: 1.48; }
  .hero__badge {
    width: 100%;
    padding: 12px 13px;
    border-radius: 16px;
  }
  .hero__badge-icon { width: 38px; height: 38px; border-radius: 12px; }
  .hero__badge strong { font-size: .95rem; }
  .hero__badge span { font-size: .76rem; line-height: 1.35; }

  main { gap: 11px; }
  .panel, .result-card { border-radius: 17px; }
  .panel { padding: 14px; }

  .section-heading { gap: 10px; margin-bottom: 15px; }
  .section-heading h2 { font-size: 1.3rem; }
  .section-heading .button { min-height: 40px; padding: 8px 10px; font-size: .74rem; }

  .input-grid { gap: 10px; }
  .fuel-card { padding: 12px; border-radius: 15px; }
  .fuel-card label { margin-top: 10px; }
  .fuel-card label > span { font-size: .78rem; }
  .input-prefix, .input-suffix { min-height: 44px; border-radius: 11px; }

  .mode-row { align-items: stretch; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 14px; }
  .mode-row > span { font-size: .84rem; }
  .segmented { width: 100%; }
  .segmented__button { flex: 1; }

  .dashboard { grid-template-columns: 1fr; gap: 11px; }
  .result-card--winner { grid-column: auto; }
  .result-card { min-height: auto; padding: 16px; }
  .winner-line h2 { font-size: 1.48rem; }
  .winner-line p { font-size: .86rem; }
  .winner-saving { margin-top: 12px; padding-top: 10px; font-size: .9rem; }
  .big-number { margin-top: 10px; font-size: 2.2rem; }

  .comparison-grid { grid-template-columns: 1fr; gap: 11px; }
  .fuel-result__title { margin-bottom: 8px; }
  .metric-list > div { gap: 10px; padding: 10px 0; }
  .metric-list dt { font-size: .85rem; }
  .metric-list dd { font-size: .92rem; }

  .table-panel .section-heading { align-items: center; }
  .table-wrap { border: 0; overflow: visible; }
  table, tbody { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.025);
  }
  tbody td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    padding: 10px 11px;
    text-align: left;
    border: 0;
    border-top: 1px solid var(--line);
  }
  tbody td:nth-child(even) { border-right: 1px solid var(--line); }
  tbody td:first-child {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-top: 0;
    background: rgba(255,255,255,.04);
    font-size: 1rem;
    font-weight: 900;
  }
  tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .66rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .045em;
    font-weight: 800;
  }
  tbody td:first-child::before { content: "Valor abastecido"; }
  tbody td.gas, tbody td.eth { font-size: .88rem; }

  .gauge-layout { gap: 16px; }
  .range { margin-top: 14px; }
  .range-scale { font-size: .65rem; }
  .note { margin-top: 12px; font-size: .75rem; }
  .gauge-stats { gap: 8px; }
  .gauge-stats > div { gap: 8px; padding: 11px 12px; }
  .gauge-stats span { font-size: .77rem; }
  .gauge-stats strong { font-size: .95rem; }

  .insight-panel { align-items: stretch; flex-direction: column; gap: 14px; }
  .insight-panel .button { width: 100%; }
  .footer { font-size: .74rem; line-height: 1.45; }
}

@media (max-width: 430px) {
  .shell { padding-inline: 10px; }
  .panel { padding: 13px; }
  .eyebrow { font-size: .63rem; letter-spacing: .12em; }
  .hero h1 { font-size: clamp(1.95rem, 10.5vw, 2.65rem); }

  .section-heading:not(.section-heading--compact) {
    align-items: stretch;
    flex-direction: column;
  }
  .section-heading:not(.section-heading--compact) .button { width: 100%; }
  .section-heading--compact { align-items: flex-start; }

  .fuel-card { padding: 11px; }
  .input-prefix b, .input-suffix b { font-size: .74rem; }

  .metric-list > div {
    grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
  }
  .metric-list dd { white-space: normal; overflow-wrap: anywhere; }

  tbody td { padding: 9px 10px; }
  tbody td::before { font-size: .61rem; }

  .gauge-stats > div { grid-template-columns: minmax(0, 1fr) minmax(80px, auto); }
  .gauge-stats strong { white-space: normal; text-align: right; overflow-wrap: anywhere; }
}

@media (max-width: 350px) {
  .hero__badge { align-items: flex-start; }
  .section-heading--compact { flex-direction: column; }
  .pill { align-self: flex-start; }
  tbody tr { grid-template-columns: 1fr; }
  tbody td:nth-child(even) { border-right: 0; }
  tbody td:first-child { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
