body {
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa, #e4ebf5);
  margin: 0;
  padding: 20px;
  text-align: center;
  /*background-image: url(../../img/wolf_jauria/fondo_cartas.jpg);*/
  background-size: cover;      /* ajusta y cubre todo el viewport */
  background-repeat: no-repeat; /* que no se repita */
  background-position: center; /* centrada */
  /*background-attachment: fixed; /* opcional: efecto parallax */
    
}

.background-image {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1; /* detrás de todo */
      overflow: hidden;
    }

    

.contenedor {
    display: flex;
  justify-content: center;
  gap: 20px;
    background: rgba(0,0,0,0.5);
    box-shadow: 0px 0px 50px 0px;
}

h2 { margin-bottom: 20px; color: #000; }

.contenedor_juego_de_cartas {
    background: rgba(255,233,255,0.8);
}

/* Panel de historial */
.historial-panel {
  width: 350px;
  background: rgba(255,255,255,0.7);
  border-right: 3px solid #6a5acd;
  padding: 15px;
  border-radius: 0 12px 12px 0;
  box-shadow: 6px 0 18px rgba(0,0,0,0.15);
  overflow-y: auto;
  max-height: 90vh;
  position: relative;
  z-index: 900;
}
.historial-panel h3 {
  margin-top: 0;
  color: #6a5acd;
  text-align: center;
}
#listaHistorial {
  text-align: left;
  font-size: 14px;
  margin-bottom: 15px;
}
.historial-item {
    width: 60%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding: 6px;
  background: #f5f5ff;
  border-radius: 6px;
  border-left: 3px solid #6a5acd;
  position: relative;
}
.historial-item span { flex: ; }
.eliminar-btn {
  margin-left: 10px;
  color: red;
  cursor: pointer;
  font-weight: bold;
}
#exportarHistorial {
  background: #28a745;
  color: white;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
}

/* Cartas */
.cartas-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  max-width: 800px;
  margin: auto;
}
.carta {
  perspective: 1000px;
  cursor: pointer;
}
.carta-inner {
  position: relative;
  width: 120px;
  height: 180px;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}
.carta.flipped .carta-inner { transform: rotateY(180deg); }
.carta-front, .carta-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  text-align: center;
  padding: 5px;
}
.carta-front { background: #4A4AFF; }
.carta-back {
  background: #fff;
  transform: rotateY(180deg);
}
.carta-back img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
}

button {
  margin: 10px 5px;
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s;
}
#configurar { background: #ffd93d; }
#exportar { background: #6bcf77; color: white; }
#importar { background: #4d96ff; color: white; }
button:hover { transform: scale(1.05); }

/* Modal genérico */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
.modal-content {
  background: white;
  padding: 20px;
  border-radius: 12px;
  max-width: 400px;
  text-align: center;
  animation: popUp 0.3s ease;
  position: relative;
}
@keyframes popUp {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-content h3 { margin-top: 0; color: #6a5acd; }
.modal-content img {
  max-width: 100%;
  border-radius: 10px;
  margin: 15px 0;
}
.modal-content button {
  background: #6a5acd;
  color: white;
  margin: 5px;
}
.close-x {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  font-weight: bold;
}
.close-x:hover { color: red; }

/* Panel lateral configuración */
.side-panel {
  display: none;
  flex-direction: column;
  width: 340px;
  background: #ffffff;
  border-left: 3px solid #6a5acd;
  padding: 20px;
  border-radius: 12px 0 0 12px;
  box-shadow: -6px 0 18px rgba(0,0,0,0.25);
  overflow-y: auto;
  max-height: 90vh;
  animation: slideIn 0.4s ease;
  position: relative;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.close-btn {
  position: sticky;
  top: 0;
  right: 0;
  margin-left: auto;
  font-size: 22px;
  cursor: pointer;
  color: #6a5acd;
  font-weight: bold;
  transition: 0.3s;
  display: block;
  text-align: right;
  background: #fff;
  padding: 5px;
  border-radius: 0 0 0 8px;
  z-index: 10;
}
.close-btn:hover { color: red; transform: scale(1.2); }

/* Configuración de cartas */
.card-config {
  background: #f9f9ff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  text-align: left;
}
.card-config label {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: bold;
  color: #444;
}
.card-config input[type="text"],
.card-config input[type="number"],
.card-config input[type="file"] {
  width: 100%;
  padding: 6px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}
.card-preview {
  margin-top: 10px;
  text-align: center;
}
.card-preview img {
  max-width: 100px;
  border-radius: 8px;
  border: 1px solid #aaa;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.card-config button {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  background: #ff4d4d;
  color: white;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}
.card-config button:hover { background: #e60000; }

/* Popup confirmación adaptable */
.confirm-popup {
  position: absolute;
    /*transform: translateX(-200px);*/
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  z-index: 9999;
  width: 110px;
}
.confirm-popup p {
  margin: 0 0 6px;
  font-weight: bold;
  color: #444;
}
.confirm-popup button {
  margin: 2px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}
.confirm-popup .si { background: #e74c3c; color: white; }
.confirm-popup .no { background: #6c757d; color: white; }
