:root {
  /* Spacing System */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Colors - Semantic */
  --color-text-primary: #ffffff;
  --color-text-secondary: #b3b3b3;
  --color-text-tertiary: rgba(255, 255, 255, 0.6);
  --color-accent: #FFD700;
  --color-success: #90EE90;
  --color-warning: #FF9800;
  --color-danger: #FF6B6B;
  --color-purple: #9C27B0;

  /* Background Colors */
  --color-bg-panel: rgba(0, 0, 0, 0.85);
  --color-bg-panel-soft: rgba(0, 0, 0, 0.7);
  --color-bg-element: rgba(0, 0, 0, 0.4);

  /* Typography */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background: #1a1a1a;
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fullscreen Canvas */
#gameCanvas {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  background: white;
  z-index: 1;
  object-fit: contain;
}

/* Drift Meter (Left Side - Old School Racing Game Style) */
.drift-meter {
  position: fixed;
  left: var(--space-xl);
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 20, 0.9));
  border: 3px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  backdrop-filter: blur(16px);
  z-index: 1000;
  box-shadow:
    0 0 30px rgba(255, 215, 0, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.8),
    inset 0 0 40px rgba(255, 215, 0, 0.05);
  min-width: 120px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.drift-meter.active {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.drift-meter-header {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-bottom: var(--space-lg);
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.8),
    0 0 20px rgba(255, 215, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.8);
  animation: neon-pulse 2s ease-in-out infinite;
}

@keyframes neon-pulse {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(255, 215, 0, 0.8),
      0 0 20px rgba(255, 215, 0, 0.5),
      0 2px 4px rgba(0, 0, 0, 0.8);
  }
  50% {
    text-shadow:
      0 0 15px rgba(255, 215, 0, 1),
      0 0 30px rgba(255, 215, 0, 0.7),
      0 2px 4px rgba(0, 0, 0, 0.8);
  }
}

.drift-speed-bar-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.drift-speed-bar {
  position: relative;
  width: 50px;
  height: 280px;
  background: linear-gradient(to bottom,
    rgba(255, 50, 50, 0.2),
    rgba(255, 150, 0, 0.2),
    rgba(255, 215, 0, 0.2)
  );
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.8),
    0 0 15px rgba(255, 215, 0, 0.2);
}

.drift-speed-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(to top,
    rgba(255, 215, 0, 0.9) 0%,
    rgba(255, 180, 0, 0.95) 40%,
    rgba(255, 100, 0, 1) 70%,
    rgba(255, 50, 50, 1) 100%
  );
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow:
    0 0 20px currentColor,
    inset 0 0 15px rgba(255, 255, 255, 0.3);
  transition: height 0.1s ease-out;
}

.drift-speed-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(to right,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.8;
  }
}

.drift-meter-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.drift-meter-multiplier {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.8);
  animation: pulse-scale 0.8s ease-in-out infinite;
}

