  :root {
    --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #5f6b7a;
    --border: #d9dee5; --accent: #2563eb; --good: #15803d; --bad: #b91c1c;
    color-scheme: light;
  }
  :root[data-theme="dark"] {
    --bg: #14171c; --card: #1d2128; --text: #e6e9ee; --muted: #9aa4b2;
    --border: #333a45; --accent: #60a5fa; --good: #4ade80; --bad: #f87171;
    color-scheme: dark;
  }
  /* Dark mode switch: styles in banners.css, code in theme.js (shared with the other pages). */
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body {
    margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text);
  }
  /* Page layout and banners (left 30% / top 25%): banners.css, shared with the landing page.
     Here only the main column's padding. */
  main { padding: 24px 24px 48px 16px; }
  html[data-device="phone"][data-orientation="portrait"] main,
  html[data-device="tablet"][data-orientation="portrait"] main { padding: 16px 12px 40px; }
  /* Phones held sideways have little height: tighten the spacing. */
  html[data-device="phone"][data-orientation="landscape"] main { padding: 12px 12px 32px; }
  h1 { font-size: 1.6rem; margin: 0 0 4px; }
  h2 { font-size: 1.1rem; margin: 0 0 12px; }
  .sub { color: var(--muted); margin: 0 0 20px; }
  section {
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
    padding: 18px 20px; margin-bottom: 16px;
  }
  .fuel-picks { display: flex; flex-wrap: wrap; gap: 10px; }
  .pick {
    display: flex; align-items: center; gap: 8px; padding: 8px 14px;
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer; user-select: none;
  }
  .pick:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
  .row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-top: 10px; }
  label.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
  input[type=number], select {
    font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 8px; width: 150px;
  }
  input:disabled, select:disabled { opacity: .5; cursor: not-allowed; }
  input.invalid { border-color: var(--bad); }
  .settings { display: grid; gap: 14px; }
  .setting { border-top: 1px solid var(--border); padding-top: 12px; }
  .setting:first-child { border-top: 0; padding-top: 0; }
  .setting h3 { font-size: 1rem; margin: 0; }
  .hint { color: var(--muted); font-size: .85rem; }
  .privacy { color: var(--muted); font-size: .8rem; margin-top: 28px; padding: 12px 4px 0; border-top: 1px solid var(--border); }
  .privacy p { margin: 0; }
  .privacy p + p { margin-top: 6px; }
  /* Explanatory text (calculator page "How it works", and the Q&A page) */
  a { color: var(--accent); }
  .about h3, .faq-page h3 { font-size: 1rem; margin: 16px 0 4px; }
  .about p, .faq-page section p { margin: 8px 0; }
  .faq-link { font-weight: 600; }
  table.example { border-collapse: collapse; margin: 10px 0; font-variant-numeric: tabular-nums; max-width: 100%; }
  table.example caption { text-align: left; color: var(--muted); font-size: .85rem; padding-bottom: 4px; }
  table.example th, table.example td { border-bottom: 1px solid var(--border); padding: 5px 14px 5px 0; text-align: left; }
  table.example td:last-child, table.example th:last-child { text-align: right; padding-right: 0; }
  /* Q&A page: same layout as the calculator (banner area + main column) */
  .faq-page section { scroll-margin-top: 12px; }
  .faq-page .crumbs { margin-bottom: 12px; font-size: .9rem; }
  .faq-page .toc ul { margin: 0 0 20px; padding-left: 20px; columns: 2 22rem; }
  .faq-page .toc li { margin: 3px 0; break-inside: avoid; }
  .faq-page .cta { font-size: 1.05rem; font-weight: 600; margin: 24px 0 0; }
  .check { display: flex; gap: 6px; align-items: center; font-size: .9rem; cursor: pointer; padding-bottom: 6px; }
  .choices { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
  .choice > label { display: flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 500; }
  .choice .row { margin: 6px 0 0 26px; }
  .row.stacked { flex-direction: column; align-items: flex-start; gap: 10px; }
  /* Info icon next to field labels, and its bubble */
  .field-head { position: relative; display: inline-flex; align-items: center; gap: 6px; }
  .info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; padding: 0; border-radius: 50%;
    border: 1px solid var(--accent); background: transparent; color: var(--accent);
    font: italic 700 11px/1 Georgia, "Times New Roman", serif; cursor: pointer;
  }
  .info:hover, .info[aria-expanded="true"] { background: var(--accent); color: var(--card); }
  h2 .info-pop { font-weight: 400; }
  .info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .info-pop.full-text-pop { position: fixed; top: auto; z-index: 20; word-break: break-word; }
  /* Long dropdowns take the available width (never their longest entry's width). */
  .row.stacked > label.field { align-self: stretch; min-width: 0; }
  .row.stacked select.wide { width: 100%; min-width: 0; max-width: 100%; }
  .info-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 10;
    width: max-content; max-width: 280px; white-space: normal;
    background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
    padding: 6px 10px; font-size: .85rem; box-shadow: 0 4px 12px rgba(0,0,0,.18);
  }
  /* Single-head / multi-head selector switch */
  .segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .segmented label { position: relative; padding: 6px 16px; cursor: pointer; font-size: .9rem; user-select: none; }
  .segmented label + label { border-left: 1px solid var(--border); }
  .segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  .segmented label:has(input:checked) { background: var(--accent); color: #fff; }
  .segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
  .choice .detail { margin: 4px 0 0 26px; }
  select.wide { width: auto; max-width: 100%; }
  .actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
  button {
    font: inherit; font-weight: 600; background: var(--accent); color: #fff; border: 0;
    border-radius: 8px; padding: 10px 22px; cursor: pointer;
  }
  button:disabled { opacity: .6; cursor: default; }
  .error { color: var(--bad); margin: 10px 0 0; white-space: pre-line; }
  .error:empty { display: none; }
  /* Results table: sized to its section. Long text wraps instead of widening it. */
  #results { container-type: inline-size; }
  /* Jumping to the results stops below the fixed top banner on upright phones/tablets. */
  html[data-banner-layout="top"] #results { scroll-margin-top: calc(25vh + 8px); }
  .results-table { width: 100%; max-width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: auto; }
  .results-table th, .results-table td {
    padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
  }
  .results-table th:nth-child(2), .results-table td:nth-child(2) { text-align: left; }
  .results-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .results-table tr.best td { font-weight: 600; }
  /* Medium width: tighter cells. */
  @container (max-width: 640px) {
    .results-table th, .results-table td { padding: 6px 6px; font-size: .9rem; }
    .results-table th { font-size: .72rem; letter-spacing: 0; }
  }
  /* Narrow (e.g. phone held upright): each result becomes a small card. */
  @container (max-width: 480px) {
    .results-table thead { display: none; }
    .results-table, .results-table tbody { display: block; }
    .results-table tr {
      display: grid; grid-template-columns: auto 1fr; column-gap: 12px;
      padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px;
    }
    .results-table tr.best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
    .results-table td { display: contents; border: 0; padding: 0; text-align: left; }
    .results-table td > span { padding: 3px 0; }
    .results-table td > .cell-label { display: block; color: var(--muted); font-size: .85rem; }
    .results-table td > .cell-value { display: block; text-align: right; }
    /* Rank and fuel name form the card's heading line. */
    .results-table td:nth-child(1) > .cell-label,
    .results-table td:nth-child(2) > .cell-label { display: none; }
    .results-table td:nth-child(1) > .cell-value {
      grid-column: 1; grid-row: 1; justify-self: start; font-weight: 700;
      width: 1.8em; height: 1.8em; line-height: 1.8em; border-radius: 50%;
      text-align: center; background: var(--border); padding: 0;
    }
    .results-table tr.best td:nth-child(1) > .cell-value { background: var(--accent); color: #fff; }
    /* Fuel name: the full card width, starting just after the rank badge. */
    .results-table td:nth-child(2) > .cell-value {
      grid-column: 1 / -1; grid-row: 1; text-align: left; font-weight: 600; align-self: center;
      padding-left: calc(1.8em + 10px); margin-bottom: 4px;
    }
  }
  .cell-label { display: none; }
  .summary { margin: 0 0 12px; }
  #results[hidden] { display: none; }
