/* ============================================================================
   VolleyTV overlay — transparent 1920x1080 stage composited over live video.
   Palette is lifted from the BeachTV ffmpeg overlay (navy bars, cream text).
   ============================================================================ */

:root {
  --navy-900: #0c1420;
  --navy-800: #12203a;
  --navy-700: #1d2c46;
  --navy-600: #2a3a55;
  --navy-bar: #2e3a4f;
  --navy-bar-2: #243044;
  --cream: #f6f5ec;
  --muted: #9fb0c6;
  --accent: #ffd23f;        /* serve highlight */
  --accent-soft: #ffe488;
  --setpoint: #e2b35a;      /* set point gold */
  --matchpoint: #d2686f;    /* match point rose (matches reference badge) */
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  --bug-h: 52px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: transparent;          /* critical: overlay is keyed over video */
  font-family: 'Barlow', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 1920px;
  height: 1080px;
}

.hidden { display: none !important; }

/* ============================ SCOREBUG ============================ */

.scorebug {
  position: absolute;
  top: 36px;
  left: 48px;
  display: flex;
  flex-direction: column;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
  animation: bug-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bug-in {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.scorebug__rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: 8px;
  overflow: hidden;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--bug-h);
  min-width: 560px;
  background: linear-gradient(100deg, var(--navy-bar) 0%, var(--navy-bar-2) 100%);
  padding-left: 56px;
  color: var(--cream);
}

/* serve indicator (ball dot) */
.row__serve {
  position: absolute;
  left: 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
}
.row.serving .row__serve {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.25), 0 0 14px 2px rgba(255, 210, 63, 0.6);
}

.row__team {
  flex: 1 1 auto;
  font-family: 'Barlow Condensed', 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
  text-transform: uppercase;
}

/* per-set score columns */
.row__sets {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
}
.set-cell {
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 28px;
  color: #c7d2e0;
  background: rgba(0, 0, 0, 0.16);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}
.set-cell.finished { color: #8595ab; }
.set-cell.active {
  color: #fff;
  background: rgba(255, 210, 63, 0.14);
}

/* set-wins box on the far right */
.row__setwins {
  flex: 0 0 auto;
  width: 56px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 30px;
  color: var(--navy-900);
  background: var(--cream);
}
.row:nth-child(1) .row__setwins { background: #eef0e6; }
.row.match-winner .row__setwins { background: var(--accent); }

/* point badge (SET / MATCH POINT) */
.scorebug__badge {
  align-self: flex-start;
  margin-bottom: 8px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s, height 0.3s;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 2px;
  color: #fff;
  padding: 0 18px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}
.scorebug__badge.show {
  height: 38px;
  opacity: 1;
  transform: translateY(0);
}
.scorebug__badge.setpoint { background: linear-gradient(100deg, var(--setpoint), #b88a2e); }
.scorebug__badge.matchpoint {
  background: linear-gradient(100deg, var(--matchpoint), #b1454d);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 104, 111, 0.0); }
  50%      { box-shadow: 0 0 18px 2px rgba(210, 104, 111, 0.7); }
}

/* ============================ STATS PANEL ============================ */

.stats {
  position: absolute;
  left: 50%;
  top: 220px;
  transform: translateX(-50%);
  width: 1480px;
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 50% 0%, #1a2940 0%, var(--navy-900) 70%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
  padding: 26px 40px 34px;
  color: var(--cream);
  animation: panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateX(-50%) translateY(24px) scale(0.985); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.stats.swap { animation: panel-swap 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes panel-swap {
  0%   { opacity: 0; transform: translateX(-50%) translateY(12px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.stats__title {
  margin: 4px auto 0;
  width: max-content;
  background: #dadbd2;
  color: var(--navy-900);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 3px;
  padding: 6px 34px;
  border-radius: 4px;
}

.stats__head {
  display: flex;
  justify-content: space-between;
  margin: 22px 6px 6px;
}
.stats__player {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 38px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  max-width: 620px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats__player--away { text-align: right; }

.stats__rows { display: flex; flex-direction: column; }
.stat-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 62px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
}
.stat-row:nth-child(odd) { background: rgba(255, 255, 255, 0.022); }
.stat-row__home, .stat-row__away {
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 30px;
}
.stat-row__away { text-align: right; }
.stat-row__label {
  padding: 0 40px;
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
/* the "raw" rows (top results / partners) want smaller, lighter text */
.stat-row.raw .stat-row__home,
.stat-row.raw .stat-row__away {
  font-weight: 500;
  font-size: 24px;
}

/* ============================ PLACEHOLDER ============================ */

.placeholder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--cream);
  animation: panel-in 0.6s ease both;
}
.placeholder__vs {
  margin-top: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 64px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
.placeholder__sep {
  display: inline-block;
  margin: 0 22px;
  color: var(--accent);
  font-size: 40px;
  vertical-align: middle;
}
.placeholder__sub {
  margin-top: 14px;
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ============================ DEBUG PANEL (dev) ============================ */
.debug {
  position: absolute;
  top: 16px;
  right: 16px;
  display: none;
  min-width: 260px;
  padding: 12px 16px;
  font: 600 15px/1.65 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color: #d6e6f5;
  background: rgba(8, 14, 24, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  white-space: pre;
}
.debug.show { display: block; }
.debug h4 {
  margin: 0 0 6px;
  font: 700 13px 'Barlow Condensed', sans-serif;
  letter-spacing: 2px;
  color: #8aa0bd;
  text-transform: uppercase;
}
.debug .k { color: #8aa0bd; }
.debug .v { color: #fff; }
.debug .ok { color: #5fd98a; }
.debug .warn { color: #ffd23f; }
.debug .err { color: #ff7a7a; }
.debug .off { color: #5b6b80; }
