/* ============================================
   Cards Against Ball Pit - Synthwave Theme
   ============================================ */

/* Google Fonts - Retro-futuristic typography for all themes */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Rajdhani:wght@400;500;600;700&family=Audiowide&family=Exo+2:wght@400;500;600;700&family=Press+Start+2P&family=Share+Tech+Mono&family=Electrolize&family=Comfortaa:wght@400;500;600;700&family=Quicksand:wght@400;500;600;700&family=Michroma&family=Teko:wght@400;500;600;700&family=VT323&family=Russo+One&display=swap');

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Synthwave Color Palette */
  --color-bg-dark: #0d0221;
  --color-bg-mid: #1a1a2e;
  --color-bg-card: #16213e;

  --color-primary: #ff00ff;       /* Hot pink/magenta */
  --color-primary-dim: #cc00cc;
  --color-primary-rgb: 255, 0, 255;
  --color-secondary: #00fff9;     /* Electric cyan */
  --color-secondary-dim: #00ccc9;
  --color-secondary-rgb: 0, 255, 249;
  --color-accent: #ff6b35;        /* Neon orange */
  --color-accent-alt: #f9c80e;    /* Neon yellow */
  --color-purple: #7b2cbf;        /* Grid purple */
  --color-purple-dim: #5a189a;

  --color-text: #ffffff;
  --color-text-dim: #b8b8d1;
  --color-text-muted: #6c6c8a;

  --color-success: #39ff14;       /* Neon green */
  --color-error: #ff3366;         /* Neon red */
  --color-warning: #ffcc00;

  /* Gradients */
  --gradient-sunset: linear-gradient(135deg, #ff6b35 0%, #ff00ff 50%, #7b2cbf 100%);
  --gradient-ocean: linear-gradient(135deg, #00fff9 0%, #7b2cbf 100%);
  --gradient-bg: linear-gradient(180deg, #0d0221 0%, #1a1a2e 50%, #16213e 100%);

  /* Glow Effects */
  --glow-pink: 0 0 10px #ff00ff, 0 0 20px #ff00ff, 0 0 40px #ff00ff;
  --glow-cyan: 0 0 10px #00fff9, 0 0 20px #00fff9, 0 0 40px #00fff9;
  --glow-orange: 0 0 10px #ff6b35, 0 0 20px #ff6b35;
  --glow-purple: 0 0 10px #7b2cbf, 0 0 20px #7b2cbf;

  /* Typography */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.6);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index layers */
  --z-base: 0;
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* ============================================
   Color Themes
   ============================================ */

/* Theme: Sunset Boulevard - Warm oranges and pinks, wide cruising fonts */
[data-theme="sunset"] {
  --font-display: 'Audiowide', sans-serif;
  --font-body: 'Exo 2', sans-serif;

  --color-bg-dark: #1a0a0a;
  --color-bg-mid: #2d1515;
  --color-bg-card: #3d1f1f;

  --color-primary: #ff6b35;
  --color-primary-dim: #cc5529;
  --color-primary-rgb: 255, 107, 53;
  --color-secondary: #ffd93d;
  --color-secondary-dim: #ccae31;
  --color-secondary-rgb: 255, 217, 61;
  --color-accent: #ff3366;
  --color-accent-alt: #ff9500;
  --color-purple: #c44569;
  --color-purple-dim: #9e3755;

  --gradient-sunset: linear-gradient(135deg, #ff9500 0%, #ff6b35 50%, #ff3366 100%);
  --gradient-ocean: linear-gradient(135deg, #ffd93d 0%, #ff6b35 100%);
  --gradient-bg: linear-gradient(180deg, #1a0a0a 0%, #2d1515 50%, #3d1f1f 100%);

  --glow-pink: 0 0 10px #ff3366, 0 0 20px #ff3366, 0 0 40px #ff3366;
  --glow-cyan: 0 0 10px #ffd93d, 0 0 20px #ffd93d, 0 0 40px #ffd93d;
  --glow-orange: 0 0 10px #ff6b35, 0 0 20px #ff6b35;
  --glow-purple: 0 0 10px #c44569, 0 0 20px #c44569;
}

/* Theme: Midnight Arcade - Deep blues and purples, retro pixel fonts */
[data-theme="midnight"] {
  --font-display: 'Press Start 2P', monospace;
  --font-body: 'Share Tech Mono', monospace;

  --color-bg-dark: #050520;
  --color-bg-mid: #0a0a3a;
  --color-bg-card: #101050;

  --color-primary: #8b5cf6;
  --color-primary-dim: #7c3aed;
  --color-primary-rgb: 139, 92, 246;
  --color-secondary: #06b6d4;
  --color-secondary-dim: #0891b2;
  --color-secondary-rgb: 6, 182, 212;
  --color-accent: #f472b6;
  --color-accent-alt: #c084fc;
  --color-purple: #4c1d95;
  --color-purple-dim: #3b0764;

  --gradient-sunset: linear-gradient(135deg, #f472b6 0%, #8b5cf6 50%, #4c1d95 100%);
  --gradient-ocean: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
  --gradient-bg: linear-gradient(180deg, #050520 0%, #0a0a3a 50%, #101050 100%);

  --glow-pink: 0 0 10px #8b5cf6, 0 0 20px #8b5cf6, 0 0 40px #8b5cf6;
  --glow-cyan: 0 0 10px #06b6d4, 0 0 20px #06b6d4, 0 0 40px #06b6d4;
  --glow-orange: 0 0 10px #f472b6, 0 0 20px #f472b6;
  --glow-purple: 0 0 10px #4c1d95, 0 0 20px #4c1d95;
}

/* Theme: Neon Matrix - Green and teal cyberpunk, hacker terminal fonts */
[data-theme="matrix"] {
  --font-display: 'Share Tech Mono', monospace;
  --font-body: 'Electrolize', sans-serif;

  --color-bg-dark: #001a0a;
  --color-bg-mid: #002a15;
  --color-bg-card: #003d20;

  --color-primary: #00ff88;
  --color-primary-dim: #00cc6a;
  --color-primary-rgb: 0, 255, 136;
  --color-secondary: #00ffff;
  --color-secondary-dim: #00cccc;
  --color-secondary-rgb: 0, 255, 255;
  --color-accent: #88ff00;
  --color-accent-alt: #00ff44;
  --color-purple: #00aa55;
  --color-purple-dim: #008844;

  --gradient-sunset: linear-gradient(135deg, #88ff00 0%, #00ff88 50%, #00aa55 100%);
  --gradient-ocean: linear-gradient(135deg, #00ffff 0%, #00ff88 100%);
  --gradient-bg: linear-gradient(180deg, #001a0a 0%, #002a15 50%, #003d20 100%);

  --glow-pink: 0 0 10px #00ff88, 0 0 20px #00ff88, 0 0 40px #00ff88;
  --glow-cyan: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 40px #00ffff;
  --glow-orange: 0 0 10px #88ff00, 0 0 20px #88ff00;
  --glow-purple: 0 0 10px #00aa55, 0 0 20px #00aa55;
}

/* Theme: Vapor Dream - Soft pastels, dreamy rounded fonts */
[data-theme="vapor"] {
  --font-display: 'Comfortaa', sans-serif;
  --font-body: 'Quicksand', sans-serif;

  --color-bg-dark: #1a1025;
  --color-bg-mid: #2a1a3a;
  --color-bg-card: #3a2550;

  --color-primary: #ff71ce;
  --color-primary-dim: #e55ab5;
  --color-primary-rgb: 255, 113, 206;
  --color-secondary: #01cdfe;
  --color-secondary-dim: #01a4cb;
  --color-secondary-rgb: 1, 205, 254;
  --color-accent: #05ffa1;
  --color-accent-alt: #b967ff;
  --color-purple: #7b2cbf;
  --color-purple-dim: #5a189a;

  --gradient-sunset: linear-gradient(135deg, #05ffa1 0%, #ff71ce 50%, #b967ff 100%);
  --gradient-ocean: linear-gradient(135deg, #01cdfe 0%, #ff71ce 100%);
  --gradient-bg: linear-gradient(180deg, #1a1025 0%, #2a1a3a 50%, #3a2550 100%);

  --glow-pink: 0 0 10px #ff71ce, 0 0 20px #ff71ce, 0 0 40px #ff71ce;
  --glow-cyan: 0 0 10px #01cdfe, 0 0 20px #01cdfe, 0 0 40px #01cdfe;
  --glow-orange: 0 0 10px #05ffa1, 0 0 20px #05ffa1;
  --glow-purple: 0 0 10px #b967ff, 0 0 20px #b967ff;
}

/* Theme: Outrun - Classic 80s red/blue, sleek racing fonts */
[data-theme="outrun"] {
  --font-display: 'Michroma', sans-serif;
  --font-body: 'Teko', sans-serif;

  --color-bg-dark: #13071b;
  --color-bg-mid: #1f0f2d;
  --color-bg-card: #2b1740;

  --color-primary: #ff2a6d;
  --color-primary-dim: #d12259;
  --color-primary-rgb: 255, 42, 109;
  --color-secondary: #05d9e8;
  --color-secondary-dim: #04adb9;
  --color-secondary-rgb: 5, 217, 232;
  --color-accent: #ff6b35;
  --color-accent-alt: #d1f7ff;
  --color-purple: #7b2cbf;
  --color-purple-dim: #5a189a;

  --gradient-sunset: linear-gradient(135deg, #ff6b35 0%, #ff2a6d 50%, #7b2cbf 100%);
  --gradient-ocean: linear-gradient(135deg, #05d9e8 0%, #ff2a6d 100%);
  --gradient-bg: linear-gradient(180deg, #13071b 0%, #1f0f2d 50%, #2b1740 100%);

  --glow-pink: 0 0 10px #ff2a6d, 0 0 20px #ff2a6d, 0 0 40px #ff2a6d;
  --glow-cyan: 0 0 10px #05d9e8, 0 0 20px #05d9e8, 0 0 40px #05d9e8;
  --glow-orange: 0 0 10px #ff6b35, 0 0 20px #ff6b35;
  --glow-purple: 0 0 10px #7b2cbf, 0 0 20px #7b2cbf;
}

/* Theme: Cyberpunk - Yellow/cyan dystopian future, industrial fonts */
[data-theme="cyberpunk"] {
  --font-display: 'Russo One', sans-serif;
  --font-body: 'Rajdhani', sans-serif;

  --color-bg-dark: #0a0a0f;
  --color-bg-mid: #12121a;
  --color-bg-card: #1a1a25;

  --color-primary: #fcee09;
  --color-primary-dim: #d4c908;
  --color-primary-rgb: 252, 238, 9;
  --color-secondary: #00f0ff;
  --color-secondary-dim: #00c0cc;
  --color-secondary-rgb: 0, 240, 255;
  --color-accent: #ff003c;
  --color-accent-alt: #ff9500;
  --color-purple: #9d4edd;
  --color-purple-dim: #7b2cbf;

  --gradient-sunset: linear-gradient(135deg, #ff9500 0%, #fcee09 50%, #00f0ff 100%);
  --gradient-ocean: linear-gradient(135deg, #00f0ff 0%, #fcee09 100%);
  --gradient-bg: linear-gradient(180deg, #0a0a0f 0%, #12121a 50%, #1a1a25 100%);

  --glow-pink: 0 0 10px #fcee09, 0 0 20px #fcee09, 0 0 40px #fcee09;
  --glow-cyan: 0 0 10px #00f0ff, 0 0 20px #00f0ff, 0 0 40px #00f0ff;
  --glow-orange: 0 0 10px #ff003c, 0 0 20px #ff003c;
  --glow-purple: 0 0 10px #9d4edd, 0 0 20px #9d4edd;
}

/* Theme: VHS - Retro video tracking, warm magenta/cyan color bleed, VCR fonts */
[data-theme="vhs"] {
  --font-display: 'VT323', monospace;
  --font-body: 'VT323', monospace;

  --color-bg-dark: #0d0d0d;
  --color-bg-mid: #1a1a1a;
  --color-bg-card: #252525;

  --color-primary: #ff3ea5;
  --color-primary-dim: #d13589;
  --color-primary-rgb: 255, 62, 165;
  --color-secondary: #00ffc8;
  --color-secondary-dim: #00cca0;
  --color-secondary-rgb: 0, 255, 200;
  --color-accent: #ffff00;
  --color-accent-alt: #00ffff;
  --color-purple: #9933ff;
  --color-purple-dim: #7a29cc;

  --gradient-sunset: linear-gradient(135deg, #ff3ea5 0%, #ffff00 50%, #00ffc8 100%);
  --gradient-ocean: linear-gradient(135deg, #00ffc8 0%, #ff3ea5 100%);
  --gradient-bg: linear-gradient(180deg, #0d0d0d 0%, #1a1a1a 50%, #252525 100%);

  --glow-pink: 0 0 10px #ff3ea5, 0 0 20px #ff3ea5, 0 0 40px #ff3ea5;
  --glow-cyan: 0 0 10px #00ffc8, 0 0 20px #00ffc8, 0 0 40px #00ffc8;
  --glow-orange: 0 0 10px #ffff00, 0 0 20px #ffff00;
  --glow-purple: 0 0 10px #9933ff, 0 0 20px #9933ff;
}

/* Theme: Tron - Electric blue/orange, digital grid, clean futuristic fonts */
[data-theme="tron"] {
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Electrolize', sans-serif;

  --color-bg-dark: #000408;
  --color-bg-mid: #001015;
  --color-bg-card: #001a22;

  --color-primary: #00d4ff;
  --color-primary-dim: #00a8cc;
  --color-primary-rgb: 0, 212, 255;
  --color-secondary: #ff6600;
  --color-secondary-dim: #cc5200;
  --color-secondary-rgb: 255, 102, 0;
  --color-accent: #ffffff;
  --color-accent-alt: #6fe7ff;
  --color-purple: #0088aa;
  --color-purple-dim: #006688;

  --gradient-sunset: linear-gradient(135deg, #ff6600 0%, #00d4ff 50%, #0088aa 100%);
  --gradient-ocean: linear-gradient(135deg, #00d4ff 0%, #ff6600 100%);
  --gradient-bg: linear-gradient(180deg, #000408 0%, #001015 50%, #001a22 100%);

  --glow-pink: 0 0 10px #00d4ff, 0 0 20px #00d4ff, 0 0 40px #00d4ff;
  --glow-cyan: 0 0 10px #00d4ff, 0 0 20px #00d4ff, 0 0 40px #00d4ff;
  --glow-orange: 0 0 10px #ff6600, 0 0 20px #ff6600;
  --glow-purple: 0 0 10px #0088aa, 0 0 20px #0088aa;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--gradient-bg);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Grid overlay for retro effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(var(--color-purple) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-purple) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.05;
  pointer-events: none;
  z-index: -1;
}

/* VHS Theme: Scanning light effect */
[data-theme="vhs"] body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-primary) 50%,
    transparent 100%);
  box-shadow:
    0 0 10px var(--color-primary),
    0 0 20px var(--color-primary),
    0 0 40px var(--color-primary);
  opacity: 0.6;
  pointer-events: none;
  z-index: 9999;
  animation: scanLine 8s linear infinite;
}

@keyframes scanLine {
  0% {
    top: -2px;
    opacity: 0;
  }
  5% {
    opacity: 0.6;
  }
  95% {
    opacity: 0.6;
  }
  100% {
    top: 100vh;
    opacity: 0;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 {
  font-size: var(--text-4xl);
  text-shadow: var(--glow-pink);
  color: var(--color-primary);
}

h2 {
  font-size: var(--text-3xl);
  text-shadow: var(--glow-cyan);
  color: var(--color-secondary);
}

h3 {
  font-size: var(--text-2xl);
  color: var(--color-text);
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
  text-shadow: var(--glow-pink);
}

/* ============================================
   Layout Utilities
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.text-center { text-align: center; }

/* ============================================
   Card Components
   ============================================ */

/* White Card (Answer) - Playing Card Style */
.card-white {
  background: #f5f5f0;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 20px 15px;
  min-height: 180px;
  width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--text-base);
  font-weight: 700;
  color: #1a1a1a;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  box-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(0, 255, 249, 0.15);
  transition: var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: visible;
}

/* Corner symbols for white cards */
.card-white::before {
  content: '◈';
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 14px;
  color: #00c8c8;
  text-shadow: 0 0 5px rgba(0, 255, 249, 0.5);
}

.card-white::after {
  content: '◈';
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 14px;
  color: #00c8c8;
  transform: rotate(180deg);
  text-shadow: 0 0 5px rgba(0, 255, 249, 0.5);
}

.card-white:hover {
  transform: translateY(-10px) rotate(-2deg);
  box-shadow:
    4px 4px 15px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(0, 255, 249, 0.3);
}

.card-white.selected {
  transform: translateY(-15px);
  box-shadow:
    4px 4px 15px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(255, 170, 0, 0.5);
  animation: card-pulse 1.5s ease-in-out infinite;
}

.card-white.selected::before,
.card-white.selected::after {
  color: #ff8800;
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.8);
}

@keyframes card-pulse {
  0%, 100% { box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.4), 0 0 40px rgba(255, 170, 0, 0.5); }
  50% { box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.4), 0 0 60px rgba(255, 170, 0, 0.7); }
}

/* Black Card (Question) - Playing Card Style */
.card-black {
  background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 25px 20px;
  min-height: 220px;
  width: 180px;
  max-width: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: #ffffff;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  box-shadow:
    3px 3px 10px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(255, 0, 255, 0.2);
  position: relative;
  overflow: visible;
}

/* Corner symbols for black cards */
.card-black::before {
  content: '✦';
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 16px;
  color: #ff00ff;
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.8);
}

.card-black::after {
  content: '✦';
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 16px;
  color: #ff00ff;
  transform: rotate(180deg);
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.8);
}

/* Inner border for black card */
.card-black > * {
  position: relative;
  z-index: 1;
}

.card-black .blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 3px solid #00fff9;
  margin: 0 4px;
  text-shadow: 0 0 10px rgba(0, 255, 249, 0.5);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4);
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .card-white, .card-black {
    min-height: 120px;
  }
}

/* ============================================
   Button Styles
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button - Pink Glow */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-purple) 100%);
  color: var(--color-text);
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--glow-pink);
  transform: translateY(-2px);
}

/* Secondary Button - Cyan Glow */
.btn-secondary {
  background: transparent;
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(0, 255, 249, 0.1);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

/* Ghost Button */
.btn-ghost {
  background-color: rgba(128, 128, 128, 0.1); /* Visible enough to be clickable */
  color: var(--color-text-dim);
  border-color: var(--color-text-muted);
  position: relative;
  z-index: 10;
}

.btn-ghost:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--color-text);
  border-color: var(--color-text);
}

/* Ensure anchor buttons are fully clickable */
a.btn {
  display: inline-flex;
  text-decoration: none;
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--color-success) 0%, #00cc00 100%);
  color: var(--color-bg-dark);
  border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 0 20px var(--color-success);
}

/* Danger Button */
.btn-danger {
  background: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 51, 102, 0.1);
  box-shadow: 0 0 15px var(--color-error);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: rgba(22, 33, 62, 0.8);
  border: 2px solid var(--color-purple);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 10px rgba(0, 255, 249, 0.3);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-checkbox input,
.form-radio input {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
}

/* ============================================
   Game-Specific Components
   ============================================ */

/* Game Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  background: rgba(13, 2, 33, 0.9);
  border-bottom: 2px solid var(--color-purple);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.game-code {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-accent);
  text-shadow: var(--glow-orange);
  letter-spacing: 0.2em;
}

.timer-container {
  flex-shrink: 0;
}

/* Timer */
.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--color-secondary);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-secondary);
  box-shadow: var(--glow-cyan);
}

.timer.warning {
  border-color: var(--color-warning);
  color: var(--color-warning);
  box-shadow: 0 0 15px var(--color-warning);
  animation: pulse-glow 0.5s ease-in-out infinite;
}

.timer.danger {
  border-color: var(--color-error);
  color: var(--color-error);
  box-shadow: 0 0 15px var(--color-error);
  animation: pulse-glow 0.3s ease-in-out infinite;
}

/* Player List */
.player-list {
  list-style: none;
  padding: 0;
  max-height: 450px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-purple) transparent;
}

.player-list::-webkit-scrollbar {
  width: 6px;
}

.player-list::-webkit-scrollbar-track {
  background: transparent;
}

.player-list::-webkit-scrollbar-thumb {
  background: var(--color-purple);
  border-radius: 3px;
}

.player-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: rgba(22, 33, 62, 0.6);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  border-left: 3px solid var(--color-purple);
  transition: var(--transition-fast);
}

.player-item.is-judge {
  border-left-color: var(--color-primary);
  background: rgba(255, 0, 255, 0.1);
}

.player-item.is-you {
  border-left-color: var(--color-secondary);
  background: rgba(0, 255, 249, 0.1);
}

.player-name {
  font-weight: 600;
  flex: 1;
  text-align: left;
}

.player-score {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-accent);
}

/* Phase Indicator */
.phase-indicator {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-4);
}

.phase-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: rgba(22, 33, 62, 0.5);
  border: 1px solid var(--color-text-muted);
  transition: var(--transition-base);
}

.phase-step.active {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
  box-shadow: var(--glow-cyan);
}

.phase-step.completed {
  color: var(--color-success);
  border-color: var(--color-success);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.toast {
  padding: var(--space-4) var(--space-6);
  background: rgba(22, 33, 62, 0.95);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-purple);
  border-top: 3px solid var(--color-secondary);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 255, 249, 0.2);
  animation: slideDown 0.3s ease;
  max-width: 400px;
  text-align: center;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success {
  border-top-color: var(--color-success);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(57, 255, 20, 0.2);
}

.toast.error {
  border-top-color: var(--color-error);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(255, 51, 102, 0.2);
}

.toast.warning {
  border-top-color: var(--color-warning);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(255, 204, 0, 0.2);
}

/* ============================================
   Animations
   ============================================ */
@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardFlip {
  0% {
    transform: perspective(1000px) rotateY(90deg);
  }
  100% {
    transform: perspective(1000px) rotateY(0);
  }
}

@keyframes neonFlicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
  96% { opacity: 0.9; }
  97% { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

.animate-slide-up {
  animation: slideUp 0.4s ease;
}

.animate-card-flip {
  animation: cardFlip 0.5s ease;
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-purple);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 2, 33, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--color-bg-mid);
  border: 2px solid var(--color-purple);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--glow-purple), var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.modal-header {
  margin-bottom: var(--space-6);
}

.modal-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.modal-body {
  margin-bottom: var(--space-6);
}

.modal-footer {
  display: flex;
  gap: var(--space-4);
  justify-content: flex-end;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (max-width: 768px) {
  :root {
    --text-4xl: 2rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }

  .game-header {
    flex-direction: column;
    gap: var(--space-4);
  }

  .phase-indicator {
    flex-wrap: wrap;
  }

  .btn-lg {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-2);
  }

  .card-white, .card-black {
    padding: var(--space-3);
    font-size: var(--text-base);
  }

  .modal {
    padding: var(--space-4);
  }
}

/* ============================================
   Connection Status Indicator
   ============================================ */
.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: var(--transition-base);
}

