body {
  font-family: sans-serif;
  padding: 20px;
  margin: 0;
  background: transparent;
  color: white;
  text-align: center;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  z-index: 0;
}

#bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  pointer-events: none;
}

#logoPrincipal {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 15px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 769px) {
  #logoPrincipal {
    width: 600px;
  }
}

.botonera {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#desbloquear-todas,
#contador-disponibles {
  padding: 10px 20px;
  font-size: 1rem;
  background: #ffeb3b;
  color: black;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
  display: inline-block;
  white-space: nowrap;
}

#desbloquear-todas:hover,
#contador-disponibles:hover {
  background: #fdd835;
}

#volverStories {
  border: 5px solid white;
  background: transparent;
  color: white;
  font-size: 1rem;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 15px;
  display: inline-block;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

#volverStories:hover {
  background: white;
  color: black;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 10px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding: 0 10px;
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(5, 1fr) !important;
  }

  .modal-wrapper {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 0;
  }

  .modal-content {
    max-width: 90vw;
    max-height: 80vh;
    height: auto;
    object-fit: contain;
  }

  .modal-link {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
    background: #ffeb3b;
    color: black;
    border-radius: 6px;
    font-weight: bold;
    z-index: 20;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  }

  .modal-metadata {
    display: none !important;
  }
}

.image-card {
  position: relative;
  width: 100%;
  padding-bottom: 150%;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.image-card.desbloqueada {
  background: transparent;
}

.image-card img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-height: 100%;
  max-width: 100%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: brightness(0.5) contrast(0.8) saturate(0.8);
  transition: filter 0.3s ease;
  z-index: 1;
}

.image-card.desbloqueada img {
  filter: none;
}

.image-card.locked {
  background: #4e4e4e;
}

.image-card.locked::after {
  content: "🔒";
  font-size: 2rem;
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.image-card span {
  position: absolute;
  bottom: 5px;
  right: 5px;
  font-size: 0.7rem;
  color: white;
  background: rgba(0,0,0,0.4);
  padding: 2px 4px;
  border-radius: 4px;
  z-index: 3;
}

.metadata-label {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-size: 0.7rem;
  color: white;
  background: rgba(0,0,0,0.5);
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 4;
  text-align: left;
}

.modal {
  display: none;
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
}

.modal-wrapper {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.modal-content {
  max-height: 90vh;
  max-width: 90vw;
  border-radius: 10px;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
}

.modal-link {
  position: absolute;
  bottom: 20px;
  left: 20px;
  padding: 10px 20px;
  background: #ffeb3b;
  color: black;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  transition: background 0.3s;
  font-size: 1rem;
  z-index: 2;
}

.modal-link:hover {
  background: #fdd835;
}

.modal-metadata {
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 15px;
  max-width: 300px;
  color: #ffeb3b;
  font-size: 0.9rem;
  font-family: monospace;
  white-space: normal;
  overflow-wrap: break-word;
  z-index: 2;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 90vh;
  overflow-y: auto;
  text-align: left;
}

.close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  z-index: 11;
}

@keyframes zoomShudder {
  0%   { transform: translate(-50%, -50%) scale(1); }
  20%  { transform: translate(-49%, -51%) scale(1.2); }
  40%  { transform: translate(-51%, -49%) scale(0.98); }
  60%  { transform: translate(-50%, -50%) scale(1.1); }
  80%  { transform: translate(-50.5%, -49.5%) scale(1.05); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}

.image-card.unlocked-glitch img {
  animation: zoomShudder 0.5s ease;
}

.image-card.unlocked-glitch::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: none;
  animation: none;
  z-index: 2;
  pointer-events: none;
}

.volver-container {
  text-align: center;
  margin: 30px 0 50px 0;
}

#totalMetadataCount {
  margin: 10px 0 20px 0;
  font-weight: bold;
  font-size: 1.1rem;
  color: white;
}

.reducido {
  font-size: 50%;
}

#tablaMetadata {
  border-collapse: separate;
  border-spacing: 0 10px;
}