@keyframes pulse-scale {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.drift-meter-score {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

.drift-meter-score span {
  color: var(--color-accent);
  font-size: var(--font-size-xl);
}

/* Drift Break Flash Animation */
@keyframes drift-break-flash {
  0% {
    border-color: rgba(255, 107, 107, 0.8);
    box-shadow:
      0 0 30px rgba(255, 107, 107, 0.8),
      0 4px 20px rgba(0, 0, 0, 0.8);
  }
  50% {
    border-color: rgba(255, 107, 107, 1);
    box-shadow:
      0 0 50px rgba(255, 107, 107, 1),
      0 4px 20px rgba(0, 0, 0, 0.8);
  }
  100% {
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow:
      0 0 30px rgba(255, 215, 0, 0.3),
      0 4px 20px rgba(0, 0, 0, 0.8);
  }
}

.drift-meter.drift-break-effect {
  animation: drift-break-flash 0.5s ease-out;
}

/* Leaderboard (Top Right Overlay) */
.leaderboard {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  background: var(--color-bg-panel);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  color: var(--color-text-primary);
  backdrop-filter: blur(16px);
  min-width: 240px;
  max-width: 280px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard h3 {
  margin: 0;
  font-size: var(--font-size-sm);
  text-align: left;
  color: var(--color-text-secondary);
  text-shadow: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: var(--font-weight-semibold);
}

.ping-display {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

#leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-element);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
}

.leaderboard-entry.you {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid var(--color-accent);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.2);
}

.leaderboard-player {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  min-width: 0;
}

.leaderboard-player span {
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-color {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.leaderboard-stats {
  display: flex;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

.leaderboard-kills {
  color: var(--color-success);
}

.leaderboard-deaths {
  color: var(--color-danger);
}

/* Leaderboard Discord Footer */
.leaderboard-discord-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  color: #7289DA;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  transition: all 0.2s ease;
  text-align: center;
  margin-left: calc(var(--space-lg) * -1);
  margin-right: calc(var(--space-lg) * -1);
  margin-bottom: calc(var(--space-lg) * -1);
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.leaderboard-discord-footer:hover {
  background: rgba(88, 101, 242, 0.12);
  color: #5865F2;
}

.leaderboard-discord-footer svg {
  flex-shrink: 0;
}

.leaderboard-discord-footer span {
  letter-spacing: 0.3px;
}

/* Kill Notifications (Top Left) */
.kill-notifications {
  position: fixed;
  top: var(--space-xl);
  left: var(--space-xl);
  min-width: 240px;
  max-width: 320px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.kill-notification {
  background: var(--color-bg-panel);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  animation: notification-slide-in 0.3s ease-out;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.kill-notification.fade-out {
  opacity: 0;
}

.kill-notification.kill {
  border-left: 3px solid var(--color-danger);
}

.kill-notification.self-kill {
  border-left: 3px solid var(--color-warning);
}

.kill-notification.join {
  border-left: 3px solid var(--color-success);
}

@keyframes notification-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Bottom HUD (Inventory + Boost Bar) */
.bottom-hud {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  background: var(--color-bg-panel);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.slots-container {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-md);
}

.inventory-slot {
  position: relative;
  width: 38px;
  height: 38px;
  background: var(--color-bg-element);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.inventory-slot:hover {
  border-color: rgba(255, 215, 0, 0.5);
}

.inventory-slot[data-slot="1"] {
  border-color: rgba(156, 39, 176, 0.6);
  background: rgba(156, 39, 176, 0.12);
}

.inventory-slot[data-slot="2"] {
  border-color: rgba(255, 215, 0, 0.6);
  background: rgba(255, 215, 0, 0.12);
}

.slot-icon {
  font-size: 1.2em;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.slot-text {
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.slowmo-text {
  color: var(--color-purple);
}

.boost-text {
  color: var(--color-accent);
}

.slot-label {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 10px;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  line-height: 1;
}

.slot-cooldown {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(255, 215, 0, 0.5), rgba(255, 215, 0, 0.7));
  height: 0%;
  pointer-events: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Boost Fuel Strip (Thin Top Bar) */
.boost-fuel-strip {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.boost-fuel-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: var(--color-accent);
  transition: width 0.2s ease;
}

/* Admin Controls Panel */
.admin-controls {
  position: fixed;
  bottom: var(--space-xl);
  left: var(--space-xl);
  background: var(--color-bg-panel-soft);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  backdrop-filter: blur(12px);
  z-index: 500;
  min-width: 260px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.admin-controls:hover {
  opacity: 1;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-header h3 {
  margin: 0;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-shadow: none;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.settings-header-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.reset-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: var(--space-xs);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: var(--radius-sm);
}

.reset-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(255, 215, 0, 0.1);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.toggle-btn:hover {
  color: var(--color-text-primary);
}

.bot-control-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.bot-control-btn:hover {
  color: #4ECDC4;
  border-color: #4ECDC4;
  background: rgba(78, 205, 196, 0.15);
}

.bot-control-btn:active {
  transform: scale(0.95);
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-content.collapsed {
  display: none;
}

.mode-toggle-row {
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.setting-row label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  min-width: 110px;
  flex-shrink: 0;
}

.setting-row input[type="range"] {
  flex: 1;
  cursor: pointer;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.setting-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
}

.setting-row span {
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  min-width: 48px;
  text-align: right;
  font-family: 'SF Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  user-select: none;
}

.mode-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-accent);
}

.mode-label {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.3px;
}

/* Music Controls */
.music-controls {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--color-bg-panel);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  z-index: 1000;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.music-btn {
  background: transparent;
  border: none;
  font-size: var(--font-size-2xl);
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
}

.music-btn:hover {
  opacity: 0.8;
}

.volume-slider {
  width: 100px;
  height: 5px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--color-text-primary);
  border-radius: 50%;
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--color-text-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Join Game Modal */
.join-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.join-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.join-modal-content {
  background: rgba(20, 20, 20, 0.95);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) 40px;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.join-modal-content h2 {
  margin: 0 0 var(--space-2xl) 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.form-group {
  margin-bottom: var(--space-2xl);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-base);
  font-family: inherit;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

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

.color-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px currentColor;
}

.color-swatch.selected {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 20px currentColor;
  transform: scale(1.15);
}

.color-swatch.selected::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-text-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.error-message {
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
  text-align: center;
  min-height: 20px;
}

.join-button {
  width: 100%;
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  font-family: inherit;
  background: var(--color-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s ease;
}

.join-button:hover {
  background: #FFC700;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.join-button:active {
  transform: translateY(0);
}

/* Player Profile Modal */
.profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.profile-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.profile-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.profile-modal-content {
  position: relative;
  background: rgba(20, 20, 20, 0.95);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1;
}

.profile-modal-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.profile-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-primary);
}

.profile-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-name-badge {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.profile-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.profile-color-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.profile-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.profile-stat-section h4 {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-stat-row:last-child {
  border-bottom: none;
}

.profile-stat-row.highlight {
  padding: var(--space-md) var(--space-sm);
  background: rgba(255, 215, 0, 0.1);
  border-radius: var(--radius-sm);
  border-bottom: none;
  margin-top: var(--space-sm);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.stat-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.profile-stat-row.highlight .stat-value {
  color: var(--color-accent);
  font-size: var(--font-size-lg);
}

.profile-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.profile-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}

.profile-list-item-name {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

.profile-list-item-value {
  color: var(--color-text-secondary);
}

.profile-list-empty {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-style: italic;
  padding: var(--space-md);
}

#headToHeadSection.hidden {
  display: none;
}

/* Global Chat */
.chat-container {
  position: fixed;
  bottom: 160px; /* Above inventory bar, moved up */
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  max-width: 90vw;
  background: rgba(0, 0, 0, 0.5); /* More transparent */
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  z-index: 900;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chat-container.active {
  opacity: 1;
  pointer-events: all;
}

.chat-messages {
  padding: var(--space-md);
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-message {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
}

.chat-message-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-message-text {
  color: var(--color-text-primary);
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  outline: none;
}

.chat-input::placeholder {
  color: var(--color-text-tertiary);
}

.chat-input:focus {
  background: rgba(0, 0, 0, 0.7);
  border-top-color: var(--color-accent);
}

/* Discord Link in Join Modal */
.discord-link-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-2xl);
  padding: var(--space-md) var(--space-lg);
  background: rgba(88, 101, 242, 0.15);
  border: 2px solid rgba(88, 101, 242, 0.4);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: #7289DA;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
  text-align: center;
}

.discord-link-modal:hover {
  background: rgba(88, 101, 242, 0.25);
  border-color: rgba(88, 101, 242, 0.6);
  color: #fff;
  transform: translateY(-1px);
}

.discord-link-modal svg {
  flex-shrink: 0;
}

.discord-link-modal span {
  letter-spacing: 0.3px;
}

/* Kill Clip Preview (Bottom Left) */
.kill-clip-preview {
  position: fixed;
  bottom: var(--space-2xl);
  left: var(--space-2xl);
  width: 320px;
  background: var(--color-bg-panel);
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(255, 215, 0, 0.2);
  backdrop-filter: blur(16px);
  z-index: 2000;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.kill-clip-preview.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.kill-clip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 215, 0, 0.1);
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.kill-clip-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kill-clip-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.kill-clip-close:hover {
  color: var(--color-text-primary);
}

.kill-clip-video {
  width: 100%;
  height: 180px;
  background: #000;
  object-fit: contain;
  display: block;
}

.kill-clip-actions {
  padding: var(--space-md) var(--space-lg);
  background: rgba(0, 0, 0, 0.3);
}

.kill-clip-copy-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-md);
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kill-clip-copy-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.2));
  border-color: rgba(255, 215, 0, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.kill-clip-copy-btn:active {
  transform: translateY(0);
}

/* Copy notification toast */
.copy-notification {
  position: fixed;
  bottom: 280px;
  left: var(--space-2xl);
  padding: var(--space-md) var(--space-xl);
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-md);
  color: var(--color-success);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  box-shadow: 0 4px 12px rgba(144, 238, 144, 0.3);
  z-index: 2001;
  animation: slideInUp 0.3s ease;
}

.copy-notification.fade-out {
  animation: fadeOut 0.3s ease;
  opacity: 0;
}

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

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
