@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #4a2c5a, #6b4b7d, #8e5aa3);
  font-family: 'Orbitron', 'Arial', sans-serif;
  overflow: hidden;
}

#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#ui {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.9), rgba(142, 90, 163, 0.8));
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-width: 180px;
  animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
  from { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(142, 90, 163, 0.3); }
  to { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 30px rgba(142, 90, 163, 0.6); }
}

#ui > div {
  margin: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

#ui > div:first-child {
  font-size: 18px;
  color: #ffff88;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#score, #level, #lines {
  color: #88ffff;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  text-shadow: 0 0 10px rgba(136, 255, 255, 0.5);
  min-width: 60px;
  text-align: right;
  transition: all 0.3s ease;
}

#score {
  position: relative;
}

#score::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, transparent, rgba(136, 255, 255, 0.2), transparent);
  border-radius: 4px;
  opacity: 0;
  animation: scoreShimmer 3s ease-in-out infinite;
}

@keyframes scoreShimmer {
  0%, 100% { opacity: 0; transform: translateX(-100%); }
  50% { opacity: 1; transform: translateX(100%); }
}

#level {
  position: relative;
  font-weight: bold;
}

#nextPiece, #holdPiece {
  position: absolute;
  z-index: 100;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: nextPieceGlow 3s ease-in-out infinite alternate;
  min-width: 120px;
}

#nextPiece {
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.9), rgba(142, 90, 163, 0.8));
}

#holdPiece {
  top: 240px;
  right: 20px;
  background: linear-gradient(135deg, rgba(90, 74, 44, 0.9), rgba(163, 142, 90, 0.8));
}

@keyframes nextPieceGlow {
  from { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 136, 255, 0.3); }
  to { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 25px rgba(255, 136, 255, 0.5); }
}

#nextPiece > div:first-child {
  color: #ff88ff;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  margin-bottom: 10px;
}

#holdPiece > div:first-child {
  color: #ffaa44;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  margin-bottom: 8px;
}

#nextPieceContainer, #holdPieceContainer {
  width: 120px;
  height: 120px;
  border: 2px solid rgba(142, 90, 163, 0.6);
  border-radius: 15px;
  margin-top: 10px;
  background: linear-gradient(45deg, rgba(0, 0, 0, 0.4), rgba(74, 44, 90, 0.3));
  box-shadow: 
    inset 0 2px 10px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(142, 90, 163, 0.3),
    0 0 40px rgba(142, 90, 163, 0.1);
  position: relative;
  overflow: hidden;
  animation: nextPieceGlow 4s ease-in-out infinite;
  cursor: pointer;
  transition: all 0.3s ease;
}

#holdPieceContainer {
  width: 100px;
  height: 100px;
  border-color: rgba(163, 142, 90, 0.6);
  background: linear-gradient(45deg, rgba(0, 0, 0, 0.4), rgba(90, 74, 44, 0.3));
  box-shadow: 
    inset 0 2px 10px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(163, 142, 90, 0.3),
    0 0 40px rgba(163, 142, 90, 0.1);
  margin: 8px auto 0 auto;
}

/* Center cross-hair guides */
#nextPieceContainer::before,
#nextPieceContainer::after {
  content: '';
  position: absolute;
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 45%, 
    rgba(142, 90, 163, 0.3) 48%, 
    rgba(255, 136, 255, 0.6) 50%, 
    rgba(142, 90, 163, 0.3) 52%, 
    transparent 55%, 
    transparent 100%);
  pointer-events: none;
  opacity: 0.7;
  animation: guidePulse 3s ease-in-out infinite alternate;
}

/* Horizontal guide line */
#nextPieceContainer::before {
  top: 50%;
  left: 10%;
  right: 10%;
  height: 1px;
  transform: translateY(-50%);
}

/* Vertical guide line */
#nextPieceContainer::after {
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, 
    transparent 0%, 
    transparent 45%, 
    rgba(142, 90, 163, 0.3) 48%, 
    rgba(255, 136, 255, 0.6) 50%, 
    rgba(142, 90, 163, 0.3) 52%, 
    transparent 55%, 
    transparent 100%);
}

