/* Game page specific styles */

/* Game Container */
.game-container {
  min-height: 100vh;
  background-color: #f0f0f0;
  display: flex;
  flex-direction: column;
  position: relative;
}


/* Game page adjustments for unified header */


/* Game Main */
.game-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
}

/* Game Canvas */
#gameCanvas {
  border: 3px solid #333;
  border-radius: 8px;
  background-color: #1a1a1a;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

/* Welcome Box */
.welcome-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.welcome-box h2 {
  color: #333;
  margin-bottom: 25px;
  font-size: 2rem;
}

.instructions {
  text-align: left;
  margin: 30px 0;
  background: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
}

.instructions h3 {
  color: #4CAF50;
  margin-bottom: 15px;
  margin-top: 25px;
}

.instructions h3:first-child {
  margin-top: 0;
}

.instructions ul {
  list-style-type: none;
  padding: 0;
  margin: 15px 0;
}

.instructions li {
  margin: 8px 0;
  padding-left: 25px;
  position: relative;
  line-height: 1.5;
}

.instructions li::before {
  content: '🎮';
  position: absolute;
  left: 0;
  top: 0;
}

#startGameBtn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
}

#startGameBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

/* Game Over Box */
#gameOverBox {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 0;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  z-index: 1001;
  min-width: 400px;
  max-width: 500px;
}

.game-over-content {
  padding: 40px;
  text-align: center;
}

#gameOverBox h2 {
  margin: 0 0 20px 0;
  color: #ff4444;
  font-size: 2rem;
}

#gameOverBox h3 {
  margin: 25px 0 15px 0;
  color: #333;
  font-size: 1.3rem;
}

#topScoresList {
  list-style: none;
  padding: 0;
  margin: 15px 0 25px 0;
  max-height: 200px;
  overflow-y: auto;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
}

#topScoresList li {
  margin: 8px 0;
  padding: 8px;
  background: white;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#playAgainBtn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#playAgainBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

/* Touch Controls */
.touch-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: grid;
  grid-template-areas: 
    ". up ."
    "left down right";
  gap: 10px;
  background: transparent;
  padding: 15px;
  border-radius: 12px;
}

.touch-controls.left {
  right: auto;
  left: 20px;
}

.control-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.control-row:first-child {
  grid-area: up;
}

.control-row:last-child {
  grid-area: down;
}

.touch-btn {
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.2s ease;
}

.touch-btn:active {
  background: rgba(255,255,255,0.4);
  transform: scale(0.95);
}

#touchUp { grid-area: up; }
#touchLeft { grid-area: left; }
#touchDown { grid-area: down; }
#touchRight { grid-area: right; }

/* Room Selection Overlay */
.room-selection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  backdrop-filter: blur(5px);
}

.room-selection.hidden {
  display: none !important;
}

.room-selection-content {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 600px;
  width: 90%;
  max-height: calc(100vh - 100px);
  margin-top: 60px;
  overflow-y: auto;
}

.room-selection-content h2 {
  text-align: center;
  color: #333;
  margin-bottom: 10px;
  font-size: 2rem;
}

.room-selection-content p {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
}

.auto-join-section {
  margin-bottom: 25px;
}

.auto-join-btn, .wait-room-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

.auto-join-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

.wait-room-btn {
  background: linear-gradient(135deg, #ff9800, #f57c00);
}

.wait-room-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 152, 0, 0.3);
}

.rooms-divider {
  text-align: center;
  margin: 30px 0;
  position: relative;
}

.rooms-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e0e0;
}

.rooms-divider span {
  background: white;
  padding: 0 20px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.rooms-list {
  margin-bottom: 25px;
  max-height: 300px;
  overflow-y: auto;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafafa;
}

.room-item:hover {
  border-color: #4CAF50;
  background: #f0f8f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.room-item.full {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: #ccc;
}

.room-item.full:hover {
  border-color: #ccc;
  background: #fafafa;
  transform: none;
  box-shadow: none;
}

.room-info {
  flex: 1;
}

.room-name {
  font-weight: bold;
  font-size: 16px;
  color: #333;
  margin-bottom: 5px;
}

.room-players {
  font-size: 14px;
  color: #666;
}

.room-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.room-status.available {
  background: #e8f5e8;
  color: #4CAF50;
}

.room-status.full {
  background: #ffebee;
  color: #f44336;
}

.refresh-section {
  text-align: center;
}

.refresh-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

/* Loading Screen */
.loading-screen {
  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: 2000;
  color: white;
}

.loading-content {
  text-align: center;
}

.loading-content p {
  margin-top: 20px;
  font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-nav {
    padding: 0 15px;
  }
  
  .game-title {
    font-size: 1.2rem;
  }
  
  .menu-container {
    top: 70px;
    right: 15px;
  }
  
  .hamburger-menu {
    padding: 10px;
  }
  
  .hamburger-menu .line {
    width: 20px;
    height: 2px;
  }
  
  .welcome-box {
    padding: 25px;
    margin: 15px;
  }
  
  .welcome-box h2 {
    font-size: 1.5rem;
  }
  
  .instructions {
    padding: 20px;
  }
  
  .room-selection-content {
    padding: 25px 20px;
    margin: 15px;
    margin-top: 60px;
  }
  
  .room-selection-content h2 {
    font-size: 1.5rem;
  }
  
  #gameOverBox {
    min-width: auto;
    width: 90%;
    max-width: 400px;
  }
  
  .game-over-content {
    padding: 25px;
  }
  
  .touch-controls {
    bottom: 15px;
    right: 15px;
    padding: 10px;
  }
  
  .touch-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .game-main {
    padding: 10px;
  }
  
  .welcome-box {
    padding: 20px 15px;
  }
  
  .instructions {
    padding: 15px;
  }
  
  .room-selection-content {
    padding: 20px 15px;
    margin-top: 60px;
  }
}