.connection-status.connected .connection-dot {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.connection-status.reconnecting .connection-dot {
  background: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
  animation: pulse-glow 0.5s ease-in-out infinite;
}

.connection-status.disconnected .connection-dot {
  background: var(--color-error);
  box-shadow: 0 0 8px var(--color-error);
}

/* Copy Button */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: rgba(0, 255, 249, 0.1);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  color: var(--color-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: var(--text-sm);
}

.copy-btn:hover {
  background: rgba(0, 255, 249, 0.2);
  box-shadow: var(--glow-cyan);
}

.copy-btn.copied {
  background: rgba(57, 255, 20, 0.2);
  border-color: var(--color-success);
  color: var(--color-success);
}

/* Keyboard Shortcut Hints */
.keyboard-hint {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background: rgba(22, 33, 62, 0.8);
  border: 1px solid var(--color-purple);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}

.keyboard-shortcuts-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-2);
}

/* ============================================
   Legacy Support (Admin Pages)
   ============================================ */
#back-to-admin {
  margin-bottom: var(--space-4);
  font-size: var(--text-base);
}

#back-to-admin a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

#back-to-admin a:hover {
  color: var(--color-primary);
  text-shadow: var(--glow-pink);
}

/* ============================================
   Mobile Optimization
   ============================================ */

