:root {
  --primary-color: #00a2ff;
  --secondary-color: #00d9ff;
  --accent-color: #ff00c8;
  --dark: #333344;
  --light: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-highlight: rgba(255, 255, 255, 0.5);
  --glass-shadow: rgba(0, 162, 255, 0.4);
}

html, body {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #141e30 0%, #243b55 100%);
  color: white;
  font-family: "Segoe UI", Arial, sans-serif;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px var(--glass-shadow));
}

.hidden {
  display: none;
}

#game-container {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #02112e 0%, #52014f 100%);
}

/* Glossy Button Container */
#button-container {
  position: absolute;
  top: 15px;
  left: 15px;
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 0;
  z-index: 100;
}

/* Info Container with Glossy Effect */
#info-container {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 10px;
  padding: 5px;
  margin: 0;
  max-width: 250px;
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
  z-index: 150;
}

/* Info Container with Glossy Effect */
#drop-button-container {
  position: absolute;
  bottom: 1dvh;
  left: 5;
  display: flex;
  gap: 10px;
  padding: 5px;
  margin: 0;
  max-width: 250px;
  text-align: center;
  z-index: 150;
}

/* Glossy Buttons */
.button {
  padding: 12px 20px;
  font-size: 18px;
  background: linear-gradient(180deg, var(--primary-color) 0%, rgba(0, 122, 204, 1) 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 
    0 10px 20px rgba(0, 0, 0, 0.2),
    inset 0 -3px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.button:hover {
  background: linear-gradient(180deg, #00b8ff 0%, var(--primary-color) 100%);
  transform: translateY(-2px);
  box-shadow: 
    0 15px 25px rgba(0, 0, 0, 0.3),
    inset 0 -3px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.button:active {
  transform: translateY(1px);
  box-shadow: 
    0 5px 10px rgba(0, 0, 0, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Button with Glossy Reflection */
.button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 50%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(-25deg) translateY(-20%);
  pointer-events: none;
}

#pause-button, #play-button {
  font-size: 20px;
  background: linear-gradient(180deg, var(--primary-color) 0%, rgba(0, 122, 204, 1) 100%);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 auto;
}

#play-button {
  font-size: 34px;
  width: 60px;
  height: 60px;
}

#mute-button {
  font-size: 20px;
  background: linear-gradient(180deg, var(--primary-color) 0%, rgba(0, 122, 204, 1) 100%);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.frosted-glass-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  z-index: 100;
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.3),
    0 0 20px var(--glass-shadow),
    inset 0 1px 2px var(--glass-highlight);
  min-width: 275px;
}

/* Game Over Screen with Frosted Glass Effect */
#game-over {
  display: none;
}

#game-over h1 {
  font-size: 36px;
  margin-bottom: 20px;
  background: linear-gradient(to right, var(--secondary-color), var(--light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(0, 162, 255, 0.6);
}

/* Start Screen with Frosted Glass Effect */

#start-screen h1 {
  font-size: 48px;
  margin-bottom: 20px;
  background: linear-gradient(to right, var(--secondary-color), var(--light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(0, 162, 255, 0.3);
  font-weight: bold;
  letter-spacing: 3px;
}

/* Next Piece Container with Frosted Glass Effect */
#next-piece-container {
  position: absolute;
  top: 90px;
  right: 15px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px;
  border-radius: 15px;
  z-index: 100;
  text-align: center;
  font-size: 0.9em;
  font-weight: bold;
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 1px var(--glass-highlight);
}

#next-piece-canvas {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(20, 30, 48, 0.6);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
  opacity: 0.95;
  margin: 0 auto;
  text-align: center;
}

/* Level Selector with Glossy Effect */
.level-selector {
  margin: 20px 0;
  text-align: center;
}

.level-selector select {
  padding: 10px 15px;
  font-size: 16px;
  background: var(--light);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: rgb(0, 0, 0);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  appearance: none;
  cursor: pointer;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px var(--glass-highlight);
  transition: all 0.2s;
}

.level-selector select:hover {
  border-color: var(--secondary-color);
}

.level-selector select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 
    0 0 0 2px rgba(255, 0, 200, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
#start-button, #restart-button1, #restart-button2 {
  background: linear-gradient(180deg, var(--accent-color) 0%, #cc00a2 100%);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 15px 30px;
}

#start-button:hover, #restart-button1:hover, #restart-button2:hover {
  background: linear-gradient(180deg, #ff40d6 0%, var(--accent-color) 100%);
}


#pause-overlay p {
  font-size: 30px;
  margin-bottom: 20px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Controls Display */
#controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-size: 16px;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px;
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 1px var(--glass-highlight);
}

.controls-list {
  text-align: left;
  display: inline-block;
  margin: 20px auto;
  padding-left: 20px;
}

.controls-list li {
  margin-bottom: 15px;
  list-style-type: none;
  position: relative;
}

.controls-list li::before {
  content: "•";
  position: absolute;
  left: -15px;
  color: var(--primary-color);
  font-size: 20px;
}

.controls-list li strong {
  color: var(--secondary-color);
  text-shadow: 0 0 5px rgba(0, 217, 255, 0.3);
}

/* Mobile controls container styling */
.mobile-controls {
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 20px;
}

.mobile-controls h3 {
  color: var(--secondary-color);
  margin-bottom: 15px;
  font-size: 20px;
  text-shadow: 0 0 10px rgba(0, 217, 255, 0.4);
}

/* Add game-container mobile-specific styles */
#game-container.mobile-view #controls {
  display: none; /* Always hide keyboard controls details on mobile */
}

/* Make buttons bigger on mobile for easier touch */
@media (max-width: 768px) {
  
  #start-screen h1 {
    font-size: 38px;
  }

  #button-container {
    top: 0px;
    left: 0px;
  }
  
  #info-container {
    font-size: 10px;
    top: 0px;
    right: 0px;
    padding: 5px;
    gap: 10px;
  }
  
  #controls {
    display: none; /* Hide keyboard controls on mobile */
  }
    
  /* Start screen mobile improvements */
  .controls-list {
    padding-left: 0;
  }
  
  #start-screen {
    width: 85%;
    max-width: 400px;
    padding: 25px;
  }
  
  .mobile-controls .controls-list li {
    margin-bottom: 15px;
  }
  
  /* Make buttons more touch-friendly */
  .button {
    padding: 15px 25px;
    font-size: 20px;
    border-radius: 30px;
  }
  
  /* Adjust the level selector for mobile */
  .level-selector select {
    padding: 12px 20px;
    font-size: 18px;
  }
  
  #next-piece-container {
    top: 40px;
    right: 0px;
    padding: 5px;
    opacity: 0.5;
  }
}

/* Drop button - mobile only */
#drop-button {
  display: none;
  z-index: 300;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  padding: 10px 16px;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  background: linear-gradient(180deg, var(--accent-color) 0%, #cc00a2 100%);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.2),
    inset 0 -3px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  #drop-button {
    display: flex;
  }
}

/* Ensure canvas captures touch events properly */
#game-container canvas {
  z-index: 10;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Add some Y2K details */
#score-container, #high-score-container, #level-container {
  position: relative;
  padding: 5px 10px;
  font-weight: bold;
}

#score-container::before, #high-score-container::before, #level-container::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 1px;
  background: linear-gradient(90deg, 
    rgba(255,255,255,0) 0%, 
    rgba(255,255,255,0.5) 50%, 
    rgba(255,255,255,0) 100%);
}

#score, #high-score, #level, #final-score, #final-high-score {
  color: var(--secondary-color);
  text-shadow: 0 0 10px rgba(0, 217, 255, 0.6);
  font-weight: bold;
}