/* =========================
   THEME OBS — CLASSIC BROADCAST
   - Look TV classique (bleu nuit, chiffres nets)
   - Sets en ligne, jeux/points alignés à droite
   - Chrono AU-DESSUS des sets
   - Barre d’alerte SOUS la ligne B (en flux)
   ========================= */

:root{
  --bg: rgba(0,0,0,0);               /* transparent OBS */
  --ink: #ffffff;
  --muted: #cfd8eb;

  /* Bandeaux / lignes */
  --row-start: #0f2446;              /* bleu profond */
  --row-end:   #1a2f57;              /* léger dégradé */
  --row-sep:   rgba(255,255,255,.08);

  /* Top bar */
  --top-start: #15365f;
  --top-end:   #234a7f;

  /* Cases jeux/points */
  --game-bg: #22466e;                /* bleu moyen */
  --point-bg: #000000;               /* fond point */
  --point-ink:#ffffff;

  /* Accents */
  --serve-dot:#ffd400;               /* pastille serveur */
  --lead: #ffd95c;                   /* dernier set / accent léger */

  /* Box */
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0,0,0,.35);

  /* Typo */
  --fs-top:   clamp(13px,1.6vw,18px);
  --fs-name:  clamp(14px,1.6vw,18px);
  --fs-set:   clamp(14px,1.6vw,18px);
  --fs-game:  clamp(15px,1.8vw,20px);
  --fs-point: clamp(16px,2vw,22px);
  --fs-match: clamp(12px,1.3vw,15px);

  /* Hauteur uniforme des lignes joueurs */
  --row-h: 52px;  /* ajuste si tu veux plus haut/bas */
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", "Noto Sans", "Liberation Sans", sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* ===== CONTAINER ===== */
.scoreboard{
  position:relative; display:flex; flex-direction:column; width:max-content; margin:0 auto;
  padding: 8px 10px;
  border-radius: 12px;
  isolation:isolate;
}

/* ===== TOP BAR (sobre, plat) ===== */
.top-bar{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--top-start), var(--top-end));
  font-weight:800; letter-spacing:.2px; text-transform:uppercase; font-size:var(--fs-top);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

/* ===== TYPE DE MATCH ===== */
.match-type{
  margin-top:6px; text-align:center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight:700; font-size: var(--fs-match);
  color:#0b1a2e;
  background: linear-gradient(180deg, #f7fbff, #eaf1ff);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  border: 1px solid rgba(0,0,0,.08);
}

/* ===== LIGNE JOUEUR (GRID pour hauteurs identiques) ===== */
.player-row{
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto auto; /* nom | sets | jeux | points */
  align-items: stretch;                       /* toutes les cellules s’étirent */
  width:100%;
  margin-top:8px;
  min-height: var(--row-h);                   /* hauteur uniforme */
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--row-start), var(--row-end));
  outline: 1px solid rgba(255,255,255,.04);
  transition: border-radius .2s ease;
}

/* Chaque cellule occupe 100% de la hauteur de la ligne */
.player-row > .player-name,
.player-row > .sets-box,
.player-row > .game-box,
.player-row > .point-box{
  height: 100%;
  display:flex;
  align-items:center;
}

/* Arrondis aux extrémités */
.player-row .player-name{
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
  transition: border-radius .2s ease;
}
.player-row .point-box{
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  overflow: hidden;
  transition: border-radius .2s ease;
}

/* Nom + serveur (ellipse obligatoire) */
.player-name{
  min-width:0;
  gap:10px;
  padding: 10px 12px;
  font-weight:800; font-size: var(--fs-name);
  white-space: nowrap;
}
.player-name > #nameA, .player-name > #nameB{
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* Pastille serveur */
.server-icon{
  width: 10px; height:10px; border-radius:50%;
  background: radial-gradient(circle at 40% 40%, #fff, var(--serve-dot) 55%, #c4a300 100%);
  box-shadow: 0 0 8px var(--serve-dot);
  visibility:hidden; flex-shrink:0;
}

/* ===== Sets / Jeux / Points (hauteurs synchronisées via grid) ===== */
.sets-box, .game-box, .point-box{
  justify-content:center; font-weight:800; min-width:0;
}

/* Sets */
.sets-box{
  gap: 14px;
  padding: 0 12px;
  font-size: var(--fs-set);
  border-left: 1px solid var(--row-sep);
  overflow: visible;
}
.set{
  position: relative;
  min-width: 18px;
  line-height: 1;                /* évite d’étirer la cellule */
  text-align: center;
  background: transparent;
  color:#ffffff;
}

/* Chrono au-dessus du set */
.set .chrono-set{
  position:absolute; left:50%; transform:translateX(-50%);
  font-size:.72em; color: var(--muted);
  background: rgba(0,0,0,.45);
  padding: 1px 6px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.10);
  pointer-events:none; white-space:nowrap; z-index:3;
}

/* Tie-break en exposant */
.tie-break-score{
  position:absolute; top:-0.55em; right:-.2em;
  font-size:.62em; color:#ffef9a; opacity:.95; font-weight:800;
  text-shadow: 0 0 6px rgba(255,240,140,.35);
}

/* Accent sur le dernier set */
.sets-box .set:last-child{ color: var(--lead); }

/* Jeux */
.game-box{
  padding:0 12px; min-width: 50px;
  font-size: var(--fs-game);
  background: var(--game-bg);
  border-left: 1px solid var(--row-sep);
  color:#eaf2ff;
}

/* Points */
.point-box{
  padding:0 14px; min-width: 54px;
  font-size: var(--fs-point);
  background: var(--point-bg);
  color: var(--point-ink);
  border-left: 1px solid var(--row-sep);
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

/* ===== BARRE “BALLE” SOUS LA LIGNE B (en flux) ===== */
#rowB + #balleBar{
  position: relative;
  width: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  transition: max-height .35s ease, opacity .35s ease, padding .35s ease;

  display: flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(90deg, #ffffff, #eef2ff);
  color:#0f1a2d;
  font-weight:800;
  font-size: clamp(12px,1.2vw,14px);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
#rowB + #balleBar::before{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(120deg, rgba(255,217,92,0) 0%, rgba(255,217,92,.18) 45%, rgba(255,255,255,.12) 55%, rgba(255,255,255,0) 100%);
  transform: translateX(-110%);
  animation: sweep 2.1s linear infinite;
  pointer-events:none;
}
#rowB + #balleBar.show{
  max-height: 26px;
  opacity: 1;
  padding: 4px 16px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
@keyframes sweep{
  0%{ transform: translateX(-120%); }
  60%{ transform: translateX(8%); }
  100%{ transform: translateX(110%); }
}
#rowB:has(+ #balleBar.show){
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
#rowB:has(+ #balleBar.show) .player-name{
  border-bottom-left-radius: 0;
}
#rowB:has(+ #balleBar.show) .point-box{
  border-bottom-right-radius: 0;
  overflow: hidden;
}

/* ===== Responsive ===== */
@media (max-width: 680px){
  :root{ --row-h: 48px; }
  .sets-box{ gap:10px; }
  .game-box{ min-width:46px; padding:0 10px; }
  .point-box{ min-width:50px; padding:0 12px; }
}

/* Accessibilité */
:focus{ outline:none; }

/* Masque d’anciennes barres s’il en reste */
.balle-break-bar, .balle-set-bar, .balle-match-bar{ display:none !important; }

/* ---- Historique (ex: #historyA) étiré comme le reste ---- */
#historyA, #historyB{
  height: 100%;
  display:flex;
  align-items:center;
}