/* Touch-friendly targets - minimum 48px */
@media (pointer: coarse) {
  .btn, button {
    min-height: 48px;
    min-width: 48px;
  }

  .hand-card {
    min-height: 140px;
  }

  .avatar-option {
    min-width: 52px;
    min-height: 52px;
  }

  .pack-item {
    min-height: 56px;
  }

  .player-item {
    min-height: 52px;
  }
}

/* Touch feedback */
@media (pointer: coarse) {
  .btn:active,
  .hand-card:active,
  .submission-card:active {
    transform: scale(0.97);
    transition: transform 0.1s;
  }
}

/* Mobile layout improvements */
@media (max-width: 768px) {
  /* Hide keyboard hints on mobile */
  .keyboard-shortcuts-hint,
  .keyboard-hint {
    display: none;
  }

  /* Stack game layout vertically */
  .game-main {
    grid-template-columns: 1fr !important;
    gap: var(--space-3);
  }

  /* Sidebar becomes bottom section on mobile */
  .game-sidebar {
    order: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .game-board {
    order: 1;
  }

  /* Compact header */
  .game-header {
    padding: var(--space-2) var(--space-3);
    flex-wrap: wrap;
  }

  .game-code {
    font-size: var(--text-lg);
  }

  .timer {
    width: 50px;
    height: 50px;
    font-size: var(--text-lg);
  }

  /* Cards scroll horizontally */
  .hand-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-4);
  }

  .hand-card {
    scroll-snap-align: center;
    flex: 0 0 130px;
    min-height: 160px;
  }

  /* Compact player list */
  .player-item {
    padding: var(--space-2);
    font-size: var(--text-sm);
  }

  .player-avatar {
    font-size: 18px;
    width: 24px;
  }

  /* Submissions grid */
  .submissions-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-2);
  }

  .submission-card {
    width: 120px;
    min-height: 150px;
    padding: 15px 10px;
  }

  /* Phase indicator compact */
  .phase-indicator {
    padding: var(--space-1) var(--space-2);
  }

  .phase-step {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
  }

  /* Your cards section */
  .your-cards-section {
    padding: var(--space-3);
  }

  .your-cards-header {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }
}