@keyframes guidePulse {
  0% { opacity: 0.4; }
  100% { opacity: 0.8; }
}

/* Center point indicator */
.center-point {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, rgba(255, 136, 255, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: centerPulse 2s ease-in-out infinite;
  z-index: 1;
}

@keyframes centerPulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 1;
  }
}

/* Corner alignment dots */
.alignment-dot {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(142, 90, 163, 0.5);
  border-radius: 50%;
  pointer-events: none;
  animation: dotFade 4s ease-in-out infinite;
}

.alignment-dot.top-left { top: 25%; left: 25%; }
.alignment-dot.top-right { top: 25%; right: 25%; }
.alignment-dot.bottom-left { bottom: 25%; left: 25%; }
.alignment-dot.bottom-right { bottom: 25%; right: 25%; }

@keyframes dotFade {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

#nextPieceContainer:hover {
  transform: scale(1.05);
  border-color: rgba(255, 136, 255, 0.8);
  box-shadow: 
    inset 0 2px 15px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(255, 136, 255, 0.5),
    0 0 60px rgba(255, 136, 255, 0.3),
    0 0 100px rgba(255, 136, 255, 0.1);
  animation: nextPieceHover 2s ease-in-out infinite;
}

#nextPieceContainer:hover::before,
#nextPieceContainer:hover::after {
  opacity: 1;
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 40%, 
    rgba(255, 136, 255, 0.4) 45%, 
    rgba(255, 255, 255, 0.8) 50%, 
    rgba(255, 136, 255, 0.4) 55%, 
    transparent 60%, 
    transparent 100%);
}

#nextPieceContainer:hover::after {
  background: linear-gradient(180deg, 
    transparent 0%, 
    transparent 40%, 
    rgba(255, 136, 255, 0.4) 45%, 
    rgba(255, 255, 255, 0.8) 50%, 
    rgba(255, 136, 255, 0.4) 55%, 
    transparent 60%, 
    transparent 100%);
}

#nextPieceContainer:hover .center-point {
  animation: centerPulseHover 1s ease-in-out infinite;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 136, 255, 0.8) 50%, transparent 100%);
}

@keyframes centerPulseHover {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.9;
  }
  50% { 
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
  }
}

#nextPieceContainer:hover .alignment-dot {
  background: rgba(255, 136, 255, 0.8);
  animation: dotPulseHover 1.5s ease-in-out infinite;
}

@keyframes dotPulseHover {
  0%, 100% { 
    opacity: 0.6;
    transform: scale(1);
  }
  50% { 
    opacity: 1;
    transform: scale(1.5);
  }
}

@keyframes nextPieceHover {
  0%, 100% { 
    box-shadow: 
      inset 0 2px 15px rgba(0, 0, 0, 0.6),
      0 0 30px rgba(255, 136, 255, 0.5),
      0 0 60px rgba(255, 136, 255, 0.3),
      0 0 100px rgba(255, 136, 255, 0.1);
  }
  50% { 
    box-shadow: 
      inset 0 2px 15px rgba(0, 0, 0, 0.6),
      0 0 40px rgba(255, 136, 255, 0.7),
      0 0 80px rgba(255, 136, 255, 0.4),
      0 0 120px rgba(255, 136, 255, 0.2);
  }
}

/* Performance-optimized shake animations using CSS transforms */
@keyframes cameraShakeLight {
  0%, 100% { transform: translate3d(0, 0, 0); }
  10% { transform: translate3d(-1px, -1px, 0); }
  20% { transform: translate3d(-2px, 0, 0); }
  30% { transform: translate3d(2px, 1px, 0); }
  40% { transform: translate3d(1px, -1px, 0); }
  50% { transform: translate3d(-1px, 1px, 0); }
  60% { transform: translate3d(-2px, 0, 0); }
  70% { transform: translate3d(2px, 1px, 0); }
  80% { transform: translate3d(-1px, -1px, 0); }
  90% { transform: translate3d(1px, 0, 0); }
}

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

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

/* Performance optimizations */
.shake-light {
  animation: cameraShakeLight 0.3s ease-in-out;
  will-change: transform;
}

