/* ==========================================================================
   COLORRACE — CYBER-ARCADE STYLESHEET
   Design System: Glassmorphism, Neon Esports, High Precision Micro-Animations
   ========================================================================== */

:root {
  --bg-primary: #0a0c16;
  --bg-secondary: #121526;
  --bg-tertiary: #1a1e36;
  --panel-bg: rgba(18, 22, 40, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-glow: rgba(0, 240, 255, 0.25);
  
  --text-main: #f0f3ff;
  --text-muted: #8b92b3;
  --text-dim: #545b7e;

  /* Accent Colors */
  --accent-cyan: #00f0ff;
  --accent-pink: #ff007f;
  --accent-crimson: #ff2e63;
  --accent-lime: #39ff14;
  --accent-amber: #ffe600;
  --accent-purple: #9d4edd;
  --accent-orange: #ff7700;
  --accent-blue: #2979ff;

  --p1-theme: #ff2e63;
  --p2-theme: #00f0ff;

  --danger-color: #ff3366;
  --success-color: #00e676;
  --warning-color: #ffab00;

  --font-display: 'Chakra Petch', sans-serif;
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-glow-cyan: 0 0 25px rgba(0, 240, 255, 0.35);
  --shadow-glow-pink: 0 0 25px rgba(255, 0, 127, 0.35);
  --shadow-glass: 0 16px 36px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* ==========================================================================
   AMBIENT BACKGROUND & CANVAS
   ========================================================================== */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  transition: all 1.2s ease;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-pink) 0%, transparent 70%);
  top: -150px;
  left: -100px;
  animation: floatGlow 14s infinite alternate ease-in-out;
}

.glow-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation: floatGlow 16s infinite alternate-reverse ease-in-out;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 60px) scale(0.95); }
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
}

#particles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ==========================================================================
   APP CONTAINER & LAYOUT
   ========================================================================== */
.app-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.brand-title .highlight {
  color: var(--accent-cyan);
  text-shadow: var(--shadow-glow-cyan);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.pill-btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.pill-btn.highlight {
  background: linear-gradient(135deg, var(--accent-cyan), #00a8ff);
  color: #050814;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 240, 255, 0.35);
}

.pill-btn.highlight:hover {
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.55);
  transform: translateY(-2px) scale(1.02);
}

.pill-btn.danger:hover {
  background: rgba(255, 51, 102, 0.2);
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   SCREENS & PANELS
   ========================================================================== */
.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen-view {
  display: none;
  flex: 1;
  width: 100%;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen-view.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
}

/* ==========================================================================
   SCREEN 1: SETUP & COLOR LOCK-IN
   ========================================================================== */
.setup-card {
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}

.setup-header {
  text-align: center;
}

.section-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.mode-toggle-group, .rounds-group, .difficulty-group {
  display: flex;
  gap: 8px;
}

.mode-btn, .round-opt-btn, .diff-btn {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-btn .icon {
  font-size: 18px;
}

.mode-btn:hover, .round-opt-btn:hover, .diff-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-btn.active, .round-opt-btn.active, .diff-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}

.diff-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.diff-btn {
  padding: 8px 6px;
}

.diff-title {
  font-size: 12px;
  font-weight: 700;
}

.diff-speed {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.diff-btn.active .diff-speed {
  color: var(--accent-cyan);
}

.diff-btn.cyber.active {
  border-color: var(--accent-pink);
  background: rgba(255, 0, 127, 0.18);
  box-shadow: 0 0 16px rgba(255, 0, 127, 0.3);
}

.diff-btn.cyber.active .diff-speed {
  color: var(--accent-pink);
}

/* Color Selection Arena */
.color-selection-arena {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-pick-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.p1-badge { color: var(--accent-crimson); }
.p2-badge { color: var(--accent-cyan); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.p1-dot { background: var(--accent-crimson); box-shadow: 0 0 10px var(--accent-crimson); }
.p2-dot { background: var(--accent-cyan); box-shadow: 0 0 10px var(--accent-cyan); }

.selected-color-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preview-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.preview-color-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.palette-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 200px;
}

.swatch-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.swatch-btn:hover:not(:disabled) {
  transform: scale(1.12);
  z-index: 2;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.swatch-btn.selected {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.6);
}

.swatch-btn:disabled {
  opacity: 0.18;
  cursor: not-allowed;
  filter: grayscale(80%);
}

.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-badge {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  padding: 8px 12px;
  border-radius: var(--radius-full);
}

/* Start Button */
.setup-actions {
  display: flex;
  justify-content: center;
}

.cta-start-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  padding: 18px 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #00f0ff 0%, #7000ff 100%);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 8px 30px rgba(0, 240, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cta-start-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 240, 255, 0.6);
}

.cta-start-btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-subtext {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   ONLINE 1v1 WEBRTC LOBBY STYLES
   ========================================================================== */
.online-lobby-panel {
  background: linear-gradient(180deg, rgba(14, 18, 36, 0.95) 0%, rgba(10, 12, 22, 0.98) 100%);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 240, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lobby-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 14px;
}

.lobby-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulseGlow 1.5s infinite alternate;
}

.live-dot.connected {
  background: var(--success-color);
  box-shadow: 0 0 12px var(--success-color);
}

.live-dot.error {
  background: var(--danger-color);
  box-shadow: 0 0 12px var(--danger-color);
}

@keyframes pulseGlow {
  from { opacity: 0.5; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.15); }
}

.lobby-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
}

.webrtc-tech-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.lobby-subtabs {
  display: flex;
  gap: 12px;
}

.lobby-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lobby-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lobby-tab-btn.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.lobby-view-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.lobby-view-pane.active {
  display: flex;
}

.room-display-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.room-code-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.code-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
}

