:root {
  --img-w: 800;
  --img-h: 600;
  --max-h: 800px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #111;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Contador dentro del visor, centrado abajo y alineado con el botón "Volver" */
#counter {
  position: absolute; /* relativo a #stage */
  left: 50%;
  bottom: 16px;
  height: 34px; /* mismo alto que #back-link (8px + 18px de línea + 8px) */
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  z-index: 10;
  pointer-events: none; /* no tapa los hotspots que haya debajo */
  line-height: 0;
}

#stage {
  position: relative;
  /* el tamaño real lo fija js/viewer.js según el hueco disponible */
  width: 800px;
  height: 600px;
  max-height: var(--max-h);
  background: #000;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

#page-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

#hotspot-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hotspot {
  position: absolute;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}

.hotspot:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}

/* La zona "volver al mosaico" sobre la foto queda totalmente invisible, sin sombreado al pasar el ratón */
.hotspot[data-id="photo-body"]:hover {
  background: transparent;
  border-color: transparent;
}

body.debug .hotspot {
  border: 2px dashed rgba(255, 60, 60, 0.85);
  background: rgba(255, 60, 60, 0.15);
}

body.debug .hotspot[data-type="youtube"] {
  border-color: rgba(60, 140, 255, 0.9);
  background: rgba(60, 140, 255, 0.18);
}

.hotspot .hotspot-label {
  display: none;
}

body.debug .hotspot .hotspot-label {
  display: block;
  position: absolute;
  top: 2px;
  left: 2px;
  font: 10px/1.2 monospace;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 3px;
  pointer-events: none;
  white-space: nowrap;
}

/* --- Modal de video --- */
#video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 1000;
}

#video-modal-hint {
  color: rgba(255, 255, 255, 0.85);
  font: 16px/1.4 sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
}

#video-modal-hint:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.7);
}

#video-modal.hidden {
  display: none;
}

#video-modal-inner {
  position: relative;
  /* el tamaño real lo fija js/viewer.js: mismo alto que #stage, ancho en 16:9 */
  width: 800px;
  height: 450px;
}

#video-frame-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

#video-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#video-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#video-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

#back-link {
  position: absolute; /* relativo a #stage */
  right: 16px;
  bottom: 16px;
  z-index: 10; /* por encima de los hotspots, por debajo del modal de vídeo */
  padding: 8px 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: sans-serif;
  font-size: 15px;
  line-height: 18px;
  text-decoration: none;
}

#back-link:hover {
  background: rgba(255, 255, 255, 0.3);
}
