/* Garage : barre haute, colonne de sélection/réglages, habillage de la scène 3D. */
:root { --side-w: clamp(300px, 27cqw, 392px); }

.header {
  position: absolute; left: 0; right: 0; top: 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; gap: 18px; padding: 0 var(--safe-r) 0 var(--safe-l);
  background: linear-gradient(180deg, rgba(20, 23, 27, .92), rgba(20, 23, 27, .74));
  border-bottom: 1px solid var(--hairline); backdrop-filter: blur(8px);
}
.brandmark { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 4px 2px; }
.vmark { width: 26px; height: 26px; background: var(--balise); clip-path: polygon(0 0, 34% 0, 50% 58%, 66% 0, 100% 0, 62% 100%, 38% 100%); }
.brand { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.6rem; letter-spacing: .01em; line-height: 1; }

.side-nav { display: flex; gap: 2px; height: 100%; }
.side-nav button {
  position: relative; border: 0; background: none; padding: 0 16px; height: 100%; color: var(--gravel);
  font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: .02em;
}
.side-nav button:hover { color: var(--line-white); }
.side-nav button.sel { color: var(--line-white); }
.side-nav button.sel::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 4px; background: var(--balise); border-radius: 2px 2px 0 0; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.live { display: none; }
.route-chip {
  --bg: var(--sign-green); display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  border: 0; background: var(--bg); border-radius: 5px; padding: 6px 14px 6px 11px; min-width: 150px; text-align: left;
  box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 3.5px var(--line-white);
}
.route-chip small { font-size: .66rem; font-weight: 600; opacity: .8; line-height: 1; }
.route-chip b { font-family: var(--display); font-weight: 700; font-size: 1.05rem; line-height: 1.05; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-chip:hover { filter: brightness(1.12); }
/* Le bouton bascule reste dans le DOM (raccourcis, QA) ; le grand panneau « Prendre la route » le remplace. */
body.garage-open #sidebarToggle { display: none; }
#sidebarToggle { background: var(--balise); color: var(--balise-ink); border-color: var(--balise); font-family: var(--display); font-size: 1.05rem; font-weight: 700; padding: 8px 16px; }
#sidebarToggle:hover { background: #ffd04f; }

/* Colonne latérale */
.sidebar {
  position: absolute; left: 0; top: var(--top-h); bottom: 0; width: var(--side-w); z-index: 10;
  background: linear-gradient(90deg, rgba(20, 23, 27, .95), rgba(20, 23, 27, .86));
  border-right: 1px solid var(--hairline); display: flex; flex-direction: column;
}
.side-main { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 22px var(--safe-l); scrollbar-width: thin; scrollbar-color: var(--asphalt-3) transparent; }
.panelpage { display: none; }
.panelpage.sel { display: block; }
.pagetitle { font-family: var(--display); font-weight: 800; font-style: italic; font-size: var(--t-xl); line-height: 1; margin: 2px 0 6px; }
.desc { color: var(--gravel); font-size: var(--t-s); margin: 0 0 10px; max-width: 38ch; }

/* Disciplines */
.category-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 10px; }
.catbtn {
  border: 1px solid var(--hairline); background: var(--asphalt-2); color: var(--gravel); border-radius: var(--r-ctl);
  padding: 7px 4px 6px; font-family: var(--display); font-weight: 700; font-size: .92rem; line-height: 1; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.catbtn small { display: none; }
.catbtn:hover { color: var(--line-white); }
.catbtn.sel { background: var(--line-white); color: var(--asphalt); border-color: var(--line-white); }

.carlist { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }
.car-group { min-width: 0; border: 1px solid var(--hairline); border-radius: var(--r-ctl); background: #ffffff02; }
.car-group > summary { display: grid; grid-template-columns: 12px minmax(0,1fr); gap: 2px 5px; padding: 9px 8px; cursor: pointer; list-style: none; }
.car-group > summary::-webkit-details-marker { display: none; }
.car-group > summary::before { content: '›'; grid-row: 1 / 3; align-self: center; color: var(--balise); font-size: 1.25rem; transform-origin: center; }
.car-group[open] > summary::before { transform: rotate(90deg); }
.car-group > summary:hover { background: #ffffff08; }
.car-group-label { font-family: var(--display); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.car-group-0 > summary .car-group-label { font-size: 1.2rem; }
.car-group-count { grid-column: 2; color: var(--gravel); font-size: .68rem; }
.car-group-content { display: flex; flex-direction: column; gap: 4px; padding: 0 5px 6px 8px; }
.car-group .car-group { border-right: 0; border-top: 0; border-bottom: 0; background: transparent; }
.car-group-3 > summary .car-group-label { font-size: .9rem; font-weight: 600; }
.car-group .car-id { display: none; }
.caritem {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; text-align: left;
  border: 1px solid transparent; border-radius: var(--r-ctl); background: rgba(255, 255, 255, .03); padding: 6px 10px 6px 6px;
}
.caritem:hover { background: rgba(255, 255, 255, .07); }
.caritem.sel { background: rgba(255, 194, 26, .12); border-color: var(--balise); }
.car-color { width: 34px; height: 24px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .35), inset 0 -8px 0 rgba(0, 0, 0, .18); }
.car-name { font-family: var(--display); font-weight: 700; font-size: 1.1rem; line-height: 1.05; }
.car-spec { color: var(--gravel); font-size: var(--t-xs); margin-top: 1px; }
.car-id { color: var(--gravel); font-family: var(--display); font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.caritem.sel .car-id { color: var(--balise); }
.library-footer { display: flex; justify-content: space-between; gap: 10px; color: var(--gravel); font-size: var(--t-xs); margin-top: 12px; }
.library-footer b { display: none; }

/* Réglages */
.setup-filter { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
#favoriteFilter.sel { border-color: var(--balise); color: var(--balise); }
.setup-results { color: var(--balise); font-size: var(--t-xs); min-height: 0; margin-top: 6px; }
#paramCount { margin: 8px 0 10px; }
.group { border-top: 1px solid var(--hairline); }
.group:last-child { border-bottom: 1px solid var(--hairline); }
.group > summary {
  list-style: none; cursor: pointer; padding: 11px 2px; display: flex; justify-content: space-between; align-items: center;
  font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: .02em;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--gravel); border-bottom: 2px solid var(--gravel); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.group[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); border-color: var(--balise); }
.group[open] > summary { color: var(--balise); }
.groupcontent { padding: 0 0 12px; }
.field { padding: 9px 0 8px; border-top: 1px solid rgba(242, 243, 238, .06); }
.field:first-child { border-top: 0; }
.fieldrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fieldtitle { display: flex; align-items: center; gap: 4px; min-width: 0; }
.fieldtitle label, .fieldrow > label { font-weight: 500; font-size: var(--t-s); }
.favorite-btn { border: 0; background: none; color: var(--gravel); padding: 0 3px; font-size: 1rem; line-height: 1; }
.favorite-btn[aria-pressed=true] { color: var(--balise); }
.field input[type=number] { width: 78px; padding: 4px 7px; text-align: right; font-variant-numeric: tabular-nums; font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--balise); }
.field select { margin-top: 6px; }
.hint { color: var(--gravel); font-size: .7rem; }
.field output { color: var(--balise); font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Atelier */
#toolsPage .searchbox { margin-top: 4px; }
.customlist { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 16px; }
.saveditem { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; padding: 6px 6px 6px 10px; border-radius: var(--r-ctl); background: rgba(255, 255, 255, .04); }
.saveditem span { font-weight: 600; font-size: var(--t-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saveditem .tiny-btn { padding: 5px 9px; }
.input-setting { display: grid; gap: 4px; font-size: var(--t-s); margin: 10px 0; }
.input-check { display: flex; align-items: center; gap: 9px; }
.keymap { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 14px 0 6px; font-size: var(--t-s); }
.keymap dt { font-family: var(--display); font-weight: 700; background: var(--line-white); color: var(--asphalt); border-radius: 3px; padding: 1px 7px; text-align: center; }
.keymap dd { margin: 0; color: var(--gravel); align-self: center; }

/* ── Scène du garage ── */
.garage-scene-ui { position: absolute; left: var(--side-w); right: 0; top: var(--top-h); bottom: 0; pointer-events: none; padding: 18px var(--safe-r) var(--safe-b) 24px; }
.garage-scene-ui > * { pointer-events: auto; }

.garage-identity { position: absolute; left: 24px; top: 18px; max-width: min(520px, 52%); pointer-events: none; }
.plate {
  display: inline-flex; align-items: stretch; background: var(--line-white); color: var(--asphalt); border-radius: var(--r-sign);
  box-shadow: inset 0 0 0 3px var(--line-white), inset 0 0 0 5px var(--asphalt), 0 12px 30px rgba(0, 0, 0, .3); overflow: hidden;
}
.plate-number { display: grid; place-items: center; min-width: 52px; padding: 0 10px; background: var(--asphalt); color: var(--line-white); font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.6rem; margin: 5px 0 5px 5px; border-radius: 3px 0 0 3px; }
.plate h1 { margin: 0; padding: 9px 18px 9px 14px; font-family: var(--display); font-weight: 800; font-style: italic; font-size: clamp(1.7rem, 3.3cqw, 2.8rem); line-height: .95; letter-spacing: -.005em; }
#garageCarMeta { margin: 10px 0 0 2px; font-weight: 600; font-size: var(--t-s); color: var(--line-white); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }

.car-stats { display: grid; grid-template-columns: auto minmax(120px, 210px) auto; gap: 6px 10px; align-items: center; margin: 14px 0 0; padding: 10px 12px; background: var(--panel-soft); border-radius: var(--r-ctl); width: max-content; backdrop-filter: blur(6px); }
.car-stats dt { font-size: var(--t-xs); color: var(--gravel); font-weight: 600; }
.car-stats dd { margin: 0; }
.car-stats .bar { height: 6px; border-radius: 1px; background: repeating-linear-gradient(90deg, rgba(242, 243, 238, .14) 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); position: relative; }
.car-stats .bar i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, var(--balise) 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); background-size: var(--bar-w, 100%) 100%; width: var(--v, 0%); transition: width .35s cubic-bezier(.2, .8, .2, 1); }
.car-stats .val { font-family: var(--display); font-weight: 700; font-size: .98rem; font-variant-numeric: tabular-nums; text-align: right; }

.garage-camera-tools { position: absolute; right: var(--safe-r); top: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 300px; }
.garage-view-caption { font-family: var(--display); font-weight: 700; font-size: .95rem; letter-spacing: .06em; color: var(--line-white); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.view-buttons { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; }
.view-buttons button { background: var(--panel); padding: 6px 10px; }
.view-buttons button.sel { background: var(--line-white); color: var(--asphalt); border-color: var(--line-white); }
.vehicle-inspection { margin-top: 4px; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-ctl); max-width: 260px; }
.vehicle-inspection > summary { list-style: none; cursor: pointer; padding: 7px 11px; font-weight: 600; font-size: var(--t-s); }
.vehicle-inspection > summary::-webkit-details-marker { display: none; }
.vehicle-inspection[open] > summary { color: var(--balise); }
.vehicle-actions { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 8px; }
.vehicle-actions button { border: 1px solid var(--hairline); background: var(--asphalt-2); border-radius: var(--r-ctl); padding: 5px 9px; font-size: var(--t-xs); font-weight: 600; }
.vehicle-actions button[aria-pressed=true] { background: var(--balise); color: var(--balise-ink); border-color: var(--balise); }
#vehicleReference { margin: 0; padding: 0 11px 9px; color: var(--gravel); font-size: .68rem; line-height: 1.35; }
#vehicleReference:empty { display: none; }

.garage-category-rail { display: none; position: absolute; left: 24px; right: 300px; bottom: calc(var(--safe-b) + 6px); gap: 4px; overflow-x: auto; scrollbar-width: none; }
.garage-category-rail::-webkit-scrollbar { display: none; }
.garage-scene-ui.setup-mode .garage-category-rail { display: flex; }
.garage-scene-ui.setup-mode .car-stats { display: none; }
.garage-category-rail button { flex: none; border: 1px solid var(--hairline); background: var(--panel); border-radius: var(--r-ctl); padding: 7px 11px; font-family: var(--display); font-weight: 700; font-size: .92rem; white-space: nowrap; }
.garage-category-rail button.sel { background: var(--line-white); color: var(--asphalt); }

.garage-bottom { position: absolute; right: var(--safe-r); bottom: var(--safe-b); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.garage-orbit-hint { font-size: var(--t-xs); color: rgba(242, 243, 238, .7); text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.garage-drive { min-width: 270px; }

/* Collection and workshop finishing. */
.header { background: #111b23ed; gap: 14px; }
.sidebar { background: linear-gradient(115deg,#111b24f5,#18252ef0); box-shadow: 15px 0 55px #00000022; }
.side-main { padding-top: 20px; }
.collection-tools { display: grid; grid-template-columns: auto 1fr; gap: 7px; margin-top: 8px; }
.collection-tools select { padding: 7px 9px; min-width: 0; }
#carFavorites.sel { color: var(--balise); border-color: var(--balise); background: #ffc21a12; }
.car-row { display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: stretch; gap: 2px; }
.caritem { width: 100%; min-width: 0; min-height: 59px; padding-block: 9px; background: #ffffff03; }
.caritem.sel { border-color: #ffc21a88; background: linear-gradient(90deg,#ffc21a20,#ffc21a08); box-shadow: inset 3px 0 var(--balise); }
.car-copy { min-width: 0; }
.car-name, .car-spec { display: block; }
.car-name { line-height: 1.15; }
.car-spec { font-size: .68rem; }
.car-favorite { border: 0; background: transparent; color: #7d909d; font-size: 1.05rem; padding: 2px; border-radius: 4px; }
.car-favorite:hover, .car-favorite[aria-pressed=true] { color: var(--balise); background: #ffc21a0b; }
.library-footer { padding-top: 10px; border-top: 1px solid var(--hairline); }
.setup-status { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 5px 0; font-size: .68rem; }
.setup-status #paramCount { margin-block: 5px; }
#setupModified { color: var(--gravel); flex: none; }
#setupModified.changed { color: var(--balise); }
.field { padding-block: 13px; }
.fieldtitle { flex: 1; }
.fieldtitle label { line-height: 1.25; }
.field.modified .fieldtitle label { color: #ffe29b; }
.field-reset { border: 0; padding: 2px 4px; border-radius: 4px; color: var(--balise); background: #ffc21a13; font-size: 1rem; margin-left: auto; }
.field:not(.modified) .field-reset { visibility: hidden; pointer-events: none; }
.hint { line-height: 1.45; padding-top: 3px; }
.field input[type=number] { background: #0a141bbb; min-height: 30px; border-color: #ffffff12; }
.garage-identity { max-width: min(520px,58%); }
.garage-identity .section-kicker { color: #d8e0e4; text-shadow: 0 2px 8px #000; }
.plate { background: transparent; color: var(--line-white); box-shadow: none; overflow: visible; border-radius: 0; }
.plate-number { margin: 0 12px 0 0; background: transparent; color: var(--balise); border-right: 1px solid #ffffff40; min-width: 0; padding: 2px 14px 2px 0; font-size: 1.8rem; }
.plate h1 { padding: 0; text-shadow: 0 3px 16px #000; font-size: clamp(1.8rem,3.6cqw,3.3rem); line-height: .96; }
.car-stats { backdrop-filter: none; background: #111b23d9; border: 1px solid var(--hairline); padding: 12px 14px; margin-top: 16px; }
.car-stats .bar { height: 4px; }
.garage-view-caption { color: #b7c5ce; font-size: .72rem; letter-spacing: .12em; }
.view-buttons button { min-height: 30px; background: #111b23d9; }
.garage-drive { box-shadow: 0 10px 30px #0004; }
.options-entry { position: relative; display: block; width: 100%; padding: 15px; margin: 16px 0; text-align: left; border-radius: 7px; border: 1px solid var(--hairline); background: #ffffff04; }
.options-entry span { display: block; font: 700 1.35rem var(--display); }
.options-entry small { color: var(--gravel); font-size: .75rem; }
.options-entry b { position: absolute; right: 14px; top: 20px; color: var(--balise); font-size: 1.5rem; }
.options-entry:hover { border-color: var(--balise); }
.input-setting output { justify-self: end; color: var(--balise); font-size: .75rem; font-variant-numeric: tabular-nums; margin-top: -2px; }
