/* ========================
   ESTILOS ESPECÍFICOS PARA LABERINTO INFINITO
========================= */

/* Contenedor del juego */
.game-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

.game-container {
  position: relative;
  background: rgba(15, 15, 35, 0.8);
  padding: 15px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(108, 92, 231, 0.2);
  overflow: hidden;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  z-index: 2;
}

canvas {
  background: linear-gradient(160deg, #0a0a1a 0%, #15152a 100%);
  display: block;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 600px;
  height: auto;
  aspect-ratio: 1/1;
}

/* Overlay de victoria */
.victory-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 184, 148, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
  z-index: 10;
}

.victory-overlay.active {
  opacity: 1;
  visibility: visible;
}

.victory-content {
  text-align: center;
  transform: scale(0.8);
  animation: pulse 1.5s infinite alternate;
}

.victory-content i {
  font-size: clamp(3rem, 8vw, 4rem);
  color: white;
  margin-bottom: 15px;
}

.victory-content h2 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 10px;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.victory-content p {
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: rgba(255, 255, 255, 0.9);
}

.time-result {
  font-size: clamp(1rem, 3vw, 1.3rem);
  margin-top: 10px;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 15px;
  border-radius: 10px;
  display: inline-block;
}

.time-result i {
  color: #00ffcc;
  margin-right: 8px;
  font-size: 1rem;
}

@keyframes pulse {
  from { transform: scale(0.95); }
  to { transform: scale(1.05); }
}

@keyframes statChange {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.stat-value.changed {
  animation: statChange 0.3s ease;
}

/* Panel de acciones */
.actions-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

/* Controles móviles */
.mobile-controls {
  display: none;
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dpad-btn {
  width: clamp(60px, 15vw, 70px);
  height: clamp(60px, 15vw, 70px);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
  cursor: pointer;
}

.dpad-btn:active {
  transform: scale(0.9);
  background: rgba(108, 92, 231, 0.5);
}

.dpad-horizontal {
  display: flex;
  gap: clamp(20px, 5vw, 30px);
}

.dpad-up {
  margin-bottom: 10px;
}

/* Timer específico para laberinto */
.timer-value {
  color: #00ffcc !important;
  text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

/* Modal de controles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  backdrop-filter: blur(5px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 15px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(108, 92, 231, 0.3);
  animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.modal-header h3 {
  margin: 0;
  color: var(--primary-color);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-modal {
  background: none;
  border: none;
  color: white;
  font-size: clamp(1.5rem, 4vw, 2rem);
  cursor: pointer;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 20px;
}

.controls-section {
  margin-bottom: 25px;
}

.controls-section:last-child {
  margin-bottom: 0;
}

.controls-section h4 {
  color: #8a7cff;
  margin-bottom: 15px;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid rgba(138, 124, 255, 0.3);
  padding-bottom: 6px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.control-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px;
  transition: transform 0.2s, background 0.2s;
}

.control-item:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.1);
}

.control-item .key {
  background: rgba(108, 92, 231, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
}

.control-item span {
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  color: #b0b0e0;
  display: block;
  text-align: center;
}

.mobile-demo {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

.dpad-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 15px;
  max-width: 180px;
}

.dpad-btn-demo {
  width: 45px;
  height: 45px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.dpad-row {
  display: flex;
  gap: 12px;
}

.objective-info {
  background: rgba(0, 184, 148, 0.1);
  border-radius: 10px;
  padding: 15px;
  border-left: 4px solid var(--secondary-color);
}

.objective-info p {
  margin-bottom: 10px;
  color: #c0c0f0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
}

.objective-info p:last-child {
  margin-bottom: 0;
}

.player-demo, .exit-demo {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.player-demo {
  background: #ff5555;
  box-shadow: 0 0 8px #ff5555;
}

.exit-demo {
  background: #00ff99;
  box-shadow: 0 0 8px #00ff99;
  border-radius: 4px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
}

/* Responsive específico para laberinto */
@media (min-width: 769px) and (max-width: 1024px) {
  .game-wrapper {
    flex-direction: row;
  }
  
  .game-container {
    flex: 2;
  }
}

@media (min-width: 1025px) {
  .game-wrapper {
    flex-direction: row;
    gap: 25px;
  }
  
  .game-container {
    flex: 3;
  }
}

@media (max-width: 480px) {
  .dpad-btn {
    width: 55px;
    height: 55px;
  }
  
  .dpad-horizontal {
    gap: 15px;
  }
}