/* Layout: one phone-sized column of screens (garage → charge / trajet → session / conduite) that slide sideways; on a wide screen the app sits in a phone frame on a quiet ground. */
:root {
  --ground: #E8EAED;
  --frame: #121316;
  --bg: #F7F8F9;
  --surface: #FFFFFF;
  --fg: #171A20;
  --muted: #5C5F66;
  --line: #E1E4E8;
  --soft: #EEF0F3;
  --accent: #3457D5;
  --accent-fg: #FFFFFF;
  --warn: #8A4B00;
  --warn-bg: #FFF2DC;
  --good: #17683F;
  --good-bg: #E2F3E9;
  --crit: #B42318;
  --crit-bg: #FDE8E6;
  --glass: #262B33;
  --tire: #1B1D21;
  --rim: #C5CAD1;
  --map-bg: #ECEFF3;
  --map-block: #E1E5EA;
  --map-road: #FFFFFF;
  --shadow: rgba(23, 26, 32, .16);
  --scrim: rgba(10, 12, 16, .38);
  --font-display: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #050607; --frame: #2A2C31; --bg: #0F1013; --surface: #17191D; --fg: #EEF0F3;
    --muted: #9EA2A9; --line: #2A2D33; --soft: #1F2227; --accent: #7B93F2; --accent-fg: #0B0D12;
    --warn: #F2B056; --warn-bg: #2E2414; --good: #5CCB93; --good-bg: #13281E; --crit: #FF8A80; --crit-bg: #3A1715;
    --glass: #0A0B0D; --tire: #060607; --rim: #8E949C;
    --map-bg: #14171B; --map-block: #1B1F25; --map-road: #2B3038;
    --shadow: rgba(0, 0, 0, .55); --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #050607; --frame: #2A2C31; --bg: #0F1013; --surface: #17191D; --fg: #EEF0F3;
  --muted: #9EA2A9; --line: #2A2D33; --soft: #1F2227; --accent: #7B93F2; --accent-fg: #0B0D12;
  --warn: #F2B056; --warn-bg: #2E2414; --good: #5CCB93; --good-bg: #13281E; --crit: #FF8A80; --crit-bg: #3A1715;
  --glass: #0A0B0D; --tire: #060607; --rim: #8E949C;
  --map-bg: #14171B; --map-block: #1B1F25; --map-road: #2B3038;
  --shadow: rgba(0, 0, 0, .55); --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.4;
  display: grid; place-items: center; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, p, dl, dd, dt { margin: 0; }

.app { position: relative; width: 100%; height: 100%; background: var(--bg); overflow: hidden; overflow: clip; }
@media (min-width: 600px) and (min-height: 720px) {
  .app {
    width: 390px; height: min(844px, calc(100% - 56px)); border-radius: 46px;
    box-shadow: 0 0 0 10px var(--frame), 0 40px 90px var(--shadow);
  }
}

/* Screens */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px;
  padding-block: 18px 22px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  overflow-y: auto; overflow-x: hidden; background: var(--bg);
  transition: transform .5s var(--ease), opacity .35s ease;
}
.screen.has-tabs { padding-bottom: 86px; }
.screen.is-next { transform: translateX(100%); }
.screen.is-prev { transform: translateX(-28%); opacity: 0; }
.screen.is-active { transform: none; opacity: 1; }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 12px; flex: none; }
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .34em; text-transform: uppercase; }
.pill {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; flex: none; padding: 0;
}
.icon-btn.ghost { visibility: hidden; }
.icon-btn svg { width: 16px; height: 16px; }

.btn {
  height: 50px; width: 100%; border: 0; border-radius: 6px; font-weight: 600; font-size: 15px;
  letter-spacing: .01em; flex: none; transition: transform .15s ease, background-color .2s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-soft { background: var(--soft); color: var(--fg); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }

/* Garage */
.model { text-align: center; padding-top: 22px; }
.model h1 {
  font-family: var(--font-display); font-weight: 500; font-size: 30px; letter-spacing: -.015em;
  line-height: 1.15; text-wrap: balance;
}
.model .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

.stage { position: relative; flex: 1; min-height: 170px; display: flex; align-items: center; }
.carousel {
  flex: 1; min-width: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior-x: contain; border-radius: 12px;
}
.carousel::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; padding-block: 6px; }
.slide svg { width: 100%; max-width: 360px; height: auto; }
#car3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
#car3d:active { cursor: grabbing; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.nav.prev { left: -6px; }
.nav.next { right: -6px; }

