/* Carosello condiviso: mostra un solo ricordo alla volta. */
.memory-carousel {
  position: relative;
  height: clamp(350px, 118vw, 610px);
  margin-top: 18px;
  border-radius: 18px;
  overflow: hidden;
  background: #ded3c8;
  box-shadow: 0 18px 45px #442b1d24;
}

.memory-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.memory-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transform: translateX(7%) scale(1.035);
  transition: opacity .7s ease, transform .75s cubic-bezier(.22, .61, .36, 1);
  cursor: zoom-in;
}

.memory-slide.from-left { transform: translateX(-7%) scale(1.035); }
.memory-slide.is-visible { opacity: 1; transform: translateX(0) scale(1); }
.memory-slide.leave-left { opacity: 0; transform: translateX(-5%) scale(.985); }
.memory-slide.leave-right { opacity: 0; transform: translateX(5%) scale(.985); }

.memory-slide img,
.memory-slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-slide video { background: #171412; }

.open-hint {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  padding: 7px 10px;
  border: 1px solid #ffffff70;
  border-radius: 20px;
  background: #241e1a70;
  backdrop-filter: blur(8px);
  color: #fff;
  font: 600 .66rem Manrope, sans-serif;
  opacity: .88;
}

.memory-carousel::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  pointer-events: none;
  background: linear-gradient(transparent, #211b18c7);
}

.carousel-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid #ffffff85;
  border-radius: 50%;
  background: #241e1a66;
  backdrop-filter: blur(7px);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background .2s, transform .2s;
}

.carousel-arrow:hover { background: #241e1aa8; }
.carousel-arrow:active { transform: translateY(-50%) scale(.93); }
.carousel-arrow.previous { left: 13px; }
.carousel-arrow.next { right: 13px; }

.carousel-meta {
  position: absolute;
  z-index: 4;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: #fff;
  font-size: .72rem;
}

.carousel-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carousel-timer {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #ffffff24;
}

.carousel-timer i {
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
}

.carousel-timer i.running { animation: carousel-countdown 6s linear forwards; }

@keyframes carousel-countdown {
  from { width: 0; }
  to { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .memory-slide { transition: opacity .2s ease; transform: none; }
  .memory-slide.from-left,
  .memory-slide.is-visible,
  .memory-slide.leave-left,
  .memory-slide.leave-right { transform: none; }
}

.live-toast {
  position: fixed;
  z-index: 90;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-start;
  gap: 11px;
  max-width: 440px;
  margin: auto;
  padding: 14px;
  border: 1px solid #ffffff24;
  border-radius: 16px;
  background: #302926f2;
  box-shadow: 0 18px 50px #211b1850;
  backdrop-filter: blur(12px);
  color: #fff;
  animation: toast-in .45s cubic-bezier(.22, .61, .36, 1) both;
}

.live-toast[hidden] { display: none; }
.live-toast p { margin: 0; font-size: .78rem; line-height: 1.5; }
.live-toast div { flex: 1; }
.live-toast div button { border: 0; background: transparent; color: #e8bda9; padding: 5px 0 0; font: 700 .7rem Manrope, sans-serif; cursor: pointer; }
.live-dot { flex: 0 0 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #d9b39e; box-shadow: 0 0 0 5px #d9b39e20; animation: live-pulse 1.8s infinite; }
.toast-close { border: 0; background: transparent; color: #ffffffa0; padding: 0 2px; font-size: 1.2rem; cursor: pointer; }

@keyframes toast-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 8px #d9b39e08; } }
