body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 10px;
  font-family: 'Press Start 2P', cursive; /* Retro gaming font */
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  color: #fff;
  touch-action: none; /* Prevent default touch actions */
}

.game-container {
  position: relative;
  display: flex;
  flex-direction: row;
  padding: 10px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  max-width: 100%;
  box-sizing: border-box;
  z-index: 1; /* Add this */
}

canvas {
  background-color: rgba(20, 20, 20, 0.9);
  border: 3px solid #333;
  border-radius: 5px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.info-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-left: 20px;
  padding: 15px;
  background: rgba(40, 40, 40, 0.6);
  border-radius: 10px;
  min-width: 130px;
}

.next-piece, .hold-piece {
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
}

h3 {
  margin: 5px 0;
  text-align: center;
  color: #00ff00;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 5px #00ff00;
}

#quadMessage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  font-weight: bold;
  color: #00ff00;
  background: rgba(0, 0, 0, 0.9);
  padding: 20px 40px;
  border-radius: 15px;
  border: 2px solid #00ff00;
  box-shadow: 0 0 20px #00ff00;
  text-shadow: 0 0 10px #00ff00;
  animation: glow 1s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 0 0 5px #00ff00, 0 0 10px #00ff00, 0 0 15px #00ff00, 0 0 20px #00ff00;
  }
  to {
    text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 0 0 30px #00ff00, 0 0 40px #00ff00;
  }
}

.hidden {
  display: none;
}

.game-over {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.game-over-content {
  background: rgba(40, 40, 40, 0.95);
  padding: 40px;
  border-radius: 15px;
  border: 2px solid #00ff00;
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
  text-align: center;
  animation: slideIn 0.5s ease-out;
}

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

@keyframes flashGameOver {
  0% { color: #ff0051; }
  50% { color: #ff6b96; }
  100% { color: #ff0051; }
}

.game-over h2 {
  color: #ff0051;
  font-size: 3em;
  margin-bottom: 30px;
  text-shadow: 0 0 10px rgba(255, 0, 81, 0.5);
  animation: flashGameOver 1s infinite;
}

.score-display {
  margin: 20px 0;
  font-size: 1.2em;
}

.score-display p {
  margin: 10px 0;
}

.buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 30px;
}

.buttons button {
  padding: 15px 30px;
  font-family: 'Press Start 2P', cursive;
  font-size: 1em;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#retryButton {
  background: #00ff00;
  color: #000;
}

#quitButton {
  background: #ff0051;
  color: #fff;
}

.buttons button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

#pauseScreen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.menu-content {
  background: #333;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
}

.menu-content button {
  margin: 10px;
  padding: 10px 20px;
}

#resumeButton {
  background: #00ff00;
  color: #000;
  font-family: 'Press Start 2P', cursive;

}

#quitFromPauseButton {
  background: #ff0051;
  color: #fff;
  font-family: 'Press Start 2P', cursive;

}

.menu-content button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

@keyframes dissolveBlock {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.dissolving {
  position: absolute;
  transition: all 0.3s;
  z-index: 100;
}

.main-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.main-menu h1, .countdown {
  font-family: 'Press Start 2P', cursive; /* Use the same font */
  color: #00ff00;
  text-shadow: 0 0 5px #00ff00;
  text-align: center;
  letter-spacing: 2px;
}

.main-menu h1 {
  font-size: 3em;
  margin-bottom: 40px;
  animation: glow 1.5s ease-in-out infinite alternate;
}

.countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4em;
  color: #00ff00;
  z-index: 1500;
  text-shadow: 0 0 5px #00ff00;
  animation: countdownScale 1s ease-in-out;
}

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

/* Make canvas responsive */
canvas#gameCanvas {
  max-width: 100%;
  height: auto;
}

