/* ===== ESTILOS GENERALES ===== */
#cards-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 15px;
}

/* ===== ESTILOS DE TARJETA ===== */
.card {
  max-width: 100%;
  margin-bottom: 2rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  border: none;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.75rem;
}

.card-text {
  font-size: 1rem;
  color: #555;
  margin-bottom: 1.5rem;
}

/* ===== CONTENEDOR SCROLL ===== */
.scroll-wrapper {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  padding-bottom: 10px;
}

.scroll-wrapper::-webkit-scrollbar {
  height: 6px;
}

.scroll-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.scroll-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ===== CONTENEDOR PUZZLE ===== */
.puzzle-container {
  display: flex;
  height: 300px;
  width: 100%;
  gap: 0;
  margin: 0;
  padding: 0;
}

/* ===== PIEZAS DEL PUZZLE ===== */
.piece {
  position: relative;
  overflow: hidden;
  border-right: 1px solid #ccc;
  cursor: grab;
  user-select: none;
  height: 300px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.piece:last-child {
  border-right: none;
}

.piece:active {
  cursor: grabbing;
  transform: scale(0.98);
  border-color: #007bff;
  z-index: 10;
}

.piece img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: auto;
  pointer-events: none;
  user-select: none;
}

/* ===== TEXTO VERTICAL ===== */
.pieza-texto-vertical {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  writing-mode: vertical-lr;
  text-orientation: upright;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 4px;
  border-radius: 4px;
  pointer-events: none;
  user-select: none;
  font-weight: bold;
  line-height: 1.2;
  max-height: 90%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pieza-texto-vertical span {
  display: block;
  text-align: center;
  margin: 1px 0;
  background-color: red;
}

/* ===== ESTADO COMPLETO ===== */
.puzzle-completo .piece {
  border-color: #28a745;
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 768px) {
  .card {
    border-radius: 0;
    margin-bottom: 1.5rem;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .piece {
    height: 250px;
  }
  
  .pieza-texto-vertical {
    font-size: 0.8rem;
    padding: 6px 3px;
  }
}

@media (max-width: 576px) {
  .piece {
    height: 200px;
  }
  
  .pieza-texto-vertical {
    font-size: 0.7rem;
    padding: 4px 2px;
    white-space: normal;
  }
}

/* ===== EFECTOS HOVER (solo desktop) ===== */
@media (hover: hover) {
  .piece:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
  }
}

/* ===== CLASES UTILITARIAS ===== */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

.grab-cursor {
  cursor: grab;
}

.grabbing-cursor {
  cursor: grabbing;
}