/* Moviola — © 2026 Emanuele Colecchia. All rights reserved. See LICENSE. */
/* Moviola: dark board for working at night after the match, one accent colour, team colours that never change
   (yellow = us, coral = opponents). The report is light, for printing. */
:root {
  --bg: var(--bg);
  --rail: #0d1325;
  --panel: #131a2e;
  --raised: #1a2340;
  --line: #27314f;
  --line-soft: #1f2843;
  --text: #e9edf7;
  --muted: var(--faint);
  --us: var(--us);
  --them: var(--them-t);
  --accent: var(--accent);
  --accent-ink: var(--accent-ink);
  --pitch: #1b5a39;
  --pitch-band: #1e6240;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 6px 18px rgba(0, 0, 0, 0.28);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: radial-gradient(1200px 500px at 70% -200px, #16224a 0%, var(--bg) 60%); background-attachment: fixed; color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }
.star { color: var(--us-t); }

/* ---------- controls ---------- */
button, .btn, select, input, textarea { font: inherit; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; transition: border-color 0.12s, background 0.12s, color 0.12s; }
button, .btn { cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); background: var(--raised-2); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .btn:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: var(--accent); }
button.accent { background: transparent; border-color: var(--us); color: var(--us-t); font-weight: 600; }
button.accent:hover { background: rgba(245, 217, 10, 0.12); }
button:disabled { opacity: 0.4; cursor: default; }
textarea { width: 100%; padding: 8px 10px; }
kbd { display: inline-block; min-width: 18px; text-align: center; background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font: 600 11px/16px ui-monospace, Consolas, monospace; color: var(--muted); margin-right: 6px; }
button.on kbd { background: rgba(9, 16, 11, 0.25); border-color: rgba(9, 16, 11, 0.35); color: var(--accent-ink); }

