/* ==========================================================================
   Base Design System & CSS Variables
   ========================================================================== */
:root {
  --pitch-bg-start: #043e3c;
  --pitch-bg-end: #022221;
  --accent-color: #009e9d;
  --header-bg: #141414;
  --logo-bg: #0d8b5c;
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Outfit', sans-serif;
  
  --control-panel-bg: rgba(20, 20, 20, 0.85);
  --control-panel-border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.15);
  --input-focus: #009e9d;
  
  --transition-smooth: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-bounce: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: transparent;
  color: var(--text-primary);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* ==========================================================================
   1920x1080 Overlay Container (Autoscale)
   ========================================================================== */
.overlay-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1920px;
  height: 1080px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  overflow: hidden;
  background-color: transparent;
}

.overlay-content {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%; /* 1536px */
  height: 80%; /* 864px */
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  z-index: 2;
  display: flex;
  flex-direction: column;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

/* ==========================================================================
   Soccer Pitch Background
   ========================================================================== */
.soccer-pitch-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--pitch-bg-start) 0%, var(--pitch-bg-end) 100%);
  z-index: 1;
  transition: var(--transition-smooth);
}

/* Scanline / Grass texture overlay for realism */
.soccer-pitch-bg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.08),
    rgba(0, 0, 0, 0.08) 40px,
    rgba(255, 255, 255, 0.02) 40px,
    rgba(255, 255, 255, 0.02) 80px
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* ==========================================================================
   Header Section (Top Bar & Brand)
   ========================================================================== */
