/* Chrono Slot – thème inspiré de PC Lap Counter (fond noir, lignes bleues, chiffres jaunes) */
:root {
  --bg: #000;
  --panel: #14161c;
  --panel2: #1d2029;
  --line: #2c3140;
  --text: #f2f4f8;
  --muted: #9aa3b5;
  --yellow: #ffe21a;
  --blue1: #0a1d6b;
  --blue2: #1d4fd8;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
body { display: flex; flex-direction: column; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
input, select { font: inherit; color: var(--text); background: #0d0f14; border: 1px solid #3a4152; border-radius: 3px; padding: 4px 6px; }
input[type=number] { width: 6em; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue2); width: 1.1em; height: 1.1em; vertical-align: -2px; }

/* ---------- barre de titre ---------- */
.titlebar { display: flex; align-items: center; gap: 12px; padding: 4px 10px; background: linear-gradient(#2b4a9a, #16306f); font-size: 14px; flex-wrap: wrap; }
.titlebar .appname { font-weight: 700; }
.titlebar .sub { color: #cdd8ff; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.conn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.conn .dot.off { background: #777; box-shadow: none; }
.conn a.help { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #8fa3d9; color: #cdd8ff; text-decoration: none; font-size: 12px; }
.conn a.warn { color: var(--orange); }
.circuit-pick { display: block; margin-bottom: 10px; }

/* ---------- barre d'outils (icône au-dessus du libellé) ---------- */
.toolbar { display: flex; align-items: stretch; gap: 1px; padding: 3px 4px; background: linear-gradient(#262a33, #050608); border-bottom: 1px solid #000; overflow-x: auto; flex-shrink: 0; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; padding: 3px 6px; background: transparent; border: 1px solid transparent; border-radius: 3px; }
.tool:hover:not(:disabled) { background: #2f3542; border-color: #4a5266; }
.tool .ic { font-size: 22px; line-height: 26px; height: 26px; }
.tool .lb { font-size: 12px; white-space: nowrap; }
.tool.go .ic { color: #3ddc5f; }
.tool.pause .ic { color: #9fb3d9; }
.tool.stop .ic { color: #ff4a4a; }
.tool.stop.armed { background: #7a1010; border-color: #ff4a4a; }
.tool.on { background: #2a3b66; border-color: #4f6fbf; }
.toolbar .sep { width: 1px; margin: 4px 4px; background: #3a3f4c; }
.toolbar .sync { margin-left: auto; align-self: center; font-size: 12px; color: var(--muted); padding: 0 8px; white-space: nowrap; }

.simbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 4px 10px; background: #2a1f00; border-bottom: 1px solid #5a4400; font-size: 13px; }
.simlane { display: inline-flex; align-items: center; gap: 4px; }
.flash { position: fixed; top: 90px; left: 50%; transform: translateX(-50%); z-index: 50; background: #111827; border: 2px solid var(--yellow); padding: 10px 18px; border-radius: 6px; font-size: 18px; box-shadow: 0 6px 30px #000; }

/* ---------- boutons génériques ---------- */
.small { font-size: 13px; padding: 3px 10px; border-radius: 3px; border: 1px solid #4b6bd0; background: #1f3c99; }
.ghost { background: #222733; border: 1px solid #454c5e; border-radius: 3px; padding: 6px 12px; }
.ghost.small { padding: 3px 10px; }
.danger { border-color: #a33; color: #ffb4b4; }
.primary { background: linear-gradient(#2f6af0, #1a45b8); border: 1px solid #6d93ff; border-radius: 3px; padding: 7px 20px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- tableau principal ---------- */
.board-wrap { flex: 1; overflow: auto; position: relative; background: #000; }
.empty { padding: 60px 20px; text-align: center; font-size: 22px; color: var(--muted); }
table.board { width: 100%; border-collapse: collapse; table-layout: auto; }
.board thead th { cursor: grab; user-select: none; touch-action: none; }
.board thead th.dragging { opacity: .45; cursor: grabbing; }
.board thead th.drop-l { box-shadow: inset 4px 0 0 var(--yellow); }
.board thead th.drop-r { box-shadow: inset -4px 0 0 var(--yellow); }
.board thead th .rz { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; touch-action: none; z-index: 3; }
.board thead th:last-child .rz { right: 0; }
.board thead th .rz:hover, .board thead th .rz:active { background: rgba(255,255,255,.35); }
.board thead th { position: sticky; top: 0; z-index: 2; background: linear-gradient(#5d6270, #2b2e36); color: #fff; font-weight: 400; font-size: 13px; padding: 3px 6px; border: 1px solid #000; white-space: nowrap; }
.board tbody tr { height: calc((100vh - 190px) / var(--rows, 2)); max-height: 260px; }
.board tbody td { border: 1px solid #000; padding: 4px 8px; text-align: center; vertical-align: middle;
  background: linear-gradient(180deg, #0c2a9e 0%, #081a66 45%, #050f40 100%); color: #fff; }
.board td.c-pos { background: linear-gradient(90deg, #000 0%, #062080 100%); }
.posn { font-size: clamp(48px, 9vh, 110px); font-weight: 900; font-style: italic; color: var(--yellow); -webkit-text-stroke: 2px #000; text-shadow: 3px 3px 0 #000; line-height: 1; padding: 0 8px; }
/* largeur automatique des colonnes, sauf celles réglées en tirant leur titre (th.sized) */
.board th:is(.c-pos, .c-photo, .c-lane):not(.sized) { width: 1%; }
.board th.c-driver:not(.sized) { min-width: 220px; }
.board th.c-gauge:not(.sized) { min-width: 170px; }
.glow { display: inline-block; padding: 18px 40px; font-size: clamp(22px, 4vh, 44px); font-weight: 800; color: #000;
  background: radial-gradient(ellipse at center, #fff86a 0%, #f2e30f 35%, rgba(242,227,15,.35) 60%, transparent 72%); }
.board td.c-car { font-size: 15px; color: #cfd8ff; }
.num { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num.xl { font-size: clamp(40px, 8vh, 96px); }
.num.lg { font-size: clamp(28px, 5.5vh, 64px); }
.num.md { font-size: clamp(18px, 3.2vh, 34px); }
.pill { display: inline-block; padding: 4px 12px; border-radius: 14px; font-size: clamp(16px, 2.8vh, 28px); background: linear-gradient(#5b6070, #24262e); border: 2px solid #9aa0ad; color: #fff; }
.pill.rec { background: linear-gradient(#7b2fd0, #3b0f80); border-color: #e3c5ff; }
.fuelnum { color: #5aa9ff; font-size: clamp(16px, 2.6vh, 26px); }
.gauge { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px; padding: 6px 8px 16px; background: #1b1b1b; border: 1px solid #555; border-radius: 4px; font-size: 10px; color: #f66; }
.gauge .mx { color: #ddd; }
.gauge .segs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.gauge .segs i { height: 9px; background: #333; }
.gauge .segs i.on { background: #39e639; box-shadow: 0 0 4px #39e639; }
.gauge.low .segs i.on { background: var(--orange); box-shadow: 0 0 4px var(--orange); }
.gauge.empty { background: #b31414; }
.gauge .glabel { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 11px; }
.lanebox { display: inline-block; min-width: 30px; padding: 1px 6px; border: 2px solid #fff; border-radius: 3px; background: var(--c, #888); color: #fff; font-weight: 800; font-style: normal; font-size: 18px; text-shadow: 1px 1px 0 #000; }
.c-lane .sg { display: block; margin: 6px auto 0; font-size: 11px; padding: 1px 6px; background: #3a0d0d; border: 1px solid #a33; border-radius: 3px; }
.board tr.done td:not(.c-pos) { filter: saturate(.6) brightness(.85); }
.tags { margin-top: 2px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tag { background: #222; border: 1px solid #777; border-radius: 3px; font-size: 13px; padding: 1px 6px; }
.tag.warn { background: #8a1c00; border-color: #ff9b6b; animation: blink 1s steps(2) infinite; }

/* ---------- vue Zoom (même rendu que le grand écran) ---------- */
.zoomwrap { height: 100%; }
.zoomwrap .d-wrap { height: 100%; }

/* ---------- grand message central ---------- */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); z-index: 5; pointer-events: none; }
.overlay.soft { background: transparent; align-items: flex-end; padding-bottom: 20px; }
.ov-box { background: rgba(10,12,18,.92); border: 3px solid #555; border-radius: 10px; padding: 20px 40px; text-align: center; box-shadow: 0 10px 50px #000; }
.ov-box.ready { padding: 10px 24px; border-color: var(--blue2); }
.ov-box.pause { border-color: var(--yellow); }
.ov-box.false { border-color: var(--red); animation: blinkb 0.8s steps(2) infinite; }
.ov-big { font-size: clamp(50px, 12vh, 140px); font-weight: 900; color: var(--yellow); letter-spacing: 2px; }
.ov-box.false .ov-big { color: var(--red); }
.ov-text { font-size: clamp(16px, 2.5vh, 26px); color: #ddd; margin-top: 6px; }
.ov-lights { display: flex; gap: 22px; justify-content: center; }
.ov-lights .bulb { width: clamp(60px, 12vh, 130px); height: clamp(60px, 12vh, 130px); }

/* ---------- barre d'état du bas ---------- */
.statusbar { display: flex; align-items: center; gap: 18px; padding: 4px 12px; background: linear-gradient(#20242c, #050607); border-top: 1px solid #3a3f4c; flex-shrink: 0; flex-wrap: wrap; }
.inds { display: flex; gap: 12px; }
.ind { display: flex; flex-direction: column; align-items: center; font-size: 12px; gap: 2px; }
.ind i { width: 26px; height: 22px; border-radius: 5px; background: linear-gradient(#5a6070, #2a2e38); border: 1px solid #9aa0ad; position: relative; }
.ind.on i { background: linear-gradient(#ffb347, #e06d00); border-color: #ffd29a; }
.ind.on i::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-weight: 800; color: #fff; }
.clocks { display: flex; gap: 18px; align-items: flex-end; border-left: 1px solid #3a3f4c; padding-left: 16px; }
.clocks div { display: flex; flex-direction: column; align-items: center; }
.clocks label { font-size: 12px; color: #ddd; }
.clocks b { font-size: 26px; font-weight: 800; color: #cfe3ff; font-variant-numeric: tabular-nums; }
.clocks b.small { font-size: 16px; font-weight: 600; color: #ddd; }
.recs { font-size: 13px; line-height: 1.5; border-left: 1px solid #3a3f4c; padding-left: 16px; }
.recs label { color: #ccc; }
.bulbs { display: flex; gap: 6px; margin-left: auto; padding: 4px 10px; background: #111; border-radius: 12px; }
.bulb { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #666, #2a2a2a); display: inline-block; }
.bulb.red { background: radial-gradient(circle at 35% 35%, #ff9a9a, #e00000); box-shadow: 0 0 10px #f00; }
.bulb.green { background: radial-gradient(circle at 35% 35%, #b6ffb6, #00c000); box-shadow: 0 0 10px #0f0; }
.bulb.yellow { background: radial-gradient(circle at 35% 35%, #fff2a0, #e0b000); box-shadow: 0 0 10px #fc0; animation: blink 1s steps(2) infinite; }
.power { padding: 6px 16px; border-radius: 8px; font-weight: 700; background: linear-gradient(#3b4252, #161a22); border: 2px solid #c22; }
.power.on { color: #fff; }
.power.off { color: #ff6b6b; background: linear-gradient(#5a0d0d, #2a0505); }

@keyframes blink { 50% { opacity: .25; } }
@keyframes blinkb { 50% { border-color: #400; } }

/* ---------- menu clic droit ---------- */
.ctxmenu { position: fixed; z-index: 60; display: flex; background: #000; border: 1px solid #777; box-shadow: 4px 4px 14px #000; min-width: 230px; }
.ctx-side { writing-mode: vertical-rl; transform: rotate(180deg); background: #333; padding: 6px 3px; font-weight: 700; font-size: 13px; }
.ctx-items { display: flex; flex-direction: column; flex: 1; }
.ctx-item { text-align: left; background: none; border: none; padding: 7px 14px; font-size: 14px; }
.ctx-item:hover:not(:disabled) { background: #1f3c99; }

/* ---------- fenêtres ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto; }
.modal { background: var(--panel); border: 1px solid #5a6275; border-radius: 4px; width: min(1000px, 100%); box-shadow: 0 10px 50px #000; }
.modal.m-setup { width: min(820px, 100%); }
.modal-title { display: flex; align-items: center; padding: 6px 10px; background: linear-gradient(#2b4a9a, #16306f); font-weight: 600; }
.modal-title .x { margin-left: auto; background: #b02020; border: 1px solid #f88; border-radius: 3px; width: 28px; height: 24px; }
.modal-body { padding: 14px 16px; max-height: calc(100vh - 120px); overflow: auto; }
fieldset { border: 1px solid #3c4356; border-radius: 4px; margin: 0 0 12px; padding: 8px 12px 12px; min-width: 0; }
fieldset select { max-width: 100%; }   /* noms de voix très longs : la liste reste dans son cadre */
legend { color: #9fb7ff; padding: 0 6px; }
fieldset label { display: block; margin: 7px 0; }
fieldset label.chk, fieldset label.radio { display: flex; gap: 8px; align-items: center; }
.types { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.opts summary { cursor: pointer; color: #9fb7ff; margin: 8px 0; }
.actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.lanes-setup { width: 100%; border-collapse: collapse; }
.lanes-setup th { text-align: left; font-weight: 400; color: var(--muted); font-size: 13px; }
.lanes-setup td { padding: 4px 6px; }
.lanes-setup select { width: 100%; }
.testrow { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.log { background: #07080b; border: 1px solid #333; padding: 6px; font-size: 12px; height: 220px; overflow: auto; white-space: pre-wrap; }

/* résultats / historique */
.restable, .hist, .laptable table { width: 100%; border-collapse: collapse; font-size: 14px; }
.restable th, .hist th, .laptable th { text-align: left; color: var(--muted); font-weight: 400; border-bottom: 1px solid var(--line); padding: 5px 6px; }
.restable td, .hist td, .laptable td { border-bottom: 1px solid #23283a; padding: 5px 6px; font-variant-numeric: tabular-nums; }
.restable td.pos { font-size: 22px; font-weight: 900; font-style: italic; color: var(--yellow); }
.laptable { max-height: 320px; overflow: auto; margin-top: 10px; }
.laptable td.best { color: #d9b3ff; font-weight: 700; }
.hist tr.clickable { cursor: pointer; }
.hist tr.clickable:hover td { background: #1b2233; }
.hist tr.open td { background: #1b2233; }
.hist td.win b { color: var(--yellow); }
.hist small { color: var(--muted); }
.detailrow > td { background: #10131b; padding: 10px; }
.saved { margin: 10px 0; }
.chart { width: 100%; height: auto; background: #0b0d12; border: 1px solid #23283a; border-radius: 4px; margin-top: 10px; }
.chart .grid { stroke: #2a3042; }
.chart .ax { fill: #8a93a8; font-size: 11px; }
.records .recgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.records h3 { margin: 6px 0; font-size: 15px; color: #9fb7ff; }
.records ol { margin: 0; padding-left: 20px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.people form { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.people form input { flex: 1; min-width: 100px; }
.people form button { background: #1f3c99; border: 1px solid #4b6bd0; border-radius: 3px; padding: 4px 12px; }
.plist { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow: auto; }
.plist li { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px; border-bottom: 1px solid #23283a; }

/* plein écran : on cache la barre de titre */
body.fs .titlebar { display: none; }

@media (max-width: 800px) {
  .board .c-car, .board th.c-car { display: none; }
  .glow { padding: 8px 16px; }
  .tool { min-width: 60px; }
  .clocks b { font-size: 20px; }
}

/* ---------- grand écran / live timing ---------- */
body.display-page { overflow: hidden; }
.d-empty { display: grid; place-items: center; height: 100vh; font-size: 4vh; color: var(--muted); }
.d-wrap { display: flex; flex-direction: column; height: 100vh; background: #000; position: relative; }
.d-wrap.d-yellow { box-shadow: inset 0 0 0 10px #ffd400; }
.d-head { display: flex; align-items: center; gap: 3vw; padding: 1vh 2vw; background: linear-gradient(#2b4a9a, #16306f); }
.d-title { font-size: 3.2vh; font-weight: 700; }
.d-phase { font-size: 2.2vh; color: #cdd8ff; font-weight: 400; }
.d-bulbs { display: flex; gap: 1vw; margin-left: auto; }
.d-bulbs .bulb { width: 4.5vh; height: 4.5vh; }
.d-clock { display: flex; flex-direction: column; align-items: flex-end; font-size: 7vh; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.d-clock label { font-size: 1.8vh; font-weight: 400; color: #cdd8ff; }
.d-clock small { font-size: 2.4vh; font-weight: 600; }
.d-rows { flex: 1; display: grid; grid-template-rows: repeat(var(--n), 1fr); gap: 0.6vh; padding: 0.6vh; }
.d-row { display: grid; grid-template-columns: 12vh auto 1fr 20vh 30vh 22vh; align-items: center; gap: 2vw; padding: 0 2vw;
  background: linear-gradient(180deg, #0c2a9e 0%, #081a66 45%, #050f40 100%); border-left: 1.2vh solid var(--c); }
.d-pistes .d-row { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #fff) 0%, var(--c) 40%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  border-left-color: #000; text-shadow: 0 0 3px #000, 1px 2px 2px #000; }
.d-pistes .d-car, .d-pistes .d-name small, .d-pistes .d-best, .d-pistes .d-gap { color: #fff; }
.d-pistes .d-photo { border-color: #fff; }
/* classement du championnat sur le grand écran */
.d-champ { flex: 1; display: grid; grid-template-rows: repeat(var(--n), 1fr); gap: 0.6vh; padding: 0.6vh; }
.d-crow { display: grid; grid-template-columns: 12vh 1fr auto; align-items: center; gap: 2vw; padding: 0 3vw;
  background: linear-gradient(180deg, #0c2a9e 0%, #081a66 45%, #050f40 100%); }
.d-crow .d-pos { font-size: min(9vh, calc(70vh / var(--n))); }
.d-cname { font-size: min(6vh, calc(45vh / var(--n))); font-weight: 800; }
.d-cname small, .d-cpts small { font-size: .45em; font-weight: 400; color: #cdd8ff; }
.d-cpts { font-size: min(7vh, calc(50vh / var(--n))); font-weight: 900; font-variant-numeric: tabular-nums; color: var(--yellow); }

/* télécommande (live timing sur le téléphone du propriétaire) */
.remote-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 14, 30, .94); border-top: 2px solid #2f6af0; }
.rbtn { flex: 1 1 0; min-width: 70px; padding: 14px 6px; font-size: 18px; font-weight: 800; border-radius: 8px; background: linear-gradient(#3a4155, #1d2130); border: 1px solid #6c7590; color: #fff; }
.rbtn.go:not(:disabled) { background: linear-gradient(#2fa84f, #17702f); border-color: #7be39a; }
.rbtn.stop:not(:disabled) { background: linear-gradient(#c0392b, #7a1a12); border-color: #ff9b8b; }
.rbtn:disabled { opacity: .35; }
/* avec la barre : la page en colonne, l'affichage prend la place qui reste */
body:has(.remote-bar) #app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body:has(.remote-bar) .d-wrap { flex: 1; min-height: 0; height: auto; }
.rstatus { flex-basis: 100%; text-align: center; font-size: 14px; color: #cdd8ff; }
.d-row.ghost { filter: grayscale(1) brightness(.7); }
.d-pos { font-size: 11vh; font-weight: 900; font-style: italic; color: var(--yellow); -webkit-text-stroke: 3px #000; line-height: 1; }
.d-photo { height: 12vh; width: 12vh; object-fit: cover; border-radius: 8px; border: 3px solid var(--c); }
.d-photo.none { visibility: hidden; }
.d-name { font-size: 6vh; font-weight: 800; line-height: 1.1; }
.d-name small { font-size: 2.6vh; color: #cdd8ff; }
.d-name .lanebox { font-size: 3vh; vertical-align: middle; }
.d-car { font-size: 2.4vh; font-weight: 400; color: #cfd8ff; }
.d-status { color: #ffb36b; }
.d-laps { font-size: 13vh; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.d-times { font-size: 5.5vh; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.15; }
.d-best { color: #bbb; }
.d-best.rec { color: #d9b3ff; }
.d-gap { font-size: 4vh; font-weight: 700; color: #ffb36b; text-align: right; }
.d-fuel { font-size: 2.8vh; color: #5aa9ff; }
.d-foot { padding: 0.8vh 2vw; font-size: 2.4vh; background: #111; }
.d-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 2vh 5vw; font-size: 12vh; font-weight: 900;
  color: var(--yellow); background: rgba(0,0,0,.85); border: 4px solid var(--yellow); border-radius: 16px; pointer-events: none; }
@media (max-width: 800px) {
  .d-row { grid-template-columns: 8vh 1fr 12vh 22vh; }
  .d-photo, .d-gap { display: none; }
  .d-name { font-size: 4vh; }
}

/* ---------- thèmes (Options → Affichage) ---------- */
body[data-theme="noir"] .board tbody td { background: linear-gradient(180deg, #2a2a2a 0%, #141414 50%, #050505 100%); }
body[data-theme="noir"] .board td.c-pos { background: #000; }
body[data-theme="rouge"] .board tbody td { background: linear-gradient(180deg, #a3101a 0%, #6a0a10 45%, #34050a 100%); }
body[data-theme="rouge"] .board td.c-pos { background: linear-gradient(90deg, #000 0%, #6a0a10 100%); }
/* fond de chaque ligne à la couleur de sa piste (--c), contour noir sur le texte pour rester lisible sur le jaune */
body[data-theme="pistes"] .board tbody td { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #fff) 0%, var(--c) 40%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  text-shadow: 0 0 3px #000, 1px 2px 2px #000; }
body[data-theme="pistes"] .board td.c-pos { background: linear-gradient(90deg, #000 0%, color-mix(in srgb, var(--c) 70%, #000) 100%); }
body[data-theme="pistes"] .board td.c-car { color: #fff; }
body[data-theme="pistes"] .board .glow { text-shadow: none; }
body[data-theme="pistes"] .board td.c-photo img { border-color: #fff; }

/* ---------- tableau : photos, équipes, lièvres, disqualifiés ---------- */
.board td.c-photo { padding: 2px; }
.board td.c-photo img { width: clamp(50px, 12vh, 120px); height: clamp(50px, 12vh, 120px); max-width: 100%; object-fit: cover; border-radius: 6px; border: 2px solid var(--c); display: block; }
.teamname { color: #cdd8ff; font-size: 14px; margin-top: 2px; }
.board tr.ghost td:not(.c-pos) { filter: grayscale(1) brightness(.75); }
.board tr.ghost .glow { background: radial-gradient(ellipse at center, #ddd 0%, #aaa 35%, rgba(170,170,170,.3) 60%, transparent 72%); }
.board tr.dq td { opacity: .55; }
.seriesbar { padding: 3px 12px; background: #1f2d5c; border-bottom: 1px solid #000; font-weight: 600; }
.seriesinfo { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; padding: 6px 10px; background: #1b2546; border-radius: 4px; }
.overlay.top { align-items: flex-start; padding-top: 10px; }
.ov-box.yellowflag { border-color: #ffd400; padding: 6px 30px; }
.ov-box.yellowflag .ov-big { font-size: clamp(30px, 6vh, 60px); color: #ffd400; }

/* ---------- pilotes : photo, sons ---------- */
.photo-pick { display: inline-grid; place-items: center; border: 1px dashed #556; border-radius: 6px; cursor: pointer; overflow: hidden; flex-shrink: 0; background: #0d0f14; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.plist li.person { display: block; }
.prow { display: flex; align-items: center; gap: 8px; }
.prow .pname { flex: 1; }
.sounds { padding: 4px 0 8px 52px; }
.btnlike { display: inline-block; cursor: pointer; }
.teamlist { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.x-mini { background: none; border: none; color: #f88; padding: 0 2px; }
.colorder { margin: 4px 0; padding: 0; list-style: none; }
.colorder li { display: flex; align-items: center; gap: 4px; padding: 1px 0; }
.colorder li .chk { flex: 1; margin: 0; }
.colorder li span.chk { padding-left: 26px; }   /* toujours affichée : alignée avec celles qui ont une case */
.colorder li button { padding: 0 8px; }
input[type=color] { width: 40px; height: 28px; padding: 0 2px; }

/* ---------- manches, championnat ---------- */
.restable tr.cur td { background: #1b2546; }
.restable td.gp { cursor: pointer; white-space: nowrap; }
.restable td.gp:hover { background: #1b2233; }
.restable td.excl { text-decoration: line-through; opacity: .5; }
.champ .testrow input { flex: 1; }

/* ---------- comptes ---------- */
.titlebar .acct { margin-left: auto; }
.titlebar .acct.warn { border-color: var(--orange); color: var(--orange); }
.auth-page { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; align-items: flex-start; padding: 40px 16px; }
.auth-box { width: min(420px, 100%); }
.auth-about { width: min(420px, 100%); color: var(--muted); }
.auth-about h2 { color: var(--text); font-size: 20px; margin-top: 0; }
.auth-about li { margin: 6px 0; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; }
.auth-form button { align-self: flex-start; }
.auth-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.auth-err { color: var(--red); margin: 0; }
.auth-ok, .account .ok { color: var(--green); }
.account .warn { color: var(--orange); }
.account .auth-form { max-width: 360px; }
.auth-tabs { gap: 6px; margin-bottom: 14px; }
