/* petrol.bh — Front-Page Price Box */

:root {
  --paper: #f3f3ef;
  --sheet: #ffffff;
  --ink: #121212;
  --ink-2: #3a3a36;
  --soft: #595953;
  --rule-soft: #cfcfc7;
  --wash: #e7e7e0;
  --red: #d0102b;
  --rise: #b00d24;
  --fall: #0d6e43;
  --buff: #ebdfc4; /* newsprint buff: the month's biggest move and the logo dot */

  --display: "Archivo", "Arial Narrow", sans-serif;
  --text: "Archivo", system-ui, sans-serif;
  --arabic: "Noto Kufi Arabic", "Geeza Pro", sans-serif;

  --gutter: 16px;
  --rule: 3px solid var(--ink);
  --hair: 1px solid var(--ink);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tabbar-h: 62px;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 400 16px/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
button, input, output { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
svg { flex: none; }
[lang="ar"] { font-family: var(--arabic); }
::selection { background: var(--buff); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
html { scrollbar-color: var(--ink) var(--paper); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }
.num { text-align: end; }

/* Staging strip */
.environment-banner {
  position: sticky; inset-block-start: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 8px var(--gutter);
  color: #fff; background: var(--ink);
  font-size: 13px; line-height: 1.3;
}
.environment-banner[hidden] { display: none; }
.environment-banner strong {
  padding: 2px 8px; color: var(--ink); background: var(--buff);
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px;
}

/* Masthead */
.band { color: #fff; background: var(--red); }
.band-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.wordmark {
  font: 900 32px/1 var(--display); font-stretch: 68%;
  letter-spacing: -0.01em; text-decoration: none; white-space: nowrap;
}
.wordmark span { color: #ffd9de; }
.wordmark.is-dark span { color: var(--red); }
.band :focus-visible { outline-color: #fff; }
.band-note { display: none; font-size: 14px; font-weight: 600; }
.band-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.band-button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px;
  border: 1.5px solid #fff; background: transparent; color: #fff;
  font-size: 14px; font-weight: 700;
}
.band-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.band-button:hover:not(:disabled) { background: #fff; color: var(--red); }
.band-button:disabled { opacity: 1; border-style: dashed; border-color: #ffb3bd; color: #ffe3e7; }
.band-button small { font-size: 12px; font-weight: 600; }
.band-button [lang="ar"] { font-size: 13px; line-height: 1; }

.dateline { border-block-end: var(--rule); background: var(--paper); }
.dateline-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-block: 9px; }
.edition { font-size: 14px; color: var(--ink-2); }
.edition strong { color: var(--ink); font-weight: 800; }
.dateline-sep { display: inline-block; width: 1px; height: 0.9em; margin-inline: 10px; vertical-align: -0.08em; background: var(--ink-2); }
.edition-status {
  padding: 2px 8px; border: var(--hair);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.edition-status.is-older { border-style: dashed; }
.edition-status:empty { visibility: hidden; }
.section-nav { display: none; }

/* Front: headline + price box + record */
.front { display: grid; gap: 20px; padding-block: 20px 36px; }
#front-headline {
  font: 850 clamp(2.3rem, 3.4vw + 1.3rem, 4.25rem)/0.94 var(--display);
  font-stretch: 64%; letter-spacing: -0.005em; text-transform: uppercase;
  max-width: 24ch;
}
#front-headline span { display: block; }
.standfirst { margin-block: 10px 18px; max-width: 46ch; color: var(--ink-2); font-size: 16px; line-height: 1.4; }

.price-box { width: 100%; border-collapse: collapse; border: var(--rule); background: var(--sheet); }
.price-box thead th {
  padding: 8px 12px; border-block-end: var(--hair);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; text-align: start;
}
.price-box thead th.num { text-align: end; }
.price-box tbody tr + tr { border-block-start: var(--hair); }
.price-box td, .price-box tbody th { padding: 10px 12px; vertical-align: middle; }
.price-box tbody th { text-align: start; font-weight: 400; }
.grade-name { display: block; font: 800 20px/1.05 var(--display); font-stretch: 78%; white-space: nowrap; }
.grade-ar { display: block; margin-top: 3px; color: var(--soft); font-size: 13px; line-height: 1.3; }
.grade-swatch { display: inline-block; width: 10px; height: 10px; margin-inline-end: 7px; background: var(--swatch); vertical-align: 0.05em; }
.figure {
  display: block; font: 900 clamp(2.6rem, 2.5vw + 1.8rem, 4rem)/0.88 var(--display);
  font-stretch: 66%; letter-spacing: -0.01em;
}
.figure-sub { display: block; margin-top: 4px; color: var(--soft); font-size: 13px; }
.change { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.change-main { display: inline-flex; align-items: center; gap: 4px; font: 800 18px/1 var(--display); font-stretch: 80%; }
.change-main svg { width: 12px; height: 12px; fill: currentColor; }
.change-pct { font-size: 13px; color: var(--ink-2); }
.is-up .change-main { color: var(--rise); }
.is-down .change-main { color: var(--fall); }
.is-flat .change-main { color: var(--soft); }
.price-box tr.is-biggest {
  background: linear-gradient(var(--buff), var(--buff)) no-repeat 0 0 / 100% 100%;
  transition: background-size 0.7s var(--ease-out);
}
.price-box tr.is-biggest.is-pre { background-size: 0% 100%; }
.price-box tr.is-biggest .change-main,
.price-box tr.is-biggest .grade-ar,
.price-box tr.is-biggest .figure-sub,
.price-box tr.is-biggest .change-pct { color: var(--ink); }
.box-foot { margin-top: 8px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.box-foot strong { color: var(--ink); }
.box-foot a { white-space: nowrap; }
.col-prev { display: none; }
.figure-sub .bhd { display: none; }
@media (min-width: 760px) { .figure-sub .bhd { display: inline; } }

.record { padding-block-start: 14px; border-block-start: var(--rule); }
.record h2 { font: 800 22px/1 var(--display); font-stretch: 75%; text-transform: uppercase; margin-bottom: 8px; }
.record-list > div { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding-block: 9px; border-block-end: 1px solid var(--rule-soft); font-size: 14px; }
.record-list dt { color: var(--soft); }
.record-list dd { font-weight: 600; overflow-wrap: anywhere; }
.record-status { display: inline-flex; align-items: center; gap: 6px; }
.record-status::before { content: ""; width: 9px; height: 9px; border: 1.5px solid currentColor; }
.record-status.is-verified { color: var(--ink); }
.record-status.is-verified::before { background: currentColor; }
.record-note { margin-top: 12px; color: var(--ink-2); font-size: 14px; line-height: 1.5; max-width: 52ch; }

/* Modules */
.module { padding-block: 8px 48px; }
.module > .wrap { border-block-start: var(--rule); padding-block-start: 14px; }
.module-head { margin-bottom: 22px; }
.module-head h2 {
  font: 850 clamp(2rem, 2.6vw + 1.2rem, 3.25rem)/0.95 var(--display);
  font-stretch: 64%; text-transform: uppercase; text-wrap: balance;
}
.module-head p { margin-top: 8px; color: var(--ink-2); max-width: 60ch; text-wrap: pretty; }
.module-grid { display: grid; gap: 24px; }

.field { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; }
.field legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 800; }

/* Segmented radio groups */
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 13px;
  border: var(--hair); background: var(--sheet); color: var(--ink);
  font-size: 14px; font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented button:hover { background: var(--wash); }
.segmented button[aria-checked="true"] { background: var(--ink); color: #fff; }
.segmented.is-fuel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented .swatch { width: 10px; height: 10px; background: var(--swatch); box-shadow: 0 0 0 1px #fff; }

/* Banknotes */
.notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.note {
  position: relative; display: block; width: 100%; aspect-ratio: 1.9; padding: 0;
  border: 0; overflow: hidden; color: #fff; background: var(--note);
  transition: transform 0.15s var(--ease-out);
}
.note::after { content: ""; position: absolute; inset: 4px; border: 1px solid rgb(255 255 255 / 0.45); }
.note:hover::after { border-color: #fff; }
.note:active, .note.is-adding { transform: scale(0.96); }
.note-cur { position: absolute; inset-inline-start: 9px; inset-block-start: 7px; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; }
.note strong { position: absolute; inset-inline-start: 9px; inset-block-end: 6px; font: 900 clamp(22px, 2.4vw, 30px)/1 var(--display); font-stretch: 70%; }
.note-ar { position: absolute; inset-inline-end: 9px; inset-block-end: 7px; font-size: 12px; line-height: 1; }
.note-1 { --note: #8f1f2c; }
.note-5 { --note: #1b4f7e; }
.note-10 { --note: #22573f; }
.note-20 { --note: #5c3d29; }
.note-count { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; border: var(--hair); background: var(--sheet); }
.note-count button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-inline-end: var(--hair); background: transparent; }
.note-count button svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }
.note-count button:disabled { color: var(--rule-soft); }
.note-count output { flex: 1; text-align: center; font-weight: 800; }
.note-slot.is-active .note-count { background: var(--ink); color: #fff; }
.note-slot.is-active .note-count button { border-color: #fff; }
.note-slot.is-active .note-count button:disabled { color: #777; }

.total-line { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; padding-block: 10px; border-block: var(--hair); }
.total-line span { font-size: 14px; color: var(--ink-2); }
.total-line strong { font: 850 26px/1 var(--display); font-stretch: 72%; }
.text-button { margin-inline-start: auto; min-height: 36px; padding: 0 4px; border: 0; background: none; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }

/* Answer boxes */
.answer { align-self: start; padding: 16px; border: var(--hair); border-block-start: var(--rule); background: var(--sheet); }
.answer-lead { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.answer-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 4px; }
.answer-figure strong { font: 900 clamp(3.4rem, 4vw + 2rem, 5.5rem)/0.86 var(--display); font-stretch: 64%; letter-spacing: -0.01em; }
.answer-figure span { font-size: 17px; font-weight: 600; }
.answer-figure .cur { font: 800 24px/1 var(--display); font-stretch: 72%; }
.answer-change { display: inline-block; margin-top: 12px; padding: 4px 8px; font-weight: 700; font-size: 15px; }
.answer-change.is-up { color: #fff; background: var(--rise); }
.answer-change.is-down { color: #fff; background: var(--fall); }
.answer-change.is-flat { background: var(--wash); }
.answer.is-empty .answer-figure strong { color: var(--rule-soft); }
.answer-keep { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule-soft); color: var(--ink-2); font-size: 15px; }
.answer-keep strong { color: var(--ink); }

.compare { display: grid; gap: 8px; margin-top: 18px; }
.compare-row { display: grid; grid-template-columns: 36px 1fr 72px; align-items: center; gap: 10px; font-size: 13px; }
.compare-row span { color: var(--soft); font-weight: 600; }
.compare-row b { text-align: end; }
.compare-track { height: 14px; border: var(--hair); }
.compare-track i { display: block; height: 100%; width: 0; background: var(--rule-soft); transition: width 0.45s var(--ease-out); }
.compare-row.is-now .compare-track i { background: var(--ink); }

/* Tank */
.stepper-row { display: flex; align-items: stretch; border: var(--hair); background: var(--sheet); width: max-content; }
.step { display: grid; place-items: center; width: 48px; height: 48px; border: 0; background: transparent; }
.step svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; }
.step:hover:not(:disabled) { background: var(--wash); }
.step:disabled { color: var(--rule-soft); }
.step-value { display: grid; place-items: center; min-width: 92px; border-inline: var(--hair); font: 850 24px/1 var(--display); font-stretch: 72%; }
.range { width: 100%; margin: 18px 0 6px; height: 28px; background: transparent; appearance: none; -webkit-appearance: none; }
.range::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--ink) var(--fill, 28%), var(--rule-soft) var(--fill, 28%)); }
.range::-moz-range-track { height: 4px; background: var(--rule-soft); }
.range::-moz-range-progress { height: 4px; background: var(--ink); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border: 3px solid var(--ink); background: var(--sheet); }
.range::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--ink); border-radius: 0; background: var(--sheet); }
.range-scale { display: flex; justify-content: space-between; color: var(--soft); font-size: 12px; }

.mini-table { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: 15px; }
.mini-table th, .mini-table td { padding: 9px 4px; border-block-end: 1px solid var(--rule-soft); }
.mini-table thead th { border-block-end: var(--hair); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); }
.mini-table tbody th { text-align: start; font-weight: 600; }
.mini-table td:last-child { font-weight: 800; }
.mini-table .is-up { color: var(--rise); }
.mini-table .is-down { color: var(--fall); }
.mini-note { margin-top: 8px; color: var(--soft); font-size: 13px; }

/* Vehicle picker */
.vehicle-selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vehicle-selects label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 600; min-width: 0; }
.vehicle-selects label[hidden] { display: none; }
.vehicle-selects label:last-child:nth-child(odd), #vehicle-variant-wrap { grid-column: 1 / -1; }
.vehicle-field select {
  width: 100%; min-height: 44px; padding: 0 36px 0 12px; border: var(--hair); border-radius: 0;
  background: var(--sheet); color: var(--ink); font: 600 15px var(--text);
  appearance: none; -webkit-appearance: none;
}
.vehicle-field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.vehicle-field select:disabled { color: var(--soft); background-color: var(--wash); cursor: not-allowed; }
.vehicle-help { margin-top: 8px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.vehicle-card { margin-top: 10px; padding: 12px 14px; border: var(--hair); border-block-start: var(--rule); background: var(--sheet); animation: card-in 0.3s var(--ease-out); }
.vehicle-card[hidden] { display: none; }
.vehicle-tank strong { font: 900 34px/1 var(--display); font-stretch: 68%; }
.vehicle-tank { font-weight: 700; }
.vehicle-name { margin-top: 4px; font-weight: 700; }
.vehicle-name span { display: block; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.vehicle-octane, .vehicle-source, .vehicle-override { margin-top: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.vehicle-override { color: var(--ink); }
.vehicle-clear { margin-top: 6px; margin-inline-start: -4px; }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }


/* History */
.history-controls { display: grid; gap: 10px; margin-bottom: 16px; }
.chart { border: var(--hair); border-block-start: var(--rule); background: var(--sheet); padding: 12px 8px 8px; }
.chart-frame { position: relative; width: 100%; }
.chart-frame svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart figcaption { padding: 8px 4px 0; color: var(--soft); font-size: 13px; }
.chart .grid-line { stroke: var(--rule-soft); stroke-width: 1; }
.chart .axis-label { fill: var(--soft); font: 500 12px var(--text); }
.chart .series { fill: none; stroke-width: 2.5; stroke-linejoin: miter; stroke-dasharray: 1; }
.js-motion .chart-frame .series { stroke-dashoffset: 1; }

.history-summary { margin-top: 16px; max-width: 70ch; font-size: 16px; line-height: 1.5; }
.history-summary strong { font-weight: 800; }

.log-heading { margin: 28px 0 8px; font: 800 22px/1 var(--display); font-stretch: 75%; text-transform: uppercase; }
.table-scroll { overflow-x: auto; }
.log { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--sheet); border: var(--hair); }
.log thead th { padding: 8px 10px; border-block-end: var(--hair); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; text-align: start; }
.log thead th.num { text-align: end; }
.log td, .log tbody th { padding: 8px 10px; border-block-end: 1px solid var(--rule-soft); text-align: start; font-weight: 400; }
.log td.num { text-align: end; }
.log tbody th { white-space: nowrap; }
.log tr.month-row th { padding-block: 10px 6px; border-block-start: var(--hair); border-block-end: 0; background: var(--paper); font-weight: 800; }
.log tr.month-row.is-held th { padding-block: 8px; color: var(--soft); font-weight: 600; }
.log tr.month-row.is-held th span { margin-inline-start: 10px; font-weight: 400; }
.log .change-main { font-size: 15px; justify-content: flex-end; }
.log td strong { font: 850 18px/1 var(--display); font-stretch: 70%; }
.log tr.is-current th::after { content: "Now"; margin-inline-start: 6px; padding: 0 5px; border: var(--hair); font-size: 12px; font-weight: 800; text-transform: uppercase; }

/* Chart interaction (month cursor, readout, legend) */
.chart-frame { touch-action: pan-y; cursor: crosshair; border-radius: 0; }
.chart-frame:focus-visible { outline-offset: 4px; }
.js-motion .chart-frame.is-drawn .series { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s var(--ease-out); }
.chart-frame.is-drawn .series:nth-of-type(2) { transition-delay: 80ms; }
.chart-frame.is-drawn .series:nth-of-type(3) { transition-delay: 160ms; }
.chart-frame.is-drawn .series:nth-of-type(4) { transition-delay: 240ms; }
.chart .cursor, .chart .cursor-dot { transition: transform 0.32s var(--ease-out); }
.chart-frame.is-instant .cursor, .chart-frame.is-instant .cursor-dot { transition: none; }
.chart .cursor-band { fill: var(--ink); opacity: 0.05; }
.chart .cursor-line { stroke: var(--ink); stroke-width: 1.5; }
.chart .cursor-dot circle { stroke: var(--sheet); stroke-width: 2.5; }
.js-motion .chart-frame:not(.is-drawn) .cursor-dot { opacity: 0; }
.chart-frame.is-drawn .cursor-dot { opacity: 1; transition: transform 0.32s var(--ease-out), opacity 0.3s ease 1s; }
.readout { padding: 4px 4px 12px; border-block-end: 1px solid var(--rule-soft); margin-bottom: 8px; }
.readout-month { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.readout-month strong { font: 850 22px/1 var(--display); font-stretch: 72%; text-transform: uppercase; }
.readout-now { padding: 0 5px; border: var(--hair); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-top: 8px; }
.readout-grid dt { font-size: 13px; color: var(--ink-2); }
.readout-grid dd { display: flex; align-items: baseline; gap: 8px; }
.readout-grid dd strong { font: 900 28px/1 var(--display); font-stretch: 68%; }
.readout-grid dd span { font-size: 13px; font-weight: 700; }
.readout-grid .is-up { color: var(--rise); }
.readout-grid .is-down { color: var(--fall); }
.readout-grid .is-flat { color: var(--soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 4px 0; color: var(--ink-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 3px; background: var(--c); }
@media (min-width: 760px) { .readout-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Sparklines in the price box */
.spark { display: block; width: 120px; height: 26px; margin-top: 8px; overflow: visible; }
.spark path { fill: none; stroke: var(--c); stroke-width: 2; stroke-dasharray: 1; }
.js-motion .spark path { stroke-dashoffset: 1; }
.spark circle { fill: var(--c); transform-box: fill-box; transform-origin: center; }
.js-motion .spark circle { transform: scale(0); }
.js-motion .price-box.is-drawn .spark path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s var(--ease-out); }
.js-motion .price-box.is-drawn .spark circle { transform: scale(1); transition: transform 0.35s var(--ease-out) 0.75s; }
.price-box.is-drawn tr:nth-child(2) .spark path { transition-delay: 60ms; }
.price-box.is-drawn tr:nth-child(3) .spark path { transition-delay: 120ms; }
.price-box.is-drawn tr:nth-child(4) .spark path { transition-delay: 180ms; }
.price-box tr.is-biggest .spark path { stroke: var(--ink); }
.price-box tr.is-biggest .spark circle { fill: var(--ink); }
@media (min-width: 760px) {
  .grade-cell { display: grid; grid-template-columns: auto 1fr; column-gap: 20px; align-items: center; }
  .grade-cell .grade-name, .grade-cell .grade-ar { grid-column: 1; }
  .grade-cell .spark { grid-column: 2; grid-row: 1 / 3; justify-self: end; margin-top: 0; width: 132px; height: 30px; }
}
.price-box tbody tr { transition: background-color 0.2s ease; }
.price-box tbody tr:not(.is-biggest):hover { background-color: #fafaf7; }

/* Sliding selection in segmented groups */
.segmented.has-thumb { position: relative; isolation: isolate; }
.seg-thumb { position: absolute; inset-block-start: 0; inset-inline-start: 0; z-index: -1; background: var(--ink); pointer-events: none; }
.seg-thumb.is-ready { transition: transform 0.34s var(--ease-out), width 0.34s var(--ease-out), height 0.34s var(--ease-out); }
.segmented.has-thumb button[aria-checked="true"] { background: transparent; }
.segmented.has-thumb button { background: transparent; transition: color 0.2s ease; }
.segmented.has-thumb button:not([aria-checked="true"]) { background: var(--sheet); }
.segmented.has-thumb button:not([aria-checked="true"]):hover { background: var(--wash); }

/* Press feedback */
.segmented button, .step, .note-count button, .band-button, .text-button, .share-options button, .section-nav a, .tabbar a, .sheet-close {
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease;
}
.segmented button:active, .step:active:not(:disabled), .note-count button:active:not(:disabled), .band-button:active:not(:disabled), .share-options button:active, .sheet-close:active { transform: scale(0.96); }
.tabbar a:active { transform: scale(0.94); }
.note { transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease; }
.note:active, .note.is-adding { transform: scale(0.95); }
.note-count output { display: inline-block; }
.note-count output.is-bumped { animation: bump 0.32s var(--ease-out); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.answer-figure strong, .total-line strong { display: inline-block; }
.answer-change { transition: background-color 0.25s ease, color 0.25s ease; }

/* Share sheet entrance */
.sheet[open] { animation: sheet-in 0.32s var(--ease-out); }
.sheet[open]::backdrop { animation: fade-in 0.25s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Colophon */
.colophon { border-block-start: var(--rule); padding-block: 22px 28px; background: var(--paper); }
.colophon-inner { display: grid; gap: 12px; }
.disclaimer { max-width: 60ch; font-size: 15px; }
.colophon-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; font-weight: 700; }
.colophon-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }
.colophon-links svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* Mobile tab bar */
.tabbar {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  border-block-start: var(--rule); background: var(--paper);
}
.tabbar a {
  display: grid; justify-items: center; align-content: center; gap: 3px; height: var(--tabbar-h);
  font-size: 12px; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: 0.03em;
}
.tabbar a + a { border-inline-start: 1px solid var(--rule-soft); }
.tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; }
.tabbar a.is-active { color: #fff; background: var(--ink); }
.tabbar :focus-visible { outline-offset: -4px; }

/* Share sheet */
.sheet { width: min(440px, 100% - 2 * var(--gutter)); padding: 0; border: var(--rule); border-radius: 0; color: var(--ink); background: var(--paper); }
.sheet::backdrop { background: rgb(18 18 18 / 0.55); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: #fff; background: var(--red); }
.sheet-head h2 { font: 850 26px/1 var(--display); font-stretch: 68%; text-transform: uppercase; }
.sheet-close { display: grid; place-items: center; width: 40px; height: 40px; border: 1.5px solid #fff; background: transparent; color: #fff; }
.sheet-close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; }
.sheet-close:focus-visible { outline-color: #fff; }
.sheet > p { padding: 14px 16px 0; color: var(--ink-2); }
.share-options { display: grid; margin: 12px 16px 0; border: var(--hair); background: var(--sheet); }
.share-options button { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 14px; border: 0; background: transparent; text-align: start; font-size: 14px; color: var(--ink-2); }
.share-options button + button { border-block-start: var(--hair); }
.share-options button:hover { background: var(--wash); }
.share-options svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.share-options strong { display: block; color: var(--ink); font-size: 16px; }
.share-status { min-height: 1.5em; padding: 10px 16px 16px; font-size: 14px; color: var(--ink-2); }

/* ≥ 760px */
@media (min-width: 760px) {
  :root { --gutter: 32px; }
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .band-inner { min-height: 68px; }
  .wordmark { font-size: 38px; }
  .band-note { display: block; }
  .section-nav { display: flex; gap: 2px; margin-inline-start: auto; }
  .section-nav a { padding: 4px 10px; font-size: 14px; font-weight: 700; text-decoration: none; }
  .section-nav a:hover { background: var(--ink); color: #fff; }
  .front { padding-block: 32px 56px; }
  .price-box td, .price-box tbody th { padding: 16px 18px; }
  .price-box thead th { padding: 9px 18px; }
  .grade-name { font-size: 26px; }
  .col-prev { display: table-cell; color: var(--soft); font: 700 26px/1 var(--display); font-stretch: 70%; }
  thead .col-prev { font: inherit; font-size: 12px; font-weight: 700; color: var(--ink); }
  .figure-sub .was { display: none; }
  .segmented.is-fuel { display: flex; }
  .grade-ar { font-size: 14px; }
  .change-main { font-size: 22px; }
  .module { padding-block-end: 72px; }
  .module-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px; }
  .answer { padding: 24px; }
  .history-controls { grid-template-columns: 1fr auto; align-items: center; }
  .colophon-inner { grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; }
}

/* ≥ 1080px: margin column */
@media (min-width: 1080px) {
}

@media (max-width: 380px) {
  .band-button span:not([lang]) { display: none; }
  .price-box td, .price-box tbody th { padding: 10px 9px; }
  .grade-name { font-size: 18px; }
  .notes { gap: 6px; }
}
@media (max-width: 759px) {
  .note { aspect-ratio: 1.55; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .vehicle-card { animation: none; }
  .spark path, .chart .series { stroke-dashoffset: 0 !important; }
  .spark circle { transform: none !important; }
  .chart-frame .cursor-dot { opacity: 1 !important; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* History as monthly columns (one grade) */
.chart .column { cursor: pointer; }
.chart .column-hit { fill: transparent; }
.chart .bar { fill: var(--rule-soft); transition: fill 0.18s ease; }
.chart .column:hover .bar { fill: var(--soft); }
.chart .column.is-selected .bar { fill: var(--ink); }
.chart .bar-value { fill: var(--ink-2); font: 700 13px var(--text); }
.chart .column.is-selected .bar-value { fill: var(--ink); font-size: 14px; font-weight: 800; }
.chart .baseline { stroke: var(--ink); stroke-width: 1.5; }
.js-motion .chart-frame .bar { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.js-motion .chart-frame.is-drawn .bar { transform: scaleY(1); transition: transform 0.7s var(--ease-out) calc(var(--i) * 45ms), fill 0.18s ease; }
.js-motion .chart-frame .bar-value { opacity: 0; }
.js-motion .chart-frame.is-drawn .bar-value { opacity: 1; transition: opacity 0.3s ease calc(var(--i) * 45ms + 0.45s); }
.legend .legend-note { margin-inline-start: auto; color: var(--soft); }
.readout-grid > div.is-focus dd strong { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .chart-frame .bar { transform: none !important; }
  .chart-frame .bar-value { opacity: 1 !important; }
}

/* Tools: one horizontal track, a tool at a time. The names above ride along with the swipe. */
.tools { --tool-col: calc(920px + 2 * var(--gutter)); padding-block: 26px 56px; }
.tool-pick { max-width: var(--tool-col); margin-bottom: 18px; }
.ticker { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
.ticker-window { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent); }
.ticker-rail { display: inline-flex; align-items: baseline; gap: clamp(22px, 5vw, 48px); white-space: nowrap; will-change: transform; }
.ticker-rail button { padding: 4px 0; border: 0; background: none; color: color-mix(in srgb, var(--c) calc(var(--on, 0) * 100%), var(--soft)); font: 900 clamp(40px, 8vw, 72px)/1 var(--display); font-stretch: 62%; text-transform: uppercase; opacity: calc(0.35 + var(--on, 0) * 0.65); transform: scale(calc(0.72 + var(--on, 0) * 0.28)); transform-origin: 50% 80%; cursor: pointer; }
.ticker-rail button:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
#tab-budget, #budget .tool-face { --c: #0a6aa8; }
#tab-tank, #tank .tool-face { --c: var(--red); }
#tab-history, #history .tool-face { --c: #8a6400; }
.ticker-arrow { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer; transition: background-color 0.16s ease, color 0.16s ease, opacity 0.2s ease, transform 0.12s var(--ease-out); }
.ticker-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ticker-arrow:hover:not(:disabled) { color: var(--paper); background: var(--ink); }
.ticker-arrow:active:not(:disabled) { transform: scale(0.92); }
.ticker-arrow:disabled { opacity: 0.25; cursor: default; }
.ticker-arrow:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.tool-track { display: flex; align-items: flex-start; width: min(100%, var(--tool-col)); margin-inline: auto; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.tool-track::-webkit-scrollbar { display: none; }
.tool-track > .tool-panel { flex: 0 0 100%; min-width: 0; padding-block: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.tool-track > .tool-panel > .wrap { max-width: none; border-block-start: 0; padding-block-start: 0; }
/* Each tool opens with its own coloured face, so the colour travels with the tool */
.tool-panel .tool-face { display: grid; justify-items: center; gap: 4px; margin: 0 0 24px; padding: 26px 18px 24px; border-radius: 14px; color: #fff; background: var(--c); text-align: center; }
.tool-face svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tool-face h2 { font: 900 clamp(26px, 4.4vw, 44px)/0.95 var(--display); font-stretch: 64%; text-transform: uppercase; text-wrap: balance; }
.tool-face p { max-width: 34ch; margin: 6px 0 0; color: #fff; font-size: clamp(14px, 1.8vw, 17px); font-weight: 600; line-height: 1.4; opacity: 0.95; text-wrap: balance; }
/* Drags that belong to a control stay with it, and never turn into a swipe between tools */
.ruler-track { overscroll-behavior-x: contain; }

/* Budget: set an amount, see the litres */
.money { padding-block: 4px 8px; }
.money-output { display: grid; justify-items: center; gap: 6px; text-align: center; }
.money-output strong { font: 900 clamp(84px, 11vw, 168px)/0.88 var(--display); font-stretch: 64%; letter-spacing: -0.01em; }
.money-output-unit { padding-top: 4px; font-size: 20px; font-weight: 600; }
.money.is-empty .money-output strong { color: var(--rule-soft); }
.money-grades { margin-top: 26px; }
.money-line { display: inline-block; margin-top: 18px; padding: 5px 10px; font-size: 17px; font-weight: 700; }
.money-line.is-up { color: #fff; background: var(--rise); }
.money-line.is-down { color: #fff; background: var(--fall); }
.money-line.is-flat { background: var(--wash); }

/* Budget amount stepper */
#budget-spend.is-nudged { animation: nudge 0.22s var(--ease-out); }
@keyframes nudge { 0% { transform: scale(0.94); } 100% { transform: scale(1); } }
.money-step { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 12px; border: var(--rule); background: var(--sheet); color: var(--ink); transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.money-step svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: square; }
.money-step:hover:not(:disabled) { color: #fff; background: var(--ink); }
.money-step:active:not(:disabled) { transform: scale(0.92); }
.money-step:disabled { color: var(--rule-soft); border-color: var(--rule-soft); cursor: not-allowed; }

/* Same-litres answer */
.keep { display: grid; width: fit-content; gap: 2px; margin-top: 16px; padding: 14px 18px 16px; color: #fff; background: var(--ink); border-inline-start: 0; max-width: 100%; }
.keep[hidden] { display: none; }
.keep-label { color: #d7d7d1; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.keep-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.keep-figure span { font-size: 18px; font-weight: 600; color: #d7d7d1; }
.keep-figure strong { font: 900 clamp(40px, 4.4vw, 58px)/1 var(--display); font-stretch: 66%; letter-spacing: -0.005em; }
.keep-total { margin-top: 4px; font-size: 16px; color: #f3f3ef; }
.keep-total b { padding: 1px 6px; color: var(--ink); background: #fff; font-weight: 800; }
@media (max-width: 759px) {
  .money-stepper { grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 8px; }
  .money-step { width: 48px; height: 48px; margin-bottom: 10px; }
  .keep { display: grid; }
}
@media (prefers-reduced-motion: reduce) { #budget-spend.is-nudged { animation: none; } }

.keep.is-less .keep-figure strong { color: #7ee2a8; }

/* Instagram follow link and card */
.ig { position: relative; display: inline-flex; perspective: 900px; }
.ig-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.ig-glyph { width: 18px !important; height: 18px !important; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ig-glyph .ig-dot { fill: currentColor; stroke: none; }
.ig-link:hover .ig-glyph { stroke: #d62976; }
.ig-link:hover .ig-glyph .ig-dot { fill: #d62976; }
.ig-card {
  --rx: 0deg; --ry: 0deg;
  position: absolute; inset-block-end: calc(100% + 12px); inset-inline-start: 0; z-index: 30;
  display: grid; gap: 10px; width: 290px; padding: 14px 16px 16px;
  border: var(--hair); border-block-start: var(--rule); background: var(--sheet); color: var(--ink);
  font-weight: 400; text-align: start; white-space: normal;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform-origin: 30% 100%;
  transform: translateY(6px) scale(0.98) rotateX(var(--rx)) rotateY(var(--ry));
  transition: opacity 0.15s ease-in, transform 0.15s ease-in, visibility 0s linear 0.15s;
}
.ig-card::after { content: ""; position: absolute; inset-inline: 0; inset-block-start: 100%; height: 14px; }
.ig.is-open .ig-card {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0) scale(1) rotateX(var(--rx)) rotateY(var(--ry));
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out), visibility 0s;
}
.ig-head { display: flex; align-items: center; gap: 12px; }
.ig-ring { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(from 210deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75); }
.ig-ring > span { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--sheet); }
.ig-ring img { width: 40px; height: 40px; }
.ig-names { display: grid; }
.ig-names b { font-size: 16px; font-weight: 800; }
.ig-names small { color: var(--soft); font-size: 13px; }
.ig-bio { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.ig-cta { padding-top: 10px; border-top: 1px solid var(--rule-soft); font-size: 13px; font-weight: 700; }
@media (max-width: 759px) { .ig-card { display: none; } }
@media (prefers-reduced-motion: reduce) { .ig-card, .ig.is-open .ig-card { transform: none; transition: opacity 0.01ms; } }

/* Drawn wordmark */
.wordmark { display: inline-flex; align-items: center; color: #fff; }
.wordmark-svg { display: block; height: 34px; width: auto; }
.wordmark .wm-a { fill: currentColor; }
.wordmark .wm-b { fill: #ffd9de; }
.wordmark .wm-dot { fill: var(--buff); }
.wordmark.is-dark { color: var(--ink); }
.wordmark.is-dark .wm-b, .wordmark.is-dark .wm-dot { fill: var(--red); }
@media (min-width: 760px) { .wordmark-svg { height: 40px; } }

/* Car picker: choice between official GCC tank sizes */
.vehicle-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.vehicle-choices .text-button { margin: 0; min-height: 32px; padding: 0 10px; border: var(--hair); text-decoration: none; font-size: 13px; }
.vehicle-choices .text-button.is-on { color: #fff; background: var(--ink); }
.vehicle-octane .text-button { margin-inline-start: 4px; min-height: 28px; font-size: 13px; }

/* Recommended fuel for the chosen car */
.segmented.is-fuel { row-gap: 14px; padding-top: 10px; }
.segmented button.is-recommended { position: relative; box-shadow: inset 0 0 0 2px var(--ink); }
.fuel-tag { position: absolute; inset-block-start: -9px; inset-inline-end: 6px; padding: 1px 6px; border: 1.5px solid var(--ink); color: #fff; background: var(--red); font-size: 10px; font-weight: 800; line-height: 1.3; letter-spacing: 0.04em; text-transform: uppercase; pointer-events: none; animation: fuel-tag-in 0.32s var(--ease-out); }
.segmented button[aria-checked="true"] .fuel-tag { border-color: #fff; }
@keyframes fuel-tag-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fuel-advice { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.fuel-advice b { color: var(--ink); }
.fuel-advice.is-different { padding: 8px 10px; border: 1.5px solid var(--red); background: var(--sheet); color: var(--ink); }
.fuel-advice .text-button { margin-inline-start: 4px; min-height: 28px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .fuel-tag { animation: none; } }

/* Powertrain label on the chosen car */
.vehicle-drive { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 2px 8px; border: var(--hair); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.vehicle-drive i { width: 8px; height: 8px; background: var(--ink); }
.vehicle-drive.is-diesel i { background: var(--grade-diesel); }
.vehicle-drive.is-petrol i { background: var(--grade-mumtaz); }
.vehicle-drive.is-hybrid i, .vehicle-drive.is-plugin_hybrid i { background: linear-gradient(90deg, var(--grade-mumtaz) 50%, var(--fall) 50%); }
.vehicle-drive.is-electric i { background: var(--fall); }

/* Electric car: the tank calculator steps aside */
fieldset.is-off { opacity: 0.4; }
fieldset.is-off * { cursor: not-allowed; }
.ev-note { display: grid; gap: 10px; }
.ev-note[hidden], #tank-answer-body[hidden] { display: none; }
.ev-title { font: 900 clamp(34px, 3.6vw, 52px)/0.95 var(--display); font-stretch: 66%; text-transform: uppercase; letter-spacing: -0.005em; }
.ev-text { max-width: 46ch; color: var(--ink-2); font-size: 16px; line-height: 1.5; }

/* ---------- Tank: pump design (three steps) ---------- */
.pt-track { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; border: 1.5px solid var(--ink); background: var(--sheet); }
.pt-track li + li { border-inline-start: 1px solid var(--rule-soft); }
.pt-track button { display: grid; gap: 2px; width: 100%; padding: 12px 14px; border: 0; background: transparent; color: var(--ink); text-align: start; transition: background-color 0.2s ease, color 0.3s ease; }
.pt-track button:not(:disabled):hover { background: var(--wash); }
.pt-track small { color: var(--soft); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.pt-track b { font: 850 20px/1.05 var(--display); font-stretch: 72%; text-transform: uppercase; }
.pt-track button:disabled { cursor: not-allowed; color: var(--rule-soft); }
.pt-track button:disabled small { color: var(--rule-soft); }
.pt-track li.is-skipped b { text-decoration: line-through; }
.pt-bar { position: absolute; inset-block-end: -1.5px; inset-inline-start: 0; width: calc(100% / 3); height: 5px; background: var(--red); transition: transform 0.5s var(--ease-out); }
.pt-stage { border: 1.5px solid var(--ink); border-block-start: 0; background: var(--sheet); overflow: hidden; }
.pt-panel { padding: 24px; animation: pt-in 0.5s var(--ease-out); }
.pt-panel[hidden] { display: none; }
@keyframes pt-in { from { opacity: 0; transform: translateX(var(--from, 24px)); } to { opacity: 1; transform: none; } }
.pt-q { margin-bottom: 16px; font: 900 clamp(28px, 3.4vw, 36px)/1 var(--display); font-stretch: 66%; text-transform: uppercase; }
.pt-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pt-pick label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; }
.pt-pick select { width: 100%; min-height: 48px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 0; background: var(--sheet); color: var(--ink); font: 600 16px var(--text); }
.pt-pick select:disabled { color: var(--soft); border-color: var(--rule-soft); background: var(--paper); }
.pt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 22px; }
.pt-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; color: #fff; background: var(--ink); font-weight: 800; transition: transform 0.15s var(--ease-out), background-color 0.2s ease; }
.pt-btn:hover:not(:disabled) { background: var(--ink-2); }
.pt-btn:active:not(:disabled) { transform: scale(0.97); }
.pt-btn:disabled { color: var(--soft); background: var(--wash); cursor: not-allowed; }
.pt-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.pt-link { padding: 0; border: 0; background: none; color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }
.pt-car { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-bottom: 14px; border-block-end: 1px solid var(--rule-soft); }
.pt-car b { font-size: 17px; }
.pt-note { color: var(--soft); font-size: 13px; }
.pt-drive { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: var(--hair); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.pt-drive i { width: 8px; height: 8px; background: var(--ink); }
.pt-drive.is-diesel i { background: #8a6400; } .pt-drive.is-petrol i { background: #b0166a; } .pt-drive.is-electric i { background: var(--fall); }
.pt-drive.is-hybrid i, .pt-drive.is-plugin_hybrid i { background: linear-gradient(90deg, #b0166a 50%, var(--fall) 50%); }
.pt-ev { display: grid; gap: 8px; margin-top: 18px; padding: 18px; border: 1.5px solid var(--fall); }
.pt-ev[hidden] { display: none; }
.pt-ev-title { font: 900 clamp(28px, 3.4vw, 40px)/0.95 var(--display); font-stretch: 66%; text-transform: uppercase; }
.pt-two { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 32px; align-items: start; margin-top: 20px; }
.pt-two[hidden] { display: none; }
.pt-tank { position: relative; height: 300px; margin-top: 14px; border: 3px solid var(--ink); background: var(--paper); }
.pt-tank::before { content: ""; position: absolute; inset-block-start: -14px; inset-inline-end: 24px; width: 34px; height: 14px; border: 3px solid var(--ink); border-block-end: 0; background: var(--paper); }
.pt-level { position: absolute; inset-inline: 0; inset-block-end: 0; height: var(--level, 33%); background: var(--fuel, #b0166a); transition: height 0.7s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.4s ease; }
.pt-level::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; height: 3px; background: rgb(255 255 255 / 0.45); transform-origin: left; animation: pt-slosh 2.4s ease-in-out infinite; }
@keyframes pt-slosh { 50% { transform: scaleX(0.82); } }
.pt-marks span { position: absolute; inset-inline-start: 0; inset-block-end: calc(var(--v) / 150 * 100%); display: flex; align-items: center; gap: 4px; transform: translateY(50%); font-size: 11px; font-weight: 800; }
.pt-marks span::before { content: ""; width: 12px; height: 2px; background: var(--ink); }
.pt-marks b { padding: 0 4px; background: var(--paper); }
.pt-read { position: absolute; inset-block-start: 14px; inset-inline-start: 50%; transform: translateX(-50%); padding: 6px 12px; color: #fff; background: var(--ink); font: 900 36px/1 var(--display); font-stretch: 66%; white-space: nowrap; }
.pt-controls { display: grid; gap: 20px; }
.pt-label { margin-bottom: 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.pt-fuels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 8px; padding-top: 6px; }
.pt-fuel { position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px; border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink); font-weight: 750; text-align: start; transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s var(--ease-out); }
.pt-fuel i { width: 12px; height: 12px; background: var(--c); box-shadow: 0 0 0 1.5px #fff; }
.pt-fuel:hover { background: var(--wash); }
.pt-fuel:active { transform: scale(0.98); }
.pt-fuel[aria-checked="true"] { color: #fff; background: var(--ink); }
.pt-fuel.is-recommended { box-shadow: inset 0 0 0 1px var(--ink); }
.pt-rec { position: absolute; inset-block-start: -9px; inset-inline-end: 8px; padding: 1px 6px; border: 1.5px solid var(--ink); color: #fff; background: var(--red); font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; animation: pt-pop 0.35s var(--ease-out); }
.pt-fuel[aria-checked="true"] .pt-rec { border-color: #fff; }
@keyframes pt-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pt-advice { margin-top: 12px; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.pt-advice[hidden] { display: none; }
.pt-advice b { color: var(--ink); }
.pt-advice.is-different { padding: 8px 10px; border: 1.5px solid var(--red); background: var(--sheet); color: var(--ink); }
.pt-stepper { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; border: 1.5px solid var(--ink); background: var(--sheet); }
.pt-stepper button { height: 56px; border: 0; background: transparent; color: var(--ink); font-size: 26px; font-weight: 700; }
.pt-stepper button:hover:not(:disabled) { background: var(--wash); }
.pt-stepper button:disabled { color: var(--rule-soft); }
.pt-stepper output { text-align: center; font: 900 30px/1 var(--display); font-stretch: 70%; }
#tank-size-range { width: 100%; margin-top: 12px; accent-color: var(--ink); }
.pt-pump { color: #fff; background: var(--ink); border: 3px solid var(--ink); }
.pt-pump-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 20px; background: var(--red); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.pt-live { display: inline-flex; align-items: center; gap: 6px; }
.pt-live::before { content: ""; width: 8px; height: 8px; background: #fff; animation: pt-blink 1s steps(2) infinite; }
.pt-pump.is-done .pt-live::before { animation: none; }
@keyframes pt-blink { 50% { opacity: 0; } }
.pt-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; padding: 14px 20px; border-block-end: 1px solid #3a3a36; }
.pt-row:last-child { border-block-end: 0; }
.pt-row small { color: #d7d7d1; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.pt-row strong { text-align: end; font: 900 clamp(48px, 8vw, 92px)/0.9 var(--display); font-stretch: 62%; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.pt-row.is-price strong { color: #d7d7d1; font-size: clamp(26px, 3.4vw, 36px); }
.pt-after { display: grid; gap: 14px; margin-top: 18px; opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.5s var(--ease-out); }
.pt-after.is-on { opacity: 1; transform: none; }
.pt-tag { width: fit-content; padding: 4px 10px; color: #fff; font-weight: 800; }
.pt-tag.is-up { background: var(--rise); } .pt-tag.is-down { background: var(--fall); } .pt-tag.is-flat { color: var(--ink); background: var(--wash); }
.pt-bars { display: grid; gap: 8px; max-width: 520px; }
.pt-bars div { display: grid; grid-template-columns: 92px minmax(0, 1fr) 90px; align-items: center; gap: 10px; font-size: 14px; }
.pt-bars i { display: block; width: var(--w, 0%); height: 14px; background: var(--c, var(--ink)); transition: width 0.9s var(--ease-out); }
.pt-bars span:last-child { text-align: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.pt-fills-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pt-fills-row .pt-label { margin: 0; }
.pt-month { font-size: 16px; }
@media (max-width: 759px) {
  .pt-panel { padding: 18px 16px; }
  .pt-pick { grid-template-columns: 1fr; }
  .pt-two { grid-template-columns: 1fr; gap: 18px; }
  .pt-tank { height: 200px; }
  .pt-track button { padding: 10px; }
  .pt-track b { font-size: 16px; }
  .pt-track small { font-size: 11px; }
  .pt-row { grid-template-columns: 80px minmax(0, 1fr); padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .pt-panel, .pt-rec { animation: none; }
  .pt-level::before, .pt-live::before { animation: none; }
  .pt-level, .pt-bar, .pt-bars i, .pt-after { transition: none; }
}

/* ---------- Tidy: Budget and History (the tool track sets the 920px column) ---------- */

/* Budget: spend and litres on one line, then one tidy summary */
#budget .money { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 0; text-align: center; }
/* Amount: − BHD 10 +, with a ruler underneath that slides to match */
.money-dial { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 6px; min-width: 0; }
.money-dial-label { color: var(--soft); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
#budget .money-stepper { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 4vw, 28px); }
#budget .money-step { width: 48px; height: 48px; margin: 0; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
#budget .money-step svg { width: 22px; height: 22px; stroke-width: 2.6; stroke-linecap: round; }
#budget .money-step:disabled { opacity: 0.3; color: var(--ink); border-color: var(--ink); }
.money-amount { display: inline-flex; align-items: baseline; gap: 6px; }
.money-cur { font: 900 clamp(26px, 3.6vw, 36px)/1 var(--display); font-stretch: 64%; }
#budget-spend { min-width: 2.3ch; padding: 0; border: 0; border-block-end: 3px solid transparent; border-radius: 0; background: transparent; color: var(--ink); font: 900 clamp(48px, 7vw, 72px)/1 var(--display); font-stretch: 64%; text-align: center; -moz-appearance: textfield; transition: border-color 0.2s ease; }
#budget-spend::-webkit-outer-spin-button, #budget-spend::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#budget-spend:hover { border-block-end-color: var(--rule-soft); }
#budget-spend:focus { outline: none; border-block-end-color: var(--red); }
#budget-spend:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.ruler { position: relative; width: 100%; min-width: 0; margin-top: 6px; }
.ruler-track { overflow-x: scroll; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: grab; touch-action: pan-x; outline: none; mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
.ruler-track::-webkit-scrollbar { display: none; }
.ruler-track:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.ruler-tape { display: flex; align-items: flex-start; height: 64px; }
.ruler-tape i { position: relative; flex: none; width: var(--gap); height: 16px; scroll-snap-align: center; }
.ruler-tape i::before { content: ""; position: absolute; inset-inline-start: 50%; inset-block-start: 0; width: 2px; height: 100%; margin-inline-start: -1px; background: var(--rule-soft); }
.ruler-tape i.mid { height: 26px; }
.ruler-tape i.mid::before { background: var(--soft); }
.ruler-tape i.big { height: 36px; }
.ruler-tape i.big::before { width: 3px; background: var(--ink); }
.ruler-tape i span { position: absolute; inset-block-start: 40px; inset-inline-start: 50%; transform: translateX(-50%); font: 800 13px var(--text); font-style: normal; }
.ruler-pin { position: absolute; inset-block-start: 0; inset-inline-start: 50%; width: 4px; height: 44px; margin-inline-start: -2px; border-radius: 2px; background: var(--red); pointer-events: none; }
.ruler-pin::before { content: ""; position: absolute; inset-block-start: -10px; inset-inline-start: 50%; margin-inline-start: -8px; border-inline: 8px solid transparent; border-block-start: 10px solid var(--red); }
/* Result: one centred column */
#budget .money-output { justify-items: center; gap: 4px; margin: 0; padding-block: 20px 22px; text-align: center; border-block: 1px solid var(--rule-soft); }
#budget .money-output strong { font-size: clamp(64px, 8vw, 112px); }
#budget .money-output-unit { padding-top: 0; font-size: 16px; color: var(--ink-2); }
/* Budget's fuel choice is the same control as History's fuel choice. */
#budget .money-grades { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; margin: 0; padding: 0; border: var(--hair); }
#budget .money-grades button { min-height: 40px; padding: 0 10px; justify-content: center; border: 0; font-size: 13px; white-space: nowrap; }
#budget .money-grades button + button { border-inline-start: 1px solid var(--rule-soft); }
#budget .money-line { display: block; margin: 0; padding: 0; color: var(--ink-2); background: none; font-size: 15px; font-weight: 600; text-wrap: balance; }
#budget .money-line.is-up { color: var(--rise); background: none; }
#budget .money-line.is-down { color: var(--fall); background: none; }
#budget .keep { width: 100%; margin: 0; padding: 16px 0 0; gap: 4px; justify-items: center; color: var(--ink); background: none; border-block-start: 1px solid var(--rule-soft); text-wrap: balance; }
#budget .keep-figure { justify-content: center; }
#budget .keep-label { color: var(--soft); font-size: 12px; letter-spacing: 0.06em; }
#budget .keep-figure strong { font-size: clamp(30px, 3.4vw, 42px); color: var(--ink); }
#budget .keep.is-less .keep-figure strong { color: var(--fall); }
#budget .keep-figure span { color: var(--ink-2); font-size: 16px; }
#budget .keep-total { color: var(--ink-2); font-size: 15px; }
#budget .keep-total b { padding: 0; color: var(--ink); background: none; font-weight: 800; }

/* History: one row of grades, a calm chart, and the months shown chosen under it */
#history .history-controls { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
#history .history-controls .segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 0; border: var(--hair); }
#history .history-controls .segmented button { min-height: 40px; padding: 0 10px; justify-content: center; border: 0; font-size: 13px; white-space: nowrap; }
#history .history-controls .segmented button + button { border-inline-start: 1px solid var(--rule-soft); }
#history .chart { padding: 14px 12px 10px; border: var(--hair); }
#history .readout { padding: 0 4px 14px; margin-bottom: 10px; }
#history .readout-month strong { font-size: 20px; }
#history .readout-now { padding: 0; border: 0; color: var(--red); letter-spacing: 0.04em; }
#history .readout-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; }
#history .readout-grid dt { font-size: 12px; color: var(--soft); }
#history .readout-grid dd strong { font-size: 26px; }
#history .readout-grid dd span { font-size: 12px; }
#history .legend { margin-top: 6px; }
.period { display: grid; gap: 10px; margin-block: 14px 18px; }
.period[hidden] { display: none; }
.period-read { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 10px; min-height: 2.6em; text-align: center; }
.period-read b { font: 900 clamp(24px, 4vw, 32px)/1 var(--display); font-stretch: 66%; }
.period-read span { color: var(--soft); font-size: 14px; font-weight: 700; }
.period-read small { flex-basis: 100%; color: var(--ink-2); font-size: 13px; font-weight: 700; }
/* Stock-chart ranges: one strip, the short ranges share the width and "Since inception" takes what it needs */
.period-ranges { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 0; justify-self: center; width: min(100%, 560px); margin-block-end: 6px; border: var(--hair); background: var(--sheet); }
.period-ranges button { justify-content: center; padding-inline: 12px; border: 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.period-ranges button + button { border-inline-start: 1px solid var(--rule-soft); }
.segmented.period-ranges button:not([aria-checked="true"]) { background: transparent; }
.segmented.period-ranges button:not([aria-checked="true"]):hover { background: var(--wash); }
.period-ranges button:focus-visible { outline: 3px solid var(--red); outline-offset: -3px; }
#history .chart figcaption { font-size: 12px; }
#history .history-summary { margin-top: 18px; color: var(--ink-2); font-size: 15px; }
.log-fold { margin-top: 22px; border-block: 1px solid var(--rule-soft); }
.log-fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 14px 0; cursor: pointer; list-style: none; }
.log-fold > summary::-webkit-details-marker { display: none; }
.log-fold > summary::after { content: ""; width: 10px; height: 10px; margin-inline-start: auto; border-inline-end: 2px solid var(--ink); border-block-end: 2px solid var(--ink); transform: rotate(45deg) translateY(-3px); transition: transform 0.3s var(--ease-out); }
.log-fold[open] > summary::after { transform: rotate(-135deg) translateY(-3px); }
.log-fold > summary:hover { color: var(--ink-2); }
.log-count { color: var(--soft); font: 600 13px var(--text); text-transform: none; letter-spacing: 0; }
.log-fold .table-scroll { padding-block-end: 16px; }
.log-fold[open] .table-scroll { animation: tl-in 0.35s var(--ease-out); }
@keyframes tl-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 759px) {
  #budget .money-grades button { font-size: 12px; padding: 0 4px; }
  #budget .money-grades .swatch { width: 8px; height: 8px; }
  #history .history-controls .segmented button { font-size: 12px; padding: 0 4px; }
  #history .history-controls #history-fuel .swatch { width: 8px; height: 8px; }
  #history .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .log-fold[open] .table-scroll { animation: none; } .log-fold > summary::after { transition: none; } }
#budget .money-grades[hidden], #history .history-controls .segmented[hidden] { display: none; }