/* ============================================
   Theme Selector
   ============================================ */
.theme-selector {
  position: relative;
  display: inline-block;
}

.theme-selector-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(22, 33, 62, 0.8);
  border: 1px solid var(--color-purple);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-selector-btn:hover {
  border-color: var(--color-primary);
  background: rgba(22, 33, 62, 0.95);
}

.theme-preview {
  display: flex;
  gap: 2px;
}

.theme-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-name {
  font-weight: 500;
}

.theme-arrow {
  font-size: var(--text-xs);
  opacity: 0.7;
  transition: var(--transition-fast);
}

.theme-selector-btn:hover .theme-arrow {
  opacity: 1;
}

.theme-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: var(--space-1);
  min-width: 200px;
  background: rgba(22, 33, 62, 0.98);
  border: 1px solid var(--color-purple);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(123, 44, 191, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition-fast);
  z-index: var(--z-dropdown);
}

.theme-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown opens upward when at bottom of screen */
.theme-selector.dropdown-up .theme-dropdown {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: var(--space-1);
  transform: translateY(10px);
}

.theme-selector.dropdown-up .theme-dropdown.open {
  transform: translateY(0);
}

.theme-selector.dropdown-up .theme-arrow {
  transform: rotate(180deg);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3);
  background: transparent;
  border: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.theme-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.theme-option.active {
  background: rgba(123, 44, 191, 0.3);
}