/* ---------- sidebar: sections of the app ---------- */
body { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
#sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 14px; background: var(--rail); border-right: 1px solid var(--line-soft); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: 0.1px; padding: 0 6px; }
.logo { flex: none; width: 26px; height: 18px; border-radius: 3px; background: var(--pitch); border: 1.5px solid rgba(255, 255, 255, 0.8); position: relative; }
.logo::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1.5px solid rgba(255, 255, 255, 0.8); }
.logo::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--us); }
.matchbox { display: grid; gap: 6px; padding: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.matchbox label { font-size: 12px; color: var(--muted); }
.matchbox select { width: 100%; min-width: 0; font-size: 13px; }
.matchbox button { justify-content: center; }
#nav { display: grid; gap: 2px; }
#nav button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: none; background: transparent; color: var(--muted); padding: 9px 10px; font-weight: 600; border-radius: 8px; }
#nav button:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
#nav button.on { color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
#nav button.on .ic { color: var(--accent); }
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.side-tools { display: flex; gap: 6px; }
.side-tools select { flex: 1; min-width: 0; }
#cloudBadge { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font-size: 13px; }
#cloudBadge .club { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cloudBadge .state { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button .ic, .btn .ic { margin: -2px 7px -2px -2px; vertical-align: middle; }
#nav button .ic, #cloudBadge .ic { margin: 0; }
button, .btn { display: inline-flex; align-items: center; }
body[data-role="staff"] .role-edit { display: none !important; }

/* ---------- sections ---------- */
#app { min-width: 0; padding: 18px 22px 40px; }
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 40px; margin-bottom: 14px; }
.view-head h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.2px; }
.match-chip { font-size: 13px; color: var(--muted); padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; font-variant-numeric: tabular-nums; }
.match-chip.none { border-style: dashed; }
.lede { color: var(--muted); margin: -4px 0 14px; max-width: 70ch; }
.subtabs { display: flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px; }
.subtabs button { border: none; background: transparent; color: var(--muted); font-weight: 600; padding: 6px 16px; border-radius: 7px; }
.subtabs button:hover { color: var(--text); }
.subtabs button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split .video-slot { position: sticky; top: 18px; }
.split .tab { margin: 0; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel h2 { font-size: 16px; margin: 0 0 10px; }
.empty { padding: 28px 8px; text-align: center; }
.empty p { margin: 0 auto 10px; max-width: 52ch; }
/* floating notice: appearing must not move the page */
#backupBanner { position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); display: inline-flex; align-items: center; gap: 4px; background: #24210a; color: var(--us-t); border: 1px solid rgba(245, 217, 10, 0.6); border-radius: 8px; padding: 3px 4px 3px 12px; font-size: 13px; }
#backupBanner button { padding: 3px 9px; }

/* ---------- main layout ---------- */
main { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(380px, 1fr); gap: 16px; align-items: start; }
#left, #right { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
#videoBox { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
#videoBox video { width: 100%; height: 100%; }
#videoPick { position: absolute; padding: 10px 18px; font-weight: 600; border-color: var(--accent); }
#videoBox.loaded #videoPick { top: 10px; right: 10px; padding: 4px 10px; opacity: 0.65; font-size: 12px; font-weight: 400; border-color: var(--line); }
#videoBox.loaded #videoPick:hover { opacity: 1; }
#noteOverlay { position: absolute; left: 14px; right: 14px; bottom: 58px; background: rgba(9, 16, 11, 0.88); color: var(--text); border-radius: 8px; padding: 10px 14px; font-size: 16px; pointer-events: none; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); }
#clockLine { display: flex; gap: 14px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
#clock { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; }
#partBar { margin: 10px 0 0; }
#videoName { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#squadList table { max-width: 680px; }
#squadList td.num:first-child, #squadList th.num:first-child { width: 56px; }

/* ---------- right panel ---------- */
#statusRow { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
/* fixed height: a longer message must never push the pitch down while clicking */
#status { flex: 1; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; height: 66px; overflow-y: auto; font-size: 13px; line-height: 1.4; }
#status.wait { border-color: rgba(245, 217, 10, 0.6); background: rgba(245, 217, 10, 0.06); }
#teamBar { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
#teamBar input { width: 118px; }
.team { min-width: 92px; }
.team.on#teamUs { background: var(--us); border-color: var(--us); color: #1b1b1b; font-weight: 700; }
.team.on#teamThem { background: var(--them); border-color: var(--them); color: #1b1b1b; font-weight: 700; }
#chainBtn { margin-left: auto; }
#chainBtn.on { background: var(--us); border-color: var(--us); color: #1b1b1b; }
.tag { background: rgba(245, 217, 10, 0.12); color: var(--us-t); border: 1px solid var(--us); border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
#pitchWrap { border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 16px rgba(0, 0, 0, 0.35); }
#pitch { width: 100%; background: var(--pitch); cursor: crosshair; display: block; }
#pitch circle[data-id] { cursor: pointer; }
#dirLine { margin: 8px 0 10px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); margin: 10px 0 6px; }
#typeButtons { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
#restartButtons { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
#typeButtons button, #restartButtons button { font-size: 12.5px; padding: 6px 8px; text-align: left; }
#right.editing .label, #right.editing #typeButtons, #right.editing #restartButtons { display: none; }
#editPanel { background: var(--raised); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; }
#editPanel .row { margin-bottom: 8px; }
#editPanel label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; }
#editPanel input { width: 70px; }
.nudge { display: inline-grid; grid-template-columns: repeat(3, 30px); gap: 3px; }
.nudge button { padding: 2px 0; }

/* ---------- tabs and tab content ---------- */
.tab { margin: 0 0 16px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
label.radio { display: inline-flex; gap: 6px; align-items: center; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line-soft); padding: 6px 8px; text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) td, table tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--raised-2); }
td button { padding: 3px 9px; font-size: 12px; }
.dot-us { color: var(--us-t); }
.dot-them { color: var(--them-t); }
.maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.maps figure { margin: 0; background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.maps figcaption { font-weight: 700; margin-bottom: 8px; }
.maps svg { width: 100%; background: var(--pitch); border-radius: 6px; display: block; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.grid2 section { background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
.grid2 h3 { margin: 0 0 6px; font-size: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.card { background: var(--raised); border-radius: var(--radius); padding: 12px 14px; }
.card b { display: block; font-size: 20px; }

/* ---------- dialogs ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; min-width: 460px; max-width: 620px; padding: 20px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
dialog::backdrop { background: rgba(5, 9, 6, 0.7); backdrop-filter: blur(2px); }
dialog h2 { font-size: 20px; margin: 0 0 12px; }
dialog label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
dialog label input, dialog label select { display: block; width: 100%; margin-top: 4px; color: var(--text); font-size: 14px; }
dialog label.radio { display: flex; gap: 8px; align-items: baseline; margin: 8px 0; color: var(--text); font-size: 14px; }
dialog label.radio input { display: inline; width: auto; margin: 0; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
dialog menu button[value="ok"], dialog menu button#exportGo { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; }
legend { color: var(--muted); padding: 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
#helpBody td:first-child { white-space: nowrap; }

/* ---------- report: on screen a page over the app; printed alone ---------- */
#reportView { background: #d9ddd2; border-radius: var(--radius); padding: 20px; }
#reportView .empty { color: #13241a; }
#reportView .empty .muted { color: #4f5f52; }
#repClose { display: none; }
#reportView .page { background: white; color: #13241a; max-width: 900px; margin: 0 auto; padding: 32px 38px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
#reportView .bar { max-width: 900px; margin: 0 auto 12px; display: flex; gap: 8px; align-items: center; }
#reportView .bar .muted { color: #4f5f52; }
#reportView h1 { font-size: 26px; margin: 0; color: #1d4a2f; }
#reportView h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.7px; color: #1d4a2f; border-bottom: 2px solid #dfe3d8; padding-bottom: 4px; margin: 20px 0 8px; }
#reportView .sub { color: #56665a; font-size: 13px; margin-bottom: 6px; }
#reportView .score { display: inline-block; font-size: 30px; font-weight: 800; margin: 8px 0 10px; padding: 2px 16px; background: #1d4a2f; color: white; border-radius: 8px; font-variant-numeric: tabular-nums; }
#reportView table { font-size: 12.5px; }
#reportView th, #reportView td { border-bottom: 1px solid #dfe3d8; color: #13241a; background: none !important; }
#reportView th { color: #56665a; }
#reportView .maps { grid-template-columns: repeat(2, 1fr); }
#reportView .maps figure { background: #f3f4ee; border-color: #dfe3d8; }
#reportView .maps .muted { color: #56665a; }
#reportView .twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
#reportView .edit { min-height: 76px; border: 1px dashed #b7c0b2; border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; font-size: 13.5px; background: #fafbf7; }
#reportView .edit:focus { outline: 2px solid var(--accent); border-style: solid; }
#reportView .edit:empty::before { content: attr(data-placeholder); color: #8d998b; }
@media print {
  body.printing { display: block; }
  body.printing #sidebar, body.printing .view-head, body.printing #backupBanner, body.printing .view:not(#view-report) { display: none !important; }
  body.printing #app { padding: 0; }
  body.printing { background: white; }
  #reportView { padding: 0; background: white; }
  #reportView .bar { display: none; }
  #reportView .page { box-shadow: none; padding: 0; max-width: none; border-top: none; }
  #reportView .edit { border: none; padding: 0; background: none; }
  #reportView .edit:empty { display: none; }
  #reportView h2, #reportView figure { break-inside: avoid; }
}

@media screen and (max-width: 1180px) {
  main, .split { grid-template-columns: 1fr; }
  .split .video-slot { position: static; }
}

/* phone: the menu becomes a bar on top, sections scroll under it */
@media screen and (max-width: 820px) {
  body { display: block; }
  #sidebar { position: sticky; top: 0; z-index: 40; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 0; border-right: none; border-bottom: 1px solid var(--line-soft); overflow: visible; }
  .brand { font-size: 15px; padding: 0; }
  .matchbox { display: none; }
  .side-foot { margin: 0 0 0 auto; display: flex; gap: 6px; }
  #cloudBadge { width: auto; max-width: 150px; padding: 5px 9px; }
  #cloudBadge .state, #helpBtn { display: none; }
  .side-tools select { padding: 5px 6px; }
  #nav { order: 3; width: calc(100% + 24px); margin: 0 -12px; display: flex; gap: 0; padding: 0 4px; }
  #nav button { flex: 1 1 0; min-width: 0; width: auto; flex-direction: column; justify-content: flex-start; gap: 3px; padding: 7px 2px 8px; font-size: 10.5px; line-height: 1.15; text-align: center; white-space: normal; border-radius: 0; border-bottom: 2px solid transparent; }
  #nav button.on { background: transparent; border-bottom-color: var(--accent); }
  #app { padding: 14px 12px 32px; }
  .view-head h1 { font-size: 19px; }
  .tab { padding: 10px; overflow-x: auto; }
  dialog { min-width: 0; width: calc(100vw - 24px); }
  #reportView { padding: 8px; }
  #reportView .page { padding: 20px 16px; }
  #reportView .twocol, #reportView .maps { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- account and cloud ---------- */
#cloudBadge.cloud { border-color: var(--line); color: var(--muted); font-size: 13px; }
#cloudBadge.cloud.ok { color: var(--good-t); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
#cloudBadge.cloud.saving { color: var(--accent); }
#cloudBadge.cloud.pending, #cloudBadge.cloud.error { color: var(--us-t); border-color: rgba(245, 217, 10, 0.6); }
#accountDialog { min-width: 520px; }
#accountDialog h3 { font-size: 15px; margin: 18px 0 6px; }
#accountDialog .row label { margin: 0; display: flex; align-items: center; gap: 6px; }
#accountDialog .row label select, #accountDialog .row input { margin: 0; width: auto; }
#accountDialog .row input[type=email], #accountDialog .row input[name=name] { flex: 1; min-width: 200px; }
.stack .row { margin-top: 12px; }
table.members { width: 100%; border-collapse: collapse; font-size: 13px; }
table.members td { padding: 5px 4px; border-bottom: 1px solid var(--line-soft); }
table.members select { padding: 3px 6px; }
.bad { color: var(--bad-t); font-size: 13px; }

/* ---------- match window: kinds of session ---------- */
dialog.wide { max-width: 760px; width: min(760px, calc(100vw - 24px)); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
.kind-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.kind-pick label.radio { margin: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.kind-pick label.radio:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
#matchForm:not([data-kind="training"]) .k-training, #matchForm:not([data-kind="match"]) .k-match, #matchForm:not([data-split="1"]) .k-split { display: none; }
h3.sec { font-size: 16px; margin: 22px 0 4px; }
@media screen and (max-width: 820px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- YouTube player and live tagging ---------- */
#ytWrap { position: absolute; inset: 0; display: none; background: #000; }
#ytWrap iframe, #ytFrame { width: 100%; height: 100%; border: 0; }
#videoBox.yt #ytWrap { display: block; }
#videoBox.yt #videoPick { display: none; }
body.live #videoBox, body.live #partBar { display: none; }
#livePanel { background: var(--raised); border: 1px solid rgba(245, 217, 10, 0.5); border-radius: 8px; padding: 18px; }
.live-clock { font-size: 56px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 14px; color: var(--us-t); }
#liveBtn.on { background: var(--us); border-color: var(--us); color: #1b1b1b; font-weight: 700; }

/* ---------- video meeting ---------- */
.meeting { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.pl-list { display: grid; gap: 4px; }
.pl-list button { display: flex; justify-content: space-between; gap: 8px; text-align: left; background: transparent; border-color: transparent; }
.pl-list button.on { background: var(--panel); border-color: var(--line); color: var(--text); font-weight: 600; }
.pl-list .pl-new { border-style: dashed; border-color: var(--line); color: var(--muted); justify-content: center; }
.pl-title { font-size: 18px; font-weight: 700; flex: 1; min-width: 200px; background: transparent; border-color: transparent; padding-left: 4px; }
.pl-title:hover, .pl-title:focus { border-color: var(--line); }
.pl-table td { vertical-align: middle; }
.pl-note { width: 100%; min-width: 180px; }
.pl-actions { white-space: nowrap; }
.pl-actions button { padding: 3px 8px; margin-left: 2px; }
.pl-bar { margin-bottom: 8px; }
.pl-add { padding: 1px 9px !important; font-weight: 700; }
#presenter { position: fixed; inset: 0; z-index: 100; background: #060a07; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; padding: 14px 18px; }
.pres-top { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
#presenterVideo { min-height: 0; display: flex; align-items: center; justify-content: center; }
#presenterVideo #left { background: transparent; border: none; box-shadow: none; padding: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; }
#presenterVideo #videoBox { max-height: 100%; aspect-ratio: 16 / 9; width: auto; height: 100%; max-width: 100%; margin: 0 auto; }
#presenterVideo #clockLine, #presenterVideo #partBar, #presenterVideo #clipComments, #presenterVideo #videoPick { display: none !important; }
.pres-bottom { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.pres-text { flex: 1; min-width: 260px; }
#presClip { color: var(--muted); font-size: 14px; }
#presNote { font-size: 26px; font-weight: 700; line-height: 1.25; margin-top: 4px; max-width: 60ch; }
.pres-ctrl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* comments under the video */
#clipComments { margin-top: 12px; background: var(--raised); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; }
.cm-head { margin-bottom: 6px; }
.cm { padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.cm-who { font-weight: 600; }
.cm-del { float: right; padding: 0 7px; font-size: 13px; }
.cm-form { display: flex; gap: 6px; margin-top: 8px; }
.cm-form input { flex: 1; min-width: 0; }
/* player page */
.player-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.player-head h2 { margin: 0; font-size: 20px; }
.shirt { width: 48px; height: 48px; border-radius: 10px; background: var(--us); color: #1b1b1b; display: grid; place-items: center; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.player-nums { max-width: 640px; }
/* season trends */
.trends { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.trend { margin: 0; background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px 8px; }
.trend figcaption { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.trend svg { width: 100%; display: block; overflow: visible; }
.tr-grid { stroke: var(--line); stroke-width: 1; }
.tr-axis { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.tr-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tr-dot { fill: var(--accent); stroke: var(--raised); stroke-width: 2; }
.tr-hit { fill: transparent; }
.tr-pt:hover .tr-dot { r: 5.5; }
.tr-last { fill: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tr-note { font-size: 12px; color: var(--muted); }
.copyright { font-size: 11px; color: var(--muted); margin: 0; padding: 0 4px; }
@media screen and (max-width: 820px) {
  .meeting { grid-template-columns: 1fr; }
  .copyright { display: none; }
  #presNote { font-size: 19px; }
}

/* ---------- online: nothing but the login until someone logs in ---------- */
body.gated #sidebar, body.gated #app, body.gated #backupBanner, body.gated #presenter { display: none !important; }
body.gated .login-close { display: none; }
.gate-only { display: none; }
body.gated .gate-only { display: block; margin-top: 14px; text-align: center; }
body.gated #accountDialog::backdrop { background: var(--bg); }
button.danger { color: var(--bad-t); border-color: rgba(255, 107, 61, 0.45); }
button.danger:hover { background: rgba(255, 107, 61, 0.12); border-color: var(--them); }
dialog menu #matchDelete { margin-right: auto; }

/* ---------- links between sections ---------- */
body.no-match #view-tag main, body.no-match #view-events .video-slot, body.no-match #view-tag #liveBtn, body.no-match #view-tag #editMatch, body.no-match #view-tag #alignBtn { display: none !important; }
body.no-match #view-events .split { grid-template-columns: 1fr; }
.row.center { justify-content: center; }
.need-match { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions button { padding: 3px 9px; font-size: 12px; margin-left: 4px; }
.match-chip { cursor: pointer; }
.match-chip:hover { border-color: var(--accent); color: var(--text); }
.pl-add { white-space: nowrap; }
#tab-season td:first-child { white-space: nowrap; }

/* ---------- drawing on the video ---------- */
#drawLayer { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; touch-action: none; }
#videoBox.drawing #drawLayer { display: block; pointer-events: auto; cursor: crosshair; }
#videoBox.showing-drawing #drawLayer { display: block; }
#videoBox.drawing { outline: 2px solid var(--us); outline-offset: 2px; }
#drawBar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 8px 10px; background: var(--raised); border: 1px solid rgba(245, 217, 10, 0.5); border-radius: 8px; }
.draw-tools, .draw-colors { display: flex; gap: 4px; }
.draw-tools button { padding: 5px 10px; font-size: 13px; }
.swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--sw); border: 2px solid var(--raised); box-shadow: 0 0 0 1px var(--line); }
.swatch.on { background: var(--sw); box-shadow: 0 0 0 2px var(--text); }
.tag-draw { color: var(--us-t); }
#presenterVideo #drawBar { display: none !important; }

.demo-offer { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

#tagHistory { margin-top: 16px; }
body.no-match #tagHistory { display: none; }
.history-scroll { max-height: 420px; overflow-y: auto; }
#tagHistory tr.sel td { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Registra: history under the video, the pitch and the buttons on the right for the whole height */
#view-tag main { grid-template-areas: "left right" "hist right"; grid-template-rows: auto 1fr; }
#view-tag main > #left { grid-area: left; }
#view-tag main > #right { grid-area: right; }
#view-tag main > #tagHistory { grid-area: hist; margin: 0; align-self: start; }
@media screen and (max-width: 1180px) {
  #view-tag main { grid-template-areas: "left" "right" "hist"; grid-template-rows: none; }
}

/* ---------- Bordocampo: tablet at the pitch, big targets, high contrast ---------- */
.ps-clock { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.ps-time { font-size: 44px; font-weight: 800; line-height: 1; color: var(--us-t); font-variant-numeric: tabular-nums; min-width: 3.2ch; }
.ps-clock-btns { display: flex; gap: 8px; flex-wrap: wrap; }
button.big { font-size: 17px; padding: 12px 20px; min-height: 52px; border-radius: 10px; }
#psVoice.on { background: var(--good); border-color: var(--good); color: #0b1a10; font-weight: 700; }
.ps-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.kpi-pad { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kpi-btn { position: relative; min-height: 132px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 16px 18px; border: 3px solid transparent; border-radius: 16px;
  font-size: 23px; font-weight: 800; line-height: 1.15; white-space: normal; text-align: left; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: transform 0.08s, box-shadow 0.15s; }
.kpi-btn.tone-good, .kpi-btn.tone-good:hover { background: var(--good); color: #0b1a10; }
.kpi-btn.tone-bad, .kpi-btn.tone-bad:hover { background: var(--bad); color: #1c0604; }
.kpi-btn.tone-none, .kpi-btn.tone-none:hover { background: var(--accent); color: var(--accent-ink); }
.kpi-btn:hover { border-color: #fff; }
.kpi-btn:active { transform: scale(0.97); }
.kpi-btn.hit { box-shadow: 0 0 0 5px #fff; }
.kpi-n { align-self: flex-end; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; opacity: 0.85; }
.ps-side { display: grid; gap: 10px; min-width: 0; }
.ps-pitch-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.ps-ask { font-size: 16px; color: var(--us-t); }
.ps-pitch { width: 100%; display: block; background: var(--pitch); border-radius: 8px; cursor: crosshair; touch-action: manipulation; }
.ps-pitch.asking { outline: 3px solid var(--us); outline-offset: 2px; }
.ps-dir { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ps-recent { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; }
.ps-recent-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.ps-recent table { width: 100%; }
.ps-recent .row-actions button { padding: 4px 10px; font-size: 13px; }
.ps-voice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.ps-voice.on { border-color: var(--good); }
.vdot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.ps-voice.on .vdot { background: var(--good); animation: vpulse 1.2s infinite; }
@keyframes vpulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .ps-voice.on .vdot { animation: none; } }
.vheard { color: var(--text); font-style: italic; }
.vmsg { color: var(--us-t); }
#psToast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 120; background: var(--us); color: #1b1b1b; font-weight: 700; font-size: 16px; padding: 12px 20px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
#psToast.show { opacity: 1; transform: translate(-50%, 0); }
/* set pieces */
.ps-set-left { display: grid; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: fit-content; }
.seg button { border: none; border-radius: 0; padding: 10px 18px; font-size: 15px; min-height: 46px; }
.seg button + button { border-left: 1px solid var(--line); }
.ps-step { font-size: 17px; color: var(--us-t); display: flex; align-items: center; gap: 10px; min-height: 40px; }
.ps-pitch.half { max-height: 62vh; width: auto; max-width: 100%; aspect-ratio: 66 / 86; }
.ps-contact { display: grid; gap: 8px; }
.ps-contact.dim { opacity: 0.45; }
.ps-contact input { font-size: 16px; padding: 10px 12px; max-width: 280px; }
.contact-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.contact-btns button { justify-content: center; white-space: normal; min-height: 64px; font-weight: 700; }
.contact-btns .c-them { border: 2px solid var(--them); }
.contact-btns .c-us { border: 2px solid var(--us); }
.ps-pattern { display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.ps-spmap { width: 100%; display: block; border-radius: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; margin-top: 6px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #13241a; margin-right: 5px; vertical-align: -1px; }
.zbars { display: grid; gap: 6px; margin-bottom: 10px; }
.zbar { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr 2ch; gap: 8px; align-items: center; font-size: 13px; }
.zt { height: 10px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.zf { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.zn { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
table.mini td { padding: 3px 6px; font-size: 13px; }
.ps-tip { margin: 10px 0 0; padding: 10px 12px; background: rgba(245, 217, 10, 0.08); border-radius: 4px; font-size: 14.5px; }
/* KPI dialog */
.kpi-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.kpi-row label.radio { margin: 0; font-size: 13px; white-space: nowrap; }
.kpi-row .kpi-words { grid-column: 1 / -1; font-size: 13px; }
.kpi-colors { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kpi-colors .sw { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; position: relative; }
.kpi-colors .sw.on { outline: 3px solid var(--text); outline-offset: 2px; }
.kpi-colors .sw-auto { width: auto; border-radius: 15px; padding: 0 10px; font-size: 12px; }
.kpi-colors .sw-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
#actRows .kpi-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; }
.kpi-sec { margin: 18px 0 4px; font-size: 15px; }
dialog.wide { max-width: 760px; }
/* half-time sheet: light, for the dressing room and for printing */
.ht-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 960px; margin: 0 auto 12px; }
.ht-page { background: white; color: #13241a; max-width: 960px; margin: 0 auto; padding: 28px 34px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.ht-page h1 { font-size: 26px; margin: 0; color: #1d4a2f; }
.ht-page h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.7px; color: #1d4a2f; border-bottom: 2px solid #dfe3d8; padding-bottom: 4px; margin: 20px 0 10px; }
.ht-page h3 { font-size: 15px; margin: 14px 0 8px; color: #1d4a2f; }
.ht-page .sub { color: #56665a; font-size: 13px; }
.ht-page .empty p { color: #13241a; }
.ht-page table td, .ht-page table th { color: #13241a; border-bottom: 1px solid #dfe3d8; background: none !important; }
.ht-points { margin: 0; padding-left: 20px; font-size: 17px; line-height: 1.5; }
.ht-points .n, .ps-tip .n { color: #56665a; font-variant-numeric: tabular-nums; }
.ht-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ht-tile { border: 1px solid #dfe3d8; border-radius: 10px; padding: 12px 14px 6px; background: #f7f8f3; }
.ht-label { font-size: 13px; font-weight: 600; color: #56665a; min-height: 2.4em; }
.ht-n { font-size: 38px; font-weight: 800; color: #13241a; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ht-bars { width: 100%; display: block; margin-top: 4px; }
.ht-balance { display: flex; align-items: center; gap: 12px; max-width: 560px; }
.hb-n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.hb-bar { flex: 1; display: flex; gap: 2px; height: 18px; }
.hb-won { background: #1d4a2f; border-radius: 4px 0 0 4px; }
.hb-lost { background: #c9d0c2; border-radius: 0 4px 4px 0; }
.ht-balance-l { display: flex; justify-content: space-between; max-width: 560px; font-size: 12.5px; color: #56665a; padding: 2px 6px 0; }
.ht-maps { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; align-items: start; }
.ht-maps figure { margin: 0; }
.ht-maps figure.lead { grid-row: span 2; }
.ht-maps figcaption { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.ps-heat { width: 100%; display: block; background: #f3f4ee; border-radius: 6px; }
.ht-page .ps-pattern { grid-template-columns: minmax(160px, 0.7fr) minmax(0, 1fr); }
.ht-page .zt { background: #dfe3d8; }
.ht-page .zf { background: #1d4a2f; }
.ht-page .legend { color: #56665a; }
.ht-page .ps-tip { background: #fff7d6; }
.ht-sp { break-inside: avoid; }
@media screen and (max-width: 1100px) {
  .ps-grid { grid-template-columns: 1fr; }
  .ht-maps { grid-template-columns: 1fr 1fr; }
}
@media screen and (max-width: 820px) {
  .kpi-pad { grid-template-columns: 1fr 1fr; }
  .kpi-btn { min-height: 110px; font-size: 19px; }
  .ps-time { font-size: 34px; }
  .ps-pattern, .ht-page .ps-pattern, .ht-maps { grid-template-columns: 1fr; }
  .ht-page { padding: 18px 14px; }
  .kpi-row { grid-template-columns: 1fr auto; }
}
@media print {
  body.printing-ht { display: block; background: white; }
  body.printing-ht #sidebar, body.printing-ht .view-head, body.printing-ht #backupBanner, body.printing-ht .view:not(#view-pitchside), body.printing-ht .ht-bar, body.printing-ht #psToast { display: none !important; }
  body.printing-ht #app { padding: 0; }
  body.printing-ht .ht-page { box-shadow: none; padding: 0; max-width: none; }
  body.printing-ht .ht-page h2, body.printing-ht .ht-tile, body.printing-ht figure { break-inside: avoid; }
}

/* ---------- Formazione: lineup built together, real time ---------- */
.lu-live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lu-live b { color: var(--text); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.lu-msg { color: var(--bad-t); margin: -6px 0 10px; }
.lu-msg:empty { display: none; }
.lu-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.lu-top #luPick { min-width: 0; max-width: 340px; }
.lu-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.lu-board-wrap { display: grid; gap: 12px; }
.lu-head-print { display: none; }
.lu-pitch { position: relative; width: min(100%, 560px, calc(80vh * 68 / 105)); margin: 0 auto; aspect-ratio: 68 / 105; border-radius: 10px; border: 3px solid transparent; transition: border-color 0.2s, box-shadow 0.2s;
  background: repeating-linear-gradient(to bottom, var(--pitch) 0 10%, var(--pitch-band) 10% 20%); user-select: none; -webkit-user-select: none; }
.lu-pitch.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 25%, transparent), inset 0 0 0 999px color-mix(in srgb, var(--bad) 18%, transparent); }
.lu-lines { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: rgba(255, 255, 255, 0.7); stroke-width: 0.35; vector-effect: non-scaling-stroke; pointer-events: none; }
.lu-lines * { vector-effect: non-scaling-stroke; stroke-width: 1.5px; }
.lu-slot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; width: 84px; cursor: grab; touch-action: none; border-radius: 10px; padding: 2px; }
.lu-slot.over, .lu-chip.over, .lu-bench.over, .lu-pool.over { outline: 3px dashed var(--us); outline-offset: 2px; }
.lu-shirt { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--us); color: #1b1b1b; font-weight: 800; font-size: 18px; border: 3px solid var(--bg); font-variant-numeric: tabular-nums; position: relative; }
.lu-shirt.st-doubt { background: var(--warn); }
.lu-shirt.st-injured, .lu-shirt.st-work, .lu-shirt.st-suspended, .lu-shirt.st-away { background: var(--bad); color: #fff; }
.lu-name { font-size: 12.5px; font-weight: 700; color: #fff; background: rgba(9, 16, 11, 0.82); padding: 1px 7px; border-radius: 5px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-empty { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed rgba(255, 255, 255, 0.7); color: #fff; font-size: 11.5px; font-weight: 700; background: rgba(0, 0, 0, 0.15); }
.lu-role { font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.8); letter-spacing: 0.4px; }
.lu-slot:not(.full) .lu-role { display: none; }
.fit { position: absolute; margin: -6px 0 0 30px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 900; border: 2px solid var(--bg); }
.fit.near { background: #cfd8cb; color: #0d1410; }
.fit.out { background: var(--warn); color: #1b0b00; }
.lu-slot.off-role .lu-name { box-shadow: 0 0 0 2px var(--warn); }
.lu-slot.picked .lu-shirt, .lu-chip.picked { box-shadow: 0 0 0 4px var(--accent); }
.lu-slot.dragging, .lu-chip.dragging { opacity: 0.35; }
.lu-ghost { position: fixed; z-index: 200; pointer-events: none; transform: translate(-50%, -50%) scale(1.08); display: flex; flex-direction: column; align-items: center; gap: 2px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5)); }
.lu-bench, .lu-pool { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; }
.lu-bench-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.lu-bench-row, .lu-pool-list { display: flex; flex-wrap: wrap; gap: 8px; }
.lu-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; background: var(--raised); border: 1px solid var(--line); border-radius: 999px; cursor: grab; touch-action: none; min-height: 44px; }
.lu-chip .lu-shirt { width: 34px; height: 34px; font-size: 14px; border-width: 2px; }
.lu-chip .lu-name { background: none; color: var(--text); padding: 0; max-width: 140px; font-size: 13.5px; }
.lu-chip.add { justify-content: center; width: 44px; padding: 0; font-size: 20px; color: var(--muted); border-style: dashed; cursor: pointer; }
.lu-chip.blocked { opacity: 0.6; }
.lu-st { font-size: 11px; color: var(--bad-t); font-weight: 600; }
.lu-ghost.lu-chip, .lu-ghost .lu-name { background: var(--raised); }
.lu-checks { border-radius: var(--radius); padding: 12px 14px; border: 1px solid; margin-bottom: 12px; }
.lu-checks.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.lu-checks.good { border-color: color-mix(in srgb, var(--good) 60%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.lu-state { font-size: 15px; }
.lu-checks.bad .lu-state { color: var(--bad-t); }
.lu-checks.good .lu-state { color: var(--good-t); }
.lu-checks ul { margin: 6px 0 0; padding-left: 18px; }
.lu-checks ul.warn { color: var(--muted); }
.lu-checks ul.warn b { color: var(--text); }
.lu-side { min-width: 0; }
.lu-by { margin-top: 8px; }
.lu-note { margin: 0; color: var(--us-t); font-weight: 600; text-align: center; }
.lu-table-wrap { overflow-x: auto; }
.lu-table td { vertical-align: middle; }
.lu-table input { width: 100%; min-width: 90px; }
.lu-table .lu-year { width: 72px; min-width: 0; }
.lu-status.st-injured, .lu-status.st-work, .lu-status.st-suspended, .lu-status.st-away { border-color: var(--bad); color: var(--bad-t); }
.lu-status.st-doubt { border-color: var(--warn); color: var(--warn-t); }
.lu-roles { display: flex; flex-wrap: wrap; gap: 3px; min-width: 300px; }
.role-chip { padding: 2px 6px; font-size: 11px; font-weight: 700; border-radius: 5px; }
.lu-rule { gap: 8px; align-items: center; margin: 6px 0; }
.lu-rule input { width: 70px; }
.lu-benchmax { display: flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--muted); }
.lu-benchmax input { width: 70px; }
.lu-players.panels { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
#lineupDialog menu { align-items: center; }
/* projected in the dressing room: the pitch fills the screen */
.lu-close { display: none; }
.lu-board-wrap.projecting { position: fixed; inset: 0; z-index: 150; background: var(--bg); padding: 16px 20px; align-content: start; justify-items: center; overflow: auto; }
.lu-board-wrap.projecting .lu-close { display: inline-flex; position: fixed; top: 12px; right: 12px; z-index: 151; font-size: 18px; padding: 12px 18px; background: var(--raised); border: 2px solid var(--text); }
.lu-board-wrap.projecting .lu-head-print { display: block; text-align: center; font-size: 28px; }
.lu-board-wrap.projecting .lu-head-print span { color: var(--muted); font-size: 20px; margin-left: 10px; }
.lu-board-wrap.projecting .lu-pitch { width: min(100%, calc(78vh * 68 / 105)); }
.lu-board-wrap.projecting .lu-pitch.invalid { border-color: transparent; box-shadow: none; }
.lu-board-wrap.projecting .lu-bench { width: min(100%, 900px); }
.lu-board-wrap.projecting .lu-bench .lu-chip.add { display: none; }
body.lu-projecting { overflow: hidden; }
@media screen and (max-width: 1000px) {
  .lu-grid, .lu-players.panels { grid-template-columns: 1fr; }
}
@media screen and (max-width: 520px) {
  .lu-slot { width: 64px; }
  .lu-shirt, .lu-empty { width: 36px; height: 36px; font-size: 15px; }
  .lu-name { font-size: 11px; max-width: 66px; padding: 1px 4px; }
}

/* the remembered video: one click to open it again */
#videoReopen { position: absolute; z-index: 4; padding: 12px 20px; font-size: 15px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
#videoBox.loaded #videoReopen { display: none; }
#videoBox:has(#videoReopen:not(.hidden)) #videoPick { top: 10px; right: 10px; padding: 4px 10px; font-size: 12px; font-weight: 400; border-color: var(--line); }

/* ---------- Bordocampo, simple version ---------- */
.ps-extra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ps-extra button { min-height: 44px; }
button.small { font-size: 13px; padding: 6px 10px; }
.ps-hint { font-size: 17px; margin: 0 0 12px; padding: 12px 16px; border-radius: var(--radius); background: rgba(245, 217, 10, 0.1); }
#view-pitchside .kpi-pad { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
#view-pitchside .kpi-btn { min-height: 150px; font-size: 26px; }
#view-pitchside .kpi-n { font-size: 46px; }
.ps-last { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 16px; min-height: 68px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 18px; }
.ps-ok { width: 34px; height: 34px; border-radius: 50%; background: var(--good); color: #0b1a10; display: grid; place-items: center; font-weight: 900; flex: none; }
.ps-last button { min-height: 48px; }
.zone-sheet { background: var(--panel); border: 3px solid var(--us); border-radius: 16px; padding: 14px; }
.zs-head { display: flex; align-items: center; gap: 10px; font-size: 22px; margin-bottom: 6px; }
.zs-dir { color: var(--muted); font-size: 15px; margin-bottom: 10px; }
.zs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; border-radius: 12px; background: repeating-linear-gradient(to right, var(--pitch) 0 16.66%, var(--pitch-band) 16.66% 33.33%); }
.zs-cell { min-height: 110px; flex-direction: column; justify-content: center; gap: 4px; font-size: 20px; background: rgba(9, 16, 11, 0.55); border: 2px solid rgba(255, 255, 255, 0.55); color: #fff; border-radius: 12px; touch-action: manipulation; }
.zs-cell span { font-size: 15px; opacity: 0.85; }
.zs-cell:hover, .zs-cell:active { background: var(--us); color: #1b1b1b; border-color: var(--us); }
.sp-wizard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.sp-crumbs { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--muted); font-size: 15px; }
.sp-crumbs button { min-height: 44px; }
.sp-q { font-size: 24px; margin: 6px 0 12px; }
.sp-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.sp-btns.four { grid-template-columns: repeat(2, 1fr); }
.sp-big { min-height: 110px; justify-content: center; font-size: 22px; font-weight: 800; border-radius: 14px; white-space: normal; text-align: center; touch-action: manipulation; border-width: 3px; }
.sp-big.c-them { border-color: var(--them); }
.sp-big.c-us { border-color: var(--us); }
.sp-goal { width: 30%; margin: 0 auto; text-align: center; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border: 2px solid rgba(255, 255, 255, 0.6); border-bottom: none; border-radius: 6px 6px 0 0; padding: 2px; }
.sp-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px; margin-bottom: 12px; border: 2px solid rgba(255, 255, 255, 0.6); border-radius: 0 0 12px 12px; background: var(--pitch); }
.sp-big.zone { background: rgba(9, 16, 11, 0.5); color: #fff; }
.sp-big.zone.out { background: var(--raised); }
.sp-num { font-size: 18px; padding: 12px; max-width: 320px; }
.sp-sum-h { margin: 18px 0 8px; }
.sp-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.sp-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 14px; }
.sp-card > b { font-size: 16px; }
.ps-last #spShot, .ps-last #spGoal { min-height: 48px; }
.ht-more { margin-top: 10px; }
.ht-more summary { cursor: pointer; color: #1d4a2f; font-weight: 600; }
.ht-maps.small { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 10px; }
.ht-foot { max-width: 960px; margin: 12px auto 0; }
/* sun: high contrast for direct sunlight at the pitch (Bordocampo only) */
body.sun #view-pitchside { --panel: #ffffff; --raised: #eef0ea; --line: #13241a; --line-soft: #97a394; --text: #000; --muted: #26332a; --us: #b98a00; }
body.sun #view-pitchside { background: #fff; color: #000; margin: -18px -22px; padding: 18px 22px; min-height: 100vh; }
body.sun #view-pitchside button:not(.kpi-btn):not(.primary):not(.on) { background: #fff; color: #000; border: 2px solid #000; }
body.sun #view-pitchside .ps-time { color: #000; }
body.sun #view-pitchside .kpi-btn { border: 4px solid #000; }
body.sun #view-pitchside .kpi-btn.tone-good { background: #00a35c; color: #fff; }
body.sun #view-pitchside .kpi-btn.tone-bad { background: #d40000; color: #fff; }
body.sun #view-pitchside .kpi-btn.tone-none { background: #0047b3; color: #fff; }
body.sun #view-pitchside .zs-cell { background: #fff; color: #000; border: 3px solid #000; }
body.sun #view-pitchside .sp-big.zone { background: #fff; color: #000; }
body.sun #view-pitchside .sp-box { background: #e6efe2; border-color: #000; }
body.sun #view-pitchside .sp-goal { border-color: #000; color: #000; }
body.sun #view-pitchside .ps-hint { background: #fff3c4; border-color: #000; }
#psSun.on { background: var(--us); color: #1b1b1b; border-color: var(--us); font-weight: 700; }
/* ---------- Schemi (set-piece playbook) ---------- */
.pb-kinds { margin-bottom: 12px; flex-wrap: wrap; }
.pb-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.pb-list { display: grid; gap: 4px; }
.pb-list button { justify-content: space-between; text-align: left; white-space: normal; background: transparent; border-color: transparent; }
.pb-list button.on { background: var(--panel); border-color: var(--line); font-weight: 600; }
.pb-main { display: grid; gap: 10px; min-width: 0; }
.pb-head { align-items: center; }
.pb-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.pb-tools button { min-height: 42px; }
.pb-board { max-width: 640px; }
.pb-svg { width: 100%; display: block; border-radius: 8px; touch-action: none; user-select: none; }
.pb-svg.tool-move .pb-tok { cursor: grab; }
.pb-svg.tool-us, .pb-svg.tool-them, .pb-svg.tool-run, .pb-svg.tool-ball { cursor: crosshair; }
.pb-svg.tool-erase .pb-tok, .pb-svg.tool-erase .pb-arrow { cursor: not-allowed; }
.pb-arrow { stroke-linecap: round; }
.pb-arrow.sel, .pb-tok.sel circle { stroke: var(--accent); }
.pb-tok.sel circle { stroke-width: 0.7; }
.pb-selrow input { width: 70px; }
.pb-note { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.pb-clips summary { cursor: pointer; padding: 6px 0; }
.pb-cliptable td { vertical-align: middle; }
/* ---------- Presenze ---------- */
.at-bar { align-items: center; margin-bottom: 10px; }
.at-wrap { overflow-x: auto; }
.at-table th.at-d { text-align: center; font-size: 12px; white-space: nowrap; }
.at-table th.at-d button { display: block; margin: 3px auto 0; padding: 1px 6px; font-size: 11px; }
.at-c { text-align: center; padding: 2px; }
.mark { width: 40px; height: 40px; justify-content: center; padding: 0; font-weight: 800; font-size: 16px; border-radius: 8px; }
.mark.m-p { background: var(--good); color: #0b1a10; border-color: var(--good); }
.mark.m-a { background: var(--bad); color: #1c0604; border-color: var(--bad); }
.mark.m-g { background: var(--warn); color: #1b1000; border-color: var(--warn); }
.rel { display: inline-flex; gap: 6px; align-items: baseline; padding: 2px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.rel b { font-size: 15px; font-variant-numeric: tabular-nums; }
.rel-good { border-color: var(--good); color: var(--good-t); }
.rel-mid { border-color: var(--warn); color: var(--warn-t); }
.rel-low { border-color: var(--bad); color: var(--bad-t); }
/* ---------- Trend ---------- */
.tr-find { margin-bottom: 14px; }
.tr-find ul { margin: 0 0 8px; padding-left: 20px; font-size: 15px; line-height: 1.55; }
.tr-bar { align-items: baseline; margin: 6px 0; }
.tr-defs { margin-bottom: 12px; display: grid; gap: 6px; }
.tr-defs .row input { flex: 1; min-width: 200px; }
.tr-table th { font-size: 12px; max-width: 120px; white-space: normal; vertical-align: bottom; }
.tr-pair { white-space: nowrap; }
.tr-in { width: 46px; padding: 4px 6px; text-align: center; margin: 0 1px; }
.tr-res input { width: 38px; padding: 4px; text-align: center; }
.res { display: inline-block; width: 22px; text-align: center; border-radius: 4px; font-weight: 800; font-size: 12px; margin-left: 4px; }
.res-w { background: var(--good); color: #0b1a10; } .res-d { background: #cfd8cb; color: #0d1410; } .res-l { background: var(--bad); color: #1c0604; }
@media screen and (max-width: 820px) {
  .pb-grid { grid-template-columns: 1fr; }
  .pb-list { display: flex; flex-wrap: wrap; }
  .sp-big { min-height: 90px; font-size: 19px; }
  #view-pitchside .kpi-btn { min-height: 120px; font-size: 21px; }
  .zs-cell { min-height: 84px; font-size: 16px; }
}
/* editing what was entered at the pitch */
.ps-edit { margin-top: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 8px 12px; }
.ps-edit summary { cursor: pointer; font-weight: 700; min-height: 40px; display: flex; align-items: center; font-size: 15px; }
.ps-edit-t td { vertical-align: middle; padding: 4px; }
.ps-edit-t input.e-min { width: 56px; text-align: center; }
.ps-edit-t input.e-player { width: 52px; text-align: center; }
.ps-edit-t select { max-width: 220px; min-height: 38px; }
.ps-edit-t .row-actions button { min-height: 38px; }
body.sun #view-pitchside .ps-edit select, body.sun #view-pitchside .ps-edit input { background: #fff; color: #000; border: 2px solid #000; }
/* menu grouped by the moment of the match */
.nav-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--faint); padding: 12px 10px 3px; }
@media screen and (max-width: 820px) {
  .nav-h { display: none; }
  #nav { overflow-x: auto; scrollbar-width: none; }
  #nav button { flex: 0 0 68px; }
}
/* Bordocampo: other actions and "who?" */
.act-h { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-size: 16px; }
.act-pad { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
#view-pitchside .kpi-btn.act { min-height: 84px; font-size: 17px; padding: 10px 12px; border-radius: 12px; }
#view-pitchside .kpi-btn.act .kpi-n { font-size: 24px; }
.who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 14px; }
.who-l { font-weight: 800; font-size: 17px; margin-right: 4px; }
.who-n { min-width: 52px; min-height: 52px; justify-content: center; font-size: 19px; font-weight: 800; border-radius: 50%; padding: 0; }
.who-n.on { background: var(--us); color: #1b1b1b; border-color: var(--us); }
body.sun #view-pitchside .who-n.on { background: #000 !important; color: #fff !important; }
#view-pitchside .ps-last { margin-top: 0; margin-bottom: 4px; }
.ht-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ht-act { border: 1px solid #dfe3d8; background: #f7f8f3; border-radius: 8px; padding: 6px 10px; font-size: 13.5px; }
.ht-act b { font-size: 17px; margin-right: 4px; }
.ht-page .at-wrap table th { font-size: 11.5px; }
/* set pieces: the pitch drawn while tapping */
.sp-wizard { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); gap: 18px; align-items: start; }
.sp-preview { position: sticky; top: 10px; }
.sp-prev-svg { width: 100%; display: block; border-radius: 10px; }
.sp-opt.lit { fill: rgba(245, 217, 10, 0.5); stroke: var(--us); stroke-dasharray: none; }
@media screen and (max-width: 820px) { .sp-wizard { grid-template-columns: 1fr; } .sp-preview { position: static; max-width: 360px; } }
/* KPI zone: the exact point on a pitch, zones as a guide */
.zs-pitch { width: 100%; max-height: 62vh; display: block; border-radius: 12px; cursor: crosshair; touch-action: manipulation; }
.zs-line { stroke: rgba(255, 255, 255, 0.3); stroke-width: 0.35; stroke-dasharray: 1.5 1.5; }
.zs-t1 { fill: rgba(255, 255, 255, 0.55); font-size: 3.6px; font-weight: 700; pointer-events: none; }
.zs-t2 { fill: rgba(255, 255, 255, 0.45); font-size: 3px; pointer-events: none; }

/* ---------- roles: the player sees his room, the lineup, the set plays, the video meetings ---------- */
#nav button[data-view="me"] { display: none; }
body[data-role="player"] #nav button[data-view="me"] { display: flex; }
body[data-role="player"] #nav button:not([data-view="me"]):not([data-view="lineup"]):not([data-view="meeting"]):not([data-view="guide"]),
body[data-role="player"] #nav .nav-h, body[data-role="player"] .matchbox, body[data-role="player"] .coach-only,
body[data-role="player"] #luNew, body[data-role="player"] #luMore, body[data-role="player"] #luFormation,
body[data-role="player"] .pb-tools, body[data-role="player"] #pbNew, body[data-role="player"] #pbDel { display: none !important; }
body[data-role="player"] .lu-pool { display: none; }
/* ---------- Cambi (bench tablet) ---------- */
.sb-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.sb-count { display: flex; align-items: baseline; gap: 4px; }
.sb-count b { font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.sb-count span { font-size: 20px; color: var(--muted); }
.sb-count small { margin-left: 6px; color: var(--muted); }
.sb-youth { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; border: 2px solid; font-size: 15px; }
.sb-youth.ok { border-color: var(--good); color: var(--good-t); }
.sb-youth.bad { border-color: var(--bad); color: var(--bad-t); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.sb-min { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.sb-min input { width: 70px; font-size: 22px; text-align: center; padding: 6px; }
.sb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr); gap: 18px; align-items: start; }
.sb-pitch { width: min(100%, 520px, calc(74vh * 68 / 105)); }
.sb-out { cursor: pointer; }
.sb-side h3 { margin: 4px 0 8px; }
.sb-bench { display: flex; flex-wrap: wrap; gap: 10px; }
.sb-bench .lu-chip { min-height: 56px; padding-right: 14px; font-size: 15px; }
.sb-bench .lu-chip .lu-shirt { width: 44px; height: 44px; font-size: 17px; }
.sb-young { position: absolute; margin: -34px 0 0 30px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 900; border-radius: 4px; padding: 0 4px; }
.lu-chip .sb-young { position: static; margin: 0 0 0 -2px; }
.sb-done { padding-left: 20px; line-height: 1.8; }
.out { color: var(--bad-t); } .in { color: var(--good-t); }
.sb-sheet { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; padding: 20px; }
.sb-sheet.ok { background: rgba(5, 9, 6, 0.8); }
.sb-sheet.bad { background: rgba(200, 0, 0, 0.88); animation: sbflash 0.5s ease-in-out 3; }
@keyframes sbflash { 50% { background: rgba(255, 40, 40, 0.97); } }
@media (prefers-reduced-motion: reduce) { .sb-sheet.bad { animation: none; } }
.sb-sheet-box { width: min(560px, 100%); background: var(--panel); border: 3px solid var(--text); border-radius: 18px; padding: 22px; text-align: center; }
.sb-sheet.bad .sb-sheet-box { background: #1c0604; border-color: #fff; }
.sb-sheet-box h2 { font-size: 28px; margin: 0 0 10px; }
.sb-sheet-box ul { text-align: left; font-size: 17px; line-height: 1.5; }
.sb-big { font-size: 24px; font-weight: 800; line-height: 1.6; }
.sb-sheet-box .row { gap: 12px; margin-top: 12px; }
.sb-sheet-box .sb-min { justify-content: center; }
/* ---------- Moneyball ---------- */
.mb-panel { margin-bottom: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; }
.mb-panel summary { cursor: pointer; min-height: 32px; display: flex; gap: 8px; align-items: center; }
.mb-radar { width: 100%; max-width: 380px; display: block; margin: 6px auto 0; overflow: visible; }
.mb-lab { fill: var(--muted); font-size: 11.5px; }
.mb-val { fill: var(--text); font-weight: 700; }
.mb-d { font-size: 12px; font-weight: 700; margin-left: 4px; }
.mb-d.up { color: var(--good-t); } .mb-d.down { color: var(--bad-t); }
.mb-panel .legend i { border: none; }
/* ---------- meritocracy matrix ---------- */
.merit { margin: 14px 0; }
.merit-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(220px, 1fr); gap: 16px; align-items: center; }
.merit-svg { width: 100%; display: block; }
.mgrid { stroke: var(--line-soft); stroke-width: 1; }
.mavg { stroke: var(--faint); stroke-width: 1.2; stroke-dasharray: 5 4; }
.max { fill: var(--muted); font-size: 11px; }
.mq { fill: var(--muted); font-size: 10.5px; opacity: 0.8; }
.mnum { fill: #1b1b1b; font-size: 9px; font-weight: 800; pointer-events: none; }
.mdot { cursor: pointer; }
.mdot.sel circle:nth-child(3) { stroke: var(--accent); stroke-width: 3; }
.merit-say { font-size: 17px; line-height: 1.5; }
/* ---------- player room ---------- */
.me-pick h2 { margin: 0 0 4px; }
.me-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.me-grid button { justify-content: flex-start; gap: 12px; min-height: 64px; font-size: 16px; white-space: normal; text-align: left; }
.me-grid .shirt { width: 40px; height: 40px; font-size: 16px; }
.me-grid2 { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); gap: 16px; margin-bottom: 14px; }
.me-card { width: 100%; max-width: 360px; display: block; margin: 8px auto 12px; border-radius: 12px; }
.me-moments { padding-left: 22px; line-height: 1.8; font-size: 15px; }
.me-links { margin-top: 14px; }
/* ---------- set plays: timing ---------- */
.pb-board { position: relative; }
.pb-phase { position: absolute; top: 10px; left: 12px; font-size: 18px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
.pb-steps { display: grid; gap: 6px; }
.pb-steps-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pb-step { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 8px; padding: 4px 8px; font-size: 13px; }
@media screen and (max-width: 900px) {
  .sb-grid, .merit-grid, .me-grid2 { grid-template-columns: 1fr; }
}
/* ---------- injuries ---------- */
.inj-form { margin-bottom: 14px; }
.inj-form .form-grid { margin-bottom: 10px; }
.inj-list { display: grid; gap: 8px; margin-bottom: 12px; }
.inj-card { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; }
.inj-card.closed { border-left-color: var(--good); opacity: 0.85; }
.inj-main { flex: 1; min-width: 0; line-height: 1.45; }
.inj-act { display: flex; gap: 6px; flex-wrap: wrap; }
.inj-late { color: var(--warn-t); }
.inj-hist summary { cursor: pointer; font-weight: 700; margin: 8px 0; }
.inj-sheet .who { justify-content: center; }
.inj-kinds { margin: 8px auto; flex-wrap: wrap; }
.lu-slot.hurt .lu-shirt { box-shadow: 0 0 0 3px var(--bad); }
/* player photos and card styles */
.lu-photo { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; overflow: hidden; font-size: 17px; }
.lu-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-styles { margin: 0 auto 10px; display: flex; justify-content: center; width: fit-content; }
.card-styles button { padding: 6px 12px; min-height: 36px; font-size: 13px; }


/* ==========================================================================================
   Linea di gesso (2026-11): the app is marked out like a pitch. Turf owns the frame (the rail),
   chalk lines mark every boundary and every current place. Flat colour only: no gradients,
   glows or glass. DIN numerals for titles, labels and numbers; four text sizes.
   Two themes: dark (night, tagging at the laptop) and light (day, phone at the pitch).
   Team colours only in data: bib yellow = us, bib orange = them. The tagging pitch stays grass.
   ========================================================================================== */
:root {
  color-scheme: dark;
  --bg: #0d1410;
  --panel: #121b15;
  --raised: #18231c;
  --raised-2: #203028;
  --field: #0a100c;
  --line: #2d3f33;
  --line-soft: #1f2c24;
  --text: #eef1e8;
  --muted: #a5b2a4;
  --faint: #879586;
  --chalk: #eef1e8;
  --accent: #eef1e8;
  --accent-ink: #0d1410;
  --turf: #123019;
  --turf-band: #163522;
  --on-turf: #eef1e8;
  --on-turf-muted: #b4c3b1;
  --us: #f5d90a;
  --them: #ff6b3d;
  --us-t: #f5d90a;
  --them-t: #ff8a63;
  --good: #1f6b3a;
  --bad: #c42520;
  --warn: #f6c418;
  --good-t: #5ad68b;
  --bad-t: #ff8178;
  --warn-t: #f2b134;
  --pitch: #1b5a39;
  --pitch-band: #1e6240;
  --radius: 4px;
  --radius-sm: 3px;
  --shadow: none;
  --t-label: 12px;
  --t-body: 14px;
  --t-head: 18px;
  --t-title: 30px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-din: Bahnschrift, "DIN Alternate", "DIN Next", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-display: var(--font-din);
  --mark-ease: cubic-bezier(0.16, 1, 0.3, 1);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4ee;
  --panel: #ffffff;
  --raised: #eef0e8;
  --raised-2: #e3e7dc;
  --field: #ffffff;
  --line: #c3cbbc;
  --line-soft: #dde2d6;
  --text: #13241a;
  --muted: #4c5c4f;
  --faint: #5f6e62;
  --accent: #1d4a2f;
  --accent-ink: #f3f4ee;
  --us-t: #7a6000;
  --them-t: #b8400f;
  --good-t: #12733a;
  --bad-t: #b9261d;
  --warn-t: #855400;
}
html { background: var(--bg); }
body {
  font: var(--t-body)/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, .brand { font-family: var(--font-display); text-wrap: balance; letter-spacing: 0; }
h2, h3 { font-weight: 700; }
/* numbers read first: DIN, tabular */
#clock, .live-clock, .ps-time, .kpi-n, .sb-count b, .ht-n, .hb-n, .card b, .who-n, .shirt, .lu-shirt, .zn, .res,
#reportView .score, .tr-last, kbd { font-family: var(--font-din); font-variant-numeric: tabular-nums; }
/* labels: small DIN caps, rank by case and weight, not by size */
th, .label, .nav-h, legend, .matchbox label, #reportView h2, .ht-page h2 {
  font-family: var(--font-din); font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* browser surfaces in the palette */
::selection { background: color-mix(in srgb, var(--text) 24%, transparent); color: var(--text); }
input, textarea { caret-color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .btn:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
a { color: var(--text); text-decoration-color: var(--faint); text-underline-offset: 3px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- controls: square-ish, flat, one height ---------- */
button, .btn, select, input, textarea { color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); }
button, .btn { background: var(--raised); min-height: 34px; padding: 6px 13px; font-weight: 600; gap: 2px; justify-content: center; box-shadow: none;
  transition: background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out; }
button:hover, .btn:hover { background: var(--raised-2); border-color: var(--muted); }
button:active:not(:disabled) { transform: translateY(1px); }
select:hover, input:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
/* one solid chalk (dark) or turf (light) block per screen: the primary action */
button.primary, dialog menu button[value="ok"], dialog menu button#exportGo {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: none; }
button.primary:hover, dialog menu button[value="ok"]:hover, dialog menu button#exportGo:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--bg)); border-color: var(--accent); }
/* a switched-on toggle is marked, not filled: chalk border on the raised ground */
button.on, .row-actions button.on { background: var(--raised-2); border: 2px solid var(--text); color: var(--text); font-weight: 700; box-shadow: none; }
button.on:hover { background: var(--raised-2); border-color: var(--text); }
button.on kbd { color: var(--text); border-color: var(--line); }
button svg, button .ic { pointer-events: none; }
button.accent { color: var(--us-t); border-color: var(--us); background: transparent; }
button.danger { background: transparent; color: var(--bad-t); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: var(--bad); }
button:disabled { opacity: 0.38; }
button.small { min-height: 28px; padding: 3px 10px; }
kbd { background: var(--bg); border-color: var(--line); border-radius: 2px; color: var(--muted); }

/* ---------- the rail: mown turf, chalk nav ---------- */
#sidebar { background: repeating-linear-gradient(180deg, var(--turf) 0 72px, var(--turf-band) 72px 144px); color: var(--on-turf);
  border-right: none; padding: 20px 14px 14px; --text: var(--on-turf); --muted: var(--on-turf-muted); --faint: var(--on-turf-muted);
  --line: rgba(238, 241, 232, 0.3); --raised: rgba(0, 0, 0, 0.18); --raised-2: rgba(0, 0, 0, 0.3); --field: rgba(0, 0, 0, 0.22);
  --accent: #eef1e8; --accent-ink: #0d1410; color-scheme: dark; }
#sidebar option { background: #14301f; color: #eef1e8; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: 0.01em; gap: 11px; }
/* the mark: the centre circle with the halfway line, in chalk */
.logo { width: 26px; height: 26px; border-radius: 50%; background: transparent; border: 2px solid var(--chalk); overflow: visible; }
.logo::before { left: 50%; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border: none; background: var(--chalk); }
.logo::after { width: 4px; height: 4px; margin: -2px 0 0 -2px; background: var(--chalk); }
.matchbox { background: transparent; border: 1px solid rgba(238, 241, 232, 0.28); border-radius: var(--radius-sm); padding: 11px; }
.matchbox label { color: var(--on-turf-muted); }
#nav { gap: 0; }
#nav button { position: relative; padding: 6px 10px; font-size: var(--t-body); color: var(--on-turf-muted); min-height: 33px; justify-content: flex-start;
  border-radius: 0; background: transparent; box-shadow: none; border: none; }
#nav button:hover { background: rgba(0, 0, 0, 0.16); color: var(--on-turf); }
#nav button.on { color: #fff; background: transparent; box-shadow: none; }
#nav button.on .ic { color: var(--chalk); }
.nav-h { color: rgba(238, 241, 232, 0.66); padding: 11px 10px 3px; }
#sidebar { gap: 14px; }
#cloudBadge { min-height: 38px; }
#cloudBadge.cloud.ok { color: #8fe0ad; border-color: rgba(143, 224, 173, 0.5); }
.copyright { color: rgba(238, 241, 232, 0.6); }

/* the signature: a chalk line is marked in, left to right, under whatever is current */
#nav button.on::after, .subtabs button.on::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 2px; background: var(--chalk);
  transform-origin: left center; animation: chalk-mark 0.42s var(--mark-ease) both; }
@keyframes chalk-mark { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { #nav button.on::after, .subtabs button.on::after, .view-head::after { animation: none; } }

/* ---------- section heads: title in DIN on a chalk baseline ---------- */
#app { padding: 22px 30px 48px; }
.view-head { position: relative; margin-bottom: 20px; min-height: 44px; gap: 16px; padding-bottom: 10px; }
.view-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text);
  transform-origin: left center; animation: chalk-mark 0.6s var(--mark-ease) both; }
.view-head h1 { font-size: var(--t-title); font-weight: 700; line-height: 1; text-transform: uppercase; letter-spacing: 0.01em; }
.match-chip { background: transparent; border: none; border-radius: 0; padding: 4px 0; font-family: var(--font-din); font-size: var(--t-head); font-weight: 600; color: var(--text); }
.match-chip:hover { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.match-chip.none { color: var(--muted); font-size: var(--t-body); border: none; }
.lede { font-size: var(--t-body); line-height: 1.55; margin-top: -8px; color: var(--muted); }
.subtabs { padding: 0; gap: 4px; border: none; border-radius: 0; background: transparent; }
.subtabs button { position: relative; min-height: 36px; padding: 6px 12px 9px; border: none; border-radius: 0; background: transparent; color: var(--muted); }
.subtabs button:hover { color: var(--text); background: transparent; }
.subtabs button.on { background: transparent; color: var(--text); box-shadow: none; }
.subtabs button.on::after { background: var(--text); left: 12px; right: 12px; bottom: 0; }

/* ---------- surfaces: one flat level; what sits inside is separated by lines, not boxes ---------- */
.tab, .panel, #left, #right, .ps-recent, .ps-clock, .ps-voice, .ps-last, .lu-bench, .lu-pool, .sp-card, .mb-panel, .sb-top, .inj-card, .ps-edit, .sp-wizard {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: none; }
.tab { padding: 18px 20px; }
.panel { padding: 18px 20px; }
.panel h2 { font-size: var(--t-head); margin-bottom: 12px; }
.maps figure, .trend, .grid2 section, .card, .tab .maps figure, .tab .trend, .tab .grid2 section, .tab .card {
  background: transparent; border: none; border-top: 2px solid var(--line); border-radius: 0; box-shadow: none; padding: 10px 0 4px; }
.maps figcaption, .trend figcaption { font-family: var(--font-display); font-size: var(--t-body); font-weight: 600; }
.card b { font-size: 26px; line-height: 1.1; }
.maps svg { border-radius: 2px; }
#pitchWrap, .ps-pitch, .zs-pitch, .pb-svg, .sp-prev-svg, .lu-pitch, .ps-spmap { border-radius: 2px; box-shadow: none; }
#videoBox { border-radius: 2px; }
#status { background: var(--field); border-color: var(--line-soft); border-radius: var(--radius-sm); }
#clock { font-size: 40px; font-weight: 700; background: transparent; border: none; padding: 0 4px 0 0; line-height: 1; }
.need-match { background: transparent; border: 1px dashed var(--line); }
.live-clock { font-size: 64px; }
#livePanel, #editPanel, #drawBar, #clipComments { background: var(--raised); border-radius: var(--radius); }
#editPanel { border-color: var(--text); }
/* hints and notes: a chalk rule, not a team colour */
.ps-tip, .ps-hint { border: 1px solid var(--line); border-top: 2px solid var(--text); border-radius: 0; background: var(--raised); }
#noteOverlay { border: 1px solid rgba(238, 241, 232, 0.5); border-radius: var(--radius-sm); box-shadow: none; }
.ps-time, .live-clock { color: var(--text); }
/* tiles on the pitch tablet: card red and turf green, chalk lettering */
.kpi-btn.tone-good, .kpi-btn.tone-good:hover, .kpi-btn.tone-bad, .kpi-btn.tone-bad:hover,
.mark.m-p, .mark.m-a, .res-w, .res-l, .ps-ok, #psVoice.on { color: #f7f8f3; }
.mark.m-g { color: #1b1500; }
#backupBanner { border-radius: var(--radius-sm); box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.5); }
.tag { border-radius: 2px; }
.team { border-radius: var(--radius-sm); }
.kpi-btn, .sp-big, .zs-cell, .zone-sheet, .seg, .mark, button.big, .contact-btns button { border-radius: var(--radius); }
.kpi-btn.tone-none, .kpi-btn.tone-none:hover { background: var(--accent); color: var(--accent-ink); }
.kpi-btn:hover { border-color: var(--text); }
.kpi-btn.hit { box-shadow: 0 0 0 5px var(--text); }
.lu-chip, .rel { border-radius: var(--radius-sm); }
.lu-name { border-radius: 2px; }
.shirt { border-radius: var(--radius-sm); box-shadow: none; }
.sb-sheet-box { border-radius: var(--radius); }

/* ---------- tables: quiet header, numbers in columns, halves kept apart ---------- */
table { font-size: 13.5px; }
th, td { padding: 9px 10px; border-bottom-color: var(--line-soft); }
th { color: var(--faint); border-bottom: 1px solid var(--line); padding-top: 6px; }
td { font-variant-numeric: tabular-nums; }
td.num { font-family: var(--font-din); font-size: 15px; font-weight: 600; }
.chip-score { font-family: var(--font-din); font-size: var(--t-title); font-weight: 700; line-height: 1; padding: 0 6px; vertical-align: -3px; font-variant-numeric: tabular-nums; }
.tdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot-us .tdot { background: var(--us); } .dot-them .tdot { background: var(--them); }
td.dot-us, td.dot-them { white-space: nowrap; }
#tagHistory .row-actions button { padding: 3px 7px; margin-left: 0; }
#tagHistory th, #tagHistory td { padding-left: 7px; padding-right: 7px; }
td button.danger { background: transparent; border-color: transparent; color: var(--bad-t); padding: 3px 7px; }
td button .ic { margin: 0; width: 16px; height: 16px; }
tbody tr:nth-child(even) td, table tr:nth-child(even) td { background: transparent; }
tr.click:hover td { background: color-mix(in srgb, var(--text) 6%, transparent); }
#tagHistory tr.sel td { background: color-mix(in srgb, var(--us) 12%, transparent); }
td button { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
.row-actions button { background: transparent; border-color: transparent; color: var(--muted); }
.row-actions button:hover { background: var(--raised-2); border-color: var(--line); color: var(--text); }
.row-actions button.danger { color: var(--bad-t); }
tr.half-line td { font-family: var(--font-din); font-size: var(--t-label); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text); background: transparent !important; border-bottom: 2px solid var(--text); padding: 18px 10px 5px; }

/* ---------- empty states ---------- */
.empty { padding: 44px 16px; }
.empty p:first-child { font-family: var(--font-display); font-size: var(--t-head); color: var(--text); }

/* ---------- dialogs: flat sheet, chalk rule under the title ---------- */
dialog { border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--text); box-shadow: 0 18px 32px -14px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(5, 9, 6, 0.72); backdrop-filter: none; }
html[data-theme="light"] dialog::backdrop { background: rgba(19, 36, 26, 0.45); }
dialog h2 { font-size: 22px; text-transform: uppercase; padding-bottom: 8px; border-bottom: 2px solid var(--text); }
fieldset { border-radius: var(--radius-sm); }
.kind-pick label.radio { border-radius: var(--radius-sm); }
.kind-pick label.radio:has(input:checked) { border-color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }

/* ---------- charts and small marks in the world ---------- */
.tr-line { stroke: var(--text); }
.tr-dot { fill: var(--text); stroke: var(--panel); }
.zf { background: var(--text); border-radius: 0; }
.zt { border-radius: 0; }
.mavg { stroke: var(--faint); }
.legend i { border-color: var(--bg); }
.swatch { border-color: var(--raised); }
.sb-young { background: var(--text); color: var(--bg); border-radius: 2px; }
.live-dot { background: var(--good); box-shadow: none; }

/* ---------- printed sheets (report, half-time): limewash paper, turf ink, DIN ---------- */
#reportView { background: #1a241d; border-radius: var(--radius); }
html[data-theme="light"] #reportView { background: #e2e6dc; }
#reportView .page, .ht-page { background: #fbfbf7; color: #13241a; border-radius: 2px; box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.55); }
#reportView h1, .ht-page h1 { font-family: var(--font-din); font-size: 30px; text-transform: uppercase; color: #13241a; }
#reportView h2, .ht-page h2 { color: #1d4a2f; border-bottom: 2px solid #1d4a2f; }
#reportView .score { font-size: 34px; font-weight: 700; padding: 2px 14px; background: #1d4a2f; color: #fbfbf7; border-radius: 2px; }
#reportView .maps figure, .ht-tile, .ht-act { background: transparent; border: none; border-top: 2px solid #dfe3d8; border-radius: 0; }
#reportView .edit { border-radius: 2px; }
#reportView .edit:focus { outline: 2px solid #1d4a2f; }
#reportView .bar .muted, #reportView > .empty, #reportView > .empty .muted { color: var(--muted); }
#reportView .bar { flex-wrap: wrap; }
.ht-n { font-weight: 700; }
.hb-won, .hb-lost { border-radius: 0; }

/* ---------- theme switch in the rail ---------- */
#themeBtn { padding: 6px 9px; }
#sidebar { overflow-x: hidden; }
.side-tools { gap: 4px; }
.side-tools select { padding-left: 7px; padding-right: 4px; }
#helpBtn { padding: 6px 10px; }
#themeBtn .ic { margin: 0; }

@media screen and (max-width: 820px) {
  #app { padding: 14px 12px 32px; }
  .view-head h1 { font-size: 22px; }
  .match-chip { font-size: var(--t-body); }
  .chip-score { font-size: 22px; }
  #reportView .page table { display: block; overflow-x: auto; }
  #sidebar { background: var(--turf); }
  #nav button { font-size: 11px; min-height: 0; justify-content: flex-start; color: var(--on-turf-muted); border-bottom: none; }
  #nav button.on { background: transparent; box-shadow: none; color: #fff; border-bottom: none; }
  #nav button.on::after { left: 8px; right: 8px; bottom: 0; }
  .tab, .panel { padding: 14px; }
  .view-head .subtabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .view-head .subtabs button { flex: none; }
  #view-pitchside .kpi-pad { grid-template-columns: 1fr 1fr; gap: 10px; }
  #view-pitchside .kpi-btn { min-height: 112px; font-size: 18px; padding: 12px; }
  #view-pitchside .kpi-n { font-size: 34px; }
  dialog, #accountDialog { min-width: 0 !important; width: calc(100vw - 24px); max-width: calc(100vw - 24px); padding: 18px 16px; }
}
#teamBar button { min-height: 32px; }
#chainBtn { padding: 4px 10px; font-size: 12.5px; }

/* ---------- Analisi → Occasioni: xG, origin of the shots, pressing ---------- */
.ch-score { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; margin: 6px 0 18px; padding: 14px 0; border-top: 2px solid var(--text); border-bottom: 1px solid var(--line); }
.ch-score > div { display: grid; gap: 2px; min-width: 0; }
.ch-score b { font-family: var(--font-din); font-size: 48px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-team { font-family: var(--font-din); font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-h { font-family: var(--font-din); font-size: var(--t-label); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 4px; }
.ch-maps { grid-template-columns: 1fr 1fr; margin-top: 8px; }
.grid2 .ch-list { grid-column: 1 / -1; }
.ch-list .history-scroll { max-height: 460px; }
/* ---------- Rosa: season minutes ---------- */
.min-table td { vertical-align: middle; }
.min-bar { display: inline-block; width: 110px; height: 8px; background: var(--line-soft); vertical-align: middle; margin-right: 8px; }
.min-bar i { display: block; height: 100%; background: var(--text); }
.min-pct { font-family: var(--font-din); font-variant-numeric: tabular-nums; color: var(--muted); }
.min-last { white-space: nowrap; }
.min-last span { display: inline-block; min-width: 26px; margin-right: 3px; padding: 1px 3px; text-align: center; font-family: var(--font-din); font-size: var(--t-label); font-variant-numeric: tabular-nums; border: 1px solid var(--line); border-radius: 2px; }
.min-last .full { background: var(--text); color: var(--bg); border-color: var(--text); }
.min-last .zero { color: var(--faint); border-style: dashed; }
.youth { display: inline-block; margin-left: 4px; padding: 0 4px; font-family: var(--font-din); font-size: 11px; font-weight: 700; border: 1px solid var(--text); border-radius: 2px; vertical-align: 1px; }
@media screen and (max-width: 820px) {
  .ch-score { grid-template-columns: 1fr 1fr; gap: 12px 18px; }
  .ch-score b { font-size: 36px; }
  .ch-maps { grid-template-columns: 1fr; }
  .min-bar { width: 60px; }
}

/* weekly club backup: a reminder in the corner, the download happens only on click */
#clubBackupBanner { position: fixed; right: 16px; bottom: 16px; z-index: 31; display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-top: 2px solid var(--text); border-radius: var(--radius-sm); font-size: 13px; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.5); }
#clubBackupBanner button { min-height: 28px; padding: 3px 10px; }
body.gated #clubBackupBanner, body.printing #clubBackupBanner, body.printing-ht #clubBackupBanner { display: none !important; }
.min-table td:nth-child(8) { white-space: nowrap; }
.min-table td:nth-child(2) { min-width: 140px; }

/* ---------- live actions vs video actions on one match ---------- */
.live-use { margin: 0 0 14px; padding: 10px 0 8px; border-top: 2px solid var(--text); border-bottom: 1px solid var(--line); }
.live-use .row { margin-bottom: 4px; }
.live-use .seg button { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.live-use .seg button.on { border: none; background: var(--text); color: var(--bg); }
.live-marks summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.live-marks .history-scroll { max-height: 280px; }
/* ---------- Partite → Calendario ---------- */
.cal-table { margin-bottom: 6px; }
.cal-table td { vertical-align: middle; }
.cal-day { width: 110px; white-space: nowrap; font-family: var(--font-din); font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-kind { font-family: var(--font-din); font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.cal-match .cal-kind { color: var(--text); }
.cal-res { font-family: var(--font-din); font-size: 18px; font-variant-numeric: tabular-nums; }
.cal-month { border-bottom: 2px solid var(--text); padding-bottom: 4px; }
.cal-attendance td { color: var(--muted); }
/* ---------- Rosa → Carico ---------- */
.load-weeks { display: inline-flex; align-items: flex-end; gap: 3px; height: 26px; vertical-align: middle; }
.load-weeks i { display: block; width: 10px; min-height: 1px; background: var(--muted); }
.load-weeks i:last-child { background: var(--text); }
.load-state { font-family: var(--font-din); font-size: var(--t-label); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.load-high { color: var(--bad-t); }
.load-low { color: var(--warn-t); }
.load-ok { color: var(--good-t); }
.load-new, .load-none { color: var(--muted); }
.load-table td { vertical-align: middle; }
.load-table td:nth-child(2) { min-width: 140px; }

/* ---------- match momentum ---------- */
.mom { margin: 6px 0 18px; }
.mom figcaption { font-family: var(--font-display); font-weight: 600; margin-bottom: 6px; }
.mom-svg { width: 100%; max-width: 760px; display: block; color: var(--text); }
#reportView .mom-svg { max-width: none; }
/* ---------- clip archive ---------- */
.arch-filters select { max-width: 220px; }
.arch-n { font-family: var(--font-din); font-size: 28px; line-height: 1; }
.arch-scroll { max-height: 560px; }
/* ---------- player season ---------- */
.pl-season { margin: 12px 0 16px; }
.pos { color: var(--good-t); } .neg { color: var(--bad-t); }
/* ---------- cards ---------- */
.yc-limit { width: 48px; text-align: center; margin: 0 4px; }
.card-form select { max-width: 240px; }
/* ---------- season summary: printed alone ---------- */
.sum-page table td, .sum-page table th { color: #13241a; border-bottom: 1px solid #dfe3d8; background: none !important; }
@media print {
  body.printing-sum { display: block; background: white; }
  body.printing-sum #sidebar, body.printing-sum .view-head, body.printing-sum #backupBanner, body.printing-sum #clubBackupBanner, body.printing-sum .view:not(#view-matches),
  body.printing-sum #tab-season, body.printing-sum #tab-calendar, body.printing-sum .ht-bar { display: none !important; }
  body.printing-sum #app { padding: 0; }
  body.printing-sum #tab-summary { border: none; padding: 0; background: white; }
  body.printing-sum .sum-page { box-shadow: none; padding: 0; max-width: none; }
  body.printing-sum .sum-page h2, body.printing-sum .ht-tile, body.printing-sum tr { break-inside: avoid; }
}

/* ---------- shirt numbers of a match, merge two matches ---------- */
.shirt-tool, .merge-tool { margin: 0 0 14px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.merge-tool { margin-top: 18px; }
.shirt-tool summary, .merge-tool summary { cursor: pointer; font-weight: 600; }
.shirt-tool form select, .merge-tool form select { max-width: 280px; }
.view-head .subtabs { flex-wrap: wrap; }

/* drawn icons where glyphs were: in a button alone, centred; the "to show" star in the team colour */
button > .ic:only-child { margin: 0; }
.ic.star { width: 15px; height: 15px; vertical-align: -2px; fill: var(--us); stroke: var(--us); color: var(--us-t); }
html[data-theme="light"] .ic.star { fill: #e2c400; stroke: #7a6000; }
.ic.star.inline { margin-left: 4px; }
.tag-draw .ic { width: 14px; height: 14px; vertical-align: -2px; }
.at-legend .ic { width: 14px; height: 14px; vertical-align: -2px; margin: 0 2px; }
.mark .ic { width: 20px; height: 20px; margin: 0; stroke-width: 2.6; }
.lu-rule .r-rm, .td-rm, .kpi-rm, .e-del, .cm-del { padding: 3px 7px; }
.lu-rule .r-rm .ic, .td-rm .ic, .kpi-rm .ic, .e-del .ic, .cm-del .ic { width: 15px; height: 15px; }
#pbList .ic, .pb-list .muted .ic { width: 13px; height: 13px; vertical-align: -2px; margin: 0 2px 0 0; }

/* ==========================================================================================
   Phones and tablets: iPhone notch and home bar, no zoom on inputs, touch targets, Bordocampo on a tablet
   ========================================================================================== */
#sidebar { height: 100vh; height: 100dvh; padding-top: calc(20px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
#app { padding-right: calc(30px + env(safe-area-inset-right)); padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
#backupBanner, #clubBackupBanner { bottom: calc(16px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); }
#psToast { bottom: calc(28px + env(safe-area-inset-bottom)); }
#presenter { padding: calc(14px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left)); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, .btn, a, select, label, summary, .kpi-btn { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* touch devices: inputs at 16px (iOS zooms in on smaller ones), bigger controls, no sticky hover */
body.touch input, body.touch select, body.touch textarea { font-size: 16px; }
body.touch button, body.touch .btn, body.touch select, body.touch input:not([type="checkbox"]):not([type="radio"]) { min-height: 42px; }
body.touch td button, body.touch .row-actions button, body.touch button.small { min-height: 36px; }
body.touch .kpi-btn, body.touch .sp-big, body.touch .zs-cell, body.touch .who-n, body.touch .mark { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@media (hover: none) {
  button:hover, .btn:hover { background: var(--raised); border-color: var(--line); }
  button.primary:hover, dialog menu button[value="ok"]:hover { background: var(--accent); border-color: var(--accent); }
  button.on:hover { background: var(--raised-2); border-color: var(--text); }
  #nav button:hover { background: transparent; }
  .kpi-btn:hover { border-color: transparent; }
  tr.click:hover td { background: transparent; }
}
button:active:not(:disabled) { transform: translateY(1px) scale(0.99); }

@media screen and (max-width: 820px) {
  #sidebar { height: auto; padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); padding-bottom: 0; }
  #app { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  body.touch #nav button { min-height: 52px; }
}

/* Bordocampo on a tablet (touch, wider than a phone): the rail folds to icons, the pad fills the screen */
@media (min-width: 821px) {
  body.touch[data-view="pitchside"] { grid-template-columns: 76px minmax(0, 1fr); }
  body.touch[data-view="pitchside"] #sidebar { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: 8px; gap: 10px; align-items: center; }
  body.touch[data-view="pitchside"] .brand span:not(.logo), body.touch[data-view="pitchside"] .matchbox, body.touch[data-view="pitchside"] .nav-h,
  body.touch[data-view="pitchside"] .copyright, body.touch[data-view="pitchside"] #cloudBadge .club, body.touch[data-view="pitchside"] #cloudBadge .state,
  body.touch[data-view="pitchside"] #helpBtn span, body.touch[data-view="pitchside"] #langSelect { display: none; }
  body.touch[data-view="pitchside"] #nav button { flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 2px; font-size: 10.5px; line-height: 1.1; text-align: center; white-space: normal; width: 60px; }
  body.touch[data-view="pitchside"] #nav button.on::after { left: 12px; right: 12px; bottom: 0; }
  body.touch[data-view="pitchside"] .side-foot { width: 60px; }
  body.touch[data-view="pitchside"] .side-tools { flex-direction: column; }
  body.touch[data-view="pitchside"] #cloudBadge { justify-content: center; padding: 6px; }
  body.touch[data-view="pitchside"] #app { padding: calc(14px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) 18px; }
  body.touch[data-view="pitchside"] .view-head { margin-bottom: 12px; min-height: 0; }
  body.touch[data-view="pitchside"] .view-head h1 { font-size: 24px; }
  body.touch[data-view="pitchside"] .ps-clock { margin-bottom: 10px; padding: 8px 12px; }
  body.touch[data-view="pitchside"] .ps-hint { margin-bottom: 10px; padding: 10px 14px; font-size: 16px; }
  body.touch[data-view="pitchside"] #view-pitchside .kpi-pad { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
  body.touch[data-view="pitchside"] #view-pitchside .kpi-btn { min-height: 116px; font-size: 22px; }
  body.touch[data-view="pitchside"] #view-pitchside .kpi-n { font-size: 40px; }
  body.touch[data-view="pitchside"] #view-pitchside .kpi-btn.act { min-height: 78px; font-size: 16px; }
}
/* iPad portrait and big phones in landscape: the pad in 3 columns */
@media screen and (min-width: 600px) and (max-width: 820px) {
  body.touch #view-pitchside .kpi-pad { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.touch #view-pitchside .act-pad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* phones in landscape (short screens): the menu does not stay on top, more room for the pad */
@media screen and (max-height: 500px) and (max-width: 1000px) {
  body.touch #sidebar { position: static; }
}

/* ---------- Guida ---------- */
.guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0 28px; }
.guide-role { border-top: 2px solid var(--text); padding-top: 10px; margin-bottom: 22px; }
.guide-role h2 { font-size: var(--t-head); text-transform: uppercase; margin: 0 0 2px; }
.guide-role ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; counter-reset: g; }
.guide-role li { counter-increment: g; }
.guide-step { display: grid; grid-template-columns: 28px 1fr; gap: 2px 10px; width: 100%; text-align: left; justify-content: stretch; align-items: start; white-space: normal; background: var(--panel); border: 1px solid var(--line-soft); padding: 10px 12px; font-weight: 400; line-height: 1.4; }
.guide-step::before { content: counter(g); grid-row: span 2; font-family: var(--font-din); font-size: 22px; font-weight: 700; line-height: 1; color: var(--muted); }
.guide-step b { font-weight: 700; }
.guide-step span { color: var(--muted); font-size: 13px; }
.guide-step:hover { border-color: var(--text); }
.guide-foot { max-width: 80ch; }

/* ---------- printing / PDF: colours as on screen (pitch, score, team dots), whatever the "background graphics" option says ---------- */
@media print {
  html, body, body * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 12mm; }
  :root, html { color-scheme: light; }
  #reportView .muted, #reportView figcaption, .ht-page .muted, .sum-page .muted { color: #4f5f52 !important; }
  html, body, #app, .view, #reportView, #reportView .page, .ht-page, .sum-page, #tab-summary { background: white !important; }
  #reportView .page { box-shadow: none; border-radius: 0; }
  #reportView .maps { grid-template-columns: repeat(2, 1fr); }
  .ht-page .empty, .ht-page .empty b { color: #13241a !important; }
  .ht-page button { display: none !important; }
  #reportView .maps figure, .ht-maps figure, .sum-page figure { break-inside: avoid; }
}

/* ---------- maker of the app, owner badge and owner panel ---------- */
.made-by { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0.2px; }
.made-by b { color: var(--text); font-weight: 700; }
#reportView .made-by, .ht-page .made-by, .sum-page .made-by { color: #56665a; border-top: 1px solid #dfe3d8; padding-top: 8px; }
#reportView .made-by b, .ht-page .made-by b, .sum-page .made-by b { color: #1d4a2f; }
.login-sign { text-align: center; margin-top: 10px; }
.side-foot .copyright b { color: var(--text); }
.owner-badge { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.4px;
  text-transform: uppercase; background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }
.status-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-pill.st-pending { background: color-mix(in srgb, #f5c518 25%, transparent); color: var(--text); }
.status-pill.st-approved { background: color-mix(in srgb, var(--good) 25%, transparent); color: var(--text); }
.status-pill.st-blocked { background: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--text); }
#ownerTable th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px; }
#ownerTable .row-actions { white-space: nowrap; }
#ownerTable tr.owner-pending td { background: color-mix(in srgb, #f5c518 7%, transparent); }
.club-wait { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
body.owner-waiting #nav button[data-view="club"] { position: relative; }
body.owner-waiting #nav button[data-view="club"]::before { content: ""; position: absolute; top: 6px; left: 6px; width: 9px; height: 9px; border-radius: 50%; background: #f5c518; }
.owner-wrap { overflow-x: auto; margin: 0 -4px; }
#ownerTable td:first-child { min-width: 120px; }
#ownerTable tr:not(.owner-acts) td { border-bottom: none; padding-top: 9px; }
#ownerTable tr.owner-acts td { padding-top: 0; }
#ownerTable .row-actions button { margin-right: 6px; }

/* player finder (vision.js) */
#visionLayer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; z-index: 2; }
#visionHit { position: absolute; left: 0; top: 0; right: 0; bottom: 48px; display: none; cursor: crosshair; z-index: 3; }
body.vision #visionLayer, body.vision #visionHit { display: block; }
body.vision #videoPick { z-index: 4; }
#videoBox.drawing #visionHit, #videoBox.drawing #visionLayer, #videoBox.yt #visionHit { display: none; }
#visionBar { gap: 8px; margin: 6px 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
#visionBar { flex-wrap: wrap; }
#visionBar .vision-text { flex: 1 1 100%; font-size: 13px; }
#visionBar .spacer { display: none; }
.radar-legend { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.radar-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.5); margin-left: 6px; }
#visionBar .radar-sum { flex: 1 1 100%; font-size: 12px; }
#radarLayer .radar-num { font-size: 2.2px; font-weight: 700; fill: #fff; stroke: #111; stroke-width: 0.45px; paint-order: stroke; }
#visionBar .vision-size { font-size: 13px; white-space: nowrap; }
#visionBar .vision-size input { width: 4.2em; padding: 3px 4px; }
#visionBtn.on { background: #ffd60a; color: #111; border-color: #ffd60a; }
@media print { #visionLayer, #visionHit, #visionBar { display: none !important; } }
#drawBar .draw-hint { flex: 1 1 100%; font-size: 13px; }

/* ==========================================================================================
   Phone and tablet (2026-11-11). The same chalk-line world, laid out for a thumb:
   - phone (up to 640px): a slim turf bar on top (mark, account, theme, language), the main sections of the role in a
     turf tab bar at the bottom, "Altro" opens the rest of the rail as a sheet from the bottom; sections run edge to
     edge as flat bands split by rules (no boxes inside the page box); wide tables scroll with the first column held.
   - tablet: touch-sized subtabs, the toast and the bars above the safe areas.
   ========================================================================================== */
#tabbar, #sheetScrim { display: none; }
.rail-body { display: contents; }
/* a column never grows to the widest table inside it: tables scroll in their own box */
@media screen and (max-width: 1180px) {
  main, .split { grid-template-columns: minmax(0, 1fr); }
  main > *, .split > * { min-width: 0; }
}
/* tables scroll on their own (wrapped by nav.js), the text around them does not */
.tscroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tscroll > table { min-width: 100%; }
/* feedback toast: a chalk block, not a team colour */
#psToast { background: var(--text); color: var(--bg); border-radius: var(--radius-sm); font-family: var(--font-din); letter-spacing: 0.01em;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.55); bottom: calc(28px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); white-space: normal; text-align: center; }
#visionBtn.on { background: var(--raised-2); color: var(--text); border: 2px solid var(--text); }

/* tablet and phone: touch first */
@media screen and (max-width: 1180px) {
  body.touch .subtabs button { min-height: 44px; }
  body.touch .view-head { row-gap: 10px; }
}

@media screen and (max-width: 640px) {
  /* the top bar: one slim row of turf */
  #sidebar { flex-wrap: nowrap; align-items: center; gap: 10px; background: var(--turf); border-bottom: none;
    padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(14px + env(safe-area-inset-left)); }
  .brand { font-size: 19px; gap: 9px; flex: none; }
  .logo { width: 22px; height: 22px; }
  .side-foot { margin-left: auto; gap: 6px; flex-wrap: nowrap; align-items: center; }
  .side-foot .copyright, #helpBtn { display: none; }
  #cloudBadge { max-width: 132px; min-height: 40px; padding: 4px 10px; font-size: 13px; }
  .side-tools { gap: 6px; }
  #themeBtn { min-width: 40px; min-height: 40px; padding: 0; }
  #langSelect { width: 58px; flex: none; min-height: 40px; padding: 0 6px; font-family: var(--font-din); font-weight: 600; letter-spacing: 0.04em; }

  /* the tab bar: the main sections of the role, in thumb reach; a chalk line marks the current one from the top */
  #tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--turf);
    border-top: 1px solid rgba(238, 241, 232, 0.16); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  #tabbar button { position: relative; flex: 1 1 0; min-width: 0; min-height: 58px; flex-direction: column; justify-content: center; gap: 4px;
    padding: 6px 2px 5px; border: none; border-radius: 0; background: transparent; color: #b4c3b1; font-size: 11px; font-weight: 600;
    line-height: 1.1; text-align: center; white-space: normal; }
  #tabbar button .ic { width: 22px; height: 22px; margin: 0; }
  #tabbar button span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #tabbar button:hover { background: transparent; }
  #tabbar button.on { color: #fff; border: none; background: transparent; }
  #tabbar button.on::after { content: ""; position: absolute; left: 16%; right: 16%; top: 0; height: 2px; background: #eef1e8;
    transform-origin: left center; animation: chalk-mark 0.42s var(--mark-ease) both; }
  #tabbar button:active:not(:disabled) { transform: none; background: rgba(0, 0, 0, 0.18); }

  /* "Altro": the rail from the bottom, above the tab bar */
  /* under the top bar (z 40, the sheet lives in it), over the page */
  #sheetScrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(5, 10, 7, 0.55); }
  .rail-body { display: none; }
  body.sheet-open .rail-body { display: flex; flex-direction: column; gap: 14px; position: fixed; left: 0; right: 0; z-index: 45;
    bottom: calc(58px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 120px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
    padding: 18px calc(16px + env(safe-area-inset-right)) 14px calc(16px + env(safe-area-inset-left));
    background: var(--turf); border-top: 2px solid #eef1e8; box-shadow: 0 -18px 32px -14px rgba(0, 0, 0, 0.6);
    animation: sheet-up 0.32s var(--mark-ease) both; }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  body.sheet-open .matchbox { display: grid; }
  body.sheet-open #nav { order: 0; width: auto; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 6px; }
  body.sheet-open #nav .nav-h { grid-column: 1 / -1; padding: 10px 2px 4px; border-top: 1px solid rgba(238, 241, 232, 0.16); }
  body.sheet-open #nav button { flex-direction: column; justify-content: center; gap: 6px; min-height: 68px; padding: 8px 4px; font-size: 12px;
    line-height: 1.15; text-align: center; white-space: normal; }
  body.sheet-open #nav button .ic { width: 22px; height: 22px; }
  body.sheet-open #nav button.on::after { left: 22%; right: 22%; bottom: 2px; }
  body.sheet-open { overflow: hidden; }

  /* room for the tab bar */
  #app { padding: 16px calc(14px + env(safe-area-inset-right)) calc(84px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }
  #psToast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  #clubBackupBanner { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); }

  /* view head: title and match on the chalk baseline, actions under them */
  .view-head { gap: 6px 12px; margin-bottom: 16px; padding-bottom: 10px; min-height: 0; }
  .view-head h1 { font-size: 26px; }
  .view-head .match-chip { order: 3; flex: 1 1 100%; min-width: 0; font-size: var(--t-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0; }
  .view-head .match-chip .chip-score { font-size: 20px; }
  .view-head .spacer { display: none; }
  .view-head > button, .view-head > .btn { order: 4; }
  .view-head .subtabs { order: 5; flex: 1 1 100%; flex-wrap: nowrap; margin: 0 -14px; padding: 0 8px; width: calc(100% + 28px); max-width: none;
    overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
  .view-head .subtabs::-webkit-scrollbar { display: none; }
  .view-head .subtabs button { flex: none; scroll-snap-align: start; }

  /* sections edge to edge: flat bands split by rules, not boxes in the page box */
  .tab, .panel, #left, #right { margin-left: -14px; margin-right: -14px; border-left: none; border-right: none; border-radius: 0; padding: 16px 14px; overflow-x: visible; }
  #reportView { margin-left: -14px; margin-right: -14px; padding: 14px 0 0; border-radius: 0; }
  #reportView > :not(.page) { margin-left: 14px; margin-right: 14px; }
  #reportView .page { padding: 22px 16px; border-radius: 0; box-shadow: none; }

  /* wide tables: the first column stays while the numbers scroll */
  .tscroll { margin-right: -14px; padding-right: 14px; }
  .tscroll > table th:first-child, .tscroll > table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); max-width: 44vw; }
  .tscroll > table th { white-space: nowrap; }

  dialog, #accountDialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 0; border-left: none; border-right: none; border-bottom: none;
    border-top: 2px solid var(--text); max-height: calc(100dvh - 40px - env(safe-area-inset-top)); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
body.gated #tabbar, body.presenting #tabbar, body.printing #tabbar, body.printing-ht #tabbar, body.printing-sum #tabbar { display: none !important; }
@media print { #tabbar, #sheetScrim { display: none !important; } }
@media (prefers-reduced-motion: reduce) { #tabbar button.on::after, body.sheet-open .rail-body { animation: none; } }

/* ---------- Formazione → Convocazioni, Benessere e GPS, Test atletici, Valutazioni ---------- */
.cu-bar, .wb-bar { flex-wrap: wrap; align-items: end; }
.cu-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 10px; }
.cu-sum b { font-family: var(--font-din); font-size: 22px; font-variant-numeric: tabular-nums; }
.cu-table .lu-shirt { width: 32px; height: 32px; font-size: 14px; border-width: 2px; }
.cu-table tr.cu-off td { opacity: 0.5; }
.cu-table .cu-pick input { width: 22px; height: 22px; min-width: 0; }
.cu-ans { white-space: nowrap; }
.cu-ans button { margin-right: 4px; }
.cu-ans button.on.ans-y { background: var(--good); border-color: var(--good); color: #111; }
.cu-ans button.on.ans-m { background: var(--warn); border-color: var(--warn); color: #111; }
.cu-ans button.on.ans-n { background: var(--bad); border-color: var(--bad); color: #fff; }
.cu-sum .ans-y b { color: var(--good-t); }
.cu-sum .ans-m b { color: var(--warn-t); }
.cu-sum .ans-n b { color: var(--bad-t); }
.cu-note { min-width: 140px; }
.wb-table select.wb-sel { min-width: 0; padding: 4px 6px; }
.wb-table input.wb-min { width: 70px; min-width: 0; }
.ft-tests { flex-wrap: wrap; margin-bottom: 10px; }
.ft-entry input { width: 110px; min-width: 0; }
.ft-up { color: var(--good-t); font-weight: 700; }
.ft-down { color: var(--bad-t); font-weight: 700; }
.ft-bar { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--line-soft); vertical-align: middle; overflow: hidden; }
.ft-bar i { display: block; height: 100%; background: var(--accent); }
.ev-table tr.ev-sel td { background: var(--raised); }
.linkish { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.linkish:hover { background: none; color: var(--accent); }
.ev-prev { font-size: 12px; }
.ev-card { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.ev-card .row { align-items: center; }
.ev-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; margin: 6px 0; }
.ev-bars div { display: grid; grid-template-columns: 130px 1fr 24px; align-items: center; gap: 8px; }
.ev-bars .ft-bar { width: 100%; }
@media (max-width: 700px) { .cu-ans button { padding: 6px 8px; } .ev-bars div { grid-template-columns: 100px 1fr 24px; } }

/* ---------- period bar (Rosa, Analisi, Riepilogo) ---------- */
.period-bar { flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.period-bar .seg button { padding: 4px 10px; }
.period-bar select { padding: 4px 8px; }
.per-week { font-variant-numeric: tabular-nums; }

/* ---------- Formazione → Allenamenti ---------- */
.tp-seg { margin-bottom: 10px; }
.tp-drills { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.tp-drill { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel); }
.tp-thumb { width: 110px; flex: none; }
.tp-thumb svg { width: 100%; height: auto; display: block; border-radius: 4px; }
.tp-items { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.tp-item { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.tp-n { font-family: var(--font-din); font-weight: 700; font-size: 18px; text-align: center; }
.tp-item-main { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.tp-note { flex: 1 1 200px; min-width: 0; }
.tp-min input { width: 64px; min-width: 0; }
.tp-move button { padding: 3px 8px; }
.tp-list tr.tp-today td { background: var(--raised); }
@media (max-width: 700px) { .tp-item { grid-template-columns: 24px 1fr auto; } .tp-item-main { grid-column: 2 / -1; } .tp-min { grid-column: 2; justify-self: start; } .tp-move { grid-column: 3; } .tp-move button { min-width: 40px; min-height: 40px; } .tp-n { grid-row: 1 / 3; align-self: start; } }

/* ---------- Formazione → Documenti ---------- */
.dc-table td { white-space: nowrap; }
.dc-table input[type="date"] { min-width: 0; width: 150px; padding: 4px 6px; }
.dc-table td.dc-expired input { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--raised)); }
.dc-table td.dc-soon input { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, var(--raised)); }
.dc-table td.dc-ok input { border-color: color-mix(in srgb, var(--good) 60%, var(--line)); }
.dc-tag { display: block; font-size: 12px; margin-top: 2px; }
td.dc-expired .dc-tag, .sheet td.dc-expired { color: var(--bad-t); font-weight: 700; }
td.dc-soon .dc-tag, .sheet td.dc-soon { color: var(--warn-t); font-weight: 700; }

/* ---------- Partite → Questa settimana ---------- */
details.week { margin: 0 0 14px; }
details.week summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.week-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.week-list li { padding: 6px 10px; border-left: 4px solid var(--line); background: var(--raised); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.week-list li.wk-bad { border-left-color: var(--bad); }
.week-list li.wk-warn { border-left-color: var(--warn); }
.week-list li.wk-info { border-left-color: var(--accent); }
.week-list .wk-go { text-decoration: none; font-weight: 400; text-align: left; white-space: normal; }

/* ---------- printed staff pages (training session, player sheet) ---------- */
#printSheet { display: none; }
.sheet { color: #111; background: #fff; font-size: 13px; }
.sheet h1 { font-size: 22px; margin: 0; }
.sheet h2 { font-size: 15px; margin: 16px 0 6px; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
.sheet .sub { color: #555; font-weight: 400; font-size: 12px; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet td, .sheet th { border-bottom: 1px solid #ddd; padding: 3px 6px; text-align: left; color: #111; }
.sheet .num { text-align: right; }
.sheet .ht-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sheet .ht-tile { border: 1px solid #ccc; border-radius: 6px; padding: 6px 8px; background: #fff; color: #111; }
.sheet .ht-label { font-size: 11px; color: #555; }
.sheet .ht-n { font-size: 20px; font-weight: 700; }
.sheet .ft-bar { background: #e6e6e6; }
.sheet .ft-bar i { background: #333; }
.sheet-head { display: flex; gap: 14px; align-items: center; }
.sheet-head .shirt { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: #f5d90a; font-weight: 800; font-size: 22px; }
.sheet-photo { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; }
.sheet-drill { display: grid; grid-template-columns: 1fr 220px; gap: 12px; break-inside: avoid; border-bottom: 1px solid #ddd; padding: 8px 0; }
.sheet-drill h2 { border: 0; margin: 0 0 4px; }
.sheet-board svg { width: 100%; height: auto; }
.sheet .made-by { margin-top: 16px; color: #777; font-size: 11px; }
@media print {
  body.printing-sheet { display: block; background: white; }
  body.printing-sheet > *:not(#printSheet) { display: none !important; }
  body.printing-sheet #printSheet { display: block; }
  body.printing-sheet .sheet h2, body.printing-sheet .ht-tile, body.printing-sheet tr { break-inside: avoid; }
}

/* ---------- staff tables become cards on the phone (portrait); tablet and landscape keep the table ---------- */
.week-list .wk-go { display: block; width: 100%; padding: 0; line-height: 1.45; }
.tp-session .form-grid label, #tpDrillForm .form-grid label, #evForm .form-grid label, #cuForm .form-grid label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.tp-session .form-grid input, #tpDrillForm .form-grid input, #tpDrillForm .form-grid select, #tpDrillForm textarea, #cuForm .form-grid input, #evForm .form-grid input, #evForm textarea { width: 100%; }
#evForm .form-grid label select { width: auto; }
.cu-ans { display: flex; gap: 6px; flex-wrap: nowrap; }
.cu-ans button { margin: 0; }
@media (max-width: 700px), (max-height: 500px) and (max-width: 1000px) {
  .lu-table-wrap:has(> .cards-sm) { overflow: visible; }
  table.cards-sm, table.cards-sm tbody { display: block; width: 100%; }
  table.cards-sm tr:has(> th) { display: none; }
  table.cards-sm tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 10px; align-items: end;
    padding: 12px 14px; margin: 0 0 10px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
  table.cards-sm td { display: block; padding: 0; border: 0; background: none !important; text-align: left; min-width: 0; }
  table.cards-sm td[data-l]::before { content: attr(data-l); display: block; margin-bottom: 4px; font-family: var(--font-din); font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.cards-sm td.c-num { grid-column: 1; align-self: center; font-family: var(--font-din); font-size: 20px; font-weight: 800; }
  table.cards-sm td.c-name { grid-column: 2 / -1; align-self: center; font-weight: 700; font-size: 16px; }
  table.cards-sm td.c-wide, table.cards-sm td.cu-ans, table.cards-sm td.cu-notecell { grid-column: 1 / -1; }
  table.cards-sm select, table.cards-sm input:not([type="checkbox"]) { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
  table.cards-sm .num { text-align: left; }
  /* call-ups: tick, shirt and name on one line, the three answers as big buttons */
  table.cards-sm.cu-table tr { grid-template-columns: 34px 44px minmax(0, 1fr); align-items: center; }
  table.cards-sm.cu-table td.c-check { grid-column: 1; }
  table.cards-sm.cu-table td.c-num { grid-column: 2; }
  table.cards-sm.cu-table td.c-name { grid-column: 3; }
  table.cards-sm.cu-table td.cu-ans::before { display: none; }
  .cu-ans button { flex: 1 1 0; min-height: 44px; padding: 6px 4px; white-space: normal; }
  table.cards-sm.cu-table tr.cu-off { padding: 8px 14px; }
  table.cards-sm.cu-table tr.cu-off td { opacity: 0.55; }
  table.cards-sm.cu-table td.cu-notecell:empty, .cu-table td.cu-ans:empty { display: none; }
  /* tests: rank, shirt, name, then the numbers */
  table.cards-sm.ft-table td.c-rank { grid-column: 1; align-self: center; color: var(--muted); font-family: var(--font-din); font-size: 20px; }
  table.cards-sm.ft-table td.c-num { grid-column: 2; }
  table.cards-sm.ft-table td.c-name { grid-column: 3 / -1; }
  table.cards-sm.ft-table .ft-bar { width: calc(100% - 50px); }
  /* ratings: the button on the name line */
  table.cards-sm.ev-table td.c-name { grid-column: 2 / 4; }
  table.cards-sm.ev-table td.c-act { grid-column: 4; grid-row: 1; justify-self: end; align-self: center; }
  table.cards-sm.ev-table tr.ev-none td:not(.c-num):not(.c-name):not(.c-act) { display: none; }
  table.cards-sm.ev-table tr.ev-none { padding: 8px 14px; }
  table.cards-sm.cu-table td.cu-ans { display: flex; }
  table.cards-sm.ft-table td.c-rank { font-size: 15px; }
  table.cards-sm.ev-table td.c-act button { min-height: 40px; }
  /* documents: two dates per line */
  table.cards-sm.dc-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  table.cards-sm.dc-table td.c-num { display: none; }
  table.cards-sm.dc-table td.c-name { grid-column: 1 / -1; }
  table.cards-sm.dc-table input[type="date"] { width: 100%; }
  /* sessions list */
  table.cards-sm.tp-list tr { cursor: pointer; }
  table.cards-sm.tp-list td.c-date { grid-column: 1 / 3; font-family: var(--font-din); font-weight: 700; color: var(--muted); }
  table.cards-sm.tp-list td.c-st { grid-column: 3 / -1; justify-self: end; }
  table.cards-sm.tp-list td.c-name { grid-column: 1 / -1; }
  table.cards-sm.tp-list td.c-wide:empty, .tp-list td.c-name:empty { display: none; }
  /* bars and forms */
  .cu-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cu-sum > span { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; font-size: 13px; }
  .cu-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .wb-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cu-bar > button { padding: 10px 4px; }
  .cu-bar label, .wb-bar label { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
  .cu-bar select, .wb-bar input { width: 100%; }
  .cu-bar > button, .wb-bar > button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .tp-drill { flex-direction: column; }
  .tp-thumb { width: 100%; max-width: 260px; }
  .period-bar .seg { display: flex; width: 100%; }
  .period-bar .seg button { flex: 1 1 0; padding: 8px 2px; font-size: 13px; }
  .ft-tests { flex-wrap: nowrap; overflow-x: auto; }
  .sheet .ht-tiles { grid-template-columns: repeat(2, 1fr); }
  .sheet-drill { grid-template-columns: 1fr; }
}
