/* ===== Copilote — thème & layout (optimisé écran tactile Tesla) ===== */
:root {
  --bg: #0b0d10;
  --panel: #15181d;
  --panel-2: #1d2128;
  --panel-3: #262b34;
  --line: #2b313b;
  --text: #e9ecf1;
  --muted: #8d96a5;
  --accent: #3e8bff;
  --accent-2: #2a6fdc;
  --ok: #2fcf73;
  --warn: #f5a623;
  --bad: #ef4a3c;
  --tesla: #e82127;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --radius: 18px;
  --nav-w: 104px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef0f3;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --panel-3: #e6e9ee;
  --line: #d9dde4;
  --text: #15181d;
  --muted: #5f6877;
  --shadow: 0 8px 26px rgba(20, 30, 50, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.big-num { font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

#app { display: grid; grid-template-columns: var(--nav-w) 1fr; height: 100vh; height: 100dvh; }

/* ---- Navigation latérale ---- */
#nav {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; padding: 12px 8px; overflow-y: auto;
}
#nav .nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--muted);
  padding: 14px 4px; border-radius: 16px; font-size: 14px; font-weight: 600;
}
#nav .nav-btn svg { width: 32px; height: 32px; }
#nav .nav-btn.active { background: var(--panel-3); color: var(--text); }
#nav .nav-btn.active svg { color: var(--accent); }
#nav .spacer { flex: 1; }
#nav .nav-clock { text-align: center; font-weight: 700; font-size: 20px; padding: 8px 0; font-variant-numeric: tabular-nums; }

#views { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view.padded { padding: 22px; }

/* ---- Composants ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 10px; font-size: 16px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; gap: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 22px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 600; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 16px; }
.btn svg { width: 22px; height: 22px; }
.icon-btn {
  width: 56px; height: 56px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; box-shadow: var(--shadow);
}
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; min-height: 48px; padding: 0 18px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .lbl { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; font-weight: 600; }
.field > label b, .field > .lbl b { color: var(--text); font-variant-numeric: tabular-nums; }
input[type="text"], input[type="number"], input[type="search"], select {
  min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2);
  padding: 0 16px; width: 100%; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

/* Sliders larges pour le tactile */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; background: transparent; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 6px; background: var(--panel-3); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px; border-radius: 50%; background: var(--accent); border: 4px solid var(--panel); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
input[type="range"]::-moz-range-track { height: 10px; border-radius: 6px; background: var(--panel-3); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 4px solid var(--panel); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.switch input { display: none; }
.switch .knob { width: 64px; height: 36px; border-radius: 20px; background: var(--panel-3); position: relative; transition: .2s; flex: none; }
.switch .knob::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { left: 32px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--panel); min-height: 52px; padding: 0 20px; border-radius: 26px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--panel-3); font-size: 14px; font-weight: 600; }
.pill.ok { background: rgba(47,207,115,.16); color: var(--ok); }
.pill.warn { background: rgba(245,166,35,.16); color: var(--warn); }
.pill.bad { background: rgba(239,74,60,.16); color: var(--bad); }
.pill.tesla { background: rgba(232,33,39,.16); color: #ff5a5f; }

.bar { height: 14px; border-radius: 8px; background: var(--panel-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #7be3a6); border-radius: 8px; transition: width .4s; }

#toasts { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: var(--panel-3); color: var(--text); padding: 14px 22px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; animation: tin .25s ease-out; max-width: 80vw; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #062; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }

.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 12px; }

/* ===== Accueil ===== */
.home-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.home-grid > * { min-width: 0; }
.c-clock { grid-column: span 5; }
.c-speed { grid-column: span 3; }
.c-weather { grid-column: span 4; }
.c-range { grid-column: span 7; }
.c-timer { grid-column: span 5; }
.c-quick { grid-column: span 12; }
.clock-time { font-size: 92px; font-weight: 700; letter-spacing: -3px; line-height: 1; font-variant-numeric: tabular-nums; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.quick { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-2); text-align: left; min-height: 110px; }
.quick svg { width: 30px; height: 30px; color: var(--accent); }
.quick b { font-size: 18px; }
.quick span { color: var(--muted); font-size: 14px; }
.range-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.range-row .stat { background: var(--panel-2); border-radius: 14px; padding: 14px; }

/* ===== Carte ===== */
.map-wrap { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: #1a1d22; }
.map-left { position: absolute; left: 16px; top: 16px; width: 400px; max-width: calc(100% - 110px); display: flex; flex-direction: column; gap: 10px; max-height: calc(100% - 32px); z-index: 5; }
.search-box { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 16px; box-shadow: var(--shadow); }
.search-box svg { width: 24px; height: 24px; color: var(--muted); flex: none; }
.search-box input { border: 0; background: transparent; min-height: 56px; padding: 0 6px; }
.search-box .icon-btn { box-shadow: none; border: 0; background: transparent; width: 48px; height: 48px; }
.search-box.wp-mode { outline: 2px solid #a970ff; }
.search-box.wp-mode svg { color: #a970ff; }
.results { padding: 6px; box-shadow: var(--shadow); max-height: 50vh; overflow-y: auto; }
.results button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 12px 14px; border-radius: 12px; min-height: 60px; }
.results button:active, .results button:hover { background: var(--panel-2); }
.results small { display: block; color: var(--muted); font-size: 14px; }
.route-panel { box-shadow: var(--shadow); overflow-y: auto; padding: 16px; }
.route-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.route-head h2 { margin: 0; font-size: 20px; }
.route-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.route-sum .stat { background: var(--panel-2); border-radius: 12px; padding: 10px; }
.route-sum .stat .v { font-size: 22px; }
.stop { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.stop .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--ok); color: #062; }
.stop .dot.end { background: var(--accent); color: #fff; }
.stop .dot.start { background: var(--panel-3); color: var(--text); }
.stop .dot.wp { background: #a970ff; color: #fff; }
.via-list { margin-top: 10px; }
.via { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.via-n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #a970ff; color: #fff; font-weight: 700; font-size: 14px; }
.via-t { min-width: 0; }
.via-t b, .via-t small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.via-t small { color: var(--muted); font-size: 13px; }
.via .icon-btn { width: 44px; height: 44px; box-shadow: none; flex: none; font-size: 20px; font-weight: 700; }
.via .icon-btn svg { width: 20px; height: 20px; }
.via-add { width: 100%; justify-content: flex-start; margin-top: 4px; color: #b98cff; }
.stop b { display: block; }
.stop .meta { color: var(--muted); font-size: 14px; }
.steps-list { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.steps-list div { padding: 8px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; font-size: 15px; }
.steps-list .arr { width: 26px; text-align: center; }

.map-controls { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.nav-banner { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 14px 24px; background: #0f5132; color: #fff; border-radius: 18px; box-shadow: var(--shadow); z-index: 6; min-width: 380px; max-width: 46%; }
.nav-banner .arrow { font-size: 54px; line-height: 1; }
.nav-banner .dist { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nav-banner .text { font-size: 18px; opacity: .92; }
.map-left.nav-on { width: 340px; }
.speed-bubble { position: absolute; right: 16px; bottom: 30px; width: 104px; height: 104px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 5; }
.speed-bubble b { font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.speed-bubble small { color: var(--muted); font-size: 13px; }
.nav-bottom { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 22px; align-items: center; padding: 10px 14px 10px 24px; z-index: 5; box-shadow: var(--shadow); }
.nav-bottom .stat .v { font-size: 26px; }

.car-marker { width: 46px; height: 46px; }
.car-marker svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.stop-marker { width: 38px; height: 38px; border-radius: 50%; background: var(--ok); color: #062; display: grid; place-items: center; font-weight: 800; border: 3px solid #fff; box-shadow: var(--shadow); }
.wp-marker { width: 40px; height: 46px; display: grid; place-items: start center; cursor: pointer; }
.wp-pin { width: 32px; height: 32px; margin-top: 2px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #a970ff; border: 3px solid #fff; box-shadow: var(--shadow); display: grid; place-items: center; }
.wp-pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 14px; }
.dest-marker { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); border: 3px solid #fff; box-shadow: var(--shadow); }

.maplibregl-popup-content { background: var(--panel) !important; color: var(--text); border-radius: 14px !important; padding: 16px !important; box-shadow: var(--shadow) !important; font-size: 15px; min-width: 240px; }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.maplibregl-popup-close-button { font-size: 28px; width: 40px; height: 40px; color: var(--muted); }
.popup h4 { margin: 0 0 6px; font-size: 17px; padding-right: 30px; }
.popup .row { margin-top: 10px; }
.maplibregl-ctrl-attrib { font-size: 11px; }

/* ===== Outils ===== */
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.tool-grid .card { display: flex; flex-direction: column; gap: 16px; }
.result-hero { display: flex; align-items: baseline; gap: 10px; }
.result-hero .unit { font-size: 24px; color: var(--muted); font-weight: 600; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.links-grid a { text-decoration: none; color: inherit; }
.conv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ===== Jeux ===== */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.game-card { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); min-height: 180px; }
.game-card .emoji { font-size: 50px; line-height: 1; }
.game-card b { font-size: 21px; }
.game-card span { color: var(--muted); font-size: 15px; }
.game-stage { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.game-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.game-top h2 { margin: 0; font-size: 22px; }
.game-body { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 12px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.game-body canvas { display: block; border-radius: 14px; background: var(--panel); touch-action: none; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(5,7,10,.72); text-align: center; z-index: 3; color: #fff; }
.overlay h2 { margin: 0; font-size: 42px; }
.overlay p { margin: 0; font-size: 20px; opacity: .85; }

.dpad { position: absolute; right: 22px; bottom: 22px; display: grid; grid-template-columns: repeat(3, 76px); grid-template-rows: repeat(3, 76px); gap: 6px; z-index: 2; }
.dpad button { border-radius: 18px; border: 1px solid var(--line); background: rgba(40,46,56,.85); color: #fff; font-size: 30px; }
.dpad button:active { background: var(--accent); }

.mem-grid { display: grid; gap: 12px; }
.mem-card { perspective: 800px; border: 0; padding: 0; background: transparent; }
.mem-card .in { position: relative; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.mem-card.flip .in, .mem-card.done .in { transform: rotateY(180deg); }
.mem-card .f, .mem-card .b { position: absolute; inset: 0; border-radius: 16px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.mem-card .f { background: linear-gradient(135deg, var(--accent-2), #6a4bd8); font-size: 34px; color: rgba(255,255,255,.5); }
.mem-card .b { background: var(--panel-2); border: 1px solid var(--line); transform: rotateY(180deg); }
.mem-card.done .b { background: rgba(47,207,115,.18); border-color: var(--ok); }

.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ttt button { border-radius: 18px; border: 1px solid var(--line); background: var(--panel); font-size: 72px; font-weight: 800; line-height: 1; }
.ttt button.x { color: var(--accent); }
.ttt button.o { color: var(--warn); }
.ttt button.win { background: rgba(47,207,115,.2); border-color: var(--ok); }

.ms { display: grid; gap: 3px; background: var(--line); padding: 3px; border-radius: 10px; }
.ms button { border: 0; border-radius: 6px; background: var(--panel-3); font-weight: 800; padding: 0; display: grid; place-items: center; }
.ms button.open { background: var(--panel); }
.ms button.boom { background: var(--bad); }
.ms .n1 { color: #4ea1ff; } .ms .n2 { color: #39c06d; } .ms .n3 { color: #ff5d52; } .ms .n4 { color: #a77bff; }
.ms .n5 { color: #ff9f2e; } .ms .n6 { color: #2ec7c9; } .ms .n7 { color: #e0e0e0; } .ms .n8 { color: #999; }

/* ===== Réglages ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-grid .card { display: flex; flex-direction: column; gap: 12px; }

/* ===== Responsive (écrans étroits / téléphone) ===== */
@media (max-width: 900px) {
  :root { --nav-w: 0px; }
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #nav { order: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 6px; }
  #nav .spacer, #nav .nav-clock { display: none; }
  #nav .nav-btn { padding: 8px 4px; font-size: 12px; flex: 1; }
  #nav .nav-btn svg { width: 26px; height: 26px; }
  .view.padded { padding: 16px; }
  .home-grid > * { grid-column: span 12 !important; }
  .tool-grid, .settings-grid { grid-template-columns: 1fr; }
  .clock-time { font-size: 64px; }
  .map-left { width: calc(100% - 100px); }
  .nav-banner { min-width: 0; max-width: calc(100% - 32px); left: 16px; transform: none; }
  .route-sum { grid-template-columns: 1fr 1fr; }
}

/* Finitions */
.nav-bottom .stat .v { font-size: 22px; white-space: nowrap; }
.route-panel .row .btn { padding: 0 14px; }

/* ===== Home Assistant : Ma Tesla / Maison ===== */
.car-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-bottom: 12px; }
.car-grid > * { min-width: 0; }
.c-batt { grid-column: span 7; } .c-actions { grid-column: span 5; }
.c-clim { grid-column: span 6; } .c-charge { grid-column: span 6; }
.c-tires { grid-column: span 7; } .c-loc { grid-column: span 5; }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-2); font-size: 30px; }
.act span { font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; }
.act.on { background: rgba(62,139,255,.18); border-color: var(--accent); }
.act.warn { background: rgba(245,166,35,.16); border-color: var(--warn); }
.tires { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tires .stat { background: var(--panel-2); border-radius: 12px; padding: 12px; }
.warn-txt .v { color: var(--warn); }
h3.sec { margin: 20px 0 10px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cam { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam span { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.cam.err::after { content: "Image indisponible"; position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: 14px; }
.cam-viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.cam-viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.cam-bar { padding: 12px 16px; background: rgba(20,22,26,.95); color: #fff; }
.clim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.fav { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; min-height: 104px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); text-align: left; }
.fav .ico { font-size: 26px; }
.fav b { font-size: 15px; line-height: 1.2; }
.fav span:last-child { color: var(--muted); font-size: 13px; }
.fav.on { background: rgba(62,139,255,.16); border-color: var(--accent); }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal-box { width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.pick-list { overflow-y: auto; margin-top: 10px; flex: 1; min-height: 200px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--line); min-height: 56px; }
.pick input { width: 26px; height: 26px; accent-color: var(--accent); flex: none; }
.pick .ico { font-size: 22px; }
.pick small { display: block; color: var(--muted); font-size: 12px; word-break: break-all; }
pre.code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); white-space: pre; overflow-x: auto; }
details summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; }
@media (max-width: 900px) {
  .car-grid > * { grid-column: span 12 !important; }
  .tires { grid-template-columns: repeat(2, 1fr); }
}

.mt-logo { position: absolute; left: 12px; bottom: 10px; z-index: 4; }
.mt-logo img { height: 22px; display: block; }

/* ===== Alertes : limitation et trafic ===== */
.limit-sign { position: absolute; right: 130px; bottom: 38px; width: 88px; height: 88px; border-radius: 50%; background: #fff; border: 9px solid #e0241b; display: grid; place-items: center; z-index: 5; box-shadow: var(--shadow); }
.limit-sign b { color: #111; font-size: 32px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.speed-bubble.over { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1s infinite; }
.speed-bubble.over small { color: rgba(255,255,255,.85); }
@keyframes pulse { 50% { transform: scale(1.06); } }
.traffic-alert { position: absolute; left: 50%; top: 132px; transform: translateX(-50%); z-index: 6; padding: 12px 22px; border-radius: 16px; color: #fff; font-weight: 800; font-size: 20px; box-shadow: var(--shadow); max-width: 60%; text-align: center; }
.traffic-sum { background: rgba(245,166,35,.12); border: 1px solid rgba(245,166,35,.4); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 15px; }
.traffic-sum.ok { background: rgba(47,207,115,.1); border-color: rgba(47,207,115,.35); }
.inc-list { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 14px; }
@media (max-width: 900px) { .limit-sign { right: 16px; bottom: 150px; width: 72px; height: 72px; border-width: 7px; } .traffic-alert { max-width: calc(100% - 32px); } }

/* Barre de progression (téléchargement de la voix) */
.progress { height: 10px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .25s; }

/* ===== Arcade de Bord intégrée (vue Jeux) ===== */
.arcade-view { position: relative; height: 100%; }
.arcade-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.arcade-load { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.arcade-back { position: absolute; left: 14px; bottom: 14px; z-index: 5; box-shadow: var(--shadow); }
.arcade-back[hidden] { display: none; }

/* ===== Carnet de bord ===== */
.cb-t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cb-t th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cb-t td { padding: 10px; border-bottom: 1px solid var(--line); }
.cb-t tr:last-child td { border-bottom: 0; }

/* barre latérale : plus compacte sur les écrans peu hauts */
#nav { overflow-y: auto; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
@media (max-height: 860px) { #nav .nav-btn { padding-top: 7px; padding-bottom: 7px; min-height: 0; } #nav .nav-btn svg { width: 26px; height: 26px; } #nav .nav-clock { padding: 4px 0; font-size: 17px; } }

/* outils de l'Arcade dans l'onglet Outils */
.arcade-tool { width: 100%; height: calc(100vh - 150px); min-height: 520px; border: 0; border-radius: var(--radius); background: transparent; display: block; }
#tTabs { flex-wrap: wrap; overflow: visible; }
#tTabs button { min-height: 46px; padding: 0 16px; }