.theme-option:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.theme-option:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.theme-option .theme-color {
  width: 14px;
  height: 14px;
}

/* Mobile adjustments for theme selector */
@media (max-width: 480px) {
  .theme-selector-btn .theme-name {
    display: none;
  }

  .theme-dropdown {
    right: 0;
    left: auto;
  }
}

/* Small phones */
@media (max-width: 400px) {
  .game-sidebar {
    grid-template-columns: 1fr;
  }

  .submission-card {
    width: 100px;
    min-height: 130px;
    font-size: var(--text-sm);
  }

  .hand-card {
    flex: 0 0 110px;
    min-height: 140px;
    font-size: var(--text-sm);
  }

  .card-black.question-card {
    font-size: var(--text-base);
    min-height: 160px;
  }
}

/* Landscape phone - hand cards at bottom */
@media (max-height: 500px) and (orientation: landscape) {
  .your-cards-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 35vh;
    z-index: 100;
    background: rgba(13, 2, 33, 0.98);
    border-top: 2px solid var(--color-purple);
  }

  .game-container {
    padding-bottom: 35vh;
  }
}

/* Safe area support for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .your-cards-section {
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }

  .game-header {
    padding-top: calc(var(--space-3) + env(safe-area-inset-top));
  }
}

/* ============================================
   Betting Panel (High Stakes Mode)
   ============================================ */