.overlay-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 110px; /* Reduced height */
  display: flex;
  align-items: stretch;
  background-color: var(--header-bg);
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.logo-wrapper {
  width: 120px; /* Reduced width */
  background-color: var(--logo-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: var(--transition-smooth);
}

.logo-container {
  width: 80px; /* Reduced width */
  height: 80px; /* Reduced height */
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-svg, .logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.title-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 40px;
  position: relative;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.team-name {
  font-family: var(--font-display);
  font-size: 38px; /* Reduced font-size */
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-primary);
  margin-bottom: 2px;
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.team-badge {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-color);
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: var(--transition-smooth);
  margin-bottom: 6px;
}

.subtitle-bar {
  background-color: var(--accent-color);
  margin-left: -40px; /* span over the spacing */
  padding: 5px 40px;
  width: calc(100% + 40px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  transition: var(--transition-smooth);
}

.team-subtitle {
  font-family: var(--font-body);
  font-size: 18px; /* Reduced font-size */
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 1px;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.overlay-main {
  position: absolute;
  top: 110px; /* Aligned with header height */
  left: 0;
  width: 100%;
  height: calc(100% - 110px);
  display: flex;
  z-index: 5;
}

/* Left Column: Titulares List */
.lineup-list-panel {
  width: 280px; /* Reduced width */
  height: 100%;
  padding: 30px 10px 30px 30px; /* Reduced padding */
  display: flex;
  flex-direction: column;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 22px; /* Reduced font-size */
  font-weight: 700;
  margin-bottom: 20px; /* Reduced margin */
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.titulares-list {
  display: flex;
  flex-direction: column;
  gap: 12px; /* Reduced gap */
  overflow: hidden;
}

.titulares-item {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 20px; /* Reduced font-size */
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transform: translateX(0);
  opacity: 1;
}

.titulares-number {
  width: 40px; /* Reduced width */
  font-size: 24px; /* Reduced font-size */
  font-weight: 900;
  color: var(--text-primary);
  margin-right: 12px;
  text-align: right;
  transition: var(--transition-smooth);
}

.titulares-name {
  letter-spacing: 1.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Suplentes (substitutes) — same list style, smaller/dimmer than titulares */
.suplentes-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.suplentes-title {
  font-size: 15px;
  margin-bottom: 12px;
}

.suplentes-list {
  gap: 8px;
}

.suplente-item {
  font-size: 14px;
  opacity: 0.8;
}

.suplente-item .titulares-number {
  font-size: 17px;
  width: 32px;
}

/* Right Column: Tactical Pitch Container */
.pitch-tactical-panel {
  flex: 1;
  height: 100%;
  position: relative;
}

/* Court lines container: one block per sport, only the one matching the
   .sport-<x> class on .pitch-tactical-panel is shown at a time */
.court-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  display: none;
}

.pitch-tactical-panel.sport-futbol .lines-futbol,
.pitch-tactical-panel.sport-futsal .lines-futsal,
.pitch-tactical-panel.sport-basquetbol .lines-basquetbol,
.pitch-tactical-panel.sport-voleibol .lines-voleibol {
  display: block;
}

/* Soccer Field Lines drawing (perfectly aligned with coordinate system) */
.pitch-outer-border {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-bottom: none; /* Center line is the bottom border */
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.pitch-penalty-area {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 42%; /* perfectly proportioned centered area */
  height: 32%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top: none;
  transform: translateX(-50%);
  pointer-events: none;
}

.pitch-goal-area {
  position: absolute;
  top: 0;
  left: 50%;
  width: 44%;
  height: 36%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top: none;
  transform: translateX(-50%);
  pointer-events: none;
}

.pitch-penalty-spot {
  position: absolute;
  bottom: 50px;
  left: 50%;
  width: 8px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.pitch-half-circle {
  position: absolute;
  bottom: -45px;
  left: 50%;
  width: 200px;
  height: 100px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 100px 100px 0 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.pitch-center-line {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  height: 2.5px;
  background-color: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

/* Futsal court lines (smaller goal area/arcs than soccer) */
.fs-outer-border {
  position: absolute;
  top: 20px; left: 20px; right: 20px; bottom: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-bottom: none;
}
.fs-goal-area {
  position: absolute;
  top: 20px; left: 50%;
  width: 34%; height: 20%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top: none;
  transform: translateX(-50%);
}
.fs-penalty-spot {
  position: absolute;
  top: 150px; left: 50%;
  width: 8px; height: 8px;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: translateX(-50%);
}
.fs-half-circle {
  position: absolute;
  bottom: -30px; left: 50%;
  width: 140px; height: 70px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 70px 70px 0 0;
  transform: translateX(-50%);
}
.fs-center-line {
  position: absolute;
  bottom: 20px; left: 20px; right: 20px;
  height: 2.5px;
  background-color: rgba(255, 255, 255, 0.25);
}

/* Basketball court lines (key/paint, free-throw circle, approximated 3pt arc) */
.bk-outer-border {
  position: absolute;
  top: 20px; left: 20px; right: 20px; bottom: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-bottom: none;
}
.bk-key {
  position: absolute;
  top: 20px; left: 50%;
  width: 30%; height: 34%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top: none;
  transform: translateX(-50%);
}
.bk-ft-circle {
  position: absolute;
  top: calc(20px + 34% - 45px); left: 50%;
  width: 90px; height: 90px;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translateX(-50%);
}
.bk-arc {
  position: absolute;
  top: -260px; left: 50%;
  width: 560px; height: 560px;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  transform: translateX(-50%);
}
.bk-half-circle {
  position: absolute;
  bottom: -45px; left: 50%;
  width: 200px; height: 100px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 100px 100px 0 0;
  transform: translateX(-50%);
}
.bk-center-line {
  position: absolute;
  bottom: 20px; left: 20px; right: 20px;
  height: 2.5px;
  background-color: rgba(255, 255, 255, 0.25);
}

/* Volleyball court lines (no center circle; net + attack lines instead) */
.vb-outer-border {
  position: absolute;
  top: 20px; left: 20px; right: 20px; bottom: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
}
.vb-net-line {
  position: absolute;
  bottom: 20px; left: 10px; right: 10px;
  height: 6px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 10px, transparent 10px 20px);
}
.vb-attack-line-far {
  position: absolute;
  top: calc(20px + 30%); left: 20px; right: 20px;
  border-top: 2px dashed rgba(255, 255, 255, 0.25);
}
.vb-attack-line-near {
  position: absolute;
  bottom: calc(20px + 30%); left: 20px; right: 20px;
  border-top: 2px dashed rgba(255, 255, 255, 0.25);
}

.field-players-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Player Nodes on Field
   ========================================================================== */
.field-player-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  z-index: 10;
  cursor: pointer;
  filter: drop-shadow(0 10px 15px rgba(0,0,0,0.4));
}

.player-avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 3px solid #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: var(--transition-smooth);
  margin-bottom: 8px;
}

.field-player-node:hover .player-avatar-wrapper {
  transform: scale(1.1);
  box-shadow: 0 0 30px var(--accent-color);
  border-color: var(--accent-color);
}

.player-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback default player icon */
.player-avatar-default {
  width: 60%;
  height: 60%;
  fill: #ffffff;
  opacity: 0.8;
}

.player-info-tag {
  background: rgba(10, 30, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  padding: 4px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  transition: var(--transition-smooth);
}

.field-player-node:hover .player-info-tag {
  background: var(--accent-color);
  border-color: #fff;
}

.player-node-number {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  color: var(--accent-color);
  transition: var(--transition-smooth);
}

.field-player-node:hover .player-node-number {
  color: #ffffff;
}

.player-node-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Selected / Highlighted Player (persistent, synced to OBS)
   ========================================================================== */
@keyframes selected-pulse {
  0%, 100% { box-shadow: 0 0 18px var(--accent-color); }
  50%      { box-shadow: 0 0 42px var(--accent-color), 0 0 70px var(--accent-color); }
}

.field-player-node.selected {
  z-index: 20;
}

.field-player-node.selected .player-avatar-wrapper {
  transform: scale(1.15);
  border-color: var(--accent-color);
  animation: selected-pulse 1.6s ease-in-out infinite;
}

.field-player-node.selected .player-info-tag {
  background: var(--accent-color);
  border-color: #ffffff;
}

.field-player-node.selected .player-node-number {
  color: #ffffff;
}

.titulares-item {
  cursor: pointer;
}

.titulares-item.selected .titulares-number {
  color: var(--accent-color);
}

.titulares-item.selected .titulares-name {
  color: var(--accent-color);
  text-shadow: 0 0 14px var(--accent-color);
}

/* Splay float animations for nodes on field to look alive */
@keyframes float {
  0% { transform: translate(-50%, calc(-50% - 0px)); }
  50% { transform: translate(-50%, calc(-50% - 6px)); }
  100% { transform: translate(-50%, calc(-50% - 0px)); }
}

.field-player-node.animate-float {
  /* Dynamic staggered floating via animation delay in script */
  animation: float 4s ease-in-out infinite;
}

/* ==========================================================================
   Overlay Intro & Outro Animations
   ========================================================================== */

/* State BEFORE INTRO / AFTER OUTRO */
.overlay-wrapper.state-out .overlay-content {
  transform: scale(0.95);
  opacity: 0;
}

.overlay-wrapper.state-out .overlay-header {
  transform: translateY(-100%);
  opacity: 0;
}

.overlay-wrapper.state-out .lineup-list-panel {
  transform: translateX(-80px);
  opacity: 0;
}

.overlay-wrapper.state-out .pitch-outer-border,
.overlay-wrapper.state-out .pitch-penalty-area,
.overlay-wrapper.state-out .pitch-goal-area,
.overlay-wrapper.state-out .pitch-half-circle,
.overlay-wrapper.state-out .pitch-center-line {
  opacity: 0;
}

.overlay-wrapper.state-out .titulares-item {
  transform: translateX(-40px);
  opacity: 0;
}

.overlay-wrapper.state-out .field-player-node {
  /* animation:none — la animación float pisaría el transform y el nodo no se encogería */
  animation: none;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

/* Transition speed classes */
.overlay-content {
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

.overlay-header {
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

.lineup-list-panel {
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

.titulares-item {
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.6s ease;
}

.field-player-node {
  /* Using standard cubic-bezier for spring-like bounce popup */
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.7s ease, left 0.8s ease-in-out, top 0.8s ease-in-out;
}

/* ==========================================================================
   Control Panel Button (Invisible/Faint)
   ========================================================================== */
.btn-toggle-control {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 100;
  opacity: 0.1; /* Almost invisible on stream */
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.btn-toggle-control:hover {
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.8);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px var(--accent-color);
}

/* ==========================================================================
   Scoreboard Bug (independent bar: both teams always shown + live clock)
   ========================================================================== */
.scoreboard-bar {
  /* Kept short on purpose: top(14) + row-main(~52) + gap(6) + row-clock(~24) ≈ 96px,
     comfortably above the lineup card's top edge at 10% of 1080px = 108px, since
     both can be on screen at the same time (scoreboard persists, lineup comes and goes). */
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 1;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.scoreboard-bar.scoreboard-hidden {
  opacity: 0;
  transform: translate(-50%, -40px);
  pointer-events: none;
}

.scoreboard-row-main {
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.scoreboard-team {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  min-width: 200px;
}

.scoreboard-home {
  background: linear-gradient(90deg, var(--scoreboard-home-color, #009e9d), rgba(0, 0, 0, 0.3));
  justify-content: flex-start;
}

.scoreboard-away {
  background: linear-gradient(270deg, var(--scoreboard-away-color, #e30613), rgba(0, 0, 0, 0.3));
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.scoreboard-logo-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.scoreboard-logo-default,
.scoreboard-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scoreboard-team-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.scoreboard-score-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0a1414;
  padding: 7px 22px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.scoreboard-score {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  min-width: 30px;
  text-align: center;
}

.scoreboard-score-sep {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 700;
}

.scoreboard-row-clock {
  background: rgba(10, 20, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 2px 18px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.scoreboard-clock {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

/* ==========================================================================
   Control Panel / Configuration Drawer (Glassmorphic)
   ========================================================================== */
.control-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 460px;
  height: 100vh;
  background: var(--control-panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-left: 1px solid var(--control-panel-border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateX(0); /* shown */
}

.control-panel.hidden {
  transform: translateX(100%);
  pointer-events: none; /* Make sure it doesn't receive clicks when hidden */
}

.control-panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--control-panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-panel-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.btn-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-close:hover {
  color: #ffffff;
}

.control-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Team switcher tabs (Local / Visitante) */
.team-tabs {
  display: flex;
  gap: 8px;
}

.team-tab {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--control-panel-border);
  color: #ccc;
  padding: 10px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.team-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.team-tab.active-tab {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(0, 158, 157, 0.4);
}

/* Scoreboard controls inside the panel */
.scoreboard-panel-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.score-stepper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--control-panel-border);
  border-radius: 6px;
  padding: 10px;
}

.score-stepper label {
  font-size: 11px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-stepper-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-stepper-value {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  min-width: 28px;
  text-align: center;
}

.btn-score-step {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-score-step:hover {
  background: #00bfbd;
}

.clock-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.clock-panel-value {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  min-width: 60px;
}

.clock-panel-buttons {
  display: flex;
  gap: 8px;
}

.clock-panel-buttons button {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 13px;
}

/* Styles for Forms in Control Panel */
.control-section {
  border: 1px solid var(--control-panel-border);
  border-radius: 8px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
}

.control-section legend {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-color);
  padding: 0 8px;
  margin-left: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #bbb;
}

.form-group input[type="text"],
.form-group select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 10px;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  border-color: var(--input-focus);
  outline: none;
}

.form-group input[type="file"] {
  color: #ccc;
  font-size: 12px;
  padding: 5px 0;
}

.btn-secondary.btn-xs {
  font-size: 11px;
  padding: 5px 10px;
  margin-top: 5px;
  align-self: flex-start;
}

/* Color inputs row */
.color-pickers-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.color-group label {
  text-align: center;
  font-size: 10px;
}

.color-group input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

/* Roster Editor inputs */
.player-inputs-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

.player-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-input-index {
  font-size: 11px;
  color: #777;
  width: 16px;
  font-weight: 700;
}

.input-player-number {
  width: 45px !important;
  text-align: center;
  padding: 6px !important;
}

.input-player-name {
  flex: 1;
  padding: 6px !important;
}

.player-image-upload-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease;
}

.player-image-upload-wrapper:hover {
  border-color: var(--accent-color);
  background: rgba(0, 168, 150, 0.1);
}

.player-image-upload-wrapper svg {
  width: 16px;
  height: 16px;
  fill: #aaa;
}

.player-image-upload-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.input-player-file {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Footer & Actions button styling */
.control-panel-footer {
  padding: 20px;
  border-top: 1px solid var(--control-panel-border);
  background: rgba(0,0,0,0.1);
}

.actions-row {
  display: flex;
  gap: 10px;
}

.mt-2 {
  margin-top: 8px;
}

button {
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 14px;
  padding: 10px 15px;
}

.btn-primary {
  background: var(--accent-color);
  color: #fff;
  flex: 1;
}

.btn-primary:hover {
  background: #00bfbd;
  box-shadow: 0 0 10px rgba(0, 191, 189, 0.4);
}

.btn-danger {
  background: #dc3545;
  color: #fff;
  flex: 1;
}

.btn-danger:hover {
  background: #bd2130;
}

.btn-success {
  background: #28a745;
  color: #fff;
  flex: 1;
}

.btn-success:hover {
  background: #218838;
}

.btn-secondary {
  background: #495057;
  color: #fff;
  flex: 1;
}

.btn-secondary:hover {
  background: #343a40;
}

.keyboard-hint {
  font-size: 11px;
  color: #777;
  margin-top: 15px;
  text-align: center;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

.section-help {
  font-size: 11px;
  color: #888;
  margin-bottom: 12px;
}

/* Custom Scrollbar for Drawer Panel */
.control-panel-body::-webkit-scrollbar,
.player-inputs-container::-webkit-scrollbar {
  width: 6px;
}

.control-panel-body::-webkit-scrollbar-track,
.player-inputs-container::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
}

.control-panel-body::-webkit-scrollbar-thumb,
.player-inputs-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

.control-panel-body::-webkit-scrollbar-thumb:hover,
.player-inputs-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Control Status Messages styling */
.control-status {
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 15px;
  font-size: 13px;
  text-align: center;
  font-weight: 600;
  transition: all 0.3s ease;
}

.control-status.success {
  background-color: rgba(40, 167, 69, 0.15);
  border: 1px solid #28a745;
  color: #2baf49;
}

.control-status.info {
  background-color: rgba(0, 158, 157, 0.15);
  border: 1px solid #009e9d;
  color: #00bfbd;
}

.control-status.warning {
  background-color: rgba(220, 53, 69, 0.15);
  border: 1px solid #dc3545;
  color: #ea4354;
}

/* OBS Integration drag link */
.obs-drag-link {
  display: block;
  text-align: center;
  color: var(--accent-color);
  font-weight: 700;
  text-decoration: none;
  font-size: 13px;
  border: 1px dashed var(--accent-color);
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: grab;
}

.obs-drag-link:hover {
  background: rgba(0, 158, 157, 0.1);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 158, 157, 0.2);
}

.obs-drag-link:active {
  cursor: grabbing;
}
