:root {
  --bg-deep: #090a12;
  --bg-card: rgba(18, 19, 30, 0.88);
  --border-glow: rgba(255, 255, 255, 0.12);
  
  /* Madras College (madrascollege.ac.in) Brand Palette */
  --mec-purple: #7052ff;
  --mec-purple-dark: #4f35e0;
  --mec-purple-light: #a5b4fc;
  --boys-primary: #7052ff;
  --boys-secondary: #9078ff;
  --boys-glow: rgba(112, 82, 255, 0.55);

  --mec-coral: #ff7c77;
  --mec-orange: #ff753a;
  --mec-red: #9f2033;
  --girls-primary: #ff7c77;
  --girls-secondary: #ff753a;
  --girls-glow: rgba(255, 124, 119, 0.55);

  --accent-lime: #d4f879;       /* MEC Signature Startup Lime */
  --accent-peach: #ffdeae;      /* MEC Warm Sand / Peach */
  --accent-gold: #ffd700;
  --text-white: #ffffff;
  --text-dim: #9ca3af;
  
  --font-display: 'Fredoka One', cursive, sans-serif;
  --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  font-family: var(--font-ui);
  color: var(--text-white);
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  background: radial-gradient(circle at 50% 20%, #18172e 0%, #090a12 100%);
}

/* ==================== TOP HUD HEADER ==================== */
#hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border-glow);
  z-index: 10;
  gap: 16px;
}

.team-card {
  flex: 1;
  max-width: 330px;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.team-boys {
  border-left: 5px solid var(--boys-primary);
  border-top: 1px solid rgba(112, 82, 255, 0.4);
}

.team-boys.surging {
  box-shadow: 0 0 28px var(--boys-glow);
  transform: translateY(-2px);
}

.team-girls {
  border-right: 5px solid var(--girls-primary);
  border-top: 1px solid rgba(255, 124, 119, 0.4);
}

.team-girls.surging {
  box-shadow: 0 0 28px var(--girls-glow);
  transform: translateY(-2px);
}

.team-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-badge {
  font-family: 'Russo One', var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  font-weight: 900;
}

.team-boys .team-badge {
  color: #a5b4fc;
  text-shadow: 0 0 12px rgba(112, 82, 255, 0.7);
}

.team-girls .team-badge {
  color: #fed7aa;
  text-shadow: 0 0 12px rgba(255, 124, 119, 0.7);
}

.team-mic-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Digital Tournament Match Points Digit Badge */
.team-score-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.score-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}

.score-digit {
  font-family: 'Russo One', var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 900;
}

.team-boys .score-digit {
  color: var(--boys-primary);
  text-shadow: 0 0 8px var(--boys-primary);
}

.team-girls .score-digit {
  color: var(--girls-primary);
  text-shadow: 0 0 8px var(--girls-primary);
}

/* HARDWARE SPL VU METER STYLING */
.meter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meter-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.meter-db-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.db-num {
  font-family: 'Russo One', var(--font-display);
  font-size: 1.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  transition: transform 0.08s ease, text-shadow 0.08s ease;
}

.db-num.screaming {
  transform: scale(1.15);
}

.team-boys .db-num {
  color: #ffffff;
  text-shadow: 0 0 10px var(--boys-primary);
}

.team-boys .db-num.screaming {
  color: var(--accent-lime);
  text-shadow: 0 0 16px var(--accent-lime), 0 0 28px var(--boys-primary);
}

.team-girls .db-num {
  color: #ffffff;
  text-shadow: 0 0 10px var(--girls-primary);
}

.team-girls .db-num.screaming {
  color: var(--accent-lime);
  text-shadow: 0 0 16px var(--accent-lime), 0 0 28px var(--girls-primary);
}