.shake-medium {
  animation: cameraShakeMedium 0.4s ease-in-out;
  will-change: transform;
}

.shake-heavy {
  animation: cameraShakeHeavy 0.6s ease-in-out;
  will-change: transform;
}

/* Remove will-change after animation to free up GPU memory */
.shake-light,
.shake-medium,
.shake-heavy {
  animation-fill-mode: forwards;
}

.shake-light:not(:hover):not(:focus):not(:active),
.shake-medium:not(:hover):not(:focus):not(:active),
.shake-heavy:not(:hover):not(:focus):not(:active) {
  will-change: auto;
}

.shimmer-overlay {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(45deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.1) 25%, 
    transparent 50%, 
    rgba(255, 255, 255, 0.1) 75%, 
    transparent 100%);
  border-radius: 15px;
  animation: shimmer 6s linear infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes nextPieceGlow {
  0%, 100% { 
    box-shadow: 
      inset 0 2px 10px rgba(0, 0, 0, 0.5),
      0 0 20px rgba(142, 90, 163, 0.3),
      0 0 40px rgba(142, 90, 163, 0.1);
  }
  50% { 
    box-shadow: 
      inset 0 2px 10px rgba(0, 0, 0, 0.5),
      0 0 30px rgba(142, 90, 163, 0.5),
      0 0 60px rgba(142, 90, 163, 0.2);
  }
}

@keyframes innerGlow {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(300%) rotate(45deg); }
}

.next-piece-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: radial-gradient(circle, rgba(255, 136, 255, 0.8), transparent);
  border-radius: 50%;
  pointer-events: none;
  animation: floatParticle 4s ease-in-out infinite;
}

@keyframes floatParticle {
  0%, 100% { 
    transform: translateY(0px) scale(0.8);
    opacity: 0.6;
  }
  25% { 
    transform: translateY(-8px) scale(1);
    opacity: 1;
  }
  50% { 
    transform: translateY(-12px) scale(0.9);
    opacity: 0.8;
  }
  75% { 
    transform: translateY(-6px) scale(1.1);
    opacity: 0.9;
  }
}

#gameOverScreen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.95), rgba(142, 90, 163, 0.9));
  backdrop-filter: blur(15px);
  border: 3px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  z-index: 200;
  display: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: gameOverPulse 2s ease-in-out infinite alternate;
}

@keyframes gameOverPulse {
  from { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 100, 100, 0.3); }
  to { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 50px rgba(255, 100, 100, 0.6); }
}

#gameOverScreen h2 {
  color: #ff6666;
  font-size: 28px;
  font-weight: 900;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 20px;
}

#gameOverScreen p {
  font-size: 16px;
  margin: 15px 0;
  color: #ccccff;
}

#gameOverScreen button {
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  border: none;
  color: white;
  padding: 12px 25px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  margin-top: 15px;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
  transition: all 0.3s ease;
}

#gameOverScreen button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* Pause Overlay */
#pauseOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 300;
  animation: fadeIn 0.3s ease;
}

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

#pauseContent {
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.95), rgba(142, 90, 163, 0.9));
  backdrop-filter: blur(15px);
  border: 3px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideIn {
  from { transform: translateY(-50px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

#pauseContent h2 {
  color: #88ffff;
  font-size: 32px;
  font-weight: 900;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 20px;
  font-family: 'Orbitron', sans-serif;
}

#pauseContent p {
  font-size: 18px;
  margin: 20px 0;
  color: #ccccff;
}

.pause-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.pause-controls button {
  background: linear-gradient(45deg, #4a8fff, #6ba3ff);
  border: none;
  color: white;
  padding: 12px 25px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(74, 143, 255, 0.4);
  transition: all 0.3s ease;
  font-family: 'Orbitron', sans-serif;
}

.pause-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 143, 255, 0.6);
}

.pause-controls button:nth-child(2) {
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.pause-controls button:nth-child(2):hover {
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* Mobile Touch Controls */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.9), rgba(142, 90, 163, 0.8));
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 8px;
  width: 120px;
  height: 120px;
}

.control-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  touch-action: manipulation;
}

