/* Dark driving theme (from the draft), big touch targets (48 px+), works from 360 px wide. */
:root {
  --bg: #0e1013; --card: #181b20; --fg: #eef0f3; --muted: #9aa2ad; --line: #2a2f36;
  --accent: #e31937; --good: #4ac26b; --warn: #f0a040; --bad: #ff5a5f; --btn: #252a31; --field: #0e1013;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 -apple-system, system-ui, Roboto, "Segoe UI", sans-serif; overflow-x: hidden; }
main { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 12px calc(env(safe-area-inset-bottom) + 24px); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; display: inline-block; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 0; }
a { color: #6cb6ff; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; margin-bottom: 6px; }
.top h1 { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.card.bad { border-color: var(--bad); }
.card.compact { padding: 10px 12px; }
summary { cursor: pointer; list-style: none; min-height: 32px; } summary::-webkit-details-marker { display: none; }
summary h2 { margin: 0; } summary h2::after { content: " ▾"; }
details[open] > summary { margin-bottom: 10px; }
input, select, textarea, button { font: inherit; color: inherit; border-radius: 10px; border: 1px solid var(--line); background: var(--field); padding: 10px 12px; min-height: 48px; width: 100%; }
textarea { min-height: 80px; }
input[type=checkbox], input[type=radio] { width: 22px; min-height: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
button { background: var(--btn); border: 0; font-weight: 600; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: #fff; }
button.big { font-size: 20px; min-height: 60px; margin-top: 10px; }
button.small { width: auto; min-height: 48px; padding: 6px 14px; font-size: 15px; }
button.icon { width: 48px; height: 48px; padding: 0; font-size: 24px; flex: none; }
button.link { background: none; color: #6cb6ff; font-weight: 500; text-decoration: underline; min-height: 44px; }
.row { display: flex; gap: 8px; align-items: stretch; } .row input, .row select { flex: 1; min-width: 0; } .row button { width: auto; flex: none; }
.form { display: grid; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field .label { font-size: 14px; color: var(--muted); }
.hint, small { color: var(--muted); font-size: 13px; display: block; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; min-height: 48px; }
.radio:has(input:checked) { border-color: var(--accent); }
.radio span { display: flex; flex-direction: column; }
.muted { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.hidden { display: none !important; }
.lead { font-size: 18px; }

/* Banners and status */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; font-size: 15px; border: 1px solid; }
.banner span { flex: 1; }
.banner button { width: auto; flex: none; min-height: 44px; padding: 6px 12px; }
.banner.warn { border-color: var(--warn); color: var(--warn); }
.banner.bad { border-color: var(--bad); color: var(--bad); }
.banner.info { border-color: var(--line); color: var(--muted); }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.warn-text { color: var(--warn); } .bad-text { color: var(--bad); }
.busy { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 14px); background: var(--card); border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; z-index: 5; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-size: 15px; max-width: 90vw; z-index: 10; }

/* Trip card */
.results { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.result { text-align: left; display: flex; flex-direction: column; font-weight: 500; }
.result small { margin: 0; }
.result.chosen { outline: 2px solid var(--accent); }
.trip-line { display: flex; gap: 10px; align-items: center; }
.trip-line > div:first-child { flex: 1; min-width: 0; }
.trip-dest { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-line small { margin: 0; }
.trip-actions { display: flex; gap: 6px; }

/* Battery card */
.soc { display: flex; align-items: center; gap: 8px; }
.soc input { font-size: 52px; font-weight: 700; text-align: center; padding: 0 4px; flex: 1; min-width: 0; height: 76px; }
.soc .pct { font-size: 30px; color: var(--muted); }
.soc .step { width: 72px; min-height: 76px; font-size: 34px; flex: none; }
.car-row { margin-top: 10px; display: grid; gap: 4px; }
.car-row .big { margin-top: 4px; }

/* Result card */
.stop-name { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.2; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.stat { background: var(--bg); border-radius: 10px; padding: 8px 4px; text-align: center; }
.stat b { display: block; font-size: 24px; } .stat span { font-size: 12px; color: var(--muted); }
.alt { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.alt div { flex: 1; font-size: 14px; min-width: 0; } .alt button { width: auto; min-height: 48px; padding: 6px 16px; }
.fallback .alt { border-top: 0; }
.others { margin-top: 12px; }
.others summary { color: var(--muted); font-size: 15px; display: flex; align-items: center; }

/* Wizard and Settings */
.wizard { min-height: calc(100vh - 40px); display: flex; flex-direction: column; gap: 12px; }
.wizard .progress { color: var(--muted); font-size: 13px; margin: 0; }
.wizard-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 12px; }
.summary { padding-left: 18px; } .summary li { margin: 6px 0; }
.keyfield { display: grid; gap: 6px; margin-bottom: 14px; }
.key-status { font-size: 14px; min-height: 1em; }
.key-status.good { color: var(--good); } .key-status.bad { color: var(--bad); }
.help { font-size: 14px; color: var(--muted); } .help ol { padding-left: 20px; margin: 4px 0; }
.sticky-save { position: sticky; bottom: 0; padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px); background: linear-gradient(transparent, var(--bg) 30%); }
.car-switch { width: auto; max-width: 46%; min-height: 44px; padding: 6px 10px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { width: auto; min-height: 44px; border-radius: 22px; padding: 6px 16px; }
.chip.on { background: var(--accent); color: #fff; }
.steps { display: grid; gap: 10px; margin: 12px 0; }
.step-row { display: flex; gap: 10px; align-items: flex-start; }
.step-row > div { flex: 1; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--btn); display: grid; place-items: center; font-weight: 700; flex: none; margin-top: 10px; }