.db-unit {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.meter-peak-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.meter-peak-tag span {
  color: var(--accent-gold);
  font-weight: 900;
}

.meter-bar-outer {
  width: 100%;
  height: 16px;
  background: #090e1d;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}

.meter-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  transition: width 0.04s linear;
}

/* Multi-stage High Dynamic Vocal Gradient (MEC Brand Palette) */
.boys-fill {
  background: linear-gradient(90deg, #4f35e0 0%, #7052ff 40%, #9078ff 65%, #d4f879 85%, #ffffff 100%);
  box-shadow: 0 0 14px var(--boys-glow);
}

.girls-fill {
  background: linear-gradient(90deg, #9f2033 0%, #ff753a 40%, #ff7c77 65%, #ffdeae 85%, #ffffff 100%);
  box-shadow: 0 0 14px var(--girls-glow);
}

/* Floating Peak-Hold Needle that catches highest scream */
.meter-peak-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3.5px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 4;
  left: 0%;
  transition: left 0.03s linear;
}

.boys-needle {
  background: #ffffff;
  box-shadow: 0 0 8px #7052ff, 0 0 12px #ffffff;
}

.girls-needle {
  background: #ffffff;
  box-shadow: 0 0 8px #ff7c77, 0 0 12px #ffffff;
}

/* LED Segmented Tick Marks Overlay */
.meter-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 7px,
    rgba(0, 0, 0, 0.5) 7px,
    rgba(0, 0, 0, 0.5) 9px
  );
  pointer-events: none;
  z-index: 3;
}

.threshold-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2.5px;
  background: #ffea00;
  box-shadow: 0 0 6px #ffea00;
  left: 45%;
  pointer-events: none;
  z-index: 5;
}

/* Meter Scale Ticks */
.meter-scale-ticks {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 6px;
  align-items: center;
  pointer-events: none;
  z-index: 6;
}

.meter-scale-ticks span {
  font-size: 0.55rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-ui);
}

.team-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.sound-points-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.pts-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.pts-val {
  font-family: 'Russo One', var(--font-display);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-lime);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  transition: all 0.2s ease;
}

.team-boys.surging .status-dot {
  background: var(--boys-primary);
  box-shadow: 0 0 8px var(--boys-primary);
}

.team-girls.surging .status-dot {
  background: var(--girls-primary);
  box-shadow: 0 0 8px var(--girls-primary);
}

/* ==================== CENTER MATCH ENGINE & TELEMETRY ==================== */
.race-center-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 380px;
}

.tournament-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.series-pill {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 3px 12px;
  border-radius: 20px;
  background: rgba(212, 248, 121, 0.12);
  border: 1px solid rgba(212, 248, 121, 0.4);
  color: var(--accent-lime);
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(212, 248, 121, 0.15);
}

.series-score-pill {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 1.2px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--accent-gold);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* Championship Wordmark */
.logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.pro-game-logo {
  font-family: 'Russo One', 'Bungee', sans-serif;
  font-size: 2.15rem;
  letter-spacing: 4px;
  margin: 0;
  line-height: 1;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 0%, #d4f879 40%, #7052ff 85%, #4f35e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(112, 82, 255, 0.7));
  transform: skewX(-5deg);
}

.logo-subline {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
}

/* REAL-TIME DYNAMIC TELEMETRY TRACK */
.telemetry-track-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(8, 11, 24, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 10px;
}

.track-markers-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.5px;
}

.telemetry-bar {
  position: relative;
  height: 14px;
  background: #090e1f;
  border-radius: 7px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
  margin: 10px 0 12px;
}

.telemetry-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 6px;
  opacity: 0.75;
  transition: width 0.08s linear;
}

.boys-tele-fill {
  background: linear-gradient(90deg, transparent 0%, rgba(112, 82, 255, 0.4) 50%, var(--boys-primary) 100%);
  z-index: 1;
}

.girls-tele-fill {
  background: linear-gradient(90deg, transparent 0%, rgba(255, 124, 119, 0.4) 50%, var(--girls-primary) 100%);
  z-index: 1;
}

/* Dynamic Lead Pins that physically move along track */
.telemetry-pin {
  position: absolute;
  transform: translateX(-50%);
  z-index: 5;
  transition: left 0.08s linear;
  pointer-events: none;
}

.boys-pin {
  top: -11px;
}

.girls-pin {
  bottom: -11px;
}

.pin-marker-head {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Russo One', sans-serif;
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
}

.boys-head {
  background: var(--boys-primary);
  box-shadow: 0 0 12px var(--boys-glow);
}

.girls-head {
  background: var(--girls-primary);
  box-shadow: 0 0 12px var(--girls-glow);
}

.telemetry-delta-badge {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--accent-gold);
  margin-top: 1px;
}