.room-code-badge {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent-cyan);
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.share-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.lobby-radar-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: rgba(0, 240, 255, 0.04);
  border: 1px dashed rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-sm);
}

.radar-pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan);
  animation: radarSweep 1.8s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes radarSweep {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.radar-text {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

/* Join Card */
.join-input-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.join-input-row {
  display: flex;
  gap: 12px;
}

.cyber-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 16px;
  color: #fff;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  user-select: text;
  -webkit-user-select: text;
}

.cyber-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
}

.cyber-input::placeholder {
  color: var(--text-dim);
  font-family: var(--font-sans);
  letter-spacing: 0;
  font-size: 14px;
}

.cta-join-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.5px;
  padding: 0 28px;
  background: linear-gradient(135deg, var(--accent-cyan), #00a8ff);
  color: #050814;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
  transition: all 0.2s ease;
}

.cta-join-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.5);
}

.join-status-feedback {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Connected Roster Card */
.connected-roster-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: rgba(0, 230, 118, 0.05);
  border: 1px solid rgba(0, 230, 118, 0.25);
  border-radius: var(--radius-md);
  gap: 16px;
}

.roster-player-slot {
  display: flex;
  align-items: center;
  gap: 12px;
}

.roster-role-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.roster-role-badge.p1-role {
  background: rgba(255, 46, 99, 0.15);
  color: var(--accent-crimson);
  border: 1px solid rgba(255, 46, 99, 0.4);
}

.roster-role-badge.p2-role {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.roster-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.roster-center-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ping-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 230, 118, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--success-color);
}

.ping-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
}

.beam-sub {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.guest-ready-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(255, 230, 0, 0.08);
  border: 1px solid rgba(255, 230, 0, 0.25);
  border-radius: var(--radius-md);
}

.ready-toggle-btn.is-ready {
  background: linear-gradient(135deg, var(--success-color), #00c853);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

.ready-hint {
  font-size: 13px;
  color: var(--accent-amber);
  font-weight: 500;
}

/* HUD Network Badge */
.hud-net-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 230, 118, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--success-color);
  margin-bottom: 2px;
}

.net-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
}

/* ==========================================================================
   SCREEN 2: BATTLE ARENA (HUD & STAGE)
   ========================================================================== */
.hud-bar {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  align-items: center;
  padding: 16px 24px;
  margin-bottom: 24px;
}