.control-btn:active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
  transform: scale(0.95);
}

.control-btn.rotate { grid-column: 2; grid-row: 1; }
.control-btn.left { grid-column: 1; grid-row: 2; }
.control-btn.down { grid-column: 2; grid-row: 2; }
.control-btn.right { grid-column: 3; grid-row: 2; }
.control-btn.drop { grid-column: 2; grid-row: 3; background: linear-gradient(135deg, rgba(255, 100, 100, 0.3), rgba(255, 150, 150, 0.1)); }
.control-btn.hold { grid-column: 1; grid-row: 3; background: linear-gradient(135deg, rgba(100, 255, 100, 0.3), rgba(150, 255, 150, 0.1)); }
.control-btn.pause { grid-column: 3; grid-row: 3; background: linear-gradient(135deg, rgba(100, 100, 255, 0.3), rgba(150, 150, 255, 0.1)); }

/* Wide screen layout adjustments */
@media (min-width: 1200px) {
  #holdPiece {
    top: 240px;
    right: 20px;
  }
}

/* Medium screen adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  #holdPiece {
    top: 220px;
    right: 20px;
  }
  
  #nextPieceContainer, #holdPieceContainer {
    width: 100px;
    height: 100px;
  }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  #ui {
    top: 10px;
    left: 10px;
    padding: 15px;
    min-width: 140px;
  }
  
  #nextPiece {
    top: 10px;
    right: 10px;
    padding: 8px;
    min-width: 80px;
  }
  
  #holdPiece {
    top: 180px;
    right: 10px;
    padding: 8px;
    min-width: 80px;
  }
  
  #nextPieceContainer {
    width: 70px;
    height: 70px;
  }
  
  #holdPieceContainer {
    width: 60px;
    height: 60px;
  }
  
  .next-piece-particle {
    width: 2px;
    height: 2px;
  }
  
  #nextPieceContainer:hover, #holdPieceContainer:hover {
    transform: scale(1.03);
  }
  
  #instructions {
    bottom: 160px;
    right: 10px;
    padding: 10px;
    font-size: 11px;
  }
  
  #gameOverScreen {
    padding: 30px 20px;
    margin: 0 20px;
  }
  
  .mobile-controls {
    display: block;
  }
  
  #pauseContent {
    padding: 30px 20px;
    margin: 0 20px;
  }
  
  #pauseContent h2 {
    font-size: 24px;
  }
  
  .pause-controls {
    flex-direction: column;
    gap: 10px;
  }
}

#instructions {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.8), rgba(107, 75, 125, 0.7));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  text-align: right;
}

#instructions > div {
  color: #ccccff;
  margin: 3px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  font-weight: 500;
}

#instructions > div:first-child {
  color: #ffffcc;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

/* Debug Panel Styles */
#debugPanel {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 100;
  background: linear-gradient(135deg, rgba(74, 44, 90, 0.9), rgba(107, 75, 125, 0.8));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-size: 12px;
  min-width: 200px;
  transition: all 0.3s ease;
}

#debugToggle {
  background: linear-gradient(135deg, rgba(255, 136, 255, 0.8), rgba(142, 90, 163, 0.9));
  color: white;
  padding: 8px 15px;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  transition: all 0.2s ease;
  user-select: none;
}

#debugToggle:hover {
  background: linear-gradient(135deg, rgba(255, 136, 255, 1), rgba(142, 90, 163, 1));
  transform: translateY(-1px);
}

#debugContent {
  padding: 10px;
  color: #ccccff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

#debugPanel.expanded #debugContent {
  max-height: 300px;
  padding: 10px;
}

#debugPanel:not(.expanded) #debugContent {
  padding: 0 10px;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
  font-family: 'Courier New', monospace;
}

.debug-row span:first-child {
  color: #ffcc88;
  font-weight: bold;
}

.debug-row span:last-child {
  color: #88ffcc;
  text-align: right;
  max-width: 100px;
  word-break: break-all;
}

