:root {
  --bg: #0e1116; --bg2: #151a22; --panel: #1a2029; --panel2: #202835; --line: #2c3645;
  --text: #e7ecf3; --muted: #93a1b5; --accent: #f5c542; --accent2: #3b82f6; --ok: #22c55e;
  --warn: #f59e0b; --bad: #ef4444; --ball: #f5c542; --ball-line: #1d4ed8;
  --court: #c98a4b; --court-in: #d99a5a; --court-line: #fff; --court-out: #2a5c8f;
  --radius: 10px; --shadow: 0 6px 24px rgba(0,0,0,.35);
  --g-hash: #22c55e; --g-plus: #84cc16; --g-excl: #eab308; --g-minus: #f97316; --g-slash: #a855f7; --g-eq: #ef4444;
  color-scheme: dark;
}
:root.light {
  --bg: #f3f5f8; --bg2: #e9edf2; --panel: #ffffff; --panel2: #f5f7fa; --line: #d8dee7;
  --text: #17202c; --muted: #5d6b7e; --shadow: 0 6px 24px rgba(20,30,50,.12); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent2); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 18px; letter-spacing: .3px; }
.brand b { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--panel); }
main { padding: 20px; max-width: 1600px; margin: 0 auto; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #1b1600; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
input, select, textarea { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; min-width: 0; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent2) 60%, transparent); border-color: transparent; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
label.field > input, label.field > select { font-size: 14px; color: var(--text); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--panel2);
  border: 1px solid var(--line); white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.grade { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 800; color: #111; font-size: 13px; }
.g-hash { background: var(--g-hash); } .g-plus { background: var(--g-plus); } .g-excl { background: var(--g-excl); }
.g-minus { background: var(--g-minus); } .g-slash { background: var(--g-slash); color: #fff; } .g-eq { background: var(--g-eq); color: #fff; }
.g-none { background: var(--panel2); color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--panel); cursor: default; }
th.sort { cursor: pointer; } th.sort:hover { color: var(--text); }
tbody tr:hover { background: var(--panel2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; border-radius: var(--radius); }
.progress { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .4s; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; }
.toast.error { border-color: var(--bad); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(520px, 100%);
  box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 16px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
/* dashboard */
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.match-card { display: grid; gap: 10px; padding: 0; overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s; }
.match-card:hover { transform: translateY(-2px); border-color: var(--muted); }
.match-card .thumb { aspect-ratio: 16/9; background: var(--bg2) center/cover; position: relative; }
.match-card .thumb .state { position: absolute; top: 8px; left: 8px; }
.match-card .body { padding: 0 14px 14px; display: grid; gap: 6px; }
.scoreline { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.scoreline .sc { font-size: 20px; font-variant-numeric: tabular-nums; }
/* upload */
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 40px; text-align: center; cursor: pointer; transition: .2s; }
.drop.over, .drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* calibration */
.calib { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.calib-stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; cursor: crosshair; user-select: none; }
.calib-stage img { width: 100%; display: block; }
.calib-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.kp-list { display: grid; gap: 4px; }
.kp { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.kp:hover { background: var(--panel2); } .kp.sel { border-color: var(--accent); background: var(--panel2); }
.kp .st { margin-left: auto; font-size: 12px; }
/* workspace */
.ws-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.ws-head .score { display: flex; align-items: center; gap: 14px; font-size: 16px; font-weight: 600; padding: 6px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.ws-head .score .n { font-size: 26px; font-variant-numeric: tabular-nums; }
.video-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.player-box { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-box video { width: 100%; display: block; max-height: 70vh; }
.player-box canvas.ov { position: absolute; inset: 0; pointer-events: none; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0; }
.controls .time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 120px; }
.toggles { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.toggles label { display: flex; gap: 4px; align-items: center; cursor: pointer; }
.timeline { position: relative; height: 54px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.timeline canvas { width: 100%; height: 100%; display: block; }
.side-panel { display: grid; gap: 12px; }
.ev-list { max-height: 56vh; overflow: auto; display: grid; gap: 2px; }
.ev { display: grid; grid-template-columns: 54px 1fr auto auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 7px;
  cursor: pointer; border: 1px solid transparent; font-size: 13px; }
.ev:hover { background: var(--panel2); } .ev.cur { border-color: var(--accent); background: var(--panel2); }
.ev.deleted { opacity: .4; text-decoration: line-through; }
.ev .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.ev .tp { display: flex; gap: 6px; align-items: center; min-width: 0; overflow: hidden; }
.type-chip { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; color: #0b0f14; }
.rally-row .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.minimap-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rating { display: inline-block; min-width: 38px; text-align: center; padding: 2px 6px; border-radius: 6px; font-weight: 800; color: #111; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: var(--shadow); z-index: 40; padding: 20px; overflow: auto; transform: translateX(100%); transition: transform .25s; }
.drawer.open { transform: none; }
.bar { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.status-pill { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.st-done { background: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.st-running, .st-queued { background: color-mix(in srgb, var(--accent2) 25%, transparent); color: #7fb0ff; }
.st-error, .st-cancelled { background: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }
.st-uploaded { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.help { background: var(--panel2); border-left: 3px solid var(--accent2); padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.kbd { font-family: ui-monospace, monospace; font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg2); }
code { font-family: ui-monospace, monospace; font-size: 12px; background: var(--bg2); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--bg2); padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; }
svg text { font-family: inherit; }
@media (max-width: 1100px) {
  .video-layout, .calib { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 12px 16px; }
  .topbar { gap: 10px; padding: 8px 12px; }
  .brand span { display: none; }
}
@media print {
  .topbar, .tabs, .no-print, .btn { display: none !important; }
  body, html { background: #fff; color: #000; }
  .card, .kpi { border-color: #ccc; background: #fff; }
  main { max-width: none; padding: 0; }
}
/* squadre e identificazione */
.modal-card.wide { width: min(980px, 100%); }
.team-card { display: grid; gap: 8px; color: var(--text); }
.team-card:hover { border-color: var(--muted); }
.team-card .chips, .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.badge.mine { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); color: var(--accent); }
table.roster td { padding: 4px 6px; }
table.roster input, table.roster select { width: 100%; }
.id-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.id-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
.id-card.done { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.id-card .ph { height: 150px; border-radius: 6px; background: #000 center/contain no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; cursor: pointer; }
.id-card select { width: 100%; }
.roster-side { display: grid; gap: 4px; }
.roster-side .rp { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.roster-side .rp .n { min-width: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pop { position: absolute; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: var(--shadow);
  display: grid; gap: 8px; width: 280px; font-size: 13px; }
.player-box.pick { cursor: pointer; }
.action-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.seq { display: grid; gap: 4px; }
.seq .touch { display: grid; grid-template-columns: 24px 50px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.seq .touch:hover { background: var(--panel2); } .seq .touch.cur { border-color: var(--accent); background: var(--panel2); }
.seq .touch .k { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #111; }
.seq .touch select { max-width: 100%; }
@media (max-width: 1100px) { .action-layout { grid-template-columns: 1fr; } }
/* libreria video */
.vl-timeline { position: relative; height: 58px; border-radius: 8px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line);
  cursor: pointer; touch-action: none; user-select: none; }
.vl-strip { position: absolute; inset: 0; display: flex; opacity: .75; }
.vl-strip > div { flex: 1; background: center/cover; border-right: 1px solid rgba(0,0,0,.4); }
.vl-layer { position: absolute; inset: 0; pointer-events: none; }
.vl-cut { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(239,68,68,.75) 0 6px, rgba(239,68,68,.45) 6px 12px);
  border-left: 2px solid var(--bad); border-right: 2px solid var(--bad); }
.vl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.vl-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bad); pointer-events: none; }
.vl-mark::after { content: "["; position: absolute; top: 2px; left: 4px; color: #fff; font-weight: 800; text-shadow: 0 0 3px #000; }
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 8px 12px; }
  .brand span { display: none; }
  .topbar nav { overflow-x: auto; min-width: 0; }
  .topbar nav a { white-space: nowrap; }
}
/* archivio partite */
table.archive tbody tr { cursor: pointer; }
table.archive th.sorted { color: var(--text); }
table.archive .sort-ind { opacity: .6; font-size: 11px; }
table.archive td { vertical-align: middle; }
table.archive td.thumb-cell { width: 96px; padding-right: 0; }
.arch-thumb { width: 88px; aspect-ratio: 16/9; border-radius: 6px; background: var(--bg2) center/cover; }
table.archive td.name-cell { white-space: normal; min-width: 200px; max-width: 360px; }
/* scelta del video in «Nuova analisi» */
.pick-list { display: grid; gap: 4px; max-height: 46vh; overflow: auto; }
.pick { display: grid; grid-template-columns: auto 88px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 10px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.pick:hover { background: var(--panel2); }
.pick.sel { border-color: var(--accent); background: var(--panel2); }
.pick.disabled { opacity: .5; cursor: not-allowed; }
.pick b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* caricamenti in corso (riquadro fisso) */
.upl-panel { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(380px, calc(100vw - 32px)); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 8px; }
.upl-head { cursor: pointer; user-select: none; }
.upl-list { display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.upl-row { display: grid; gap: 6px; }
.upl-row.card { padding: 10px 14px; }
.upl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
label.field .grid > select, label.field .grid > input { font-size: 14px; color: var(--text); }
.progress.paused > div { background: var(--warn); }
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 6px; }
label.field .cat-row > select { font-size: 14px; color: var(--text); }
/* gruppi di comandi del lettore (secondi / fotogrammi) */
.ctl-group { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg2); }
.ctl-label { font-size: 11px; color: var(--muted); margin-right: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-right: 4px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--accent); color: #1b1600; font-weight: 600; }
.trim-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; }
.trim-row select { padding: 4px 8px; }
/* scheda CLUB */
.club-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.club-logo-box { width: 140px; height: 140px; flex: none; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; }
.club-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.club-logo.empty { color: var(--muted); font-size: 12px; }
.role-block { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.person-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1.4fr auto; gap: 6px; }
@media (max-width: 640px) { .person-row { grid-template-columns: 1fr 1fr; } .person-row > button { grid-column: 2; justify-self: end; } }
.team-section { margin-bottom: 22px; }
/* pagina iniziale */
.home { display: grid; gap: 18px; }
.hero { position: relative; border-radius: 16px; overflow: hidden; width: 100%; height: clamp(440px, 44vw, 600px);
  border: 1px solid var(--line); box-shadow: var(--shadow); background: #070b14; }
.hero-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-text { position: relative; z-index: 1; padding: clamp(22px, 5vw, 56px); max-width: 560px; display: grid; gap: 14px; color: #e7ecf3; }
.hero-club { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; font-size: 13px; color: #cbd5e1; }
.hero-club img { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.06); }
.hero-title { font-size: clamp(40px, 7vw, 84px); line-height: .95; margin: 0; letter-spacing: -1.5px; font-weight: 800; color: #fff;
  text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.hero-title b { color: var(--accent); }
.hero-sub { margin: 0; font-size: clamp(14px, 1.6vw, 18px); color: #cbd5e1; line-height: 1.5; text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.hero-sub b { color: #fff; letter-spacing: 1px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.hero-cta .btn:not(.primary) { background: rgba(15,23,42,.7); color: #e7ecf3; border-color: rgba(255,255,255,.18); backdrop-filter: blur(4px); }
.hstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hstat { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.hstat:hover { border-color: var(--muted); }
.hstat b { font-size: 26px; font-variant-numeric: tabular-nums; }
.hstat span { font-size: 12px; color: var(--muted); }
.htiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.htile { display: flex; gap: 12px; align-items: flex-start; color: var(--text); transition: transform .15s, border-color .15s; }
.htile:hover { transform: translateY(-2px); border-color: var(--accent); }
.htile h3 { margin: 0 0 4px; }
.htile-ic { font-size: 22px; width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--panel2); }
@media (max-width: 640px) {
  .hero { height: auto; display: flex; flex-direction: column; }
  .hero-svg { position: relative; order: 2; height: 300px; }
  .hero-text { max-width: none; padding: 22px 18px 16px; }
}
/* ---------------------------------------------------------------- responsive (telefono e tablet) */
/* i figli di griglie e flex possono restringersi: una tabella larga scorre nel suo riquadro, non allarga la pagina */
.card, .grid > *, .two > *, .row > *, .side-panel > *, .video-layout > * { min-width: 0; }
select, input, textarea { max-width: 100%; }
img, video, svg { max-width: 100%; }
.ctl-group { flex-wrap: wrap; }
@media (max-width: 640px) {
  .controls { gap: 6px; }
  .controls .time { min-width: 0; }
  .ctl-group { width: 100%; justify-content: flex-start; }
  .ctl-group input { flex: 1; min-width: 50px; }
  .ws-head, .row.between { gap: 10px; }
  h1 { font-size: 20px; }
  .trim-row { gap: 8px; }
  .trim-row input { width: 64px !important; }
  table.archive td.name-cell { min-width: 160px; }
}
/* dispositivi touch: bersagli di almeno ~40 px, testo dei campi a 16 px (iOS altrimenti ingrandisce la pagina) */
@media (pointer: coarse) {
  .btn { min-height: 40px; padding: 8px 14px; }
  .btn.sm { min-height: 38px; min-width: 38px; padding: 6px 12px; font-size: 13px; justify-content: center; }
  .icon-btn { width: 40px; height: 40px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { min-height: 40px; font-size: 16px; }
  input[type=color] { min-height: 40px; min-width: 48px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .topbar nav a { padding: 10px 12px; }
  .tabs button { padding: 12px 16px; }
  .seg button { padding: 9px 12px; font-size: 13px; }
  .person-row > button { min-width: 40px; }
}
/* menu e schede senza a capo, scorrevoli se non ci stanno */
.topbar nav { overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a, .tabs button { white-space: nowrap; }
.only-phone { display: none !important; }
@media (max-width: 1100px) { .topbar { gap: 12px; } .topbar nav a { padding: 6px 9px; } }
@media (max-width: 640px) {
  .only-phone { display: flex !important; }
  /* barra in alto su due righe: logo e tema sopra, menu scorrevole sotto */
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .topbar nav { order: 3; flex: 1 0 100%; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .brand { margin-right: auto; }
  .brand span { display: inline; }
  /* roster: numero e ruolo sulla prima riga, nome e cognome sotto */
  table.roster thead { display: none; }
  table.roster, table.roster tbody { display: block; }
  table.roster tr { display: grid; grid-template-columns: 70px 1fr auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.roster td { display: block; padding: 0; border: 0; }
  table.roster td.r-num { grid-column: 1; } table.roster td.r-role { grid-column: 2; } table.roster td.r-del { grid-column: 3; grid-row: 1; }
  table.roster td.r-fn { grid-column: 1 / 3; grid-row: 2; } table.roster td.r-ln { grid-column: 3 / 4; grid-row: 2; }
  table.roster tr:has(td.r-fn) td.r-fn { grid-column: 1 / 2; } 
  table.roster tr:has(td.r-fn) { grid-template-columns: 70px 1fr 1fr auto; }
  table.roster tr:has(td.r-fn) td.r-role { grid-column: 2 / 4; } table.roster tr:has(td.r-fn) td.r-del { grid-column: 4; }
  table.roster tr:has(td.r-fn) td.r-fn { grid-column: 1 / 3; grid-row: 2; } table.roster tr:has(td.r-fn) td.r-ln { grid-column: 3 / 5; grid-row: 2; }
  table.roster td input, table.roster td select { width: 100% !important; }
}
/* tablet in verticale e telefono: tabelle di Archivio video e Partite analizzate e Squadre come schede, menu «Ordina per» */
@media (max-width: 900px) {
  .only-phone { display: flex !important; }
  /* tabelle di Archivio video e Partite analizzate e Squadre come schede */
  table.archive, table.archive tbody { display: block; }
  table.archive thead { display: none; }
  table.archive tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; padding: 12px; border-bottom: 1px solid var(--line); }
  table.archive td { display: block; padding: 0; border: 0; white-space: normal; text-align: left !important; }
  table.archive td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  table.archive td.name-cell { grid-column: 1 / -1; min-width: 0; max-width: none; font-size: 15px; }
  table.archive td.thumb-cell { grid-column: 1 / -1; width: auto; padding: 0; }
  table.archive td.thumb-cell .arch-thumb { width: 100%; max-height: 160px; }
  table.archive td.actions-cell { grid-column: 1 / -1; margin-top: 6px; }
  table.archive td.actions-cell .row > * { flex: 1; }
  .table-wrap.card { overflow: visible; }
  table.archive td.thumb-cell { max-width: 360px; }
}
@media (max-width: 1100px) {
  .topbar nav { -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
}
@media (min-width: 641px) and (max-width: 900px) {
  /* solo le righe con miniatura (Archivio video e Partite analizzate): miniatura a sinistra, dati a destra */
  table.archive tr:has(> td.thumb-cell) { grid-template-columns: 170px repeat(3, minmax(0, 1fr)); align-items: start; }
  table.archive td.thumb-cell { grid-column: 1; grid-row: 1 / span 4; }
  table.archive td.thumb-cell .arch-thumb { max-height: none; }
  table.archive tr:has(> td.thumb-cell) td.name-cell, table.archive tr:has(> td.thumb-cell) td.actions-cell { grid-column: 2 / -1; }
  table.archive td.actions-cell .row { max-width: 420px; }
}
/* proposte dai numeri di maglia */
.prop { display: grid; gap: 6px; padding: 8px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); }
.prop.compact { padding: 6px; }
.prop-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.prop-btns .btn { flex: 1; justify-content: center; }
.prop-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.prop-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.prop-row .prop { margin-top: 6px; }
.prop-ph { width: 70px; height: 100px; border-radius: 6px; background: #000 center/contain no-repeat; }
@media (max-width: 640px) { .prop-list { grid-template-columns: 1fr; } }
.prop-shots { display: flex; gap: 4px; }
.prop-shots img { width: 56px; height: 56px; object-fit: cover; border-radius: 5px; background: #000; }
.prop.compact .prop-shots img { width: 44px; height: 44px; }
/* visore dei momenti di un'identità */
.mv-stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.mv-stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.mv-stage canvas.mv-ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mv-stage.mv-lost::after { content: "Giocatrice non tracciata in questo istante"; position: absolute; left: 10px; bottom: 10px; font-size: 12px;
  background: rgba(0,0,0,.7); color: #fff; padding: 3px 8px; border-radius: 6px; }
.prop-shots img, .prop-ph, .id-card .ph { cursor: zoom-in; }
.mv-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.mv-roster .btn { justify-content: flex-start; white-space: normal; text-align: left; }
.mv-roster .btn.mv-mine { border-color: var(--ok); }
.mv-stage { touch-action: pan-y; }                 /* niente zoom della pagina con due dita sul video */
.mv-inner { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.mv-zoom { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.two.lineup-cols { grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); }
@media (max-width: 900px) { .two.lineup-cols { grid-template-columns: 1fr; } }
.mv-info { min-height: 1.2em; }
.mv-roster .btn.mv-excl { border-color: var(--bad); opacity: .65; }
.mv-roster .btn.mv-cont { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.mv-tag { display: block; width: 100%; font-size: 11px; opacity: .85; }
.mv-roster .btn.mv-excl .mv-tag { color: var(--bad); }
.mv-roster .btn.mv-cont .mv-tag { color: var(--ok); }
.card.conflicts { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.conflict-row { padding: 6px 8px; border-radius: 8px; background: var(--panel2); flex-wrap: wrap; }
.btn.pick-a { border-color: #f5c542; font-weight: 600; }
.btn.pick-b { border-color: #22d3ee; font-weight: 600; }
.btn.pick-a:hover { background: color-mix(in srgb, #f5c542 18%, var(--panel2)); }
.btn.pick-b:hover { background: color-mix(in srgb, #22d3ee 18%, var(--panel2)); }
.mv-roster .btn .mv-look { color: #c084fc; }
.truth-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 140px; overflow: auto; }
.truth-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; font-variant-numeric: tabular-nums; }
.truth-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; }
.score-box { display: grid; gap: 4px; justify-items: center; }
.set-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.set-chip { font-size: 12px; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); }
tr.set-sep td { background: var(--panel2); font-weight: 700; font-size: 12px; color: var(--accent); padding: 4px 8px; }
/* formazione di inizio set */
.lineup-card { margin-bottom: 16px; }
.lineup-card > summary { cursor: pointer; list-style: none; }
.lu-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.lu-team { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.lu-court { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--court) 22%, transparent); border: 2px solid color-mix(in srgb, var(--court-line) 60%, transparent); }
.lu-net { grid-column: 1 / -1; text-align: center; font-size: 11px; color: var(--muted); border-bottom: 3px solid var(--text); padding-bottom: 2px; margin-bottom: 2px; }
.lu-pos { display: grid; gap: 2px; }
.lu-n { font-size: 11px; font-weight: 700; color: var(--accent); }
.lu-pos select { width: 100%; font-size: 12px; }
.badge.lu-serve { background: var(--accent); color: #1b1600; border-color: var(--accent); }
/* report di scouting */
.sc-two { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 900px) { .sc-two { grid-template-columns: 1fr; } }
.zc { display: grid; gap: 4px; min-width: 180px; }
.zc-label { font-size: 11px; color: var(--muted); }
.zc-net { font-size: 10px; text-align: center; color: var(--muted); border-bottom: 3px solid var(--text); }
.zc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.zc-cell { display: grid; justify-items: center; padding: 6px 2px; border-radius: 6px; border: 1px solid var(--line); min-height: 58px; }
.zc-z { font-size: 10px; color: var(--muted); }
.sc-setters { display: grid; gap: 16px; }
.sc-setter .row { flex-wrap: wrap; }
.sc-players td, .sc-players th { white-space: nowrap; }
tr.sc-cliprow td { padding-top: 0; border-bottom: 1px solid var(--line); }
.sc-clips summary { cursor: pointer; font-size: 12px; color: var(--accent2); }
.sc-clip-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.sc-clip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--text); font-size: 12px; }
.sc-clip:hover { border-color: var(--accent); }
@media print { .sc-clips, .sc-cliprow { display: none !important; } .zc-cell { border-color: #999; } .scouting .card { break-inside: avoid; } }
/* accesso e utenti */
body.logged-out .topbar nav, body.logged-out #userBox { display: none; }
body.role-viewer [data-nav=videos], body.role-viewer [data-nav=new] { display: none; }
.user-box { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font: inherit; max-width: 200px; }
.user-btn:hover { border-color: var(--muted); }
.user-ini { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #1b1600; display: grid; place-items: center; font-weight: 800; flex: none; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; display: grid; gap: 6px; min-width: 220px; z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.user-menu.hidden { display: none; }
.user-menu .btn { justify-content: flex-start; }
.user-menu-head { display: grid; gap: 2px; padding: 2px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.hero.hero-login { height: auto; min-height: clamp(520px, 44vw, 640px); }
.login-card { display: grid; gap: 12px; margin-top: 8px; padding: 18px; width: min(360px, 100%); border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); backdrop-filter: blur(6px); color: var(--text); }
.login-card h2 { margin: 0; }
.login-card input { font-size: 16px; }
.login-card .btn.primary { justify-content: center; padding: 10px 14px; }
.login-err { color: var(--bad); font-size: 13px; }
@media (max-width: 640px) {
  .user-name { display: none; }
  .user-btn { padding: 3px; }
  .hero.hero-login .hero-sub { display: none; }
}
/* sequenze filtrate */
.seq-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.seq-layout .ev-list { max-height: 70vh; }
.seq-layout .ev .tp { min-width: 0; }
@media (max-width: 800px) { .seq-layout .ev-list { max-height: 55vh; } }
.seq-layout .ev { grid-template-columns: 54px 1fr auto auto; }
.seq-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.chip-tg { min-width: 32px; padding: 0 8px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; font-weight: 700; }
.chip-tg.on { background: var(--accent); color: #1b1600; border-color: var(--accent); }
.seq-caption { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 26px; }
@media (max-width: 1250px) { .seq-layout { grid-template-columns: 230px minmax(0, 1fr); } .seq-layout > :last-child { grid-column: 1 / -1; } }
@media (max-width: 800px) { .seq-layout { grid-template-columns: 1fr; } .seq-layout > .seq-filters { order: 2; } .seq-layout > :last-child { order: 3; } }
.truth-chip .tag { font-weight: 700; color: var(--text); border-radius: 6px; padding: 0 5px; }
.truth-chip.ours { border-color: var(--accent); }
.truth-chip.opp { border-color: #60a5fa; }
.truth-chip.unk .tag { color: var(--warn); }

/* live con ritardo */
.live-stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; display: flex; justify-content: center; align-items: center; min-height: 200px; }
.live-stage:fullscreen { border-radius: 0; }
.live-canvas { width: 100%; height: auto; max-height: 75vh; object-fit: contain; display: block; }
.live-stage:fullscreen .live-canvas { max-height: 100vh; height: 100vh; }
.live-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.65); color: #fff; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 15px; }
.live-preview { width: 100%; max-height: 55vh; background: #000; border-radius: 10px; }

/* live: schermo intero (nativo o, su iPhone, riquadro che copre la pagina) */
.live-player:fullscreen, .live-player:-webkit-full-screen, .live-player.live-full {
  position: fixed; inset: 0; z-index: 9999; background: #000; display: flex; flex-direction: column; gap: 0; padding: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.live-player:fullscreen .live-stage, .live-player:-webkit-full-screen .live-stage, .live-player.live-full .live-stage { flex: 1; border-radius: 0; min-height: 0; }
.live-player:fullscreen .live-canvas, .live-player:-webkit-full-screen .live-canvas, .live-player.live-full .live-canvas { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.live-player:fullscreen .live-controls, .live-player:-webkit-full-screen .live-controls, .live-player.live-full .live-controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.75)); opacity: .9;
}
.live-player.live-full .live-controls .small.muted, .live-player:fullscreen .live-controls .small.muted { color: #ddd; }
body.live-noscroll { overflow: hidden; }

.live-player.live-idle .live-controls { opacity: 0; pointer-events: none; transition: opacity .4s; }
.live-player.live-idle { cursor: none; }

.hero-tagline { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent, #f5c542); font-weight: 600; margin: -4px 0 10px; opacity: .95; }

/* ---- navigazione: ☰ + titolo sezione nell'intestazione, schede raggruppate (home e menu) ---- */
.menu-btn { display: grid; place-items: center; padding: 0; margin-right: -8px; }
.crumb { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.crumb a, .crumb span { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .crumb-sep { color: var(--muted); font-weight: 400; font-size: 20px; line-height: 1; }
.nav-groups { display: grid; gap: 22px; }
.nav-group-title { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.nav-group-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--g); }
.nav-group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.nav-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.nav-tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); color: var(--text); transition: transform .15s, border-color .15s, box-shadow .15s; }
.nav-tile:hover { transform: translateY(-2px); border-color: var(--g); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.nav-tile.active { border-color: var(--g); }
.nav-ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--g);
  background: color-mix(in srgb, var(--g) 14%, transparent); }
.nav-txt { display: grid; gap: 4px; min-width: 0; }
.nav-txt b { font-size: 16px; }
.nav-txt span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.nav-groups.compact .nav-tile { padding: 10px 12px; align-items: center; }
.nav-groups.compact .nav-ic { width: 36px; height: 36px; }
/* pannello del menu ☰ */
.nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 900; opacity: 0; transition: opacity .2s; }
.nav-backdrop.open { opacity: 1; }
.nav-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: min(420px, 92vw); z-index: 901; background: var(--bg2);
  border-right: 1px solid var(--line); box-shadow: var(--shadow); padding: 14px 16px 24px; overflow-y: auto;
  transform: translateX(-102%); transition: transform .2s ease; }
.nav-drawer.open { transform: none; }
.nav-drawer .nav-tiles { grid-template-columns: 1fr; gap: 8px; }
.nav-drawer .nav-tile { padding: 12px; }
.nav-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.nav-home { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.nav-home:hover { background: var(--panel); }
.icon-btn svg { display: block; margin: auto; }
.home .nav-groups { margin-top: 6px; }
@media (max-width: 640px) {
  .nav-tiles { grid-template-columns: 1fr; }
  .crumb { font-size: 14px; }
  .brand span { display: none; }
}

/* «Accedi come…» */
.imp-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  padding: 8px 20px; background: #f5c542; color: #1b1500; font-size: 14px; }
.imp-bar .btn { background: #1b1500; color: #fff; border-color: #1b1500; }
body.impersonating .topbar { top: 44px; }

.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; }

/* schede della pagina Club */
.club-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.club-tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.club-tabs a.active, .club-tabs a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* sviluppatore separato sopra la tabella utenti */
.dev-card { margin-bottom: 14px; border-color: var(--accent); }
.dev-badge { background: var(--accent); color: #1b1500; font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; }

/* ---- gestione utenti: un utente per scheda, su due righe ---- */
.ur-filters { gap: 8px; margin: 12px 0; flex-wrap: wrap; align-items: center; }
.roles-help { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; }
.roles-help summary { cursor: pointer; font-size: 14px; color: var(--muted); }
.ur-list { display: grid; gap: 10px; }
.ur { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.ur:hover { border-color: var(--muted); }
.ur-main { display: grid; grid-template-columns: 40px minmax(170px, 1.3fr) minmax(130px, 1fr) 210px 130px auto; align-items: center; gap: 12px; }
.ur-ini { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--panel2); color: var(--accent); }
.ur-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ur-role { width: 100%; }
.ur-last { line-height: 1.3; }
.ur-last span { color: var(--text); }
.ur-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ur-access { display: grid; gap: 6px; padding: 8px 0 0 52px; border-top: 1px dashed var(--line); }
.ur-line { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.ur-lbl { width: 70px; flex: none; font-size: 12px; color: var(--muted); padding-top: 3px; text-transform: uppercase; letter-spacing: .05em; }
.ur-chips { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; color: var(--text); }
.chip-all { border-color: var(--ok); color: var(--ok); }
.chip-none { color: var(--muted); }
.chip-off { opacity: .4; filter: grayscale(1); color: var(--muted); cursor: not-allowed; user-select: none; }
.chip-btn { cursor: pointer; font: inherit; font-size: 12px; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip-btn:hover { border-color: var(--accent); }
.btn.xs { padding: 2px 8px; font-size: 12px; min-height: 0; }
.btn.icon-only { width: 34px; padding: 4px 0; justify-content: center; }
@media (max-width: 900px) {
  .ur-main { grid-template-columns: 40px 1fr auto; }
  .ur-main .ur-club, .ur-main .ur-role, .ur-main .ur-last { grid-column: 2 / -1; }
  .ur-access { padding-left: 0; }
}
.btn.icon-only svg { display: block; margin: auto; }
.btn.icon-only.danger { color: var(--bad); }
@media (max-width: 900px) { .ur-main .ur-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* righe Schede/Squadre richiudibili */
.ur-access { display: none; }
.ur.open .ur-access { display: grid; }
.ur-toggle { display: block; margin-top: 4px; padding: 1px 8px; font-size: 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; }
.ur-toggle:hover { color: var(--text); border-color: var(--muted); }
.ur.open .ur-toggle { color: var(--accent); border-color: var(--accent); }

/* suggerimento al passaggio del mouse (util.js) */
.tooltip { position: fixed; z-index: 10000; pointer-events: none; max-width: 280px; padding: 6px 10px; border-radius: 8px;
  background: #0b0f15; color: #f1f5f9; font-size: 12.5px; line-height: 1.35; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  border: 1px solid #334155; opacity: 0; transition: opacity .12s; }
:root.light .tooltip { background: #111827; color: #fff; border-color: #111827; }
/* Live Replay: scelta della telecamera nei comandi (anche a schermo intero) */
.live-cam { max-width: 220px; height: 32px; padding: 0 8px; font-size: 13px; }
.live-player:fullscreen .live-cam, .live-player:-webkit-full-screen .live-cam, .live-player.live-full .live-cam { background: #111; color: #fff; border-color: #444; }
/* Live Replay: zoom e fuoco della telecamera */
.live-prevwrap { position: relative; }
.live-prevwrap .live-preview { display: block; cursor: crosshair; }
.live-focus-ring { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 2px solid #f5c542; border-radius: 10px;
  pointer-events: none; opacity: 0; }
.live-focus-ring.on { animation: liveFocus .9s ease-out; }
@keyframes liveFocus { 0% { opacity: 1; transform: scale(1.5); } 40% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
.live-camctl input[type=range] { flex: 1; min-width: 120px; }
/* archivio: squadre e risultato vanno a capo, così la colonna Analisi resta visibile anche su un portatile */
table.archive td[data-label="Squadre"], table.archive td[data-label="Risultato"] { white-space: normal; min-width: 110px; }
/* attività utenti: tabella compatta (niente scorrimento orizzontale) */
table.activity td { vertical-align: top; white-space: normal; }
table.activity td .small { white-space: nowrap; }
table.compact td, table.compact th { padding: 6px 10px; }
