:root{
  --sb-bg:#08111f;
  --sb-panel:#101b2c;
  --sb-panel2:#16243a;
  --sb-line:#2b3b53;
  --sb-text:#f8fafc;
  --sb-muted:#9fb0c5;
}
html[data-sb-theme="light"]{
  --sb-bg:#eef2f7;
  --sb-panel:#fff;
  --sb-panel2:#f7f9fc;
  --sb-line:#cbd5e1;
  --sb-text:#111827;
  --sb-muted:#64748b;
}
body{background:var(--sb-bg)!important;color:var(--sb-text)!important}

/* Barra: sync e tema, colori all'estrema destra */
.sb-pro-tools{
  position:fixed;
  z-index:99990;
  top:5px;
  left:14px;
  right:14px;
  display:flex;
  align-items:center;
  gap:6px;
  pointer-events:auto;
}
.sb-tools-spacer{flex:1}
.sb-pro-tools button,.sb-sync-badge{
  min-height:28px;
  border:1px solid var(--sb-line);
  border-radius:7px;
  background:var(--sb-panel2);
  color:var(--sb-text);
  padding:4px 9px;
  font-size:9px;
  font-weight:900;
  white-space:nowrap;
}
.sb-sync-badge.ok{color:#4ade80}
.sb-sync-badge.pending{color:#facc15}
.sb-sync-badge.offline{color:#fb923c}

.sb-team-color{display:flex;align-items:center;gap:6px}
.sb-team-color i{
  width:12px;height:12px;border-radius:50%;
  background:var(--team-chip,var(--home-color));
  border:1px solid #ffffff88;
}
.sb-team-color.home i{background:var(--home-color)}
.sb-team-color.away i{background:var(--away-color)}

.sb-color-palette{
  position:fixed;
  z-index:100001;
  width:300px;
  padding:10px;
  border:1px solid var(--sb-line);
  border-radius:10px;
  background:var(--sb-panel);
  color:var(--sb-text);
  box-shadow:0 16px 40px #0007;
}
.sb-palette-title{
  font-size:10px;font-weight:1000;letter-spacing:.12em;
  margin-bottom:8px;color:var(--sb-muted);
}
.sb-palette-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:6px;
}
.sb-color-option{
  display:flex;flex-direction:column;align-items:center;gap:4px;
  min-height:50px!important;padding:5px!important;
  border:1px solid var(--sb-line)!important;
  border-radius:7px!important;background:var(--sb-panel2)!important;
  color:var(--sb-text)!important;font-size:7px!important;font-weight:900!important;
}
.sb-color-option i{
  width:25px;height:25px;border-radius:6px;border:1px solid #80808055;
}

/* Falli squadra: usa il contatore ESISTENTE, niente doppioni */
.team-fouls{
  display:flex!important;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:4px 7px;
  line-height:1!important;
}
#home_team_fouls,#away_team_fouls{
  font-size:30px!important;
  line-height:1!important;
  font-weight:1000!important;
  display:inline-block!important;
  min-width:28px;
}
#homeBenchInfo,#awayBenchInfo{
  width:100%;
  margin-top:2px;
  font-size:9px!important;
  line-height:1.1!important;
}
.sb-team-foul-dots{
  display:inline-flex;
  gap:4px;
  align-items:center;
}
.sb-team-foul-dots i{
  width:9px;height:9px;border-radius:50%;
  border:1px solid rgba(255,255,255,.8);
  background:rgba(0,0,0,.22);
}
.sb-team-foul-dots i.on{background:#f8fafc}
.sb-team-foul-dots.bonus i.on{background:#facc15;border-color:#fde68a}

.sb-timeout-count{
  width:100%;
  display:block;
  margin-top:3px;
  font-size:8px;
  font-weight:900;
  letter-spacing:.05em;
  color:#e2e8f0;
}
.sb-timeout-count strong{
  font-size:13px;
  margin-left:3px;
  color:#fff;
}

/* Falli giocatore: colore distinto */
#playersList .player{
  position:relative!important;
  padding-right:64px!important;
}
.sb-player-fouls{
  position:absolute;
  right:7px;top:50%;
  transform:translateY(-50%);
  display:flex;align-items:center;gap:4px;
  min-width:46px;justify-content:center;
  padding:5px 7px;border-radius:8px;
  background:#172554;
  border:1px solid #3b82f6;
  pointer-events:none;
}
.sb-player-fouls span{font-size:9px;font-weight:1000;color:#93c5fd}
.sb-player-fouls strong{font-size:23px;line-height:1;font-weight:1000;color:#dbeafe}
.sb-player-fouls.one-plus{background:#422006;border-color:#f59e0b}
.sb-player-fouls.one-plus span,.sb-player-fouls.one-plus strong{color:#fde68a}
.sb-player-fouls.danger{background:#450a0a;border-color:#ef4444}
.sb-player-fouls.danger span,.sb-player-fouls.danger strong{color:#fecaca}

/* Nasconde esclusivamente il PBP aggiunto da V3.2 */
#sbSequentialPbp{display:none!important}

/* PBP ESISTENTE: sequenziale CASA sinistra / OSPITI destra */
.sbpro-pbp{
  display:flex!important;
  flex-direction:column!important;
  gap:5px!important;
}
.sbpro-pbp-row{
  width:68%!important;
  display:grid!important;
  grid-template-columns:54px 32px 1fr 62px!important;
  align-items:center!important;
  gap:7px!important;
  padding:7px 9px!important;
  border:1px solid var(--sb-line)!important;
  border-radius:8px!important;
  background:var(--sb-panel2)!important;
  margin:0!important;
}
.sbpro-pbp-row.sb-pbp-home{
  align-self:flex-start!important;
  border-left:4px solid var(--home-color)!important;
  text-align:left!important;
}
.sbpro-pbp-row.sb-pbp-away{
  align-self:flex-end!important;
  border-right:4px solid var(--away-color)!important;
  text-align:right!important;
}
.sbpro-pbp-row.sb-pbp-away .sbpro-pbp-action{
  text-align:right!important;
}
.sbpro-pbp-clock,.sbpro-pbp-period,.sbpro-pbp-score{
  font-weight:900!important;
}
.sbpro-pbp-action{font-size:11px!important}

@media(max-width:899px){
  .sb-pro-tools{left:4px;right:4px;top:3px;gap:3px}
  .sb-pro-tools button,.sb-sync-badge{font-size:7px;min-height:24px;padding:3px 5px}
  .sb-color-palette{width:min(300px,94vw)}
  #home_team_fouls,#away_team_fouls{font-size:24px!important}
  .sb-team-foul-dots{gap:2px}
  .sb-team-foul-dots i{width:7px;height:7px}
  .sbpro-pbp-row{width:88%!important;grid-template-columns:42px 27px 1fr 50px!important;padding:5px 6px!important}
}
