/* Tableau Espaces Libres — thème commun AS Basket (shared/theme.css) + terrain.
   Pensé pour PC portable et tablette : cibles tactiles de 44 px, panneaux sous le terrain en portrait. */
:root {
  --court: #1c2c49; --paint: #25395e; --court-line: #c9d6ea; --zone: var(--yellow); --target: var(--orange);
  --m: #ff4d8b; --i: var(--teal); --p: var(--blue); --ball: var(--orange);
  --path: var(--text); --ghost: var(--muted);
  --ok: var(--teal); --warn: var(--yellow); --bad: var(--red);
}

/* ─── Barre du haut (même allure que l'évaluation) ─── */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 3px solid var(--orange); position: sticky; top: 0; z-index: 10; }
.topbar .brand { color: var(--text); text-decoration: none; font-size: 1.1rem; }
.tool-name { font-weight: 700; color: var(--muted); }
.spacer { flex: 1; }
.status { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.status.online { background: var(--teal); }
.status.offline { background: var(--red); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: .35em .9em; }
button.ghost:hover { color: var(--text); border-color: var(--muted); }

/* ─── Mise en page ─── */
.wrap { max-width: 1320px; margin: 0 auto; padding: 16px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.intro { margin: 0; color: var(--muted); max-width: 80ch; }
.app { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) and (orientation: landscape), (min-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); }
  .court-card { position: sticky; top: 64px; }
}
.court-card, section.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.court-card { padding: 12px; }
.side { display: flex; flex-direction: column; gap: 12px; }
section.box { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
h2 { font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; margin: 0; color: var(--muted); }

/* ─── Contrôles ─── */
button { min-height: 44px; padding: 8px 12px; border-radius: 10px; text-align: left; border: 1px solid transparent; }
button:hover { border-color: var(--line); }
button[aria-pressed="true"] { background: var(--yellow); color: #1b1100; }
button.primary { background: var(--orange); color: #1b1100; font-weight: 700; }
button.link { min-height: 0; padding: 0 4px; background: none; color: var(--yellow); text-decoration: underline; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.row.mt { margin-top: 6px; }
.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg button { padding: 6px 10px; font-size: .92rem; }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.preset b { display: block; }
.preset span { display: block; font-size: .8rem; opacity: .8; }
.chip-m { box-shadow: inset 4px 0 0 var(--m); } .chip-i { box-shadow: inset 4px 0 0 var(--i); } .chip-p { box-shadow: inset 4px 0 0 var(--p); }
label.sw { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: .92rem; min-height: 44px; }
label.sw input { width: 20px; height: 20px; accent-color: var(--orange); }
input[type=text], textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
input[type=text] { width: 100%; }
select { min-height: 44px; }
textarea { width: 100%; min-height: 150px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible, g.pl:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ─── Positions et lecture ─── */
.timeline { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.steps { display: flex; flex-wrap: wrap; gap: 6px; }
.steps .k { font-weight: 800; font-size: 1.05rem; margin-right: 5px; }
.steps .add { background: transparent; border: 1px dashed var(--line); }
.play { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-txt { font-size: .85rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); align-items: center; margin-top: 6px; }
.legend svg { vertical-align: middle; }
.lg-path { stroke: var(--path); stroke-width: 2; } .lg-thin { fill: none; stroke-width: 1.6; } .lg-bar { stroke-width: 3.5; stroke-linecap: round; }
.lg-path-fill { fill: var(--path); } .lg-pass { stroke: var(--target); stroke-width: 2; stroke-dasharray: 5 3; } .lg-pass-fill { fill: var(--target); }
.court-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; color: var(--muted); font-size: .75rem; margin-top: 8px; }

/* ─── Panneaux ─── */
.selbox { display: flex; flex-direction: column; gap: 8px; }
.selbox .who { font-weight: 800; font-size: 1.4rem; }
.r-m-txt { color: var(--m); } .r-i-txt { color: var(--i); } .r-p-txt { color: var(--p); }
.checks { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: .92rem; }
.checks li { display: flex; gap: 8px; align-items: baseline; }
.pill { font-family: ui-monospace, Consolas, monospace; font-size: .72rem; padding: 1px 8px; border-radius: 99px; white-space: nowrap; border: 1px solid currentColor; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .mut { color: var(--muted); }
ol.deroule { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
td, th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: .78rem; }
td.num { font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl { overflow-x: auto; }
.ff { display: grid; gap: 8px; font-size: .92rem; }
.ff p { margin: 0; }
.small { font-size: .8rem; color: var(--muted); margin: 0; }
.saved { display: flex; flex-direction: column; gap: 6px; }

/* ─── Terrain (unités SVG = mètres) ─── */
svg#court { display: block; width: 100%; height: auto; max-height: 78vh; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.c-floor { fill: var(--court); } .c-paint { fill: var(--paint); }
.c-line { fill: none; stroke: var(--court-line); stroke-width: .07; }
.c-dash { fill: none; stroke: var(--court-line); stroke-width: .06; stroke-dasharray: .25 .2; }
.c-rim { fill: none; stroke: var(--target); stroke-width: .07; }
.c-lbl { fill: var(--muted); font-size: .36px; }
.z-line { stroke: var(--zone); stroke-width: .08; stroke-dasharray: .35 .22; opacity: .75; }
.z-lbl { fill: var(--zone); font-weight: 700; font-size: .55px; opacity: .9; text-anchor: middle; }
.z-lbl.alert { fill: var(--bad); opacity: 1; }
.spot { fill: none; stroke: var(--muted); stroke-width: .04; stroke-dasharray: .12 .1; }
.spot-lbl { fill: var(--muted); font-size: .3px; text-anchor: middle; }
.tgt { fill: var(--target); opacity: .2; stroke: var(--target); stroke-width: .05; stroke-opacity: .9; }
.tgt-lbl { fill: var(--target); font-weight: 800; font-size: .45px; text-anchor: middle; letter-spacing: .04em; }
g.pl { cursor: grab; } g.pl.drag { cursor: grabbing; }
g.pl circle.body { stroke: var(--bg); stroke-width: .08; }
.r-m { fill: var(--m); } .r-i { fill: var(--i); } .r-p { fill: var(--p); }
g.pl text { fill: #fff; font-weight: 800; font-size: .5px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.ball { fill: var(--ball); stroke: var(--bg); stroke-width: .05; }
.near-line { stroke: var(--bad); stroke-width: .05; stroke-dasharray: .15 .1; }
.sel-ring { fill: none; stroke: var(--yellow); stroke-width: .08; }
.step-flag { fill: var(--target); font-weight: 800; font-size: .5px; text-anchor: start; }
.p-move { fill: none; stroke: var(--path); stroke-width: .08; }
.p-drib { fill: none; stroke: var(--path); stroke-width: .07; }
.p-pass { fill: none; stroke: var(--target); stroke-width: .08; stroke-dasharray: .28 .18; }
.p-screen { stroke: var(--path); stroke-width: .16; stroke-linecap: round; }
.p-stem { stroke: var(--path); stroke-width: .08; }
.p-ghost { fill: none; stroke: var(--ghost); stroke-width: .05; stroke-dasharray: .1 .08; }
.p-ghost-t { fill: var(--ghost); font-size: .32px; text-anchor: middle; dominant-baseline: central; }
.p-num { fill: var(--path); font-weight: 800; font-size: .4px; text-anchor: middle; dominant-baseline: central; }
.p-num-bg { fill: var(--court); }
.ah-move { fill: var(--path); } .ah-pass { fill: var(--target); }
@media (prefers-reduced-motion: no-preference) { g.pl { transition: transform .18s ease-out; } g.pl.drag, svg.playing g.pl { transition: none; } }
svg.playing g.pl { transition: none; }