.hud-player {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.hud-p1.winner-highlight {
  border-color: var(--p1-theme);
  box-shadow: 0 0 20px rgba(255, 46, 99, 0.4);
}

.hud-p2.winner-highlight {
  border-color: var(--p2-theme);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.hud-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 8px currentColor;
}

.hud-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
}

.hud-score-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hud-score-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  color: #fff;
}

.hud-score-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.hud-status-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.hud-p2 {
  align-items: flex-end;
  text-align: right;
}

.hud-p2 .hud-avatar {
  flex-direction: row-reverse;
}

.hud-p2 .hud-score-display {
  flex-direction: row-reverse;
}

/* Center HUD */
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.round-tracker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-muted);
}

.round-current {
  font-weight: 700;
  color: #fff;
  font-size: 14px;
}

.hud-reaction-timer {
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer-digital {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.timer-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.timer-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-crimson));
  border-radius: var(--radius-full);
  transition: width 0.05s linear;
}

.phase-banner {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 3px 12px;
  border-radius: var(--radius-full);
}

/* ARENA STAGE (THE TWO CIRCLES) */
.arena-stage-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.arena-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;
  padding: 40px 60px;
  background: rgba(10, 14, 28, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  position: relative;
  width: 100%;
  max-width: 820px;
}

.lockout-alert {
  position: absolute;
  top: 12px;
  background: rgba(255, 51, 102, 0.95);
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 20px rgba(255, 51, 102, 0.7);
  z-index: 5;
  animation: shakeAlert 0.4s ease-in-out;
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.circle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.circle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.game-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: #1b2038;
  border: 5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.game-circle:hover {
  transform: scale(1.04);
}

.game-circle:active {
  transform: scale(0.96);
}

.game-circle.shuffle-active {
  animation: circlePulse 0.12s infinite alternate;
}

@keyframes circlePulse {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.02); }
}

.game-circle.reveal-active {
  box-shadow: 0 0 45px currentColor;
  border-color: #ffffff;
}

.circle-inner-glow {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.circle-symbol {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.circle-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.circle-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.circle-keys {
  display: flex;
  gap: 6px;
}

.key-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.key-chip.p1-key {
  color: var(--p1-theme);
  border-color: rgba(255, 46, 99, 0.4);
}

.key-chip.p2-key {
  color: var(--p2-theme);
  border-color: rgba(0, 240, 255, 0.4);
}

/* Center Divider & Countdown */
.arena-center-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.freeze-countdown {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  box-shadow: var(--shadow-glow-cyan);
  z-index: 2;
  transition: all 0.2s ease;
}

.freeze-countdown.reveal-now {
  background: var(--accent-amber);
  border-color: #fff;
  color: #000;
  box-shadow: 0 0 30px var(--accent-amber);
  transform: scale(1.15);
}

.pulse-ring {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 240, 255, 0.3);
  animation: rotateRing 8s linear infinite;
}

@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PLAYER CONTROLS CONSOLE
   ========================================================================== */
.controls-console-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.player-console {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.p-tag {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.color-target-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid #fff;
  color: #fff;
}

.console-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 10px;
}

.target-btn {
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.target-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

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

.circle-tap-btn .btn-symbol {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

.none-btn {
  background: linear-gradient(135deg, rgba(255, 77, 77, 0.15), rgba(255, 170, 0, 0.15));
  border-color: rgba(255, 100, 100, 0.3);
}

.none-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(255, 77, 77, 0.3), rgba(255, 170, 0, 0.3));
  border-color: rgba(255, 120, 120, 0.6);
  box-shadow: 0 0 16px rgba(255, 100, 100, 0.3);
}

.none-btn .btn-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1px;
  color: #ff9999;
}

.none-btn .btn-sub {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.btn-hotkey {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* AI Mode: Disable / Stylize P2 console when AI controlled */
.p2-console.is-ai .target-btn {
  cursor: default;
  opacity: 0.85;
}

.p2-console.is-ai .target-btn:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.05);
}

.target-btn.bot-pressed {
  background: var(--accent-cyan) !important;
  color: #000 !important;
  box-shadow: 0 0 25px var(--accent-cyan);
  transform: scale(1.05) !important;
}

