/* MySimpleDarts — 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: minmax(0, 1.3fr) minmax(0, 1fr) minmax(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; }

/* ---------- cartes des jeux créés */
.mode { position: relative; }
.mode .mode-tag { font-style: normal; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--cyan); margin-top: 4px; }
.mode.premium .mode-tag { color: var(--accent); }
.mode.premium { background: linear-gradient(160deg, #2a2412 0%, var(--bg2) 55%); }
.mode.premium { padding-right: 52px; }
.mode .lock { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 1.05rem; line-height: 1; background: linear-gradient(135deg, #f2b632, #ff8a3d); box-shadow: 0 2px 8px #0008; }
.mode.locked { cursor: not-allowed; background: repeating-linear-gradient(135deg, #141a17 0 10px, #111613 10px 20px); border-style: dashed; }
.mode.locked strong, .mode.locked span { color: #6f7c74; }
.mode.locked .mode-tag::before { content: 'Réservé · '; }
.cg-title { font: 800 1.3rem var(--display); text-transform: uppercase; margin: 0 0 4px; }
.p-checkout { flex-basis: 100%; margin-top: 4px; font: 700 1.05rem var(--display); color: var(--muted); letter-spacing: .02em; }
.p-checkout em { font-style: normal; font-size: .75rem; text-transform: uppercase; color: var(--muted); font-family: var(--font); font-weight: 600; margin-right: 4px; }
.p-checkout.on { color: var(--cyan); font-size: 1.25rem; }
body.tv .p-checkout { font-size: 2.6vh; }

/* ---------- Célébration de victoire : feu d'artifice plein écran ---------- */
#fireworks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; display: none; }
#fireworks.on { display: block; }
.end-box.celebrating h2 { animation: ds-winner 1.2s ease-in-out infinite alternate; }
@keyframes ds-winner { from { transform: scale(1); text-shadow: 0 0 0 transparent; } to { transform: scale(1.06); text-shadow: 0 0 22px #f2b63299; } }
.tv-winner.celebrating { animation: ds-glow 1.2s ease-in-out infinite alternate; }
@keyframes ds-glow { from { text-shadow: 0 0 0 transparent; } to { text-shadow: 0 0 40px #f2b632cc; } }
.tv-sound { position: fixed; right: 18px; bottom: 18px; z-index: 70; }
@media (prefers-reduced-motion: reduce) { .end-box.celebrating h2, .tv-winner.celebrating { animation: none; } }
.tv-winner { flex-direction: column; gap: 4vh; }
.tv-done { font: 600 2.4vh var(--font); text-transform: none; position: relative; z-index: 70; }

/* ---------- Partie en cours : barre de navigation escamotable ---------- */
body.nav-auto .topbar {
  position: fixed; top: 0; left: 0; right: 0; transform: translateY(-100%);
  transition: transform .25s ease, box-shadow .25s; background: #0a0f0df2;
}
body.nav-auto.nav-show .topbar, body.nav-auto .topbar:focus-within { transform: none; box-shadow: 0 8px 30px #000a; }
.nav-handle {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 19;
  width: 72px; height: 16px; padding: 0; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px;
  background: var(--card); color: var(--muted); font-size: 11px; line-height: 12px; cursor: pointer; opacity: .55; transition: opacity .2s;
}
.nav-handle:hover, .nav-handle:focus-visible { opacity: 1; color: var(--text); }
body.nav-auto.nav-show .nav-handle { opacity: 0; pointer-events: none; }
body:not(.nav-auto) .nav-handle { display: none; }
/* la place libérée profite à la cible : elle tient dans la hauteur de l'écran */
body.nav-auto .board-wrap { max-width: min(max(calc(100vh - 250px), 420px), 860px); }
@media (prefers-reduced-motion: reduce) { body.nav-auto .topbar { transition: none; } }

/* ---------- Historique : parties exclues des statistiques ---------- */
.hist-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.table.hist th.sel, .table.hist td.sel { width: 32px; padding-right: 0; }
.table.hist input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.table.hist tr:not(:first-child) { cursor: pointer; }
.table.hist tr:not(:first-child):hover td { background: #ffffff06; }
.table.hist tr.excluded td:not(.sel):not(:last-child) { opacity: .5; }
.badge.off { background: transparent; color: var(--warn); border: 1px dashed var(--warn); white-space: nowrap; font-size: .72rem; }
.table.hist td:nth-child(2) { white-space: nowrap; }

/* =====================================================================
   Partie : disposition « arène » — cible au centre, joueurs de chaque côté, scores en très grand
   ===================================================================== */
.arena { --board: min(calc(100vh - 360px), 46vw, 900px); display: grid; grid-template-columns: minmax(200px, 1fr) var(--board) minmax(200px, 1fr); gap: 20px; align-items: stretch; }
body.nav-auto .arena { --board: min(calc(100vh - 320px), 46vw, 900px); }
.arena-side { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; container-type: inline-size; }
.arena-center { display: flex; flex-direction: column; align-items: center; min-width: 0; gap: 8px; }
.arena-center > * { width: 100%; }

/* cartes des joueurs */
.pc { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 14px 20px 16px; display: flex; flex-direction: column; gap: 2px;
      transition: border-color .25s, box-shadow .25s, transform .25s, opacity .25s; }
.arena-side[data-n="1"] .pc { padding: 20px 24px 22px; }
.pc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 800 clamp(1.1rem, 9cqi, 2rem)/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.pc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pc-tag { font: 700 .8rem var(--font); text-transform: none; color: var(--muted); background: var(--card2); border-radius: 99px; padding: 2px 8px; }
.pc-turn { font: 800 .72rem var(--font); letter-spacing: .08em; background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 3px 9px; }
.pc .legs { margin-left: auto; }
.pc-score { font: 800 clamp(3.2rem, 46cqi, 12rem)/.95 var(--display); color: var(--text); letter-spacing: -.01em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.pc-score.long { font-size: clamp(2.8rem, 36cqi, 10rem); }
.arena-side[data-n="2"] .pc-score { font-size: clamp(3rem, 40cqi, 9rem); }
.arena-side[data-n="3"] .pc-score, .arena-side[data-n="4"] .pc-score { font-size: clamp(2.4rem, 30cqi, 6rem); }
.pc-score small { font-size: .3em; color: var(--muted); }
.pc-finish { font: 800 clamp(1.1rem, 10cqi, 2.6rem)/1.15 var(--display); color: var(--cyan); min-height: 1.15em; letter-spacing: .02em; }
.pc-finish.empty { min-height: .4em; }
.pc-stats { display: flex; gap: 6px 14px; flex-wrap: wrap; font-weight: 700; font-size: clamp(.85rem, 5.5cqi, 1.15rem); margin-top: 4px; }
.pc-stats em { font-style: normal; color: var(--muted); font-weight: 600; }
.pc .progress { margin: 6px 0 2px; }
/* joueur au tir : bien visible */
.pc.active { border-color: var(--accent); background: linear-gradient(160deg, #3a2f10 0%, #241f10 45%, var(--card) 100%); box-shadow: 0 0 0 3px #f2b63233, 0 10px 40px #f2b63226; transform: scale(1.02); }
.pc.active .pc-score { color: var(--accent); }
.pc:not(.active):not(.won) { opacity: .78; }
.pc.won { border-color: var(--green); box-shadow: 0 0 0 3px #1fa35b44; }
.pc.turn-flash { animation: ds-turn 0.45s ease-in-out 3; }
@keyframes ds-turn { 0%, 100% { box-shadow: 0 0 0 3px #f2b63233, 0 10px 40px #f2b63226; } 50% { box-shadow: 0 0 0 7px #f2b632aa, 0 0 70px #f2b63288; } }
body.has-page-bg .pc { background-color: #18201cd8; backdrop-filter: blur(6px); }
body.has-page-bg .pc.active { background: linear-gradient(160deg, #3a2f10e8 0%, #18201cd8 100%); }

/* volée en cours (au-dessus de la cible) */
.visit-strip { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px 10px; }
body.has-page-bg .visit-strip, body.has-page-bg .action-bar, body.has-page-bg .chalk, body.has-page-bg .pad { background-color: #18201cd8; backdrop-filter: blur(6px); }
.arena .visit-head { margin: 0 4px 6px; font-size: .95rem; color: var(--muted); }
.visit-row { display: flex; gap: 10px; align-items: stretch; }
.arena .visit-slots { flex: 1; margin: 0; }
.arena .slot { min-height: 64px; padding: 6px; }
.arena .slot strong { font-size: 1.7rem; }
.arena .visit-total { min-width: 2.4em; display: flex; align-items: center; justify-content: center; font: 800 2.8rem/1 var(--display); color: var(--accent); }
.arena .hint { text-align: center; margin: 0; min-height: 0; }
.arena .hint:empty { display: none; }

/* cible */
.board-stage { position: relative; }
.arena .board-wrap, body.nav-auto .arena .board-wrap { max-width: none; width: 100%; margin: 0; }
.board-stage .takeout-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; z-index: 3; box-shadow: 0 10px 40px #000a; white-space: nowrap; font-size: 1.1rem; padding: 12px 18px; }
.bot-banner { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); background: #1d2340ee; border: 1px solid #7b86ff; color: #c9ceff; padding: 6px 14px; border-radius: 99px; font-weight: 700; z-index: 3; }
.score-pop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 4;
             font: 800 calc(var(--board) * .26)/1 var(--display); color: #fff; text-shadow: 0 6px 40px #000, 0 0 20px #000; opacity: 0; }
.score-pop.big { color: var(--accent); }
.score-pop.bust { color: var(--red); font-size: calc(var(--board) * .2); }
.score-pop.show { animation: ds-pop 1.5s ease-out forwards; }
@keyframes ds-pop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.05); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.08); } }

/* barre d'actions sous la cible */
.action-bar { display: flex; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; }
.action-bar .btn { flex: 1; justify-content: center; }
.action-bar .btn.primary { flex: 1.7; }
.action-bar .icon-btn { flex: 0 0 48px; }
.action-bar .btn.on { border-color: var(--accent); color: var(--accent); }
#voiceBtn.off { color: var(--muted); text-decoration: line-through; }
.arena .pad { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.chalk { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.chalk h3 { margin: 0; font-size: 1rem; color: var(--muted); }
.chalk .visit-log { margin-top: 6px; max-height: 260px; }
.arena .cricket-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px; }

/* réglages de la partie */
.prefs-box { width: min(880px, 96vw); }
.prefs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.prefs-head h2 { margin: 0; text-transform: uppercase; }
.prefs-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 34px; }
.prefs-cols h3 { text-transform: uppercase; font-size: 1.15rem; margin: 14px 0 6px; }
.prefs-cols section > h3:first-child { margin-top: 4px; }
.prefs-cols label:not(.switch) { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-weight: 600; font-size: .9rem; }
.prefs-cols input[type=range] { width: 100%; accent-color: var(--accent); }
.prefs-cols label.switch, .switch { display: flex; flex-direction: row; align-items: center; justify-content: space-between; text-align: left; gap: 10px; padding: 6px 0; margin: 0; cursor: pointer; font-weight: 600; }
.switch span { flex: 1; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; order: 3; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cfd6d2; transition: transform .2s; }
.switch input:checked { background: #2563eb; border-color: #2563eb; }
.switch input:checked::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.tiny { padding: 2px 8px; font-size: .75rem; order: 2; }

/* écrans moyens et petits : joueurs au-dessus de la cible */
@media (max-width: 1050px) {
  .arena { --board: min(94vw, 640px); grid-template-columns: 1fr 1fr; grid-template-areas: "l r" "c c"; gap: 12px; }
  body.nav-auto .arena { --board: min(94vw, 640px); }
  .arena-side.left { grid-area: l; } .arena-side.right { grid-area: r; } .arena-center { grid-area: c; width: var(--board); margin: 0 auto; }
  .arena-side { justify-content: flex-start; }
  .pc-score, .arena-side[data-n] .pc-score { font-size: clamp(2.4rem, 30cqi, 5rem); }
  .pc.active { transform: none; }
  .prefs-cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .pc.turn-flash, .score-pop.show { animation: none; } .pc.active { transform: none; } }

/* =====================================================================
   Rapport de fin de partie
   ===================================================================== */
.r-score { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.r-player { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; }
.r-player i, .pdot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.pdot { margin-right: 6px; vertical-align: middle; }
.r-player strong { font: 800 1.3rem var(--display); text-transform: uppercase; }
.r-player.won { border-color: var(--green); }
.r-legs { color: var(--muted); font-weight: 600; }
.tabs { display: flex; gap: 4px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { background: none; border: 0; color: var(--muted); font: 700 1rem var(--font); padding: 8px 16px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--card2); color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); }
.table-wrap { overflow-x: auto; }
.r-stats th:first-child { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .92rem; }
.r-stats td { font: 700 1.15rem var(--display); }
.r-stats td.best { color: var(--accent); }
.cmp-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cmp-stage { width: min(640px, 100%); }
.cmp-board { touch-action: none; cursor: ew-resize; }
.cmp-board svg { display: block; width: 100%; height: auto; }
.cmp-board .b-frame { stroke: var(--ca, #ff4f9a); stroke-width: 6; }
.cmp-dot { stroke: #000a; stroke-width: 1.5; filter: drop-shadow(0 0 4px #000); opacity: .92; }
.cmp-line { stroke: #4f8dff; stroke-width: 2.5; }
.cmp-knob circle { fill: #4f8dff; stroke: #fff; stroke-width: 2; }
.cmp-knob text { fill: #fff; font: 700 14px var(--font); pointer-events: none; }
#cmpRange { width: 100%; accent-color: #4f8dff; margin-top: 6px; }
.cmp-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.cmp-pick { flex-direction: row !important; align-items: center; gap: 8px !important; margin: 0 !important; background: var(--card2); border-radius: 12px; padding: 6px 10px; }
.cmp-pick i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.cmp-pick select, #cmpLeg { min-width: 150px; }
.vs { font: 800 1rem var(--display); color: var(--muted); }
.leg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip-btn { background: var(--card2); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 5px 12px; font-weight: 700; cursor: pointer; }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chart-box.tall { height: 300px; position: relative; margin-bottom: 16px; }
.visit-grid-wrap { overflow-x: auto; }
.visit-grid { display: grid; gap: 6px; min-width: min-content; }
.vg-head { display: flex; align-items: center; gap: 8px; background: var(--card2); border-radius: 10px; padding: 8px 12px; font: 800 1.05rem var(--display); text-transform: uppercase; }
.vg-head i { width: 11px; height: 11px; border-radius: 50%; }
.vg-head span { margin-left: auto; color: var(--muted); }
.vg-n { display: flex; align-items: center; justify-content: center; background: var(--card2); border-radius: 10px; font: 800 1.1rem var(--display); color: var(--muted); }
.vg-cell { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "m r" "d r"; align-items: center; }
.vg-cell.empty { background: transparent; border-style: dashed; opacity: .4; }
.vg-main { grid-area: m; display: flex; align-items: baseline; gap: 8px; }
.vg-main strong { font: 800 1.6rem/1.1 var(--display); }
.vg-cell small { grid-area: d; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.vg-rem { grid-area: r; font: 700 1.1rem var(--display); color: var(--muted); }
.vg-cell.ton strong { color: var(--accent); }
.vg-cell.bust strong { color: var(--red); }
.vg-cell.won { border-color: var(--green); }
.vg-co { color: var(--green); font-weight: 700; font-size: .8rem; }

/* ---------- Bots, code de cible, rejoindre une cible ---------- */
.join-box { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 14px; padding: 12px 14px; background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px; }
.join-box p { margin: 6px 0; }
.join-code { font: 800 1.5rem var(--display); letter-spacing: .18em; color: var(--accent); }
.join-qr { width: 132px; flex: none; align-self: center; background: #fff; border-radius: 8px; padding: 4px; }
.join-qr svg { display: block; width: 100%; height: auto; }
.join-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.join-form { display: flex; gap: 8px; align-items: stretch; }
.join-form .btn { flex: none; }
.join-form input { flex: 1; min-width: 0; width: 100%; font: 800 1.6rem var(--display); letter-spacing: .2em; text-transform: uppercase; text-align: center; }
.host-list, .live-list { list-style: none; padding: 0; margin: 0 0 16px; }
.host-list li, .live-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .join-layout { grid-template-columns: 1fr; } }
#addBot .row2 { grid-template-columns: 1fr; }
/* suivi en direct sur téléphone (écran TV sur petit écran) */
@media (max-width: 1050px) {
  body.tv { overflow: auto; }
  body.tv .tv-main { height: auto; padding: 12px; }
  body.tv .tv-head { font-size: 1.05rem; flex-wrap: wrap; gap: 8px; }
  body.tv .tv-arena { --board: min(94vw, 640px); }
  body.tv .tv-visit { flex-wrap: wrap; gap: 4px 14px; padding: 8px 12px; }
  body.tv .tv-who { font-size: 1rem; width: 100%; text-align: center; }
  body.tv .tv-darts { font-size: 1.9rem; }
  body.tv .tv-total { font-size: 2.4rem; }
  body.tv .tv-arena .hint.big { font-size: 1.2rem; }
  .tv-winner { font-size: 2.4rem; padding: 16px; }
}
/* écran TV : même disposition que la partie */
body.tv .tv-arena { --board: min(calc(100vh - 34vh), 44vw); flex: 1; min-height: 0; align-items: center; }
body.tv .tv-arena .board-wrap { width: 100%; }
body.tv .tv-visit { display: flex; align-items: center; justify-content: center; gap: 2vw; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: .8vh 1.2vw; }
body.tv .tv-who { font-size: 2.6vh; }
body.tv .tv-darts { font-size: 5vh; gap: 1.2vw; }
body.tv .tv-total { font-size: 7vh; }
body.tv .tv-arena .hint.big { font-size: 3.2vh; text-align: center; }
body.tv .tv-arena .hint.big:empty { display: none; }
.arena .visit-total[data-unit] { flex-direction: column; line-height: .9; }
.arena .visit-total[data-unit]::after { content: attr(data-unit); font: 700 .8rem var(--font); color: var(--muted); }
.action-bar .btn { white-space: nowrap; padding-left: 10px; padding-right: 10px; min-width: 0; }

/* ---------- Compteur de créations IA ---------- */
.quota-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.quota-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.quota-top span { font: 800 1.2rem var(--display); color: var(--accent); }
.quota-bar { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; margin: 8px 0 4px; }
.quota-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2b632, #ff8a3d); border-radius: inherit; transition: width .4s; }
.quota-box.empty { border-color: var(--warn); }
.quota-box.empty .quota-top span { color: var(--warn); }
.quota-box p { margin: 4px 0 0; }
.quota-chip { font: 800 1rem var(--display); }
.quota-chip.full { color: var(--warn); }
fieldset.quota-set { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 4px; margin: 0 0 12px; }
fieldset.quota-set legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }
.chip.guest { background: #1d2a40; color: #9fc3ff; border: 1px solid #35507a; font-size: .7rem; padding: 1px 7px; margin-left: 6px; }
.admin-grid .admin-players { grid-column: 1 / -1; }
/* options du jeu choisi, sous « Lancer la partie » */
.game-opts { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.game-opts h3 { margin: 0 0 12px; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

/* =====================================================================
   Cartes de jeux : mini-cible à droite, les zones visées s'allument quand le jeu est choisi
   ===================================================================== */
.mode-grid { gap: 10px; }
.mode-group { grid-column: 1 / -1; margin: 6px 2px -2px; font: 700 .95rem var(--font); color: var(--muted); }
.mode-group:first-child { margin-top: 0; }
.mode, .mode.premium {
  position: relative; overflow: hidden; display: block; min-height: 124px; padding: 14px 16px 12px;
  background: radial-gradient(120% 90% at 100% 50%, #18221e 0%, #121916 60%); border: 1.5px solid #26312c; border-radius: 16px;
  text-align: left; color: var(--text); cursor: pointer; transition: border-color .2s, background .25s;
}
.mode-txt { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; max-width: 64%; min-height: 96px; }
.mode strong { font: 800 1.45rem/1 var(--display); text-transform: uppercase; letter-spacing: .01em; color: var(--text); }
.mode .mode-desc { color: #9aa8a1; font-size: .82rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mode-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 4px; }
.mode-meta i { font-style: normal; font-size: .7rem; font-weight: 700; color: #b7c3bd; background: #ffffff0d; border-radius: 99px; padding: 2px 8px; }
.mode-meta i.pill-premium { color: #1a1405; background: linear-gradient(135deg, #f2b632, #ff9a3d); }
.mode-meta i.pill-ai { color: var(--cyan); background: #2fd4c018; }
/* la mini-cible, rognée par le bord droit de la carte */
.mode-glyph { position: absolute; right: -40px; top: 50%; width: 132px; height: 132px; transform: translateY(-50%) rotate(-9deg); transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .25s; opacity: .7; }
.mode-glyph .g-frame { fill: #0c1110; }
.mode-glyph .g-a { fill: #1b2420; } .mode-glyph .g-b { fill: #222d28; } .mode-glyph .g-ring { fill: #2b3832; }
.mode-glyph .g-lit { fill: #8a6d22; }
.mode-glyph path, .mode-glyph circle:not(.g-frame) { stroke: #0c1110; stroke-width: 1.2; }
.mode:hover { border-color: #3a4a42; }
.mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* jeu choisi : bordure dorée, zones visées allumées, la cible pivote d'un cran */
.mode.on { border-color: var(--accent); background: radial-gradient(120% 90% at 100% 50%, #3a2f12 0%, #1c1a10 55%, #141612 100%); }
.mode.on .mode-glyph { opacity: 1; transform: translateY(-50%) rotate(0deg); }
.mode.on .mode-glyph .g-lit { fill: var(--accent); }
.mode.on strong { color: var(--accent); }
/* Prémium verrouillé : carte éteinte */
.mode.locked { cursor: not-allowed; border-style: dashed; background: #111614; }
.mode.locked strong { color: #7b8882; } .mode.locked .mode-desc { color: #66726c; }
.mode.locked .mode-glyph { opacity: .3; filter: grayscale(1); }
.mode.locked .mode-meta i.pill-premium { background: #2a2a22; color: #c7a24a; }
.mode .lock, .mode .mode-tag { display: none; }
@media (max-width: 520px) { .mode-grid { grid-template-columns: 1fr; } .mode-txt { max-width: 70%; } }
@media (prefers-reduced-motion: reduce) { .mode-glyph { transition: none; } }
/* une carte par ligne quand la colonne « Jeu » est étroite, deux quand elle a la place */
.play-layout > .card:first-child { container-type: inline-size; }
@container (max-width: 600px) { .mode-grid { grid-template-columns: 1fr; } .mode-txt { max-width: 70%; } }
/* rapport : bascule Impacts / Chaleur */
.seg-toggle { display: inline-flex; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-toggle button { background: none; border: 0; color: var(--muted); font: 700 .92rem var(--font); padding: 6px 16px; border-radius: 8px; cursor: pointer; }
.seg-toggle button.on { background: var(--accent); color: var(--accent-ink); }
.seg-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cmp-board.heat-mode .b-segs { opacity: .55; }
.cmp-heat { pointer-events: none; }
.heat-legend { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.heat-legend i { width: 160px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #285aff, #00dce6, #ffe600, #ff2814); }
.bot-banner.remote { background: #12303aee; border-color: var(--cyan); color: #bff3ec; white-space: nowrap; }

/* =====================================================================
   Jouer à distance (téléphone)
   ===================================================================== */
body.remote-page main { max-width: 640px; margin: 0 auto; }
.rm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin: 4px 0 10px; }
.rm-title { font: 800 1.6rem/1.1 var(--display); text-transform: uppercase; margin: 0; }
.rm-head p { margin: 4px 0 0; }
.rm-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rm-p { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; }
.rm-p.on { border-color: var(--accent); background: linear-gradient(160deg, #3a2f10, var(--card)); }
.rm-p.me .rm-name { color: var(--cyan); }
.rm-name { font: 700 .95rem var(--display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-p strong { font: 800 2.4rem/1 var(--display); }
.rm-p.on strong { color: var(--accent); }
.rm-p small { color: var(--cyan); font-weight: 700; }
.rm-step h2 { margin-bottom: 6px; }
.rm-turn { border-color: var(--accent); }
.rm-finish { font: 800 1.3rem var(--display); color: var(--cyan); min-height: 1.2em; }
.rm-tips { margin: 6px 0 12px; padding-left: 18px; color: var(--muted); }
.rm-tips li { margin: 3px 0; }
.rm-shot { display: flex; justify-content: center; cursor: pointer; margin-bottom: 8px; }
.rm-photo canvas, .rm-tap canvas { width: 100%; height: auto; display: block; border-radius: 12px; margin: 8px 0; }
.rm-slots { margin: 8px 0 4px; }
.rm-total { text-align: right; font-weight: 700; color: var(--muted); }
.rm-total strong { font: 800 2rem var(--display); color: var(--accent); margin-left: 6px; }
.rm-board { max-width: 420px; margin: 6px auto; }
.rm-actions { justify-content: center; margin: 8px 0 12px; }
.rm-tap-box { width: min(560px, 96vw); }
.rm-tap canvas { cursor: crosshair; touch-action: manipulation; }
.rm-foot { margin-top: 16px; }
/* volée jouée à distance : photo au premier plan (partie et téléphones des autres joueurs), à valider avant de jouer */
.shot-modal { z-index: 60; background: #000d; }
.shot-box { width: min(96vw, 860px); display: flex; flex-direction: column; gap: 10px; border-color: var(--cyan); padding: 14px; }
.shot-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.shot-head h2 { margin: 0; font-size: 1.5rem; }
.shot-head strong { font-family: var(--display); font-size: 1.5rem; color: var(--accent); }
.shot-flag { margin: 0; color: var(--warn); font-weight: 600; }
.shot-flag:empty { display: none; }
.shot-box img { display: block; width: 100%; max-height: 68vh; object-fit: contain; border-radius: 8px; background: #000; }
@media (max-width: 600px) { .shot-modal { padding: 8px; } .shot-box { padding: 10px; } .shot-head h2, .shot-head strong { font-size: 1.25rem; } .shot-box img { max-height: 60vh; } }
.rm-head .chip { white-space: nowrap; flex: none; }
.rm-fix { color: var(--accent); font-weight: 700; padding: 0; }
.rm-stage { margin: 0 0 2px; font-size: .8rem; font-weight: 700; color: var(--cyan); letter-spacing: .02em; }
.rm-calib { border-color: var(--cyan); }
.rm-calib-turn { background: #3a2f10; border: 1px solid var(--accent); color: var(--accent); border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.rm-calib-msg { font-weight: 700; margin: 4px 0; }
.rm-calib-msg.ok { color: var(--cyan); }
.rm-calib-msg.warn { color: var(--accent); }
.rm-calib-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.rm-calib-alt .btn { justify-content: center; text-align: center; margin: 0; }
@media (max-width: 380px) { .rm-calib-alt { grid-template-columns: 1fr; } }

/* jeu à distance : zoom sur chaque pointe avant envoi */
.rm-zoom-block { margin: 12px 0 4px; }
.rm-zoom-block p { margin: 0 0 6px; }
.rm-zooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rm-zoom { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 2px solid var(--line); border-radius: 10px; background: var(--card2); color: var(--text); font: inherit; cursor: pointer; }
.rm-zoom canvas { width: 100%; height: auto; aspect-ratio: 1; border-radius: 6px; display: block; }
.rm-zoom span { font-family: var(--display); font-weight: 700; font-size: 1.05rem; text-align: center; }
.rm-zoom span b { color: var(--accent); }
.rm-zoom.near { border-color: var(--warn); }
.rm-zoom.sel { border-color: var(--accent); box-shadow: 0 0 0 2px #f2b63255; }
.rm-zoom:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* jeu à distance : dernière volée d'un autre joueur, telle qu'il l'a photographiée */
.rm-opp { padding: 10px; }
.rm-opp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 2px 8px; }
.rm-opp-head strong { font-family: var(--display); font-size: 1.15rem; }
.rm-opp-head span { color: var(--accent); font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.rm-opp img { display: block; width: 100%; border-radius: 8px; background: #000; }

/* =====================================================================
   Cricket : grand tableau à côté de la cible (joueurs en colonnes, numéros en lignes)
   ===================================================================== */
.arena.is-cricket { grid-template-columns: minmax(0, 1.15fr) var(--board); }
.arena.is-cricket .arena-side.right { display: none; }
.arena.is-cricket .arena-side.left { justify-content: flex-start; }
.ck { display: grid; grid-template-columns: var(--ck-cols); background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.ck-head, .ck-row { display: contents; }
.ck-corner { background: var(--bg2); border-bottom: 1px solid var(--line); }
.ck-p { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 10px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; background: var(--card); }
.ck-p.active { background: linear-gradient(170deg, #3a2f10 0%, #241f10 60%, var(--card) 100%); box-shadow: inset 0 0 0 2px var(--accent); }
.ck-p.won { box-shadow: inset 0 0 0 2px var(--green); }
.ck-name { font: 800 clamp(1rem, 2.1vw, 1.7rem)/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-score { display: flex; align-items: center; gap: 10px; font: 800 clamp(2.6rem, 6vw, 5.5rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.ck-p.active .ck-score { color: var(--accent); }
.ck-legs { font: 800 1.1rem/1 var(--display); background: #000a; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; color: var(--text); }
.ck-sub { color: var(--muted); font-size: .85rem; }
.ck-num { display: flex; align-items: center; justify-content: center; background: var(--bg2); font: 800 clamp(1.2rem, 2.2vw, 1.9rem)/1 var(--display); border-bottom: 1px solid var(--line); }
.ck-cell { display: flex; align-items: center; justify-content: center; min-height: clamp(44px, 7.2vh, 78px); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ck-cell.cur { background: #f2b6320d; }
.ck-cell.scoring { background: #1fa35b1f; }
.ck-row:nth-child(even) .ck-cell, .ck-row:nth-child(even) .ck-num { background-image: linear-gradient(#ffffff06, #ffffff06); }
.ck-row.closed .ck-num, .ck-row.closed .ck-cell { opacity: .3; }
.ck-row:last-child > * { border-bottom: 0; }
.ck-mark { width: clamp(28px, 4.6vh, 48px); height: auto; overflow: visible; }
.ck-mark line, .ck-mark circle { stroke: var(--text); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.ck-mark.m3 line, .ck-mark.m3 circle { stroke: var(--green); }
.ck-cell.scoring .ck-mark.m3 line, .ck-cell.scoring .ck-mark.m3 circle { stroke: #36d47e; }
@media (max-width: 1050px) {
  .arena.is-cricket { grid-template-columns: 1fr; grid-template-areas: "l" "c"; }
  .ck-cell { min-height: 40px; }
}

/* préparation de partie : qui commence, mélange */
.order-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 6px 0 8px; }
.order-bar label { flex: 1; min-width: 180px; }
.players .icon.starter { width: auto; padding: 0 8px; font-size: .75rem; font-weight: 700; }
.players.shuffled li.on { animation: shuffle-in .45s ease; }
@keyframes shuffle-in { from { transform: translateY(-6px); opacity: .3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .players.shuffled li.on { animation: none; } }

/* vue caméra de la cible (image redressée sous les repères) */
.board-stage .board-wrap { position: relative; }
.board-wrap canvas.cam-view { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; z-index: 0; pointer-events: none; }
.board-wrap > svg { position: relative; z-index: 1; }
.dartboard.cam-on .b-segs, .dartboard.cam-on .b-photo { opacity: 0; }
.dartboard.cam-on .b-frame { fill: transparent; }
.dartboard.cam-on .b-wires { opacity: .35; }
.dartboard.cam-on .b-num { paint-order: stroke; stroke: #000; stroke-width: 3px; }
.board-tools { position: absolute; right: 6px; bottom: 6px; z-index: 3; display: flex; gap: 6px; }
.board-tools .btn { background: #0d1210d9; backdrop-filter: blur(4px); }
.board-tools .btn.on { border-color: var(--cyan); color: var(--cyan); }
/* photos de la cible prises pendant la partie (rapport) */
.r-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.r-photo { margin: 0; }
.r-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.r-photo figcaption { margin-top: 4px; }
#snapModal img { display: block; width: 100%; max-height: 64vh; object-fit: contain; border-radius: 8px; background: #000; }
.players .p-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; flex-shrink: 0; }

/* =====================================================================
   Coach personnel
   ===================================================================== */
.coach-av { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #2a3a33, #121916); border: 2px solid var(--accent); font-size: 1.3rem; flex-shrink: 0; }
.coach-av.sm { width: 32px; height: 32px; font-size: .95rem; border-width: 1.5px; }
.coach-id { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.coach-id > div { display: flex; flex-direction: column; }
.coach-id strong { font: 800 1.25rem/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin: 0 2px 1px 4px; vertical-align: middle; }
.coach-chat { max-width: 760px; margin: 0 auto; }
.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; line-height: 1.45; animation: bubble-in .25s ease; }
.bubble.coach { align-self: flex-start; background: var(--card2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.coach.soft { background: transparent; border-style: dashed; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); font-weight: 600; border-bottom-right-radius: 4px; }
.bubble.typing { display: flex; gap: 4px; padding: 14px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .15s; } .bubble.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.chip-btn { background: var(--bg2); border: 1.5px solid var(--accent); color: var(--text); border-radius: 99px; padding: 9px 16px; font: 600 .95rem var(--font); cursor: pointer; }
.chip-btn:hover, .chip-btn:focus-visible { background: #f2b63222; outline: none; }
/* exercice en cours */
.run-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.run-head h2 { margin: 0; font-size: 1.7rem; }
.run-kicker { margin: 0 0 2px; color: var(--cyan); font-weight: 700; font-size: .85rem; }
.run-prog { display: flex; gap: 6px; }
.run-prog span { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line); font-weight: 700; color: var(--muted); }
.run-prog span.on { border-color: var(--accent); color: var(--accent); }
.run-prog span.done { background: var(--green); border-color: var(--green); color: #04150b; }
.run-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.run-side { display: flex; flex-direction: column; gap: 12px; }
.run-board { position: relative; }
.run-board .board-wrap { max-width: min(78vh, 720px); }
.run-board .takeout-banner { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 3; white-space: nowrap; box-shadow: 0 10px 40px #000a; }
.ex-card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.ex-card p { margin: 0 0 12px; color: var(--muted); }
.aim { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.aim span { color: var(--muted); font-weight: 600; }
.aim strong { font: 800 2rem/1 var(--display); color: var(--accent); }
.aim small { color: var(--muted); }
.ex-count { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; margin-bottom: 6px; }
.ex-count span:last-child { font-weight: 700; color: var(--cyan); }
.coach-say { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 12px; padding: 10px 12px; }
.coach-say p { margin: 0; }
.coach-say.good { border-left-color: var(--green); }
.coach-say.calm { border-left-color: var(--cyan); }
.coach-say.tip { border-left-color: var(--accent); }
.run-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.run-actions .btn.on { border-color: var(--accent); }
#vRun .visit-slots { margin: 0; }
/* rapports */
.eval-head { text-align: center; }
.eval-big { display: flex; flex-direction: column; align-items: center; margin: 4px 0 8px; }
.eval-big strong { font: 800 clamp(3.5rem, 12vw, 6rem)/1 var(--display); color: var(--accent); }
.eval-big span { color: var(--muted); }
.eval-line { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.chip.ok { color: var(--green); border-color: var(--green); }
#vTest, #vReport { display: flex; flex-direction: column; gap: 14px; max-width: 900px; margin: 0 auto; }
#vTest[hidden], #vReport[hidden] { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.tile strong { font: 800 1.9rem/1.1 var(--display); }
.tile small.up, td.up { color: var(--green); font-weight: 700; } .tile small.down, td.down { color: var(--warn); font-weight: 700; }
.diag-row { border-left: 4px solid var(--line); padding: 4px 12px; margin-bottom: 10px; }
.diag-row p { margin: 2px 0 0; }
.diag-row.good { border-color: var(--green); } .diag-row.work { border-color: var(--warn); } .diag-row.prio { border-color: var(--accent); }
.wbars { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.wbar { display: grid; grid-template-columns: 90px 1fr 46px; align-items: center; gap: 8px; font-size: .9rem; }
.wbar i { height: 10px; border-radius: 9px; background: linear-gradient(90deg, var(--c, var(--accent)) var(--w), var(--bg2) var(--w)); }
.wbar b { text-align: right; }
.w-precision { --c: var(--accent); } .w-regularity { --c: var(--cyan); } .w-doubles { --c: #ff4f9a; } .w-checkout { --c: #8f7bff; } .w-bull { --c: var(--green); }
.week1 { padding-left: 20px; } .week1 li { margin-bottom: 6px; } .week1 li span { display: block; }
.events ul { padding-left: 18px; } .events li { margin-bottom: 4px; }
/* tableau de bord */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.coach-msg .bubble { max-width: 100%; margin-bottom: 8px; }
.next-card h2 { margin-bottom: 2px; font-size: 1.6rem; }
.plan-list { padding-left: 20px; margin: 10px 0 16px; }
.plan-list li { margin-bottom: 6px; } .plan-list .chip { margin-left: 8px; }
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.week h3 { font-size: 1rem; margin: 0 0 4px; color: var(--muted); }
.week ul { list-style: none; margin: 0; padding: 0; }
.week li { display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; align-items: center; padding: 4px 0; }
.week li small { grid-column: 2; }
.week .dot { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; grid-row: span 2; }
.week li.done .dot { background: var(--green); border-color: var(--green); color: #04150b; }
.week li.next .dot { border-color: var(--accent); color: var(--accent); }
.week li.next > span:not(.dot) { color: var(--accent); font-weight: 700; }
#evoCard .chart-box { height: 240px; }
.gain { font: 800 1.2rem var(--display); color: var(--green); margin: 10px 0 0; }
.coach-foot { margin-top: 16px; justify-content: flex-end; }
@media (max-width: 900px) {
  .run-layout, .dash-grid { grid-template-columns: 1fr; }
  #coach.running .page-head { display: none; }
  .run-head { margin-bottom: 6px; } .run-head h2 { font-size: 1.3rem; }
  /* consigne compacte, puis la cible, puis le coach et la saisie */
  .run-side { display: contents; }
  .run-layout { gap: 10px; }
  .ex-card { order: 1; padding: 10px 12px; } .ex-card p { display: none; } .ex-card h3 { font-size: 1rem; margin-bottom: 6px; }
  .aim { padding: 6px 10px; margin-bottom: 6px; } .aim strong { font-size: 1.5rem; }
  .run-board { order: 2; } .run-board > p { display: none; }
  .coach-say { order: 3; } #runSlots { order: 4; } .run-actions { order: 5; } #runPad { order: 6; }
  #camInfo, #camToggleWrap { order: 7; } #runStop { order: 8; }
  #vRun .slot { min-height: 60px; padding: 6px; } #vRun .slot strong { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { .bubble, .bubble.typing i { animation: none; } }

/* =====================================================================
   Darts Arena
   ===================================================================== */
.ar-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.ar-title { font: 800 clamp(2.2rem, 5vw, 3.6rem)/.95 var(--display); text-transform: uppercase; letter-spacing: .01em; margin: 0 0 6px; }
.ar-tag { color: var(--muted); max-width: 60ch; margin: 0; }
.ar-season { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.ar-season strong { font: 800 1.2rem var(--display); color: var(--accent); }
.ar-season span { font-size: .85rem; color: var(--muted); }
.ar-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; scrollbar-width: thin; }
.ar-tabs a { padding: 10px 14px; color: var(--muted); font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; text-decoration: none; }
.ar-tabs a:hover { color: var(--text); }
.ar-tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.ar-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .72rem; text-align: center; }
.ar-view { min-height: 40vh; }
.ar-home { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: start; }
.ar-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ar-grid2.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.ar-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ar-card h2 { font-size: 1.25rem; }
.ar-card h3 { font-size: 1rem; margin: 10px 0 6px; color: var(--muted); }
.ar-empty { margin: 4px 0; }
/* joueur */
.ar-av { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; font: 800 .95rem var(--display);
  background: hsl(var(--h) 45% 30%); color: hsl(var(--h) 80% 88%); border: 2px solid hsl(var(--h) 55% 50%); }
.ar-av.sm { width: 30px; height: 30px; font-size: .8rem; }
.ar-av.lg { width: 64px; height: 64px; font-size: 1.5rem; }
.ar-av.xl { width: 92px; height: 92px; font-size: 2.2rem; border-width: 3px; }
.ar-player-top { display: flex; gap: 14px; align-items: center; }
.ar-pname { margin: 0; font: 800 1.5rem/1.05 var(--display); letter-spacing: .02em; }
.ar-pname.big { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.ar-plevel { margin: 4px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); }
.ar-flag { font-family: system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; }
.ar-div { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: .8rem; border: 1px solid; }
.ar-div.d-bronze { color: #e0a77a; border-color: #8a5a36; } .ar-div.d-argent { color: #d4dbe0; border-color: #7d8a94; }
.ar-div.d-or { color: #f2c94c; border-color: #a8862a; } .ar-div.d-platine { color: #8fe3f0; border-color: #3e8e9b; } .ar-div.d-elite { color: #d4a8ff; border-color: #7b4fb0; }
.ar-bio { margin: 6px 0 0; font-style: italic; }
.ar-xp { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 4px; }
.ar-bar { height: 8px; background: var(--bg2); border-radius: 9px; overflow: hidden; }
.ar-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffd56a); border-radius: 9px; }
.ar-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ar-kpis div { background: var(--bg2); border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.ar-kpis strong { font: 800 1.6rem/1.1 var(--display); color: var(--accent); }
.ar-kpis span { font-size: .8rem; color: var(--muted); }
.ar-kpis.big strong { font-size: clamp(2rem, 4vw, 2.8rem); }
.ar-player .btn.block { margin-top: 12px; }
.ar-records { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.ar-records div { background: var(--bg2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.ar-records span { font-size: .8rem; color: var(--muted); }
.ar-records strong { font: 800 1.6rem var(--display); }
.ar-trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ar-trophy { background: var(--bg2); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.ar-trophy .ico { font-size: 1.6rem; }
.ar-trophy b { font-size: .85rem; } .ar-trophy small { font-size: .72rem; color: var(--muted); }
.ar-trophy.locked { border-color: var(--line); opacity: .45; filter: grayscale(1); }
/* listes, fil */
.ar-list { list-style: none; margin: 0; padding: 0; }
.ar-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ar-list li:last-child { border-bottom: 0; }
.ar-list li .num, .ar-list li > .btn:last-child, .ar-list li > b:last-child { margin-left: auto; }
.ar-list .rk { width: 20px; color: var(--muted); font-weight: 700; }
.ar-res { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; background: var(--bg2); }
.ar-res.w { background: var(--green); color: #04150b; } .ar-res.l { background: #3a2222; color: #ffb3b3; }
.ar-plink { font-weight: 700; color: var(--text); }
.ar-xp-list { list-style: none; margin: 0; padding: 0; } .ar-xp-list li { display: flex; justify-content: space-between; padding: 4px 0; font-size: .9rem; } .ar-xp-list b { color: var(--accent); }
.ar-composer textarea { width: 100%; resize: vertical; }
.ar-composer .row-actions { justify-content: flex-end; margin-top: 6px; }
.ar-seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.ar-seg button { background: none; border: 0; color: var(--muted); font: 700 .85rem var(--font); padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.ar-seg button.on { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.ar-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ar-feed { display: flex; flex-direction: column; gap: 10px; }
.ar-post { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.ar-post.auto { border-left: 4px solid var(--accent); }
.ar-post.k-180, .ar-post.k-record { border-left-color: #ff6a3d; } .ar-post.k-trophy { border-left-color: var(--accent); }
.ar-post.k-challenge { border-left-color: #8f7bff; } .ar-post.k-progress, .ar-post.k-division { border-left-color: var(--green); } .ar-post.k-team { border-left-color: var(--cyan); }
.ar-post-body { flex: 1; min-width: 0; }
.ar-post-body p { margin: 0 0 4px; }
.ar-post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ar-post-foot { display: flex; align-items: center; gap: 10px; }
.ar-act { background: none; border: 0; color: var(--muted); cursor: pointer; font: 600 .85rem var(--font); padding: 2px 6px; border-radius: 8px; }
.ar-act:hover:not(:disabled), .ar-act.on { color: var(--accent); background: #f2b6321a; }
.ar-comments { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: .9rem; }
.ar-cform { display: flex; gap: 6px; } .ar-cform input { flex: 1; }
/* défis */
.ar-ch-group h3 { margin-top: 4px; }
.ar-ch { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.ar-ch.done { border-color: var(--green); }
.ar-ch.done b { color: var(--green); }
.ar-ch-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ar-xp-pill { font-size: .75rem; font-weight: 800; color: var(--accent); white-space: nowrap; }
.ar-ch-prog { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.ar-ch-prog small { font-weight: 700; }
.ar-duel { border-left: 4px solid var(--line); padding: 6px 10px; margin-bottom: 10px; }
.ar-duel p { margin: 0 0 4px; }
.ar-duel.s-open { border-color: var(--accent); } .ar-duel.s-accepted { border-color: var(--cyan); } .ar-duel.s-won { border-color: var(--green); } .ar-duel.s-lost, .ar-duel.s-expired, .ar-duel.s-declined { opacity: .7; }
.ar-quote { font-style: italic; color: var(--muted); }
/* classements */
table.ar-rank td.rk { width: 42px; font-weight: 800; }
table.ar-rank .num { text-align: right; font-variant-numeric: tabular-nums; }
table.ar-rank tr.me td { background: #f2b63214; }
table.ar-rank td.pts { font: 800 1.1rem var(--display); color: var(--accent); }
.ar-divs { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.ar-divs li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; background: var(--bg2); border-radius: 10px; padding: 8px 12px; border: 1px solid var(--line); }
.ar-divs li.me { border-color: var(--accent); }
.form.inline { flex-direction: row; display: flex; gap: 8px; } .form.inline input { flex: 1; }
/* équipes */
.ar-battle { text-align: center; background: radial-gradient(500px 200px at 50% 0%, #2a1f3a, var(--card)); }
.ar-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 6px 0 12px; }
.ar-vs div { display: flex; flex-direction: column; }
.ar-vs a { font: 800 clamp(1.2rem, 3vw, 1.8rem) var(--display); color: var(--text); }
.ar-vs strong { font: 800 clamp(1.8rem, 5vw, 2.8rem)/1 var(--display); color: var(--accent); }
.ar-vs small { color: var(--muted); }
.ar-vs .vs { font: 800 1.4rem var(--display); color: var(--muted); }
.ar-tug { height: 14px; border-radius: 9px; background: #8f7bff; overflow: hidden; }
.ar-tug i { display: block; height: 100%; background: var(--accent); }
.ar-tug-l { display: flex; justify-content: space-between; font-weight: 800; margin-top: 4px; }
/* événements */
.ar-events { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.ar-event h2 { font: 800 1.7rem var(--display); letter-spacing: .03em; margin: 0 0 6px; }
.ar-event.ev-arena_cup { border-top: 4px solid var(--accent); } .ar-event.ev-cricket_night { border-top: 4px solid var(--green); }
.ar-event.ev-nations { border-top: 4px solid var(--cyan); } .ar-event.ev-bullseye { border-top: 4px solid var(--red); }
.ar-event.off { opacity: .75; }
.ar-event .row-actions { align-items: center; margin-bottom: 8px; }
/* grand écran (ligue) */
body.arena-tv .topbar { display: none; }
body.arena-tv .ar-title { font-size: clamp(2.6rem, 6vw, 5rem); }
body.arena-tv table.ar-rank { font-size: clamp(1.1rem, 2.2vw, 1.9rem); }
body.arena-tv table.ar-rank td { padding: .5em .6em; }
@media (max-width: 1150px) { .ar-home { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ar-home > .ar-feed-col { grid-column: 1 / -1; order: 3; } }
@media (max-width: 760px) {
  .ar-home, .ar-grid2, .ar-grid2.wide-left { grid-template-columns: 1fr; }
  .ar-season { align-items: flex-start; }
  .ar-kpis strong { font-size: 1.3rem; }
}

/* navigation : liens moins fréquents regroupés dans « Plus » */
.navmore { position: relative; }
.navmore summary { list-style: none; cursor: pointer; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.navmore summary::-webkit-details-marker { display: none; }
.navmore summary:hover, .navmore[open] summary { color: var(--text); background: var(--card); }
.navmore.on summary { color: var(--accent-ink); background: var(--accent); }
.navmore-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 190px; display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px #000a; }
.mainnav .navmore-list a { white-space: nowrap; }
.mainnav a { white-space: nowrap; }
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; }
  .navmore-list { position: fixed; left: 16px; right: 16px; top: auto; }
}

/* ---------- Arena : publications avec photos, J'aime ---------- */
.ar-composer .row-actions { align-items: center; gap: 8px; }
.ar-chint { margin-right: auto; }
.ar-cphotos { display: flex; gap: 8px; flex-wrap: wrap; }
.ar-cphotos:not(:empty) { margin-top: 8px; }
.ar-cphoto { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.ar-cphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ar-cphoto-x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #000b; color: #fff; cursor: pointer; font-size: .75rem; line-height: 1; }
.ar-photos { display: grid; gap: 4px; margin: 6px 0 8px; border-radius: 12px; overflow: hidden; max-width: 560px; }
.ar-photos.n1 { grid-template-columns: 1fr; }
.ar-photos.n2, .ar-photos.n4 { grid-template-columns: 1fr 1fr; }
.ar-photos.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.ar-photos.n3 .ar-photo:first-child { grid-row: span 2; }
.ar-photo { padding: 0; border: 0; background: var(--bg2); cursor: zoom-in; display: block; min-height: 0; }
.ar-photo img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 4 / 3; }
.ar-photos.n1 .ar-photo img { aspect-ratio: auto; max-height: 460px; object-fit: contain; background: #000; }
.ar-photos.n3 .ar-photo:first-child img { aspect-ratio: auto; }
.ar-photo:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.ar-act.like.on { color: #ff5a6e; background: #ff5a6e1a; }
.ar-post-foot { flex-wrap: wrap; }
.ar-lightbox { position: fixed; inset: 0; z-index: 200; background: #000e; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.ar-lightbox img { max-width: 100%; max-height: calc(100vh - 90px); border-radius: 8px; }
.ar-feed-page { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.ar-feed-page .ar-seg { align-self: flex-start; }

/* ---------- Arena : messagerie ---------- */
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9px; background: var(--red); color: #fff; font-size: .72rem; line-height: 18px; text-align: center; vertical-align: 1px; }
.chat { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 14px; height: calc(100vh - 230px); min-height: 460px; }
.chat-list { display: flex; flex-direction: column; gap: 8px; min-height: 0; margin: 0; }
.chat-list h2 { margin: 0; }
.chat-list input[type=search] { width: 100%; }
.chat-items { list-style: none; margin: 0 -8px; padding: 0; overflow-y: auto; flex: 1; }
.chat-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--text); text-decoration: none; }
.chat-item:hover { background: var(--card2); text-decoration: none; }
.chat-item.on { background: var(--card2); box-shadow: inset 3px 0 0 var(--accent); }
.chat-item-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item-txt b { font-size: .95rem; }
.chat-item-txt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-txt small { color: var(--text); font-weight: 700; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--muted); font-size: .75rem; }
.chat-pane { min-height: 0; display: flex; }
.chat-pane > .card { flex: 1; margin: 0; }
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.chat-empty p { max-width: 34ch; }
.chat-ico { font-size: 2.6rem; }
.chat-thread { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-who { flex: 1; min-width: 0; }
.chat-who small { display: block; }
.chat-back { display: none; font-size: 1.4rem; color: var(--text); padding: 0 6px; text-decoration: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 4px; background: var(--bg2); }
.chat-day { align-self: center; margin: 10px 0 4px; font-size: .75rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; }
.chat-day::first-letter { text-transform: uppercase; }
.chat-first { margin: auto; text-align: center; max-width: 36ch; }
.msg { max-width: min(75%, 520px); padding: 7px 11px 5px; border-radius: 16px; position: relative; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg small { display: block; text-align: right; font-size: .68rem; opacity: .7; margin-top: 1px; }
.msg.them { align-self: flex-start; background: var(--card2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.msg.them + .msg.me, .msg.me + .msg.them { margin-top: 8px; }
.msg-seen { align-self: flex-end; font-size: .7rem; color: var(--muted); margin: -1px 4px 0 0; }
.chat-quick { display: flex; gap: 6px; padding: 8px 14px 0; overflow-x: auto; scrollbar-width: none; }
.chat-chip { flex: none; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 99px; padding: 5px 11px; font: 600 .82rem var(--font); cursor: pointer; }
.chat-chip:hover { border-color: var(--accent); }
.chat-form { display: flex; gap: 8px; padding: 10px 14px 4px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; }
.chat-help { padding: 0 14px 8px; font-size: .72rem; }
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 200px); min-height: 420px; }
  .chat.open .chat-list { display: none; }
  .chat:not(.open) .chat-pane { display: none; }
  .chat-back { display: inline-block; }
  .chat-help { display: none; }
  .msg { max-width: 85%; }
}

/* ---------- Arena : amis identifiés (@nom), notifications ---------- */
.mention-wrap { position: relative; }
.mention-hl { position: absolute; inset: 0; pointer-events: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
  color: var(--text); background: var(--bg2); border: 1px solid transparent; border-radius: 8px; padding: 9px 11px; font: inherit; font-weight: 500; }
.mention-hl .mention { color: #5aa8ff; }
textarea.mention-input { position: relative; display: block; width: 100%; background: transparent; color: transparent; caret-color: var(--text); resize: none; overflow: hidden; min-height: 64px; }
textarea.mention-input::placeholder { color: var(--muted); }
textarea.mention-input::selection { color: transparent; background: #5aa8ff55; }
textarea.mention-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.mention-menu { position: absolute; left: 8px; top: 100%; z-index: 40; width: min(320px, calc(100% - 16px)); list-style: none; margin: 4px 0 0; padding: 4px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px #000a; }
.mention-menu li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.mention-menu li span:not(.ar-av) { flex: 1; font-weight: 700; }
.mention-menu li.on, .mention-menu li:hover { background: #5aa8ff22; }
a.mention { color: #5aa8ff; font-weight: 700; }
a.mention:hover { text-decoration: underline; }
.ar-tagged { margin: 6px 0 0; font-size: .85rem; color: #7db8ff; }
.ar-hero-side { display: flex; align-items: center; gap: 10px; }
.ar-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 1.25rem; text-decoration: none; }
.ar-bell:hover { text-decoration: none; border-color: var(--muted); }
.ar-bell.on { border-color: var(--accent); }
.ar-bell .ar-badge { position: absolute; top: -7px; right: -7px; }
.ar-notifs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ar-notif { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.ar-notif:hover { background: var(--card2); text-decoration: none; }
.ar-notif.unread { background: #5aa8ff14; }
.ar-notif-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ar-notif-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #5aa8ff; }
.ar-back { align-self: flex-start; }
code.break { word-break: break-all; }

/* ---------- Arena : émoticônes ---------- */
.emoji-anchor { position: relative; display: inline-flex; }
.emoji-btn.icon { padding-left: 9px; padding-right: 9px; font-size: 1rem; }
.emoji-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 70; width: min(320px, calc(100vw - 32px)); background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 14px 34px #000b; overflow: hidden; }
.emoji-pop.up { top: auto; bottom: calc(100% + 6px); }
.ar-cform .emoji-pop { left: auto; right: 0; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--bg2); }
.emoji-tabs button { flex: 1; background: none; border: 0; padding: 8px 0; font-size: 1.1rem; cursor: pointer; border-bottom: 2px solid transparent; opacity: .65; }
.emoji-tabs button.on, .emoji-tabs button:hover { opacity: 1; border-bottom-color: var(--accent); }
.emoji-body { padding: 6px 8px 8px; max-height: 236px; overflow-y: auto; }
.emoji-title { margin: 2px 2px 4px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji { background: none; border: 0; font-size: 1.35rem; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer; }
.emoji:hover, .emoji:focus-visible { background: #ffffff14; }
.ar-composer .row-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .emoji-pop, .emoji-pop.up, .ar-cform .emoji-pop { position: fixed; top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; }
  .emoji-grid { grid-template-columns: repeat(8, 1fr); }
  .ar-composer .row-actions { justify-content: flex-start; gap: 6px; }
  .ar-composer .row-actions .ar-chint { display: none; }
  .ar-composer .row-actions .btn.primary { margin-left: auto; }
}

/* ---------- Invitations par e-mail ---------- */
.auth-hero p.invite-banner { color: var(--text); background: var(--card); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; font-size: 1.05rem; }
.invite-msg { margin: 0 0 12px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 8px; color: var(--text); max-width: 420px; white-space: normal; }
.ar-invite-form { display: flex; flex-direction: column; gap: 10px; }
.ar-invite-form .row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.ar-invite-form textarea { width: 100%; resize: vertical; min-height: 64px; }
.ar-invite-form .row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ar-invites li { align-items: flex-start; }
.ar-inv-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ar-inv-who b { overflow-wrap: anywhere; }
.ar-inv-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.ok { background: #1fa35b26; color: #6fe3a1; } .chip.wait { background: #f2b6321f; color: var(--accent); } .chip.bad { background: #e2363b26; color: #ff9a9d; }
.ar-invite-link { display: flex; gap: 6px; margin-top: 6px; } .ar-invite-link input { flex: 1; min-width: 0; font-size: .85rem; }
@media (max-width: 640px) { .ar-invite-form .row2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .hide-mobile { display: none; } }

/* =====================================================================
   Nom de l'application et affichage sur téléphone
   ===================================================================== */
.brand span { text-transform: none; letter-spacing: .01em; white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 800; }
.auth-hero h1.brand-title { text-transform: none; color: var(--text); letter-spacing: -.01em; font-size: clamp(2.4rem, 10vw, 4rem); }
.auth-hero h1.brand-title span { color: var(--accent); }
.menu-btn, .tabbar, .mdrawer { display: none; }

@media (max-width: 860px) {
  /* --- barre du haut compacte + menu ; navigation principale en bas de l'écran --- */
  .topbar { flex-wrap: nowrap; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar .mainnav, .topbar .usermenu { display: none; }
  .brand { flex: 1; min-width: 0; font-size: 1.35rem; }
  .brand svg { width: 26px; height: 26px; flex: none; }
  .menu-btn { display: inline-flex; position: relative; flex: none; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px;
    background: var(--card); border: 1px solid var(--line); color: var(--text); cursor: pointer; padding: 0; }
  .menu-btn:focus-visible { outline: 2px solid var(--accent); }
  .menu-ico { display: flex; flex-direction: column; gap: 4px; }
  .menu-ico i { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
  .menu-btn .nav-badge { position: absolute; top: -5px; right: -5px; margin: 0; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #0a0f0df5; backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 5px;
    color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .01em; text-decoration: none; border-radius: 12px; }
  .tabbar a span:not(.nav-badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on::before { content: ''; position: absolute; top: -5px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tabbar a:active { background: var(--card); }
  .tabbar .nav-badge { position: absolute; top: 1px; left: calc(50% + 7px); margin: 0; }
  .tabbar ~ main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.game-page .tabbar, body.tv .tabbar, body.arena-tv .tabbar { display: none; }
  body.game-page .tabbar ~ main { padding-bottom: 16px; }
  .mdrawer { display: block; position: fixed; inset: 0; z-index: 90; background: #000b; }
  .mdrawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
    background: var(--card); border-left: 1px solid var(--line); padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom));
    animation: drawerIn .2s ease-out; }
  @keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } }
  .mdrawer-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .mdrawer-user { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
  .mdrawer-user b { display: block; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mdrawer-user small { color: var(--muted); }
  .mdrawer-av { flex: none; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font: 800 1.2rem var(--display); }
  .mdrawer-x { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font-size: 1rem; cursor: pointer; }
  .mdrawer-links { display: flex; flex-direction: column; gap: 2px; }
  .mdrawer-links a { padding: 12px; border-radius: 10px; color: var(--text); font-weight: 600; text-decoration: none; }
  .mdrawer-links a:active, .mdrawer-links a:hover { background: var(--card2); }
  .mdrawer-links a.on { background: #f2b6321f; color: var(--accent); }
  .mdrawer-out { margin: auto 0 0; }
  html.menu-open { overflow: hidden; }
  /* partie : la barre du haut escamotable garde le bouton menu */
  body.nav-auto .topbar { padding-top: max(8px, env(safe-area-inset-top)); }

  /* --- éléments de grille qui ne doivent pas élargir la page --- */
  .play-layout > *, .stats-grid > *, .game-body > *, .join-layout > *, .calib-layout > *, .test-layout > *, .ar-home > *, .ar-grid2 > * { min-width: 0; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .container, .game-main { padding: 12px; }
  .card { padding: 16px; margin-bottom: 14px; border-radius: 14px; }
  h2 { font-size: 1.25rem; }
  .page-title { font-size: 1.75rem; line-height: 1.05; margin: 2px 0 12px; }
  .page-head { margin-bottom: 4px; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; }
  input, select, textarea { font-size: 16px; }   /* évite le zoom automatique de l'iPhone */
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi em { font-size: .7rem; }
  .kpi strong { font-size: 1.6rem; }
  .auth-wrap { gap: 16px; }
  .auth-hero h1 { font-size: clamp(2rem, 11vw, 3rem); }
  .auth-hero p { font-size: 1rem; }

  /* --- listes « parties en cours » --- */
  .live-list li { flex-wrap: wrap; gap: 4px 8px; }
  .live-list .live-name { font-weight: 700; }
  .live-list .live-when { flex: 1 1 auto; font-size: .85rem; }
  .live-list li .btn, .live-list li .inline-form { margin-left: 0; }
  .live-list li > .btn:first-of-type { margin-left: auto; }
  .list li { flex-wrap: wrap; }

  /* --- tableaux de parties : une carte par ligne --- */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: auto; }
  table.stack tr:first-child { display: none; }
  table.stack tr { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; margin-bottom: 8px;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; }
  table.stack td { border: 0; padding: 0; min-width: 0; }
  table.stack .c-date { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; white-space: normal; }
  table.stack .c-game { font-weight: 700; }
  table.stack .c-res { grid-row: 2; grid-column: 2; text-align: right; }
  table.stack .c-players { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }
  table.stack .c-perf { grid-column: 1 / -1; font-size: .9rem; }
  table.stack .c-act { grid-column: 1 / -1; white-space: normal; padding-top: 4px; }
  table.recent .c-act { position: absolute; right: 12px; top: 10px; padding: 0; }
  table.recent .c-date { padding-right: 70px; }
  table.hist.stack td.sel { position: absolute; top: 10px; right: 12px; width: auto; }
  table.hist.stack .c-date { padding-right: 34px; }
  table.hist.stack .c-res { font-size: .85rem; }
  .hist-bar, .hist-actions { flex-wrap: wrap; }

  /* --- partie en cours --- */
  .game-top { gap: 8px; }
  .game-title { font-size: 1.05rem; line-height: 1.2; }
  .game-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  .game-tools::-webkit-scrollbar { display: none; }
  .game-tools > * { flex: none; }
  .ck-p { padding: 8px 6px; }
  .ck-name { font-size: .85rem; }
  .ck-score { font-size: clamp(1.6rem, 8vw, 2.6rem); gap: 4px; }
  .ck-legs { font-size: .8rem; padding: 2px 5px; }
  .ck-sub { font-size: .68rem; line-height: 1.25; }
  .ck-num { font-size: 1.1rem; }

  /* --- nouvelle partie --- */
  .mode-grid { grid-template-columns: 1fr; }
  .mode-txt { max-width: 72%; min-height: 76px; }
  .mode strong { font-size: 1.25rem; }

  /* --- Darts Arena --- */
  .ar-hero { gap: 10px; margin-bottom: 8px; align-items: center; }
  .ar-title { font-size: 2rem; margin: 0; }
  .ar-tag { display: none; }
  .ar-hero-side { width: 100%; }
  .ar-season { flex: 1; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 12px; }
  .ar-bell { width: 42px; height: 42px; }
  .ar-tabs { margin: 0 -12px 12px; padding: 0 12px; scrollbar-width: none; }
  .ar-tabs::-webkit-scrollbar { display: none; }
  .ar-tabs a { padding: 10px 11px; }
  .ar-post { padding: 10px; gap: 8px; }
  .ar-post-foot { gap: 4px 8px; }
  .chat { height: calc(100dvh - 300px); min-height: 380px; }
}
@media (max-width: 640px) {
  .form.inline { display: flex; gap: 8px; }
  .form.inline > input, .form.inline > select { flex: 1; min-width: 0; width: auto; }
  .form.inline > .btn { flex: none; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat > * { min-width: 0; }
  .ar-season strong { white-space: nowrap; font-size: 1.05rem; }
  .ar-season span { font-size: .78rem; text-align: right; }
  /* parties en cours : nom et date à gauche, actions à droite */
  .live-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name rep ab" "when rep ab"; gap: 2px 6px; align-items: center; }
  .live-list .live-name { grid-area: name; }
  .live-list .live-when { grid-area: when; font-size: .8rem; }
  .live-list li > .btn { grid-area: rep; margin: 0 !important; }
  .live-list li > .inline-form { grid-area: ab; }
  .live-list li .btn { padding-left: 10px; padding-right: 10px; }
}
.tv-brand { text-transform: none; } .tv-brand b { color: var(--text); font-weight: inherit; }
@media (max-width: 640px) {
  .hero h1 { font-size: 1.9rem; line-height: 1.05; }
  .hero { margin-bottom: 12px; }
  #joinInput { letter-spacing: .12em; font-size: 1.3rem; min-width: 0; }
  table.stack td { background: none !important; }
  table.stack tr:hover td { background: none; }
}
@media (max-width: 640px) {
  .arena .visit-slots { min-width: 0; gap: 6px; }
  .arena .slot { min-width: 0; padding: 6px 2px; }
  .arena .visit-total { min-width: 0; flex: none; width: 2.2em; font-size: 2.2rem; }
  #targets { overflow-x: auto; }
  #targets .table th, #targets .table td { padding: 6px; }
}
@media (max-width: 400px) {
  .brand { font-size: 1.2rem; gap: 8px; }
  .tabbar a { font-size: .62rem; }
}
@media (max-width: 860px) { body { overflow-x: clip; } }
@media (max-width: 640px) {
  /* partie : boutons sous la cible sur deux lignes, « Joueur suivant » bien visible */
  .action-bar { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 6px; padding: 6px; }
  .action-bar .btn { min-width: 0; padding: 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .action-bar #nextBtn { grid-column: 1 / -1; min-height: 48px; font-size: 1.05rem; }
  .arena .p-card, .arena .pc { min-width: 0; }
}
@media (max-width: 860px) {
  .toasts { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  body.game-page .toasts, body.tv .toasts { bottom: 12px; }
}
@media (max-width: 640px) {
  .emoji-pop, .emoji-pop.up, .ar-cform .emoji-pop { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (min-width: 641px) and (max-width: 900px) {
  /* --- tableaux de parties : une carte par ligne --- */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: auto; }
  table.stack tr:first-child { display: none; }
  table.stack tr { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; margin-bottom: 8px;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; }
  table.stack td { border: 0; padding: 0; min-width: 0; }
  table.stack .c-date { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; white-space: normal; }
  table.stack .c-game { font-weight: 700; }
  table.stack .c-res { grid-row: 2; grid-column: 2; text-align: right; }
  table.stack .c-players { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }
  table.stack .c-perf { grid-column: 1 / -1; font-size: .9rem; }
  table.stack .c-act { grid-column: 1 / -1; white-space: normal; padding-top: 4px; }
  table.recent .c-act { position: absolute; right: 12px; top: 10px; padding: 0; }
  table.recent .c-date { padding-right: 70px; }
  table.hist.stack td.sel { position: absolute; top: 10px; right: 12px; width: auto; }
  table.hist.stack .c-date { padding-right: 34px; }
  table.hist.stack .c-res { font-size: .85rem; }
  table.stack tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  table.stack tr { margin: 0; }
  .form.inline { display: flex; gap: 8px; } .form.inline > input { flex: 1; min-width: 0; width: auto; } .form.inline > .btn { flex: none; }
}
@media (min-width: 641px) and (max-width: 900px) { table.stack td { background: none !important; } }

/* ---------- Notifications push : réglage et proposition ---------- */
.push-box { display: flex; flex-direction: column; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.push-box:empty { display: none; }
.push-box p { margin: 0; }
.push-title { font-weight: 700; }
.push-txt { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.push-box.st-on .push-title { color: var(--green); }
.push-box.st-denied .push-title, .push-box.st-ios-install .push-title { color: var(--accent); }
.push-box .row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.push-ask { position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 80; display: flex; flex-direction: column; gap: 10px;
  max-width: 460px; margin: 0 auto; background: var(--card2); border: 1px solid var(--accent); border-radius: 14px; padding: 14px; box-shadow: 0 14px 40px #000c; animation: pushIn .25s ease-out; }
.push-ask p { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.push-ask span { color: var(--muted); font-size: .9rem; }
.push-ask div { display: flex; justify-content: flex-end; gap: 8px; }
@media (min-width: 861px) { .push-ask { bottom: 20px; right: 20px; left: auto; } }
@keyframes pushIn { from { transform: translateY(12px); opacity: 0; } }