/* Mobile adjustments for debug panel */
@media (max-width: 768px) {
  #debugPanel {
    bottom: 10px;
    right: 10px;
    left: auto;
    font-size: 11px;
    min-width: 160px;
  }
  
  #debugToggle {
    padding: 6px 12px;
  }
  
  .debug-row span:last-child {
    max-width: 80px;
  }
}

/* Debug control styles */
.debug-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  font-family: 'Courier New', monospace;
}

.debug-control-row span:first-child {
  color: #ffcc88;
  font-weight: bold;
  font-size: 11px;
}

.debug-btn {
  background: linear-gradient(135deg, rgba(136, 255, 136, 0.3), rgba(68, 204, 68, 0.4));
  border: 1px solid rgba(136, 255, 136, 0.5);
  color: #88ff88;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Courier New', monospace;
  min-width: 35px;
  text-align: center;
}

.debug-btn:hover {
  background: linear-gradient(135deg, rgba(136, 255, 136, 0.5), rgba(68, 204, 68, 0.6));
  border-color: rgba(136, 255, 136, 0.8);
  transform: translateY(-1px);
}

.debug-btn.active {
  background: linear-gradient(135deg, rgba(255, 136, 136, 0.4), rgba(204, 68, 68, 0.5));
  border-color: rgba(255, 136, 136, 0.6);
  color: #ff8888;
}

.debug-btn.active:hover {
  background: linear-gradient(135deg, rgba(255, 136, 136, 0.6), rgba(204, 68, 68, 0.7));
  border-color: rgba(255, 136, 136, 0.9);
}

@media (max-width: 768px) {
  .debug-control-row span:first-child {
    font-size: 10px;
  }
  
  .debug-btn {
    padding: 2px 6px;
    font-size: 9px;
    min-width: 30px;
  }
}

/* Leaderboard Button Styles */
#leaderboardBtn {
  width: 50px;
  height: 50px;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px !important;
  border-radius: 50% !important;
}

#leaderboardBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(255, 136, 255, 0.8);
}

/* Stat Card Styles */
.stat-card {
  background: linear-gradient(135deg, rgba(142, 90, 163, 0.4), rgba(74, 44, 90, 0.6));
  border: 2px solid rgba(255, 136, 255, 0.3);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 136, 255, 0.6);
  box-shadow: 0 10px 30px rgba(255, 136, 255, 0.3);
}

.stat-label {
  color: #ff88ff;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  color: #ffffff;
  font-size: 32px;
  font-weight: 900;
  text-shadow: 0 0 15px rgba(255, 136, 255, 0.6);
  font-family: 'Orbitron', Arial, sans-serif;
}

/* Leaderboard Table Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#leaderboard tbody tr {
  border-bottom: 1px solid rgba(255, 136, 255, 0.1);
  transition: all 0.3s ease;
}

#leaderboard tbody tr:hover {
  background: rgba(255, 136, 255, 0.1);
  transform: scale(1.02);
}

#leaderboard td {
  padding: 12px 15px;
}

/* High Score Modal Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Game Over Button Styles */
.game-over-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.game-over-buttons button {
  flex: 1;
  min-width: 140px;
}

.game-over-buttons button:nth-child(2) {
  background: linear-gradient(45deg, #8e5aa3, #ff88ff);
  box-shadow: 0 4px 15px rgba(142, 90, 163, 0.4);
}

.game-over-buttons button:nth-child(2):hover {
  box-shadow: 0 6px 20px rgba(142, 90, 163, 0.6);
}

/* Mobile Responsiveness for Leaderboard */
@media (max-width: 768px) {
  #leaderboardBtn {
    bottom: 10px;
    left: 180px;
    width: 45px;
    height: 45px;
    font-size: 20px !important;
  }
  
  #leaderboardPanel {
    padding: 10px;
  }
  
  #leaderboardPanel h1 {
    font-size: 32px;
  }
  
  .stat-card {
    padding: 15px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  #leaderboard {
    font-size: 12px;
  }
  
  #leaderboard th,
  #leaderboard td {
    padding: 8px 5px;
  }
}

/* Clear Scores Button */
#clearScoresBtn:hover {
  background: rgba(255, 50, 50, 0.5);
  border-color: #ff4444;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 50, 50, 0.4);
}