:root {
  color-scheme: light;
  --fondo: #fdf9f3;          /* crema */
  --tarjeta: #ffffff;
  --texto: #3b3a4a;
  --suave: #7c7a8e;
  --linea: #ece5ea;
  --azul: #bcd6ee;           /* azul pastel */
  --azul-fuerte: #7da6cf;
  --azul-texto: #2c4260;
  --rosa: #f5cbd8;           /* rosa pastel */
  --rosa-fuerte: #de97ae;
  --rosa-texto: #6a2f45;
  --sombra: 0 2px 10px rgba(125, 166, 207, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.5 "Inter", system-ui, sans-serif;
}
.serif { font-family: "Cormorant Garamond", Georgia, serif; }

header.portada {
  position: relative;
  text-align: center;
  padding: 60px 16px 32px;
  background:
    radial-gradient(ellipse 60% 80% at 15% 20%, rgba(188, 214, 238, 0.55), transparent 70%),
    radial-gradient(ellipse 60% 80% at 85% 30%, rgba(245, 203, 216, 0.55), transparent 70%),
    var(--fondo);
}
header.portada h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  margin: 0;
  letter-spacing: 0.01em;
  color: var(--azul-texto);
}
header.portada p { margin: 6px 0 0; color: var(--suave); }
.adorno {
  width: 90px; height: 2px; margin: 18px auto; border-radius: 2px;
  background: linear-gradient(90deg, var(--azul-fuerte), var(--rosa-fuerte));
  position: relative;
}
.adorno::after {
  content: "♡"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%);
  background: var(--fondo); padding: 0 8px; color: var(--rosa-fuerte); font-size: 1rem; line-height: 1;
}

.barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 10px 16px;
  background: rgba(253, 249, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linea);
}
.barra .info { color: var(--suave); font-size: 0.9rem; margin-right: auto; }
@media (max-width: 600px) { .barra .info { width: 100%; text-align: center; margin: 0; } }

button, .boton {
  font: inherit; font-size: 0.92rem;
  border: 1px solid var(--azul);
  background: var(--tarjeta);
  color: var(--azul-texto);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
button:hover, .boton:hover { border-color: var(--rosa-fuerte); background: #fff7fa; }
button.principal, .boton.principal { background: var(--azul); color: var(--azul-texto); border-color: var(--azul); font-weight: 500; }
button.principal:hover, .boton.principal:hover { background: var(--rosa); color: var(--rosa-texto); border-color: var(--rosa); }
button:disabled { opacity: 0.5; cursor: default; }

.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 16px 16px 48px;
  max-width: 1400px; margin: 0 auto;
}
@media (max-width: 500px) {
  .rejilla { grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 8px 4px 40px; }
}
.foto {
  position: relative;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #e6eff8, #f9e4eb);
  overflow: hidden;
  cursor: pointer;
  border-radius: 6px;
  content-visibility: auto;
  contain-intrinsic-size: 160px;
}
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s; }
@media (hover: hover) { .foto:hover img { transform: scale(1.03); } }
.foto .marca {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(255, 255, 255, 0.35);
  display: none;
}
.seleccionando .foto .marca { display: block; }
.foto.elegida .marca { background: var(--rosa-fuerte); }
.foto.elegida { outline: 3px solid var(--rosa); outline-offset: -3px; }
.foto.elegida img { opacity: 0.8; }
.foto .quitar {
  position: absolute; top: 4px; right: 4px;
  border-radius: 50%; width: 30px; height: 30px; padding: 0; justify-content: center;
  background: rgba(255, 255, 255, 0.9); color: var(--rosa-texto); border: 1px solid var(--rosa);
}