.distance-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* ==================== GAME STAGE ==================== */
#game-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #020617;
}

#raceCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Announcement Overlay (3, 2, 1, SHOUT!) */
#announcement-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}

#announcement-text {
  font-family: var(--font-display);
  font-size: 7.5rem;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 40px rgba(0, 210, 255, 0.8), 0 0 80px rgba(255, 42, 133, 0.8);
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.2); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==================== BOTTOM TOURNAMENT COMMAND DECK ==================== */
#hud-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: rgba(8, 11, 24, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid var(--border-glow);
  z-index: 10;
  gap: 10px;
}

.console-module {
  background: rgba(18, 22, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 5px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.module-audio {
  flex: 0 0 auto;
}

.module-tuning {
  flex: 0 0 auto;
}

.module-ops {
  flex: 0 0 auto;
}

.module-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.module-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-header-setup {
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--accent-cyan);
  transition: all 0.2s ease;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-header-setup:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: rotate(30deg);
}

.mode-select-pill {
  background: rgba(112, 82, 255, 0.18);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 215, 0, 0.45);
  font-size: 0.68rem;
  font-family: 'Russo One', sans-serif;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 12px;
  outline: none;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
  transition: all 0.2s ease;
}

.mode-select-pill:hover,
.mode-select-pill:focus {
  border-color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.25);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.3);
}

.module-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 1.8px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.module-tag .svg-icon {
  color: var(--accent-lime);
}

.rode-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 215, 0, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 215, 0, 0.45);
  font-size: 0.58rem;
  font-family: 'Russo One', sans-serif;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
  animation: rodePillPulse 2.5s infinite;
  white-space: nowrap;
}

@keyframes rodePillPulse {
  0%, 100% { opacity: 0.85; border-color: rgba(255, 215, 0, 0.45); }
  50% { opacity: 1; border-color: rgba(212, 248, 121, 0.7); color: #d4f879; }
}

.rode-pill.hidden {
  display: none !important;
}

.module-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#hud-footer .btn {
  padding: 5px 8px;
  font-size: 0.72rem;
  border-radius: 7px;
  gap: 4px;
  white-space: nowrap;
}

#hud-footer .console-btn {
  padding: 5px 8px;
  font-size: 0.72rem;
}

#hud-footer .console-btn .svg-icon {
  width: 14px;
  height: 14px;
}

/* Format mini dropdown */
.format-select-mini {
  background: #111827;
  color: var(--accent-lime);
  border: 1px solid rgba(212, 248, 121, 0.35);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: 0.3px;
  outline: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.format-select-mini:hover {
  border-color: var(--accent-lime);
}

#hud-footer .master-cta-btn {
  flex: 0 0 auto;
  justify-content: center;
  padding: 5px 10px;
  font-size: 0.74rem;
  letter-spacing: 0.4px;
  gap: 5px;
}

#hud-footer .master-cta-btn .svg-icon {
  width: 14px;
  height: 14px;
}

#hud-footer .btn-auto-calib {
  padding: 4px 7px;
  font-size: 0.66rem;
  font-weight: 800;
  border-radius: 6px;
  letter-spacing: 0.3px;
  gap: 4px;
}

#hud-footer .btn-auto-calib .svg-icon {
  width: 13px;
  height: 13px;
}

#hud-footer .btn-icon {
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 0.85rem;
}

#hud-footer .btn-icon .svg-icon {
  width: 15px;
  height: 15px;
}

