/* =========================
   TUTORIAL OVERLAY - ESTILO MEJORADO
   Con tabla de mapeo Arcade + Teclado
   ========================= */

/* Overlay */
.tutorial-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.tutorial-overlay.active {
  display: flex;
}

.tutorial-content {
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
  border: 3px solid #00ff41;
  border-radius: 16px;
  box-shadow:
    0 0 60px rgba(0, 255, 65, 0.3),
    0 0 100px rgba(0, 0, 0, 0.8),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  animation: openModal 0.3s ease-out;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar personalizado */
.tutorial-content::-webkit-scrollbar {
  width: 10px;
}

.tutorial-content::-webkit-scrollbar-track {
  background: #111;
  border-radius: 5px;
}

.tutorial-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00ff41, #007d27);
  border-radius: 5px;
  border: 2px solid #111;
}

.tutorial-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #00ff41, #00c83a);
}

/* Header */
.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  border-bottom: 3px solid #ff7a00;
  padding: 20px 25px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tutorial-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #00ff41;
  text-shadow: 0 0 15px rgba(0, 255, 65, 0.6);
  letter-spacing: 2px;
}

.btn-close-tutorial {
  background: transparent;
  border: 2px solid #ff7a00;
  color: #ff7a00;
  width: 45px;
  height: 45px;
  font-size: 1.4rem;
  cursor: pointer;
  font-family: inherit;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-close-tutorial:hover {
  background: #ff7a00;
  color: #000;
  box-shadow: 0 0 20px rgba(255, 122, 0, 0.5);
}

/* Body */
.tutorial-body {
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Secciones */
.controls-section {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
}

.section-title {
  margin: 0 0 20px 0;
  font-size: 1.3rem;
  color: #ff7a00;
  text-shadow: 0 0 10px rgba(255, 122, 0, 0.4);
  border-bottom: 2px solid rgba(255, 122, 0, 0.3);
  padding-bottom: 12px;
  letter-spacing: 1px;
}

/* Tabla de controles */
.controls-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.table-header {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 15px;
  padding: 12px 15px;
  background: rgba(0, 255, 65, 0.1);
  border: 1px solid rgba(0, 255, 65, 0.3);
  border-radius: 8px;
  margin-bottom: 8px;
}

.table-header span {
  font-size: 1rem;
  font-weight: bold;
  color: #00ff41;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
}

.table-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 15px;
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  transition: background 0.2s ease;
  align-items: center;
}

.table-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 255, 65, 0.2);
}

/* Columnas */
.col-action {
  font-size: 1.1rem;
  color: #ffffff;
  font-family: 'Courier Prime', monospace;
  font-weight: bold;
}

.col-arcade,
.col-keyboard {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 1rem;
  color: #ddd;
}

/* Botones arcade */
.arcade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 32px;
  padding: 0 12px;
  background: linear-gradient(180deg, #4a4a4a, #2a2a2a);
  border: 2px solid #5a5a5a;
  border-radius: 6px;
  color: #fff;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.65rem;
  box-shadow: 0 3px 0 #1a1a1a, inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.arcade-btn.stick {
  background: linear-gradient(180deg, #3a3a3a, #1a1a1a);
  border-color: #4a4a4a;
  min-width: 60px;
}

.arcade-btn.red {
  background: linear-gradient(180deg, #ff4444, #aa2222);
  border-color: #ff6666;
  color: #fff;
  box-shadow: 0 3px 0 #661111, 0 0 10px rgba(255, 68, 68, 0.3);
}

.arcade-btn.blue {
  background: linear-gradient(180deg, #4444ff, #2222aa);
  border-color: #6666ff;
  color: #fff;
  box-shadow: 0 3px 0 #111166, 0 0 10px rgba(68, 68, 255, 0.3);
}

.arcade-btn.yellow {
  background: linear-gradient(180deg, #ffcc00, #cc9900);
  border-color: #ffdd44;
  color: #000;
  box-shadow: 0 3px 0 #996600, 0 0 10px rgba(255, 204, 0, 0.3);
}

.arcade-btn.green {
  background: linear-gradient(180deg, #00ff41, #00aa2a);
  border-color: #44ff66;
  color: #000;
  box-shadow: 0 3px 0 #006611, 0 0 10px rgba(0, 255, 65, 0.3);
}

/* Teclas de teclado */
.key-highlight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, #2a2a2a, #1a1a1a);
  border: 2px solid #444;
  color: #00ff41;
  font-size: 0.85rem;
  font-family: 'Courier Prime', monospace;
  font-weight: bold;
  box-shadow: 0 3px 0 #111, inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

/* Bloques de juegos */
.game-controls-block {
  margin-top: 15px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  border-left: 4px solid #00ff41;
}

.game-title {
  margin: 0 0 12px 0;
  font-size: 1.15rem;
  color: #00ff41;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.4);
}

.game-title img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  border-radius: 4px;
}

.controls-table.compact .table-row {
  padding: 10px 12px;
}

.controls-table.compact .col-action {
  font-size: 1rem;
}

/* Footer */
.tutorial-footer {
  padding: 18px 25px;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'Courier Prime', monospace;
}

.tutorial-footer strong {
  color: #00ff41;
}

.tutorial-footer .separator {
  color: rgba(255, 255, 255, 0.3);
}

/* Animación */
.fade-in {
  animation: openModal 0.3s ease-out;
}

@keyframes openModal {
  from {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .tutorial-header h2 {
    font-size: 1.1rem;
  }

  .table-header,
  .table-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .table-header span:first-child,
  .table-row .col-action {
    font-size: 1rem;
    color: #ff7a00;
    margin-bottom: 5px;
  }

  .col-arcade,
  .col-keyboard {
    padding-left: 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
  }

  .col-arcade::before {
    content: "🕹️ ";
  }

  .col-keyboard::before {
    content: "⌨️ ";
  }

  .section-title {
    font-size: 1.1rem;
  }

  .game-title {
    font-size: 1rem;
  }

  .tutorial-footer {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .tutorial-footer .separator {
    display: none;
  }
}

@media (max-width: 480px) {
  .tutorial-content {
    width: 98%;
    max-height: 95vh;
  }

  .tutorial-body {
    padding: 15px;
  }

  .controls-section {
    padding: 12px;
  }

  .arcade-btn {
    min-width: 40px;
    height: 28px;
    font-size: 0.55rem;
    padding: 0 8px;
  }

  .key-highlight {
    min-width: 30px;
    height: 26px;
    font-size: 0.75rem;
    padding: 0 6px;
  }
}