.dots { display: flex; gap: 6px; justify-content: center; }
.dot { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .3s var(--ease), background-color .3s; }
.dot.on { width: 18px; background: var(--fg); }

.specs { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding-block: 14px 6px; }
.specs > div { display: flex; flex-direction: column-reverse; gap: 2px; }
.specs > div + div { border-left: 1px solid var(--line); }
.specs dd { font-family: var(--font-display); font-size: 21px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.specs dt { font-size: 12px; color: var(--muted); }

.hint { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.actions { display: flex; flex-direction: column; }

/* Shared: car header, steppers, chips, results */
.car-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.car-head svg { width: 76px; height: auto; flex: none; }
.car-head .names { display: flex; flex-direction: column; min-width: 0; }
.car-head .make { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.car-head .modelname { font-family: var(--font-display); font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.borne {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; flex: none;
}
.bolt { width: 36px; height: 36px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; flex: none; color: var(--accent); }
.bolt svg { width: 16px; height: 16px; }
.borne-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.borne-name { font-weight: 600; font-size: 15px; }
.borne-meta { font-size: 12.5px; color: var(--muted); }
.borne-real { font-size: 12.5px; color: var(--warn); font-weight: 500; }
.change { font-size: 13px; color: var(--accent); font-weight: 600; flex: none; }

.soc { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--muted); padding-inline: 2px; flex: none; }
.stepper { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 17px; line-height: 1; padding: 0; }
.stepper output { min-width: 52px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 10px; padding: 3px; flex: none; }
.seg button { height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px var(--shadow); }

.amount { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.step { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 22px; line-height: 1; padding: 0; flex: none; }
.value {
  font-family: var(--font-display); font-weight: 300; font-size: 62px; letter-spacing: -.035em;
  line-height: 1; font-variant-numeric: tabular-nums; text-align: center; flex: 1; min-width: 0; white-space: nowrap;
}
input[type="range"] { width: 100%; accent-color: var(--accent); height: 26px; margin: 0; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.chip.on, .chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.result { text-align: center; margin-block: auto; padding-block: 8px; display: flex; flex-direction: column; gap: 2px; }
.result-label { font-size: 13px; color: var(--muted); }
.result-big { font-family: var(--font-display); font-weight: 500; font-size: 44px; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result-range { font-size: 13px; color: var(--muted); text-wrap: balance; }

.details { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; border-top: 1px solid var(--line); padding-top: 12px; flex: none; }
.details > div { display: flex; flex-direction: column-reverse; gap: 1px; }
.details dd { font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.details dt { font-size: 11.5px; color: var(--muted); }

.note { font-size: 13px; border-radius: 10px; padding: 10px 12px; background: var(--warn-bg); color: var(--warn); flex: none; }
.tip { font-size: 13px; border-radius: 10px; padding: 10px 12px; background: var(--good-bg); color: var(--good); flex: none; }
.fine { font-size: 11px; color: var(--muted); text-align: center; }

/* Trajet */
.dest { display: flex; flex-direction: column; gap: 6px; flex: none; }
.dest label, .opt > span { font-size: 13px; color: var(--muted); }
.dest input {
  height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: 500 18px var(--font-display); padding: 0 14px; width: 100%; box-sizing: border-box; min-width: 0;
}
.rows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding-inline: 14px; flex: none; }
.rowline { display: flex; justify-content: space-between; align-items: center; min-height: 48px; font-size: 14px; gap: 10px; }
.rowline + .rowline { border-top: 1px solid var(--line); }
.switch { width: 46px; height: 28px; border-radius: 14px; border: 0; background: var(--line); position: relative; padding: 0; transition: background-color .2s; flex: none; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px var(--shadow); transition: transform .2s var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.opts { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; flex: none; }
.opt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt .chips { justify-content: flex-start; gap: 6px; }
.trip-result { text-align: center; display: flex; flex-direction: column; gap: 2px; margin-block: auto; padding-block: 4px; }
.t-cost { font-size: 14px; font-weight: 500; text-wrap: balance; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px; align-self: center; }

/* Tab bar */
.tabs {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border-top: 1px solid var(--line); padding-block: 6px 10px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.tab { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 4px; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--accent); }

/* Session */
.session-top .eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.sim { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.s-borne { color: var(--muted); font-size: 14px; }
.ring-wrap { position: relative; width: min(260px, 78%); aspect-ratio: 1; max-width: 100%; margin: 18px auto 4px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--accent); stroke-linecap: round; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.spent { font-family: var(--font-display); font-weight: 300; font-size: 46px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.of { font-size: 13px; color: var(--muted); }
.gain { text-align: center; font-family: var(--font-display); font-weight: 500; font-size: 30px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gain small { font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.s-msg { text-align: center; font-size: 13.5px; color: var(--muted); text-wrap: balance; margin-top: auto; }
.s-msg.done { color: var(--good); }

/* Conduite */
.screen.drive { padding: 0; gap: 0; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.drive-top {
  position: absolute; top: 12px; z-index: 2;
  left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: 0 6px 24px var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.dt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dt-head > div { min-width: 0; }
.dt-dest { font-family: var(--font-display); font-weight: 500; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress { position: relative; height: 6px; border-radius: 3px; background: var(--soft); }
.progress .bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); width: 0; }
.progress .pin { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--surface); }
.pin.turn { background: var(--fg); }
.pin.stop { background: var(--warn); }

.drive-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; background: var(--surface);
  border-radius: 20px 20px 0 0; padding-block: 14px 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -8px 30px var(--shadow);
}
.speed { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: -84px; display: flex; align-items: flex-end; gap: 8px; }
.speed-bubble {
  width: 68px; height: 68px; border-radius: 50%; background: var(--surface); box-shadow: 0 4px 16px var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.speed-bubble output { font-family: var(--font-display); font-weight: 600; font-size: 25px; line-height: 1; font-variant-numeric: tabular-nums; }
.speed-bubble span { font-size: 10px; color: var(--muted); }
.limit {
  width: 40px; height: 40px; border-radius: 50%; background: #FFFFFF; border: 4px solid #D0312D; color: #111111;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; box-sizing: border-box; font-variant-numeric: tabular-nums;
}
.dstats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.dstats > div { display: flex; flex-direction: column-reverse; gap: 1px; }
.dstats > div + div { border-left: 1px solid var(--line); }
.dstats dd { font-family: var(--font-display); font-weight: 500; font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dstats dd small { font-family: var(--font-body); font-size: 11px; color: var(--muted); font-weight: 500; }
.dstats dt { font-size: 11px; color: var(--muted); }
.advice { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; min-height: 40px; }
.advice p { flex: 1; min-width: 0; }
.advice.good { background: var(--good-bg); color: var(--good); }
.advice.warn { background: var(--warn-bg); color: var(--warn); }
.advice.crit { background: var(--crit-bg); color: var(--crit); }
.advice-btn { flex: none; border: 0; border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 600; background: var(--warn); color: var(--surface); }
.advice.crit .advice-btn { background: var(--crit); }
.cruise { display: flex; align-items: center; gap: 12px; }
.cruise-ctl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cruise-ctl label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.cruise-ctl b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Borne sheet */
.scrim { position: absolute; inset: 0; z-index: 19; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
  border-radius: 20px 20px 0 0; max-height: 86%; overflow-y: auto;
  padding-block: 8px 20px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  transform: translateY(105%); visibility: hidden;
  transition: transform .4s var(--ease), visibility 0s linear .4s;
  box-shadow: 0 -12px 40px var(--shadow);
}
.sheet.open { transform: none; visibility: visible; transition: transform .4s var(--ease), visibility 0s; }
.grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -.01em; }
.sheet-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; margin-bottom: 6px; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 0;
}
.row:last-child { border-bottom: 0; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.row-name svg { width: 14px; height: 14px; color: var(--accent); flex: none; }
.row-meta { font-size: 12.5px; color: var(--muted); }
.row-speed { font-size: 12px; color: var(--fg); font-weight: 500; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badges:empty { display: none; }
.badge { align-self: flex-start; margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--good); background: var(--good-bg); border-radius: 999px; padding: 2px 8px; }
.badge.fast { color: var(--accent); background: var(--soft); }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.row-big { font-family: var(--font-display); font-weight: 500; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-small { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .screen, .sheet, .scrim, .dot, .btn, .switch, .switch::after { transition: none; }
}
/* ===== Habillage Apple ===== */
/* Habillage Apple : police du système, couleurs iOS, matières translucides, réaction au toucher. Redéfinit les jetons ci-dessus. */
:root {
  --ground: #E5E5EA; --frame: #1C1C1E;
  --bg: #F2F2F7; --surface: #FFFFFF; --fg: #000000; --muted: #6E6E73; --line: rgba(60, 60, 67, 0.16);
  --soft: #E9E9EE; --accent: #0064D2; --accent-fill: #0064D2; --accent-fg: #FFFFFF; --switch-on: #34C759;
  --warn: #B25000; --warn-bg: #FFF1DE; --good: #1A7536; --good-bg: #E3F6E8; --crit: #D70015; --crit-bg: #FFE5E7;
  --map-bg: #EEF0F3; --map-block: #E3E6EA; --map-road: #FFFFFF;
  --material: rgba(249, 249, 251, 0.78); --material-edge: rgba(255, 255, 255, 0.6);
  --shadow: rgba(0, 0, 0, 0.12); --scrim: rgba(0, 0, 0, 0.32);
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #000000; --frame: #2C2C2E;
    --bg: #000000; --surface: #1C1C1E; --fg: #FFFFFF; --muted: #98989F; --line: rgba(84, 84, 88, 0.6);
    --soft: #2C2C2E; --accent: #409CFF; --accent-fill: #0060C0; --accent-fg: #FFFFFF; --switch-on: #30D158;
    --warn: #FF9F0A; --warn-bg: #2E2208; --good: #30D158; --good-bg: #0F2A17; --crit: #FF453A; --crit-bg: #33110F;
    --map-bg: #121214; --map-block: #1A1A1D; --map-road: #2C2C30;
    --material: rgba(28, 28, 30, 0.72); --material-edge: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.5); --scrim: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #000000; --frame: #2C2C2E;
  --bg: #000000; --surface: #1C1C1E; --fg: #FFFFFF; --muted: #98989F; --line: rgba(84, 84, 88, 0.6);
  --soft: #2C2C2E; --accent: #409CFF; --accent-fill: #0060C0; --accent-fg: #FFFFFF; --switch-on: #30D158;
  --warn: #FF9F0A; --warn-bg: #2E2208; --good: #30D158; --good-bg: #0F2A17; --crit: #FF453A; --crit-bg: #33110F;
  --map-bg: #121214; --map-block: #1A1A1D; --map-road: #2C2C30;
  --material: rgba(28, 28, 30, 0.72); --material-edge: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.5); --scrim: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
body { font-size: 17px; letter-spacing: -0.01em; }

/* Réaction immédiate : à l'appui, pas au relâchement, et sans le délai de 300 ms */
button, input, select, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { transition: transform 100ms ease-out, background-color 150ms ease; }
button:not(:disabled):active { transform: scale(0.97); }
.tab:active, .row:active, .list-row:active { transform: none; }
.row:active, button.list-row:active { background: var(--soft); }

/* Grands titres iOS */
.nav-large { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 4px; flex: none; }
.large-title { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.1; }
.car-chip { display: flex; align-items: center; background: var(--surface); border: 0; border-radius: 999px; padding: 3px 12px 3px 4px; min-width: 0; }
.car-chip .car-head { gap: 6px; }
.car-chip svg { width: 54px; }
.car-chip .make { font-size: 10px; }
.car-chip .modelname { font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.model h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.wordmark { letter-spacing: 0.22em; }

/* Cartes groupées, sans bordure */
.borne, .rows, .group { background: var(--surface); border: 0; border-radius: 12px; }
.btn { height: 50px; border-radius: 14px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.btn-soft { background: var(--soft); }
.btn-tinted { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.chip { border: 0; background: var(--surface); font-size: 15px; padding: 7px 14px; }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.step, .stepper button { border: 0; background: var(--soft); }
.value { font-weight: 300; letter-spacing: -0.035em; }
.result-big, .sum-big { font-weight: 700; letter-spacing: -0.03em; }
.specs dd, .dstats dd, .row-big, .gain { font-weight: 600; letter-spacing: -0.02em; }

/* Contrôle segmenté : la pastille glisse sous l'option choisie */
.seg { position: relative; border-radius: 9px; padding: 2px; }
.seg::before {
  content: ""; position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 7px;
  background: var(--surface); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s var(--ease);
}
.seg[data-sel="1"]::before { transform: translateX(100%); }
.seg button { position: relative; z-index: 1; font-size: 13px; font-weight: 600; }
.seg button[aria-selected="true"] { background: transparent; box-shadow: none; color: var(--fg); }

/* Barre d'onglets en matière translucide : le contenu défile dessous */
.tabs {
  grid-template-columns: repeat(4, 1fr); background: var(--material); border-top: 0.5px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.tab { font-size: 10px; letter-spacing: 0.01em; }
.tab svg { width: 26px; height: 26px; }
.screen.tab-in { animation: tab-in 180ms ease-out; }
@keyframes tab-in { from { opacity: 0.4; } to { opacity: 1; } }

/* Panneau des bornes : piloté au doigt et par ressorts (voir le script) */
.sheet { transition: visibility 0s linear 0.45s; border-radius: 14px 14px 0 0; }
.sheet.open { transition: none; }
.scrim, .scrim.open { transition: none; }
.sheet-head { touch-action: none; cursor: grab; padding-bottom: 4px; }
.grab { width: 36px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.4; }

/* Conduite : matières translucides par-dessus la carte */
.drive-top, .drive-panel, .speed-bubble {
  background: var(--material); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.drive-top { border: 0.5px solid var(--material-edge); box-shadow: 0 8px 30px var(--shadow); }
.drive-panel { border-top: 0.5px solid var(--material-edge); }
.guide-links { font-size: 13px; color: var(--muted); }
.guide-links a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* Listes groupées : Journal et Réglages */
.group-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; padding: 6px 16px 0; margin: 0 0 -6px; }
.group-note { font-size: 13px; color: var(--muted); padding: 0 16px; margin: -6px 0 0; }
.group { display: flex; flex-direction: column; flex: none; overflow: hidden; }
.group.summary { padding: 14px 16px; gap: 2px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 16px;
  background: none; border: 0; width: 100%; text-align: left; font-size: 17px; color: var(--fg);
}
.list-row + .list-row { border-top: 0.5px solid var(--line); }
.muted { color: var(--muted); font-size: 15px; }
.list-row > :first-child { flex: 1 1 auto; min-width: 0; }
.list-row > .muted { flex: 0 1 auto; text-align: right; }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.abo-text { display: flex; flex-direction: column; min-width: 0; }
.abo-text .muted { font-size: 13px; }
.switch { width: 51px; height: 31px; border-radius: 16px; }
.switch::after { width: 27px; height: 27px; top: 2px; left: 2px; }
.switch[aria-checked="true"] { background: var(--switch-on); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.field-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 16px; font-size: 17px; }
.field-row + .field-row { border-top: 0.5px solid var(--line); }
.field-row > span { flex: 1; min-width: 0; }
.field-row input, .field-row select { width: 120px; text-align: right; border: 0; background: transparent; font: inherit; color: var(--fg); }
.field-error { color: var(--crit); font-size: 13px; padding: 0 16px; margin: 0; }
.form .btn { margin: 8px 16px 14px; width: auto; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sum-label { font-size: 15px; color: var(--muted); }
.sum-big { font-family: var(--font-display); font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sum-sub { font-size: 13px; color: var(--muted); }
.pill.good { color: var(--good); background: var(--good-bg); border: 0; }
.pill.warn { color: var(--warn); background: var(--warn-bg); border: 0; }
.j-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 16px; }
.j-row + .j-row { border-top: 0.5px solid var(--line); }
.j-name { font-weight: 600; font-size: 15px; }
.j-meta { font-size: 13px; color: var(--muted); }
.j-paid { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.j-gap { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.j-gap.good { color: var(--good); }
.j-gap.warn { color: var(--warn); }
.tag { font-size: 11px; font-weight: 500; color: var(--muted); border: 0.5px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 6px; }
.details.four { grid-template-columns: repeat(4, 1fr); gap: 4px; }
.details.four dd { font-size: 14px; }
.details.four dt { font-size: 10.5px; }

/* Jauge de batterie de la conduite : maintenant, arrivée estimée en direct, arrivée prévue au départ */
.batt { display: flex; flex-direction: column; gap: 6px; }
.batt-bar { position: relative; height: 10px; border-radius: 5px; background: var(--soft); }
.batt-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--good); }
.batt-fill.low { background: var(--warn); }
.batt-fill.crit { background: var(--crit); }
.batt-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; transform: translateX(-50%); }
.batt-mark.live { background: var(--fg); }
.batt-mark.plan { background: var(--accent); }
.batt-legend { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--muted); }
.batt-legend span:last-child { text-align: right; }
.batt-legend b { display: block; color: var(--fg); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.batt-legend span:first-child b::before { content: ""; display: inline-block; width: 3px; height: 11px; border-radius: 2px; background: var(--fg); margin-right: 5px; vertical-align: -1px; }
.batt-legend span:last-child b::before { content: ""; display: inline-block; width: 3px; height: 11px; border-radius: 2px; background: var(--accent); margin-right: 5px; vertical-align: -1px; }

/* Retours des 100 inconnus */
.promise { font-size: 15px; color: var(--muted); text-align: center; margin: 2px 0 -14px; text-wrap: balance; }
.link-badge { font-size: 11px; font-weight: 600; color: var(--good); background: var(--good-bg); border-radius: 999px; padding: 1px 7px; margin-left: 4px; white-space: nowrap; }
.cta-bar {
  position: sticky; bottom: 66px; z-index: 4; flex: none; margin-inline: -20px; padding: 10px 20px;
  background: var(--material); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.cta-bar.btn-row { display: grid; }
.field-hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.dist-field { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.dist-field input { width: 58px; text-align: right; border: 0; background: var(--soft); border-radius: 8px; padding: 5px 7px; font: inherit; color: var(--fg); font-variant-numeric: tabular-nums; box-sizing: border-box; }
.dist-quick .chips { justify-content: flex-end; gap: 6px; }
.dist-quick .chip { background: var(--soft); padding: 5px 11px; font-size: 13px; }
.list-row, .j-row, .field-row { box-sizing: border-box; }
.stepper button { width: 36px; height: 36px; }
.tab, .details.four dt, .car-chip .make { font-size: 11px; }
.check { flex: none; color: var(--accent); font-weight: 600; font-size: 15px; }
[aria-pressed="true"] .check { color: var(--good); }
.car-sheet { z-index: 21; display: flex; flex-direction: column; gap: 12px; background: var(--bg); transition: transform 0.4s var(--ease), visibility 0s linear 0.4s; }
.car-sheet.open { transform: none; visibility: visible; transition: transform 0.4s var(--ease); }
/* Retours du test v4 : contrastes AA, zones tactiles de 44 px, libellés de 12 px, rien de caché */
.btn-primary, .chip.on, .chip[aria-pressed="true"] { background: var(--accent-fill); }
.cta-bar { position: static; margin-inline: 0; padding: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.stepper button, .nav, .step { width: 44px; height: 44px; }
.car-chip { min-height: 44px; }
.link { padding: 12px 8px; }
.seg button { height: 40px; }
.chip, .seg button { position: relative; }
.chip::after, .seg button::after { content: ""; position: absolute; inset: -5px -3px; }
.screen input[type="range"] { height: 44px; }
.dist-quick .chip { padding: 8px 11px; }
.link { padding: 13px 8px; }
.switch { box-sizing: content-box; padding: 6.5px 0; background-clip: content-box; }
.switch::after { top: 8.5px; }
.dist-field input { height: 40px; }
.tab, .details.four dt, .details dt, .dstats dt, .car-chip .make, .batt-legend, .row-small, .fine, .sim, .field-hint { font-size: 12px; }
.rowline { flex-wrap: wrap; }
.advice-link { flex: none; color: inherit; font-weight: 600; }
.demo { font-size: 11px; font-weight: 600; color: var(--warn); }
.drive-top { z-index: 3; }
.sheet-zone { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.sources { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 6px 0 0; }
.sources a { color: var(--accent); font-weight: 600; text-decoration: none; }
.form-hint { font-size: 13px; color: var(--muted); padding: 6px 16px 0; margin: 0; }

/* Retours du test v6 */
:root { --field-border: #8A8A8E; }
/* Le focus clavier ne se cache plus sous la barre d'onglets, ni ne se fait rogner dans les cartes */
.screen { scroll-padding-bottom: 96px; }
.group :focus-visible, .rows :focus-visible, .borne:focus-visible { outline-offset: -2px; }
/* Champs et interrupteurs éteints visibles (contraste ≥ 3:1) */
.field-row input, .field-row select, .dist-field input, .dest input { box-sizing: border-box; border: 1px solid var(--field-border); border-radius: 8px; padding: 6px 8px; }
.switch[aria-checked="false"] { background-color: var(--field-border); }
.btn-tinted { background: var(--soft); color: var(--accent); }
.seg button { color: var(--fg); }
/* Copilote : cibles de 44 px, textes de 12 px minimum */
#dv-play, #dv-quit { width: 44px; height: 44px; }
.advice-btn { min-height: 44px; }
.advice-link { padding: 12px 4px; }
.speed-bubble span, .demo, .link-badge, .tag, .dstats dd small, .badge { font-size: 12px; }
.badge.speed { color: var(--fg); background: var(--soft); }
/* Retours du test v7 */
.row:focus-visible { outline-offset: -2px; }
input::placeholder { color: var(--muted); opacity: 1; }
:root:not([data-theme="dark"]) .switch[aria-checked="true"] { background-color: #248A3D; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .switch[aria-checked="true"] { background-color: var(--switch-on); } }
/* Liens dans une phrase : zone de toucher agrandie sans changer l'interligne */
.guide-links a, .sources a { display: inline-block; padding: 13px 3px; margin: -13px 0; }
/* Zoom à 200 % (moins de 330 px de large) : tout passe en colonne */
.sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 330px) {
  .rowline, .soc, .list-row, .field-row, .borne, .cruise, .amount, .nav-large { flex-wrap: wrap; }
  .tab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dstats, .details, .details.four, .opts { grid-template-columns: 1fr 1fr; gap: 8px; }
  .batt-legend { flex-direction: column; }
  .batt-legend span:last-child { text-align: left; }
  .btn-row { grid-template-columns: 1fr; }
  .value { font-size: 40px; }
  .speed { display: none; }
  /* Libellé au-dessus, réglage en dessous : le « + » ne sort plus de la ligne */
  .rowline > span:first-child, .list-row > span:first-child { flex-basis: 100%; }
  .stepper output { min-width: 40px; }
  /* Copilote : en-tête et panneau dans le flux, l'écran défile au lieu de se recouvrir */
  .screen.drive { overflow-y: auto; display: flex; flex-direction: column; }
  .drive-top, .drive-panel { position: relative; inset: auto; margin: 8px; }
  .drive-panel { margin-top: auto; border-radius: 16px; max-height: none; }
  .advice { flex-direction: column; align-items: flex-start; }
}
@media (max-height: 560px) {
  .drive-panel { max-height: 62%; overflow-y: auto; }
  .speed { display: none; }
}

/* Petits écrans (667 px de haut) : le résultat en km reste visible au-dessus du bouton */
@media (max-height: 760px) {
  .screen { gap: 8px; padding-top: 12px; }
  .large-title { font-size: 30px; }
  .borne { padding: 8px 12px; }
  .amount { padding-top: 0; }
  .value { font-size: 48px; }
  .step { width: 44px; height: 44px; }
  .result { padding-block: 2px; }
  .result-big { font-size: 36px; }
  .details { padding-top: 8px; }
}

@media (prefers-reduced-transparency: reduce) {
  .tabs, .drive-top, .drive-panel, .speed-bubble { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .borne, .group, .rows, .chip, .tabs, .drive-top { border: 1px solid var(--fg); }
}
@media (prefers-reduced-motion: reduce) {
  .seg::before { transition: none; }
  .screen.tab-in { animation: none; }
}