.betting-panel {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.15) 100%);
  border: 2px solid #ffd700;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin: var(--space-3) auto;
  max-width: 900px;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.betting-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.betting-left {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.pot-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid #ffd700;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  min-width: 80px;
}

.pot-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: #ffd700;
  letter-spacing: 0.1em;
}

.pot-amount {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.bet-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  color: var(--color-text-dim);
  font-size: var(--text-sm);
}

.bet-info strong {
  color: var(--color-secondary);
}

.cards-allowed {
  color: #ffd700;
  font-weight: 600;
}

.betting-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.bet-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.bet-input-group label {
  color: var(--color-text-dim);
  font-size: var(--text-sm);
}

.bet-input {
  width: 60px;
  padding: var(--space-2);
  background: rgba(22, 33, 62, 0.8);
  border: 1px solid #ffd700;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-base);
  text-align: center;
}

.bet-input:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 10px rgba(0, 255, 249, 0.3);
}

.bet-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.bet-button {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #0d0221;
  font-weight: 700;
  padding: var(--space-2) var(--space-4);
  border: none;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.bet-button:hover {
  background: linear-gradient(135deg, #ffed4a 0%, #ffaa00 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}

.bet-placed-message {
  background: rgba(0, 255, 100, 0.1);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  color: var(--color-success);
  font-size: var(--text-sm);
}

.bet-placed-message strong {
  color: #ffd700;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .betting-panel {
    margin: var(--space-2);
    padding: var(--space-3);
  }

  .betting-content {
    flex-direction: column;
    gap: var(--space-3);
  }

  .betting-left {
    width: 100%;
    justify-content: space-between;
  }

  .betting-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .bet-input-group {
    flex-wrap: wrap;
    justify-content: center;
  }
}