/* Add media queries for different screen sizes */
@media (max-width: 768px) {
  
  .game-container {
    flex-direction: column;
    align-items: center;
  }

  .game-boards {
    flex-direction: column;
  }

  .info-panel {
    position: static;
    margin-top: 20px;
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
  }

  .next-piece, .hold-piece {
    margin: 5px;
  }

  canvas#gameCanvas {
    width: 100%;
    max-width: 350px;
  }

  canvas#nextCanvas, canvas#holdCanvas {
    width: 80px;
    height: 80px;
  }
}

/* Add touch control hints for mobile */
.touch-controls-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 5px;
  font-size: 0.8em;
  text-align: center;
  display: none;
}

@media (max-width: 768px) {
  .touch-controls-hint {
    display: block;
  }
}

.combo-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2em;
  color: #00ff00;
  text-shadow: 0 0 10px #00ff00;
  animation: comboPopup 1s ease-out;
}

@keyframes comboPopup {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.challenge-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 10px;
  border: 2px solid #00ff00;
  animation: slideIn 0.5s ease-out;
}

/* Weather effects */
.wind-effect {
  animation: windShake 2s infinite;
}

.storm-effect {
  animation: stormFlash 0.5s infinite;
}

.fog-effect {
  filter: blur(2px);
  opacity: 0.8;
}

@keyframes windShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes stormFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

.challenge-complete {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  padding: 20px 40px;
  border-radius: 15px;
  border: 2px solid #ffd700;
  color: #ffd700;
  font-size: 2em;
  text-align: center;
  animation: slideInOut 2s ease-in-out;
  z-index: 1000;
}

@keyframes slideInOut {
  0% { transform: translate(-50%, -100%); opacity: 0; }
  20% { transform: translate(-50%, -50%); opacity: 1; }
  80% { transform: translate(-50%, -50%); opacity: 1; }
  100% { transform: translate(-50%, 100%); opacity: 0; }
}

.laser-beam {
  position: absolute;
  left: 0;
  width: 100%;
  height: 30px;
  background: linear-gradient(90deg, transparent, #ff0000, transparent);
  animation: laser 0.5s linear;
}

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

.weather-notification {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 10px;
  border: 2px solid #00ffff;
  color: #00ffff;
  animation: slideIn 0.5s ease-out;
  z-index: 1000;
}

.reward-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  padding: 20px;
  border-radius: 15px;
  border: 2px solid #ffd700;
  color: #ffd700;
  text-align: center;
  animation: popIn 0.5s ease-out;
  z-index: 1000;
}

.weather-notification,
.reward-notification {
  font-family: 'Press Start 2P', cursive;
}

.reward-notification h3 {
  margin-bottom: 15px;
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.menu-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 20px;
}

.menu-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-button {
    background: #333;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 10px 20px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button.active {
    background: #00ff00;
    color: #000;
}

.menu-section {
    display: none;
}

.menu-section.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.stat-item {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #333;
    border-radius: 5px;
    margin-top: 5px;
}