.target-btn.opponent-pressed {
  background: var(--accent-cyan) !important;
  color: #000 !important;
  box-shadow: 0 0 25px var(--accent-cyan);
  transform: scale(1.05) !important;
}

.player-console.is-opponent {
  opacity: 0.92;
}

.player-console.is-opponent .target-btn {
  cursor: default;
}

.player-console.is-opponent .target-btn:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   ROUND OUTCOME OVERLAY MODAL
   ========================================================================== */
.round-outcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.82);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.outcome-card {
  width: 100%;
  max-width: 520px;
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
  border-color: rgba(255, 255, 255, 0.15);
}

.outcome-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.outcome-badge.blunder {
  background: rgba(255, 51, 102, 0.2);
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.outcome-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.outcome-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.stat-value.score-plus { color: var(--success-color); }
.stat-value.score-minus { color: var(--danger-color); }
.stat-value.state-desc { font-family: var(--font-sans); font-size: 12px; }

.outcome-duel-diff {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duel-bar-wrapper {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.duel-p1-bar {
  background: var(--p1-theme);
  height: 100%;
  transition: width 0.4s ease;
}

.duel-p2-bar {
  background: var(--p2-theme);
  height: 100%;
  transition: width 0.4s ease;
}

.duel-times-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.outcome-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 6px;
}

.auto-advance-indicator {
  font-size: 12px;
  color: var(--text-dim);
}

/* ==========================================================================
   SCREEN 3: MATCH SUMMARY / PODIUM
   ========================================================================== */
.summary-card {
  padding: 40px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

.summary-crown {
  font-size: 56px;
  animation: crownBounce 1.5s infinite alternate ease-in-out;
}

@keyframes crownBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.summary-winner {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
}

.summary-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -12px;
}

.final-score-cards {
  display: flex;
  gap: 20px;
  width: 100%;
}

.final-card {
  flex: 1;
  padding: 24px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.final-card.winner {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.25);
}

.final-p-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.final-points {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 800;
  color: #fff;
}

.final-points-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.match-analytics {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.analytics-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-align: left;
}

.analytics-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.analytics-table th, .analytics-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.analytics-table th {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.analytics-table td:nth-child(2), .analytics-table td:nth-child(3) {
  font-family: var(--font-mono);
  font-weight: 700;
}

.summary-actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

/* ==========================================================================
   RULES MODAL
   ========================================================================== */
.rules-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.rules-modal {
  width: 100%;
  max-width: 600px;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

.rules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rules-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.close-x {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
}

.rules-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rule-step {
  display: flex;
  gap: 14px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content {
  font-size: 14px;
  line-height: 1.5;
  color: #cfd4eb;
}

.step-content code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

.rule-tip {
  margin-top: 6px;
  font-size: 12px;
  color: #ffaa55;
}

.rules-footer {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   QUICK TOAST
   ========================================================================== */
.quick-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 22, 40, 0.95);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glow-cyan);
  z-index: 300;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Screen Shake Effect */
.screen-shake {
  animation: screenShakeAnim 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShakeAnim {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }

  .hud-bar {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
  }

  .hud-center {
    grid-column: span 2;
    order: -1;
    margin-bottom: 8px;
  }

  .arena-stage {
    gap: 24px;
    padding: 24px 16px;
  }

  .game-circle {
    width: 130px;
    height: 130px;
  }

  .controls-console-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .color-selection-arena {
    flex-direction: column;
    gap: 16px;
  }

  .vs-divider {
    transform: rotate(90deg);
  }
}

/* ==========================================================================
   PLAYER CALLSIGN CUSTOMIZER BAR
   ========================================================================== */
.player-callsign-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  box-shadow: inset 0 0 12px rgba(0, 240, 255, 0.05);
}

.callsign-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.callsign-icon {
  font-size: 16px;
}

.callsign-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-cyan);
}

.callsign-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 260px;
  position: relative;
}