/* Visor */
.visor {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(253, 249, 243, 0.98);
  display: none; flex-direction: column;
}
.visor.abierto { display: flex; }
.visor .lienzo { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; touch-action: pan-y; padding: 0 8px; }
.visor img { object-fit: contain; user-select: none; border-radius: 4px; box-shadow: 0 6px 30px rgba(59, 58, 74, 0.15); will-change: transform; transform-origin: center; }
.visor .arriba, .visor .abajo {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: var(--suave); font-size: 0.9rem;
}
.visor .abajo { justify-content: center; flex-wrap: wrap; }
.visor .flecha {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; justify-content: center; padding: 0; font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.9);
}
.visor .flecha.izq { left: 12px; } .visor .flecha.der { right: 12px; }
@media (max-width: 600px) { .visor .flecha { display: none; } }

/* Paneles */
.panel {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(59, 58, 74, 0.25);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.panel.abierto { display: flex; }
.panel .caja {
  background: var(--tarjeta); color: var(--texto);
  border-radius: 16px; padding: 22px; width: 100%; max-width: 520px;
  max-height: 85vh; overflow: auto; box-shadow: 0 10px 40px rgba(125, 166, 207, 0.25);
  border-top: 4px solid var(--rosa);
}
.panel h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; margin: 0 0 6px; font-size: 1.7rem; color: var(--azul-texto); }
.panel p { color: var(--suave); margin: 0 0 14px; font-size: 0.92rem; }
.bloques { display: grid; gap: 8px; }
.bloques button { justify-content: space-between; border-radius: 12px; width: 100%; }

.progreso { height: 6px; background: var(--linea); border-radius: 3px; overflow: hidden; margin: 10px 0 4px; }
.progreso > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--azul-fuerte), var(--rosa-fuerte)); transition: width 0.2s; }

.aviso {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--azul-texto); color: #fff;
  padding: 10px 16px; border-radius: 12px; z-index: 40; font-size: 0.9rem;
  max-width: calc(100% - 32px);
  display: none;
}
.vacio { text-align: center; color: var(--suave); padding: 60px 16px; }

/* Subida */
.contenedor { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }
.contenedor > h1 { color: var(--azul-texto); }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: var(--sombra); }
.tarjeta h2 { margin: 0 0 8px; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: 1.6rem; color: var(--azul-texto); }
input[type=password] {
  font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--azul);
  background: var(--fondo); color: var(--texto); width: 100%; max-width: 320px;
}
input[type=password]:focus { outline: 2px solid var(--rosa); border-color: var(--rosa-fuerte); }
.zona {
  border: 2px dashed var(--azul); border-radius: 16px; padding: 32px 16px; text-align: center; color: var(--suave);
  background: #f7fafd;
}
.zona.encima { border-color: var(--rosa-fuerte); background: #fff5f8; color: var(--texto); }
.fila { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.registro { font: 0.82rem/1.5 ui-monospace, monospace; max-height: 220px; overflow: auto; color: var(--suave); white-space: pre-wrap; margin-top: 10px; }

button.borrar { background: var(--rosa); color: var(--rosa-texto); border-color: var(--rosa); font-weight: 500; }
button.borrar:hover { background: var(--rosa-fuerte); color: #fff; border-color: var(--rosa-fuerte); }

/* Foto principal de presentación */
.principal-foto { margin: 26px auto 0; max-width: 900px; padding: 0; }
.principal-foto img {
  display: block; width: 100%; height: auto; max-height: 70vh; object-fit: cover;
  border-radius: 18px;
  border: 6px solid #fff;
  box-shadow: 0 0 0 1px var(--linea), 0 12px 40px rgba(125, 166, 207, 0.25), 0 4px 18px rgba(222, 151, 174, 0.18);
}
@media (max-width: 600px) { .principal-foto { margin-top: 20px; } .principal-foto img { border-width: 4px; border-radius: 14px; } }

/* Botón de acceso de administración (arriba a la derecha de la galería) */
.acceso {
  position: absolute; top: 12px; right: 12px;
  width: 40px; height: 40px; padding: 0; justify-content: center;
  background: none; border: none; border-radius: 50%;
  color: var(--suave); opacity: 0.55;
}
.acceso:hover, .acceso:focus-visible { background: none; color: var(--rosa-fuerte); opacity: 1; }