.progress-fill {
    height: 100%;
    background: #00ff00;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.mega-achievement-progress {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

.mode-buttons,
.theme-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.mode-buttons button,
.theme-buttons button {
    background: #333;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-buttons button:hover,
.theme-buttons button:hover {
    background: #00ff00;
    color: #000;
}

.mode-buttons button.selected,
.theme-buttons button.selected {
    background: #00ff00;
    color: #000;
}

.achievements-list,
.stats-list {
    max-height: 200px;
    overflow-y: auto;
}

.achievement-item,
.stat-item {
    background: rgba(0, 0, 0, 0.5);
    margin: 5px 0;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.8em;
}

.achievement-item.earned {
    border: 1px solid #00ff00;
}

.achievement-item .reward {
    color: #ffd700;
}

/* Shop styles */
.shop-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #00ff00;
    z-index: 2000;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.shop-item {
  padding: 10px;
  margin: 10px 0;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #00ff00;
  border-radius: 8px;
  text-align: center;
}

.shop-item button {
  margin-top: 10px;
  background: #00ff00;
  color: #000;
  border: none;
  padding: 15px 30px;
  font-family: 'Press Start 2P', cursive;
  font-size: 1em;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.shop-item button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.shop-item button:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .menu-sections {
        grid-template-columns: 1fr;
    }

    .shop-items {
        grid-template-columns: 1fr;
    }

    .mode-buttons,
    .theme-buttons {
        grid-template-columns: 1fr;
    }
}

.pause-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.pause-section {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #00ff00;
}

.score-display-game {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 5px;
    color: #00ff00;
    font-family: 'Press Start 2P', cursive;
}

.mode-description {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    font-size: 0.8em;
    color: #00ff00;
    min-height: 40px;
}

.theme-buttons button {
    position: relative;
}

.theme-buttons button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.mega-points {
    margin-top: 10px;
    color: #ffd700;
    text-align: center;
}

.main-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.menu-button {
    background: #00ff00;
    color: #000;
    border: none;
    padding: 15px 30px;
    font-family: 'Press Start 2P', cursive;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2000;
}

.menu-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.mega-achievements-list {
    max-height: 200px;
    overflow-y: auto;
}

.mega-achievement-item {
    background: rgba(0, 0, 0, 0.5);
    margin: 5px 0;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.8em;
}

.mega-achievement-item.earned {
    border: 1px solid #ffd700;
    color: #ffd700;
}

.mega-achievement-item .reward {
    color: #ffd700;
    font-weight: bold;
}

.achievements-list {
    display: none; /* Hide initially */
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    font-size: 0.8em;
}

.achievements-list.hidden {
    display: none;
}

.mega-shop-items button {
  margin-top: 10px;
  background: #00ff00;
  color: #000;
  border: none;
  padding: 15px 30px;
  font-family: 'Press Start 2P', cursive;
  font-size: 1em;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mega-shop-items button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.theme-buttons button.locked {
    opacity: 0.5;
    position: relative;
    cursor: not-allowed;
}

.theme-buttons button.locked::before {
    content: "🔒";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    color: #ff0000;
    text-shadow: 0 0 5px #000;
}

.theme-buttons button.locked:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    white-space: nowrap;
}

.multiplayer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.game-boards {
  display: flex;
  align-items: flex-start;
  position: relative;
  gap: 20px;
  z-index: 2;
}

.opponent-board .info-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-left: 20px;
  padding: 15px;
  background: rgba(40, 40, 40, 0.6);
  border-radius: 10px;
  min-width: 130px;
}

.player-board, .opponent-board {
  display: flex;
  align-items: flex-start;
  position: relative;
}

.player-board h3, .opponent-board h3 {
  margin-bottom: 15px;
  color: #00ff00;
}

.opponent-board {
  display: flex;
  align-items: flex-start;
  position: relative;
  margin-left: 20px;
  background: rgba(20, 20, 20, 0.9);
  border-radius: 5px;
  z-index: 10;
  flex-direction: row; /* Add this */
}

.opponent-board h3 {
  color: #ff0000;
  margin-top: 10px; /* Moves text below the canvas */
  text-align: center;
}

.opponent-board.active {
  display: block;
}

#opponentCanvas {
  background-color: rgba(20, 20, 20, 0.9);
  border: 3px solid #ff0000;
  border-radius: 5px;
}

.multiplayer-controls {
  background: rgba(0, 0, 0, 0.7);
  padding: 30px;
  border-radius: 15px;
  border: 2px solid #00ff00;
  text-align: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.join-room {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
}

#roomCode {
  padding: 15px;
  font-size: 1.2em;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #00ff00;
  color: #00ff00;
  border-radius: 8px;
  font-family: 'Press Start 2P', cursive;
}

.room-info {
  color: #00ff00;
  font-size: 1.2em;
  text-align: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
}

#multiplayerControls.hidden {
    display: none;
}

#multiplayerSection h2 {
  display: none;
}

#multiplayerControls, #roomInfo {
  display: none;
}

#multiplayerSection #multiplayerControls,
#multiplayerSection #roomInfo {
  display: block;
}