.callsign-input {
  width: 100%;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 14px;
  background: rgba(14, 18, 36, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: var(--radius-sm);
  color: #fff;
  transition: all 0.2s ease;
}

.callsign-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
  background: rgba(14, 18, 36, 1);
}

.save-status-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.35);
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  animation: fadeIn 0.2s ease;
}

.mini-lb-btn {
  font-size: 11px;
  padding: 6px 12px;
}

/* ==========================================================================
   BATTLE LEADERBOARD & MATCH HISTORY MODAL
   ========================================================================== */
.leaderboard-modal-panel {
  max-width: 680px;
  width: 100%;
}

.lb-modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

.leaderboard-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lb-title-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.lb-modal-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.lb-storage-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-green);
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.leaderboard-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.leaderboard-body::-webkit-scrollbar {
  width: 5px;
}

.leaderboard-body::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.3);
  border-radius: 4px;
}

/* Summary Quick Metrics */
.lb-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.lb-metric-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.lb-metric-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.lb-metric-val.highlight {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.lb-metric-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* History Table */
.leaderboard-table-wrap {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(10, 14, 28, 0.6);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.leaderboard-table thead {
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-table th {
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-align: left;
}

.leaderboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.leaderboard-table tbody tr:hover {
  background: rgba(0, 240, 255, 0.04);
}

.col-num {
  width: 32px;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.lb-matchup-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lb-player-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
}

.lb-player-name.winner {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.lb-vs-tag {
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 800;
}

.lb-winner-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.lb-player-name.winner.p2-winner {
  color: var(--p1-theme);
  text-shadow: 0 0 8px rgba(255, 46, 99, 0.4);
}

.lb-winner-badge.p2-win {
  background: rgba(255, 46, 99, 0.15);
  color: var(--p1-theme);
  border-color: rgba(255, 46, 99, 0.3);
}

.lb-winner-badge.tie {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.3);
}

.lb-rounds-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.lb-score-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.lb-time-cell {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.lb-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  gap: 8px;
  color: var(--text-muted);
}

.lb-empty-state .empty-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.lb-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

/* ==========================================================================
   REMATCH CONSENSUS BAR STYLES
   ========================================================================== */
.rematch-consensus-card {
  background: rgba(10, 14, 28, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 18px 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 0 16px rgba(0, 240, 255, 0.04);
}

.rematch-consensus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 8px;
}

.rematch-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rematch-icon {
  font-size: 16px;
  filter: drop-shadow(0 0 6px var(--accent-cyan));
}

.rematch-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-cyan);
}

.rematch-counter-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.rematch-counter-badge.partial {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}

.rematch-counter-badge.ready {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent-green);
  border-color: var(--accent-green);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.4);
  animation: pulse 1s infinite alternate;
}

.rematch-slots-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rematch-slot {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: all 0.25s ease;
  user-select: none;
  cursor: pointer;
}

.rematch-slot:hover {
  border-color: rgba(0, 240, 255, 0.35);
  background: rgba(0, 240, 255, 0.06);
  transform: translateY(-1px);
}

.rematch-slot.ready {
  border-color: var(--accent-green);
  background: rgba(0, 255, 136, 0.08);
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.2);
}

.rematch-slot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.2s;
}

.rematch-slot.ready .rematch-slot-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.rematch-slot-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rematch-slot-status {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.rematch-slot.ready .rematch-slot-status {
  color: var(--accent-green);
}

.rematch-divider-vs {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  color: var(--text-dim);
}

.rematch-prompt-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

.rematch-action-btn.is-waiting {
  background: linear-gradient(135deg, #ffd700 0%, #ff8800 100%);
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
  color: #000;
}

.rematch-action-btn.is-waiting .btn-subtext {
  color: rgba(0, 0, 0, 0.8);
}

.rematch-action-btn.both-ready {
  background: linear-gradient(135deg, #00ff88 0%, #00b4d8 100%);
  box-shadow: 0 8px 30px rgba(0, 255, 136, 0.5);
  color: #000;
  animation: pulse 0.8s infinite alternate;
}

.rematch-action-btn.both-ready .btn-subtext {
  color: rgba(0, 0, 0, 0.8);
}

