/* DartScope — feuille de style */
:root {
  --bg: #0d1210;
  --bg2: #121916;
  --card: #18201c;
  --card2: #1e2823;
  --line: #2a362f;
  --text: #ecf1ed;
  --muted: #94a39a;
  --accent: #f2b632;
  --accent-ink: #1a1405;
  --red: #e2363b;
  --green: #1fa35b;
  --cyan: #2fd4c0;
  --warn: #f08a24;
  --radius: 12px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #18251f 0%, transparent 60%), var(--bg);
  color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); letter-spacing: .02em; margin: 0 0 .5em; }
h2 { font-size: 1.35rem; font-weight: 700; }
code { background: #0006; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ok { color: var(--green); }
.warn { color: var(--warn); }
[hidden] { display: none !important; }

/* ---------- barre du haut */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 10px 24px;
  background: #0a0f0dcc; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 800 1.45rem var(--display); letter-spacing: .04em; text-transform: uppercase; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a, .usermenu a { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.mainnav a:hover, .usermenu a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.mainnav a.on, .usermenu a.on { color: var(--accent-ink); background: var(--accent); }
.usermenu { display: flex; align-items: center; gap: 8px; }
.usermenu form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }
.linkbtn:hover { color: var(--red); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.container.narrow { max-width: 640px; }
.page-title { font-size: 2.2rem; font-weight: 800; text-transform: uppercase; margin: 4px 0 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- cartes & formulaires */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.success { border-color: var(--green); }
.card.callout { border-left: 4px solid var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.form label, label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; margin: 0; }
input, select, textarea {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 9px 11px; font: inherit; font-weight: 500;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions.center { justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 16px; font: 600 .95rem var(--font); cursor: pointer; transition: transform .05s, background .15s;
}
.btn:hover { background: #26332c; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #ffc94d; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.big { padding: 13px 22px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.pulse { box-shadow: 0 0 0 0 #f2b63288; animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px #f2b63200; } 100% { box-shadow: 0 0 0 0 #f2b63200; } }
.icon { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 2px 6px; border-radius: 6px; }
.icon:hover { color: var(--text); background: var(--card2); }

.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; border: 1px solid; }
.flash-info { background: #1d2b3a; border-color: #2f4a66; }
.flash-success { background: #12301f; border-color: var(--green); }
.flash-error { background: #3a1517; border-color: var(--red); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); font-size: .8rem; color: var(--muted); font-weight: 600; }
.badge { padding: 1px 8px; border-radius: 99px; background: var(--card2); font-size: .8rem; }
.badge.win { background: var(--green); color: #fff; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li.ok { color: var(--green); } .checklist li.ko { color: var(--red); }
pre.code { background: #000; padding: 12px; border-radius: 8px; overflow: auto; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li .btn { margin-left: auto; }
.pager { display: flex; gap: 6px; margin-top: 12px; }
.pager a { padding: 4px 10px; border-radius: 6px; background: var(--card2); }
.pager a.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- toasts & modales */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; max-width: 380px; box-shadow: 0 8px 30px #0008; transition: opacity .4s, transform .4s; }
.toast-error { border-left-color: var(--red); } .toast-success { border-left-color: var(--green); } .toast-warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateX(20px); }
.modal { position: fixed; inset: 0; background: #000b; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 96vw; max-height: 96vh; overflow: auto; }

/* ---------- authentification */
body.auth main { min-height: calc(100vh - 60px); display: flex; align-items: center; }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; width: 100%; }
.auth-hero h1 { font-size: 3.4rem; font-weight: 800; text-transform: uppercase; line-height: 1; color: var(--accent); }
.auth-hero p { font-size: 1.15rem; color: var(--muted); max-width: 420px; }
.auth-card { max-width: 440px; width: 100%; }

/* ---------- accueil */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin: 8px 0 22px; }
.hero h1 { font-size: 2.6rem; font-weight: 800; margin: 0; text-transform: uppercase; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.kpi em { font-style: normal; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi strong { font: 800 2rem/1.1 var(--display); color: var(--accent); }
.kpi small { color: var(--muted); }

/* ---------- périphériques */
.board-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 14px; }
.step-num { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 800 1.4rem/40px var(--display); text-align: center; }
.step-body { min-width: 0; }
.cam-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.cam-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.cam-card.off { opacity: .75; }
.cam-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }
.cam-status { font-size: .8rem; padding: 2px 8px; border-radius: 99px; background: var(--card2); color: var(--muted); }
.cam-status.ok { background: #12301f; color: #6fe3a1; } .cam-status.warn { background: #3a2a12; color: var(--warn); }
.cam-preview-wrap { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.cam-preview { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.cam-card.live .cam-placeholder { display: none; }
.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 22px; margin-bottom: 10px; }
.slider span { display: flex; justify-content: space-between; }
.slider output { color: var(--accent); font-weight: 700; }
.slider small { font-weight: 400; }
.det-status { font-weight: 600; color: var(--muted); }
.det-status.idle { color: var(--green); } .det-status.motion { color: var(--accent); }
.test-layout { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 18px; margin-top: 14px; }
.debug-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.debug-grid figure { margin: 0; }
.debug-cam { width: 100%; background: #000; border-radius: 8px; }
.debug-grid figcaption { font-size: .8rem; color: var(--muted); }
.event-log { font-size: .85rem; max-height: 240px; overflow: auto; padding-left: 18px; color: var(--muted); }
.event-log li.dart { color: var(--text); } .event-log li.takeout { color: var(--cyan); } .event-log li.warn { color: var(--warn); }

.calib-box { width: 1280px; }
.calib-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.calib-head h2 { margin: 0; }
.calib-layout { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
.calib-stage { position: relative; }
#calibCanvas { width: 100%; display: block; background: #000; border-radius: 8px; cursor: crosshair; touch-action: none; }
#calibLoupe { position: absolute; display: none; width: 180px; height: 180px; border: 2px solid var(--accent); border-radius: 50%; pointer-events: none; box-shadow: 0 6px 20px #000a; }
.calib-mini { width: 200px; margin: 0 auto 10px; }
.calib-steps { list-style: none; padding: 0; margin: 0 0 10px; }
.calib-steps li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.calib-steps li .n { width: 22px; height: 22px; border-radius: 50%; background: var(--card2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.calib-steps li.done .n { background: var(--cyan); color: #000; }
.calib-steps li.active { background: var(--card2); outline: 1px solid var(--accent); }
.calib-steps li.active .n { background: var(--accent); color: #000; }
.calib-steps em { color: var(--muted); font-style: normal; font-size: .8rem; }
.dart-mark.calib-active circle { fill: var(--accent); }
.dart-mark.calib-done circle { fill: var(--cyan); }
.dart-mark.calib-todo circle { fill: #555; }

/* ---------- cible SVG */
.dartboard { width: 100%; height: auto; display: block; user-select: none; }
.dartboard.clickable { cursor: crosshair; }
.b-frame { fill: var(--b-frame, #0b0b0b); fill-opacity: var(--b-frame-op, 1); }
.b-dark { fill: var(--b-dark, #161616); fill-opacity: var(--b-seg-op, 1); }
.b-light { fill: var(--b-light, #efe3c6); fill-opacity: var(--b-seg-op, 1); }
.b-red { fill: var(--b-red, #d0232a); fill-opacity: var(--b-ring-op, 1); }
.b-green { fill: var(--b-green, #13874a); fill-opacity: var(--b-ring-op, 1); }
.b-wires { fill: none; stroke: var(--b-wire, #b9b9b9); stroke-width: .7; opacity: .7; pointer-events: none; }
.dartboard.has-photo .b-wires { opacity: .95; stroke-width: .9; }
.dartboard.has-photo .b-num { stroke: #000; stroke-width: 2.5px; paint-order: stroke; }
.b-photo { pointer-events: none; }
.b-num { fill: var(--b-num, #f3f3f3); font: 700 20px var(--display); pointer-events: none; }
.b-hl { fill: #f2b632; opacity: .55; pointer-events: none; animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .3; } to { opacity: .7; } }
.b-heat { pointer-events: none; }
.b-heat .dot circle { fill: #2fd4c0; opacity: .75; }
.dart-mark circle { fill: var(--cyan); stroke: #000; stroke-width: 1.5; }
.dart-mark text { fill: #000; font: 800 10px var(--display); pointer-events: none; }
.dart-mark.sel circle { fill: var(--accent); stroke: #fff; stroke-width: 2.5; }
.dart-mark.bust circle { fill: var(--red); }

/* ---------- nouvelle partie */
.play-layout { display: grid; grid-template-columns: 1.3fr 1fr 0.9fr; gap: 18px; align-items: start; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.mode { text-align: left; background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 14px; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; }
.mode strong { font: 800 1.4rem var(--display); text-transform: uppercase; }
.mode span { color: var(--muted); font-size: .85rem; }
.mode.on { border-color: var(--accent); background: #2a2412; }
.players { list-style: none; padding: 0; margin: 0 0 12px; }
.players li { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); margin-bottom: 6px; background: var(--bg2); }
.players li.on { border-color: var(--accent); }
.players .pos { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #000; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; }
.players li:not(.on) .pos { background: transparent; }
.add-player summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 10px; }

/* ---------- partie */
.game-main { max-width: 1500px; margin: 0 auto; padding: 14px 20px 30px; }
.game-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.game-title { font: 700 1.3rem var(--display); text-transform: uppercase; letter-spacing: .03em; }
.game-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cam-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; }
.cam-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.cam-chip.idle i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.cam-chip.motion i { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.cam-chip.paused i { background: var(--warn); }
body.offline .game-title::after { content: ' · hors ligne'; color: var(--red); }

.scoreboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.p-card { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; position: relative; transition: border-color .2s, background .2s; }
.p-card.active { border-color: var(--accent); background: linear-gradient(180deg, #2a2412, var(--card)); }
.p-card.won { border-color: var(--green); }
.p-name { font: 700 1.15rem var(--display); text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.legs { display: inline-flex; gap: 3px; }
.legs i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--muted); }
.legs i.on { background: var(--accent); border-color: var(--accent); }
.p-score { font: 800 4rem/1 var(--display); color: var(--text); margin: 4px 0; }
.p-card.active .p-score { color: var(--accent); }
.p-score small { font-size: 1.4rem; color: var(--muted); }
.p-stats { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text); font-weight: 600; font-size: .9rem; }
.p-stats em { font-style: normal; color: var(--muted); font-weight: 500; }
.progress { width: 100%; height: 8px; background: var(--bg2); border-radius: 9px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }

.game-body { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 440px); gap: 20px; align-items: start; }
.board-wrap { max-width: min(78vh, 760px); margin: 0 auto; }
.visit-col { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; position: sticky; top: 70px; }
.visit-head { display: flex; justify-content: space-between; align-items: baseline; font: 700 1.1rem var(--display); text-transform: uppercase; margin-bottom: 10px; gap: 10px; }
.visit-total { font-size: 2.2rem; color: var(--accent); }
.visit-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.slot { background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 10px 6px; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font: inherit; position: relative; min-height: 86px; }
.slot:disabled { cursor: default; }
.slot strong { font: 800 1.8rem var(--display); }
.slot small { color: var(--muted); font-weight: 600; }
.slot-n { position: absolute; top: 4px; left: 8px; font-size: .7rem; color: var(--muted); }
.slot.cam::after { content: '◉'; position: absolute; top: 4px; right: 8px; font-size: .65rem; color: var(--cyan); }
.slot.selected { border-color: var(--accent); box-shadow: 0 0 0 3px #f2b63240; }
.slot.bust { border-color: var(--red); }
.slot.bust strong { color: var(--red); text-decoration: line-through; }
.slot.hit strong { color: var(--green); }
.hint { min-height: 1.6em; font: 700 1.2rem var(--display); color: var(--cyan); margin-bottom: 10px; }
.hint em { font-style: normal; color: var(--muted); font-weight: 600; }
.visit-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-bottom: 12px; }
.takeout-banner { background: #12303a; border: 1px solid var(--cyan); color: var(--cyan); padding: 8px 12px; border-radius: 9px; font-weight: 700; margin-bottom: 10px; text-align: center; animation: glow 1.2s infinite alternate; }
.pad summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.pad-mult { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.pad-mult button, .pad-grid button { background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 0; font: 700 1rem var(--display); cursor: pointer; }
.pad-mult button.on { background: var(--accent); color: #000; border-color: var(--accent); }
.pad-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.pad-grid button:hover { background: var(--card2); }
.pad-grid button.miss { grid-column: span 2; color: var(--red); }
.visit-log { list-style: none; padding: 0; margin: 12px 0 0; font-size: .88rem; color: var(--muted); max-height: 220px; overflow: auto; }
.visit-log li { padding: 4px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 6px; }
.visit-log b { color: var(--text); }
.visit-log .tot { margin-left: auto; color: var(--accent); font-weight: 700; }
table.cricket { width: 100%; border-collapse: collapse; margin-top: 8px; text-align: center; font-family: var(--display); }
table.cricket th, table.cricket td { padding: 4px; border-bottom: 1px solid var(--line); }
table.cricket th.active { color: var(--accent); }
table.cricket td { font-size: 1.5rem; }
table.cricket td.m3 { color: var(--green); }
table.cricket tr.closed { opacity: .35; }
table.cricket tr.pts td { color: var(--accent); font-weight: 800; }
.end-box { width: 620px; text-align: center; }
.end-box h2 { font-size: 2.2rem; color: var(--accent); }
.end-box .table { margin: 10px 0 18px; text-align: left; }

/* ---------- écran TV */
body.tv { overflow: hidden; }
.tv-main { padding: 2vh 2vw; height: 100vh; display: flex; flex-direction: column; }
#tv { display: flex; flex-direction: column; height: 100%; }
.tv-head { display: flex; gap: 16px; align-items: center; font: 700 1.6rem var(--display); text-transform: uppercase; margin-bottom: 1.5vh; }
.tv-brand { color: var(--accent); }
body.tv .p-score { font-size: 8vh; }
body.tv .p-name { font-size: 3vh; }
.tv-body { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; min-height: 0; }
.tv-board { display: flex; justify-content: center; min-height: 0; }
.tv-board .dartboard { height: 100%; width: auto; max-width: 100%; }
.tv-who { font: 700 4vh var(--display); text-transform: uppercase; color: var(--muted); }
.tv-darts { display: flex; gap: 1.5vw; font: 800 7vh var(--display); }
.tv-darts span.bust { color: var(--red); text-decoration: line-through; }
.tv-total { font: 800 14vh/1 var(--display); color: var(--accent); }
.hint.big { font-size: 4vh; }
.tv-winner { position: fixed; inset: 0; background: #000c; display: flex; align-items: center; justify-content: center; font: 800 9vh var(--display); color: var(--accent); text-transform: uppercase; text-align: center; }

/* ---------- statistiques */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stats-grid .card { margin-bottom: 0; }
.stats-grid + .stats-grid { margin-top: 18px; }
.chart-box { height: 330px; }
.heat-board { max-width: 440px; margin: 0 auto; }
.bars .bar { display: grid; grid-template-columns: 52px 1fr 110px; gap: 10px; align-items: center; margin-bottom: 6px; font-size: .9rem; }
.bars .bar span { font-weight: 700; font-family: var(--display); font-size: 1.05rem; }
.bars .bar i { display: block; height: 12px; background: linear-gradient(90deg, var(--accent), var(--red)); border-radius: 6px; }
.bars .bar b { color: var(--muted); font-weight: 500; text-align: right; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .play-layout { grid-template-columns: 1fr 1fr; }
  .play-layout > :last-child { grid-column: span 2; }
  .calib-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; }
  .container, .game-main { padding: 16px; }
  .auth-wrap, .stats-grid, .play-layout, .game-body, .test-layout, .tv-body { grid-template-columns: 1fr; }
  .play-layout > :last-child { grid-column: auto; }
  .row3 { grid-template-columns: 1fr; }
  .visit-col { position: static; }
  .step { grid-template-columns: 1fr; }
  .p-score { font-size: 3rem; }
}

/* correctifs de mise en page */
.cam-card label, .row2 > label, .row3 > label { min-width: 0; }
.cam-card select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.b-darts .dart-mark { pointer-events: none; }
@media (max-width: 860px) { .usermenu { margin-left: auto; } .brand { flex: 1; } }

/* liste des caméras détectées */
.dev-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; flex-wrap: wrap; }
.dev-list li em { font-style: normal; color: var(--muted); font-size: .88rem; }
.dev-list li .btn { margin-left: auto; }
.dev-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dev-list li.on { border-color: #1fa35b88; }
.dev-list li.on .dev-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dev-list li.on em { color: #6fe3a1; font-weight: 600; }
.dev-list li.missing .dev-dot { background: var(--red); }
.dev-list li.missing em { color: var(--red); }
.cam-status.bad { background: #3a1517; color: #ff8a8d; }
.cam-chip.partial i { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

/* ---------- fond d'écran personnalisé */
.page-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; opacity: 0; transition: opacity .5s; pointer-events: none; }
.page-bg.on { opacity: 1; }
.page-bg-img { position: absolute; inset: 0; background-size: cover; background-position: center; transition: background-image .4s; }
.page-bg-dim { position: absolute; inset: 0; background: #000; }
body.has-page-bg .p-card, body.has-page-bg .visit-col, body.has-page-bg .tv-visit { background-color: #18201cd0; backdrop-filter: blur(6px); }
body.has-page-bg .p-card.active { background: linear-gradient(180deg, #2a2412e0, #18201cd0); }
body.has-page-bg .topbar { background: #0a0f0de6; }

/* ---------- page thème */
.theme-layout { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(340px, 460px); gap: 20px; align-items: start; }
.theme-stage { position: sticky; top: 70px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.theme-stage-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; }
.theme-stage-dim { position: absolute; inset: 0; background: #000; }
.theme-stage-board { position: relative; padding: 28px; max-width: 620px; margin: 0 auto; }
.theme-stage-board .dartboard { cursor: grab; touch-action: none; }
.theme-stage-board.dragging .dartboard { cursor: grabbing; }
.theme-stage-note { position: relative; text-align: center; color: #fffc; font-size: .85rem; padding: 0 12px 14px; text-shadow: 0 1px 3px #000; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset { background: var(--bg2); border: 2px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; color: var(--text); font: 600 .8rem var(--font); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.preset.on { border-color: var(--accent); }
.preset .sw { display: flex; width: 100%; height: 18px; border-radius: 5px; overflow: hidden; }
.preset .sw i { flex: 1; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.colors label { flex-direction: row; align-items: center; justify-content: space-between; margin: 0; font-weight: 500; }
.colors input[type=color] { width: 44px; height: 30px; padding: 2px; cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.gallery .ph { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; border: 2px solid var(--line); background: #000; }
.gallery .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .ph.in-board { border-color: var(--cyan); }
.gallery .ph.in-page { border-color: var(--accent); }
.gallery .ph .acts { position: absolute; inset: auto 0 0 0; display: flex; gap: 2px; padding: 3px; background: linear-gradient(transparent, #000c); opacity: 0; transition: opacity .15s; }
.gallery .ph:hover .acts, .gallery .ph:focus-within .acts { opacity: 1; }
.gallery .ph .acts button { flex: 1; font: 600 .68rem var(--font); padding: 4px 2px; border-radius: 5px; border: 0; cursor: pointer; background: #fffd; color: #000; }
.gallery .ph .acts button.del { flex: 0 0 24px; background: var(--red); color: #fff; }
.gallery .ph .tag { position: absolute; top: 4px; left: 4px; font: 700 .65rem var(--font); padding: 1px 6px; border-radius: 99px; background: #000b; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: #2a241233; color: var(--text); }
.seg-ctl { display: flex; gap: 4px; background: var(--bg2); padding: 3px; border-radius: 9px; border: 1px solid var(--line); margin-bottom: 10px; }
.seg-ctl button { flex: 1; background: none; border: 0; color: var(--muted); font: 600 .85rem var(--font); padding: 6px; border-radius: 7px; cursor: pointer; }
.seg-ctl button.on { background: var(--accent); color: #000; }
@media (max-width: 860px) { .theme-layout { grid-template-columns: 1fr; } .theme-stage { position: relative; top: 0; } .presets { grid-template-columns: repeat(2, 1fr); } }
.tv-visit { padding: 12px 18px; border-radius: 16px; }
.calib-steps li.calib-sep { cursor: default; font-size: .78rem; color: var(--accent); font-weight: 600; margin-top: 8px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 10px; }
.slot.near::before { content: '?'; position: absolute; top: 3px; right: 22px; font: 800 .8rem var(--display); color: var(--warn); }
.dart-mark.near circle { stroke: var(--warn); stroke-width: 2.5; }

/* ---------- atelier de jeux */
.lab-layout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start; }
.lab-layout textarea { background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px; font: inherit; resize: vertical; }
.games-list li { flex-wrap: wrap; gap: 6px; }
.games-list li.on a { color: var(--text); font-weight: 700; }
.games-list li .chip { margin-left: auto; }
.summary { white-space: pre-line; background: var(--bg2); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.selftest { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; background: var(--bg2); font-size: .9rem; }
.selftest.ok { border: 1px solid #1fa35b88; } .selftest.ok strong { color: #6fe3a1; }
.selftest.ko { border: 1px solid var(--red); } .selftest.ko strong { color: #ff8a8d; }
.selftest ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
#detail h3 { font-family: var(--display); font-size: 1.15rem; margin: 22px 0 8px; text-transform: uppercase; }
.try-layout { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 16px; }
.try-board { max-width: 420px; margin-top: 8px; }
.settings-form { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.settings-form label { margin-bottom: 4px; }
.settings-form input[type=number] { width: 90px; }
.code-view { margin-top: 16px; }
.code-view summary { cursor: pointer; color: var(--muted); }
.code-view pre { max-height: 420px; font-size: .8rem; }
.hint .msg { color: var(--accent); }
.inline-form { display: inline; margin: 0; }
@media (max-width: 960px) { .lab-layout, .try-layout { grid-template-columns: 1fr; } }
.app-card { display: flex; gap: 18px; align-items: flex-start; }
.app-card img { border-radius: 14px; flex: none; }
.app-card h2 { margin-bottom: 4px; }
html.is-app .topbar { padding-top: 6px; padding-bottom: 6px; }

/* ---------- avancement de la création & accès */
.prog-box { width: 620px; }
.prog-steps { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 6px; }
.prog-steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 4px 0; }
.prog-steps li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: .75rem; font-weight: 800; }
.prog-steps li.active { color: var(--text); font-weight: 600; }
.prog-steps li.active i { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.prog-steps li.done { color: var(--text); }
.prog-steps li.done i { background: var(--green); border-color: var(--green); color: #fff; }
.prog-steps li.done i::after { content: '✓'; }
.prog-steps li.error { color: #ff8a8d; }
.prog-steps li.error i { background: var(--red); border-color: var(--red); color: #fff; }
.prog-steps li.error i::after { content: '!'; }
.prog-steps li small { color: var(--muted); font-weight: 400; margin-left: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.prog-bar { height: 8px; background: var(--bg2); border-radius: 9px; overflow: hidden; margin-bottom: 6px; }
.prog-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width .6s ease; }
.prog-preview { background: var(--bg2); border-radius: 10px; padding: 10px 12px; font-size: .88rem; white-space: pre-line; max-height: 180px; overflow: auto; margin-bottom: 12px; border-left: 3px solid var(--accent); }
.access-pick { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; font-weight: 600; font-size: .9rem; }
.access-box { background: var(--bg2); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.access-box .seg-ctl { margin: 8px 0 4px; background: var(--card); }
.badge.premium, .chip.premium { background: linear-gradient(135deg, #f2b632, #ff8a3d); color: #1a1405; font-weight: 700; border: 0; }
.mode-note { font-size: .8rem; }
#ds-fatal { position: sticky; top: 0; z-index: 200; background: #3a1517; border-bottom: 2px solid var(--red); color: #fff; padding: 10px 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#ds-fatal span { color: #ffb3b5; font-size: .9rem; }
#ds-fatal button { margin-left: auto; background: var(--accent); color: #000; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 700; cursor: pointer; }
.games-list li.warn { color: #ff8a8d; }
