/* SciroccoMedia Graphics — regia (telefono e computer). Tema scuro, bersagli grandi, stati scritti in parole. */
:root {
  --bg: #0b0f14; --panel: #141a22; --panel-2: #1b232d; --line: #2a3441; --text: #eef2f6; --muted: #93a1b0;
  --red: #d3121c; --red-2: #a10b13; --ok: #16a34a; --warn: #f59e0b; --danger: #ef4444; --silver: #d9dde2;
  --font: "Avenir Next", "Avenir", "Helvetica Neue", -apple-system, system-ui, Arial, sans-serif;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.num { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(.98); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.big { min-height: 64px; font-size: 19px; letter-spacing: .03em; }
button.alt { background: #222c38; }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.danger { background: transparent; border-color: var(--danger); color: #ffb4b4; }
button.mini { min-height: 34px; padding: 6px 10px; font-size: 13px; }
button.on, .seg.on { background: var(--silver); color: #10151b; border-color: var(--silver); }
input, select { background: #0e1319; border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 46px; width: 100%; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin: 8px 0 0; }
label input, label select { margin-top: 5px; color: var(--text); font-size: 16px; }
.note { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .1em; padding: 3px 7px; border-radius: 6px; margin-left: 8px; vertical-align: middle; }
.tag.demo { background: var(--warn); color: #111; }
.tag.ok { background: var(--ok); color: #fff; }

/* barra superiore */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: #0f141b; border-bottom: 1px solid var(--line); }
.top .brand { height: 22px; }
.match-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 12px; font-weight: 800; letter-spacing: .06em; padding: 6px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.on { background: rgba(22,163,74,.18); border-color: var(--ok); color: #9ff0b8; }
.pill.off { background: rgba(239,68,68,.15); border-color: var(--danger); color: #ffb4b4; }
.pill.air { background: rgba(211,18,28,.2); border-color: var(--red); color: #ffc4c7; }
.banner { padding: 10px 16px; font-size: 14px; font-weight: 600; }
.banner.warn { background: rgba(245,158,11,.15); border-bottom: 1px solid var(--warn); color: #fde4b0; }
.banner button { margin-left: 8px; }

.statusbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sb-score { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.sb-score img { width: 28px; height: 28px; object-fit: contain; }
.sb-score #sbScore { font-size: 26px; font-weight: 800; padding: 0 6px; }
.sb-clock { display: flex; align-items: baseline; gap: 8px; }
.sb-clock #sbClock { font-size: 24px; font-weight: 800; color: #ffd0d3; }
.sb-clock #sbPhase { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .12em; }
#sbOnAir { margin-left: auto; }
.lastbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 14px; border-bottom: 1px solid var(--line); min-height: 44px; }
.lastbar .lbl { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.lastbar #lastMsg { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; }
.tabs button { flex: 1; white-space: nowrap; min-height: 44px; }
main { padding: 0 16px 16px; }
.tab { display: none; }
.tab.on { display: block; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.grid > * { min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.card h2 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.card h2.mt { margin-top: 20px; }
.row2, .row3, .row4 { display: grid; gap: 8px; margin: 8px 0; }
.row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: repeat(3, 1fr); } .row4 { grid-template-columns: repeat(4, 1fr); }
.row-inline { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.row-inline label { margin: 0; }
.row-inline .val { min-width: 40px; text-align: center; font-weight: 800; font-size: 18px; }
.row-inline .sep { flex: 1; }
.row-inline.small button { min-height: 38px; padding: 6px 10px; }
form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
form.inline input { width: auto; flex: 1; min-width: 90px; }
.chk { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 10px 0 0; }
.chk input { width: 22px; min-height: 22px; }

/* risultato */
.teams { display: grid; gap: 8px; }
.teams .t { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel-2); border-radius: 10px; border-left: 6px solid var(--c, #666); }
.teams .t img { width: 40px; height: 40px; object-fit: contain; }
.teams .t .nm { flex: 1; font-weight: 800; font-size: 20px; text-transform: uppercase; }
.teams .t .sc { font-size: 40px; font-weight: 800; min-width: 50px; text-align: right; }
button.goal { font-size: 20px; }
button.goal.home { background: var(--ch, var(--red)); border-color: transparent; color: var(--fh, #fff); }
button.goal.away { background: var(--ca, #1d4ed8); border-color: transparent; color: var(--fa, #fff); }
.goals summary { cursor: pointer; padding: 8px 0; color: var(--muted); font-weight: 700; }
.goals ul { list-style: none; margin: 0; padding: 0; }
.goals li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.goals li .gx { flex: 1; }
.goals li.annulled .gx { text-decoration: line-through; color: var(--muted); }

/* tempo */
.clockbig { display: flex; align-items: baseline; gap: 12px; }
.clockbig #clk { font-size: 54px; font-weight: 800; letter-spacing: .02em; }
.clockbig .phase { font-weight: 800; color: var(--muted); letter-spacing: .14em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chips button { min-height: 40px; padding: 6px 12px; font-size: 14px; }
#btnClock.running, #qClock.running { background: var(--warn); color: #111; border-color: var(--warn); }

/* grafiche */
.layer-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.layer-row:first-of-type { border-top: 0; }
.layer-row .ln { font-weight: 700; }
.layer-row .st { font-size: 12px; font-weight: 800; letter-spacing: .06em; padding: 5px 8px; border-radius: 6px; background: #222b36; color: var(--muted); }
.layer-row .st.on { background: var(--red); color: #fff; }
.layer-row button { min-height: 42px; padding: 8px 12px; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 8px; }

.preview-card .pv { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.preview-card iframe { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; }
.danger-zone { border-color: #5b1d1d; }

/* preparazione */
.team-form .rowc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.team-form .logo-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.team-form .logo-row img { width: 56px; height: 56px; object-fit: contain; background: #0e1319; border-radius: 8px; border: 1px solid var(--line); }
.team-form textarea { width: 100%; min-height: 220px; background: #0e1319; border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px; font: 15px/1.5 ui-monospace, Menlo, monospace; margin-top: 5px; }
.team-form input[type=color] { padding: 4px; height: 46px; }
.savebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* archivio */
.list { list-style: none; margin: 0 0 10px; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li .ti { flex: 1; min-width: 160px; font-weight: 700; }
.list li .ti small { display: block; color: var(--muted); font-weight: 500; }
.urlrow { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.urlrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #0e1319; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px; }
.urlrow .lb { width: 150px; font-size: 13px; color: var(--muted); font-weight: 700; }

/* barra rapida telefono */
.quick { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: 1fr .8fr 1fr; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(11,15,20,.96); border-top: 1px solid var(--line); }
.quick button { min-height: 62px; font-size: 18px; }

/* scheda marcatore */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-box { width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 18px; }
.numgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 8px 0; }
.numgrid button { min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.numgrid button b { font-size: 24px; }
.numgrid button span { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.numgrid .bench { opacity: .75; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; background: #0f141b; border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 10px; font-weight: 700; max-width: 92vw; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { border-color: var(--danger); color: #ffc4c4; }
.toast.ok { border-color: var(--ok); }

/* desktop */
@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .quick { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-card { grid-column: 1 / -1; }
  #tab-prep .grid { grid-template-columns: 1fr 1fr 1fr; }
  #tab-prep .savebar { grid-column: 1 / -1; }
  .sheet { align-items: center; }
  .sheet-box { border-radius: 18px; }
}
@media (min-width: 1400px) {
  #tab-live .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preview-card { grid-column: 2 / 4; grid-row: 1 / 3; }
}

.userbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 700; white-space: nowrap; }
@media (max-width: 600px) { .userbox #meName { display: none; } }
.seg3.two { grid-template-columns: 1fr 1fr; }
button.yel { background: #facc15; color: #111; border-color: #facc15; }
button.red { background: #dc2626; color: #fff; border-color: #dc2626; }
[data-roles][hidden] { display: none !important; }
.list li select { width: auto; min-height: 38px; padding: 6px; }

[hidden] { display: none !important; }
.pill.warn { background: rgba(245,158,11,.15); border-color: var(--warn); color: #fde4b0; }