/* Quick Mic Assignment Bar in Deck Bay 1 */
.quick-mic-selector-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 5px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-mic-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mic-label-badge {
  font-family: 'Russo One', var(--font-display);
  font-size: 0.68rem;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.boys-tag {
  background: rgba(112, 82, 255, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(112, 82, 255, 0.45);
}

.girls-tag {
  background: rgba(255, 124, 119, 0.25);
  color: #fed7aa;
  border: 1px solid rgba(255, 124, 119, 0.45);
}

.shared-tag {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
  font-size: 0.6rem;
  width: 28px;
}

.mode-select-mini {
  background: #0f172a;
  color: var(--accent-gold);
  border: 1px solid rgba(255, 215, 0, 0.35);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
}

.mode-select-mini:hover {
  border-color: var(--accent-gold);
}

.mic-mini-select {
  background: #111827;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 2px 4px;
  border-radius: 5px;
  font-size: 0.69rem;
  font-family: var(--font-ui);
  width: 68px;
  max-width: 80px;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mic-mini-select:hover,
.mic-mini-select:focus {
  border-color: var(--accent-lime);
  background: #1f2937;
}

.mic-shared-select {
  width: 175px;
  max-width: 220px;
}

.quick-keyboard-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.kbd-pill {
  font-family: 'Russo One', sans-serif;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}

.kbd-boys {
  background: rgba(112, 82, 255, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(112, 82, 255, 0.5);
}

.kbd-girls {
  background: rgba(255, 124, 119, 0.25);
  color: #fed7aa;
  border: 1px solid rgba(255, 124, 119, 0.5);
}

.btn-swap {
  padding: 3px 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  color: var(--accent-gold);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-swap:hover {
  transform: scale(1.15) rotate(180deg);
  background: rgba(255, 215, 0, 0.2);
}

.btn-audio-setup {
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.btn-audio-setup:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

/* Acoustic Tuning Sliders */
.quick-slider-group {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
}

.quick-slider-group input[type="range"] {
  width: 36px;
  accent-color: var(--accent-lime);
  cursor: pointer;
}

.quick-slider-group span {
  min-width: 25px;
  color: var(--text-white);
  font-weight: 800;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

/* Deck Split / Linked Calibration Controls */
.calib-deck-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calib-mode-pill {
  cursor: pointer;
  transition: all 0.2s ease;
}

.calib-mode-pill.split-active {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
}

.split-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.split-range {
  width: 36px;
  cursor: pointer;
  accent-color: var(--accent-lime);
}

/* SVG Icon Global Utilities */
.svg-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.svg-tiny {
  width: 12px;
  height: 12px;
}

.svg-sm {
  width: 15px;
  height: 15px;
}

.svg-gold {
  color: var(--accent-gold);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  letter-spacing: 0.5px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #7052ff, #4f35e0);
  color: #fff;
  box-shadow: 0 4px 15px rgba(112, 82, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-success {
  background: linear-gradient(135deg, #d4f879, #a8e844);
  color: #111216;
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(212, 248, 121, 0.45);
}

.glow-btn {
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 10px rgba(212, 248, 121, 0.4); }
  50% { box-shadow: 0 0 25px rgba(212, 248, 121, 0.85); transform: scale(1.02); }
  100% { box-shadow: 0 0 10px rgba(212, 248, 121, 0.4); }
}

.btn-icon {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.1rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.15rem;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 15, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
}

.modal-card {
  background: #111827;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 90%;
  max-width: 650px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { transform: scale(0.92) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-close:hover { color: #fff; }

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section h3 {
  font-size: 1rem;
  color: var(--accent-gold);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-help {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: 10px;
}

.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
}

.form-select {
  background: #1f2937;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  max-width: 280px;
}

.calib-meters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.calib-box {
  background: #1f2937;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.calib-title {
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.calib-boys .calib-title { color: var(--boys-primary); }
.calib-girls .calib-title { color: var(--girls-primary); }

.calib-val {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.calib-bar-wrapper {
  height: 12px;
  background: #0f172a;
  border-radius: 6px;
  overflow: hidden;
}

.calib-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.05s ease;
}

.calib-boys .calib-bar-fill { background: var(--boys-primary); }
.calib-girls .calib-bar-fill { background: var(--girls-primary); }

.calib-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.calib-header-row .calib-title {
  margin-bottom: 0;
}

.calib-header-row .calib-val {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0;
}

.modal-channel-controls {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 10px;
  border-radius: 8px;
}

.modal-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
}

.modal-slider-row label {
  width: 36px;
  font-size: 0.74rem;
  color: #94a3b8;
  font-weight: 800;
}

.modal-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent-lime);
  cursor: pointer;
}

.calib-boys .modal-slider-row input[type="range"] {
  accent-color: var(--boys-primary);
}

.calib-girls .modal-slider-row input[type="range"] {
  accent-color: var(--girls-primary);
}

.modal-slider-row span {
  width: 44px;
  text-align: right;
  font-size: 0.76rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.tws-tip-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 14px;
  margin-bottom: 12px;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #e2e8f0;
}

.tws-tip-card svg {
  margin-top: 2px;
}

/* RØDE Wireless GO II Dedicated Optimization Card */
.rode-optimization-card {
  background: linear-gradient(135deg, rgba(22, 28, 48, 0.95), rgba(16, 20, 36, 0.95));
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), inset 0 0 20px rgba(255, 215, 0, 0.03);
}

.rode-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rode-card-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rode-card-brand .svg-gold {
  width: 24px;
  height: 24px;
  fill: var(--accent-gold);
  flex-shrink: 0;
}

.rode-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.rode-title-row h4 {
  font-family: 'Russo One', sans-serif;
  font-size: 0.88rem;
  color: #fff;
  letter-spacing: 0.4px;
  margin: 0;
}

.rode-status-tag {
  font-family: 'Russo One', sans-serif;
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.rode-status-tag.detected {
  background: rgba(212, 248, 121, 0.18);
  color: #d4f879;
  border-color: rgba(212, 248, 121, 0.45);
  box-shadow: 0 0 10px rgba(212, 248, 121, 0.25);
}

.rode-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.3;
}

.btn-rode-preset {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(212, 248, 121, 0.22));
  color: #fff;
  border: 1px solid rgba(255, 215, 0, 0.5);
  font-family: 'Russo One', sans-serif;
  font-size: 0.74rem;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-rode-preset:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.38), rgba(212, 248, 121, 0.38));
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.35);
  transform: translateY(-1px);
}

.rode-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 2px;
}

@media (max-width: 600px) {
  .rode-steps-grid {
    grid-template-columns: 1fr;
  }
}

.rode-step-item {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.rode-step-num {
  font-family: 'Russo One', sans-serif;
  font-size: 0.72rem;
  color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.rode-step-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.71rem;
  line-height: 1.35;
  color: #cbd5e1;
}

.rode-step-content strong {
  color: #f1f5f9;
  font-size: 0.74rem;
}

.rode-step-content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
  color: #d4f879;
  font-size: 0.68rem;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--accent-gold);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: 'Russo One', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 215, 0, 0.3);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  animation: toastPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

@keyframes toastPop {
  0% { transform: translateX(-50%) translateY(16px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.modal-footer {
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

/* ==================== VICTORY / ROUND RESULTS MODAL ==================== */
.victory-card {
  text-align: center;
  padding: 30px 24px;
  background: radial-gradient(circle at 50% 10%, #1e243d, #0b0e1b);
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.25);
  max-width: 620px;
}

.victory-series-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--accent-lime);
  background: rgba(212, 248, 121, 0.1);
  border: 1px solid rgba(212, 248, 121, 0.3);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.confetti-cannon {
  margin-bottom: 6px;
  animation: bounce 0.8s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.victory-heading {
  font-family: 'Russo One', var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.winner-trophy {
  margin: 6px 0 10px;
  filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.5));
}

.victory-sub {
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.victory-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-family: 'Russo One', var(--font-display);
  font-size: 1.15rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.stat-boys-val {
  color: #a5b4fc;
}

.stat-girls-val {
  color: #fed7aa;
}

/* Series Round Breakdown Table */
.series-history-box {
  background: rgba(8, 11, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  text-align: left;
}

.history-table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-table-title {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--accent-gold);
  text-transform: uppercase;
}

.history-table-rule {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.history-table-wrapper {
  max-height: 140px;
  overflow-y: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.history-table th {
  padding: 6px 8px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-variant-numeric: tabular-nums;
}

.winner-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
}

.winner-boys {
  background: rgba(112, 82, 255, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(112, 82, 255, 0.5);
}

.winner-girls {
  background: rgba(255, 124, 119, 0.25);
  color: #fed7aa;
  border: 1px solid rgba(255, 124, 119, 0.5);
}

.victory-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.hidden {
  display: none !important;
}

/* Responsiveness for smaller screens */
@media (max-width: 900px) {
  #hud-header {
    flex-direction: column;
    padding: 8px 12px;
  }
  .team-card {
    max-width: 100%;
    width: 100%;
  }
  #hud-footer {
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 12px;
  }
}
