/* Tetris Game specific styles */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
  background: linear-gradient(135deg, #4c6ef5, #7c3aed);
  padding: 20px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 8px 32px rgba(76, 110, 245, 0.3);
}

.score-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.score-box {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  min-width: 70px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  animation: float 3s ease-in-out infinite;
}

.score-box:nth-child(1) { animation-delay: 0s; }
.score-box:nth-child(2) { animation-delay: 0.5s; }
.score-box:nth-child(3) { animation-delay: 1s; }
.score-box:nth-child(4) { animation-delay: 1.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.score-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.score-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.game-controls .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.game-controls .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.game-controls .btn:active {
  transform: translateY(0);
}

.game-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
}

.game-area {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(76, 110, 245, 0.3);
}

.game-area::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(45deg, transparent, rgba(76, 110, 245, 0.2), transparent);
  border-radius: 15px;
  animation: borderGlow 3s linear infinite;
  z-index: -1;
}

@keyframes borderGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#gameCanvas {
  background: linear-gradient(135deg, #0f0f23, #1a1a2e);
  border-radius: 8px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.game-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 600;
  color: #4c6ef5;
  text-align: center;
  background: rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #4c6ef5;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 180px;
}

.next-piece-container {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(76, 110, 245, 0.2);
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 10px;
  text-align: center;
}

#nextCanvas {
  background: linear-gradient(135deg, #0f0f23, #1a1a2e);
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.controls-info {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(76, 110, 245, 0.2);
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 5px 0;
}

.control-item:last-child {
  margin-bottom: 0;
}

.key {
  background: linear-gradient(135deg, #4c6ef5, #7c3aed);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.desc {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
}

.game-instructions {
  margin-top: 20px;
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 16px;
}

.instruction-title {
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
  font-size: 16px;
}

.instruction-content p {
  margin: 8px 0;
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
}

.instruction-content strong {
  color: #495057;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
  background-color: #fff;
  margin: 15% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 20px 0;
  text-align: center;
}

.modal-header h3 {
  margin: 0;
  color: #495057;
  font-size: 20px;
}

.modal-body {
  padding: 20px;
  text-align: center;
}

.modal-body p {
  margin: 0 0 15px;
  color: #6c757d;
}

.final-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
}

.stat-item span:last-child {
  color: #4c6ef5;
}

.new-record {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #8b7500;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Line clear animation */
.line-clear {
  animation: lineClear 0.5s ease-in-out;
}

@keyframes lineClear {
  0% { opacity: 1; }
  25% { opacity: 0.8; background-color: #fff; }
  50% { opacity: 0.6; background-color: #4c6ef5; }
  75% { opacity: 0.4; background-color: #fff; }
  100% { opacity: 0; }
}

/* Responsive design */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .score-container {
    justify-content: center;
  }
  
  .game-controls {
    justify-content: center;
  }
  
  .game-container {
    flex-direction: column;
    align-items: center;
  }
  
  .side-panel {
    flex-direction: row;
    min-width: auto;
    width: 100%;
    max-width: 330px;
  }
  
  .next-piece-container,
  .controls-info {
    flex: 1;
  }
  
  #gameCanvas {
    width: 300px;
    height: 600px;
  }
  
  #nextCanvas {
    width: 100px;
    height: 100px;
  }
}

@media (max-width: 480px) {
  .score-container {
    gap: 8px;
  }
  
  .score-box {
    min-width: 60px;
    padding: 8px 12px;
  }
  
  .score-label {
    font-size: 11px;
  }
  
  .score-value {
    font-size: 16px;
  }
  
  #gameCanvas {
    width: 250px;
    height: 500px;
  }
  
  .game-area {
    padding: 10px;
  }
  
  .side-panel {
    flex-direction: column;
    gap: 15px;
  }
  
  #nextCanvas {
    width: 80px;
    height: 80px;
  }
}