.photo-memory-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(33, 25, 34, .78);
  backdrop-filter: blur(8px);
}

.photo-memory-modal.is-open { display: grid; }

.photo-memory-polaroid {
  width: min(560px, 92vw);
  max-height: 88svh;
  margin: 0;
  padding: 14px 14px 22px;
  overflow: auto;
  background: #fffdf9;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  transform: rotate(-1deg);
  animation: memory-pop .22s ease-out;
}

.photo-memory-image {
  display: none;
  width: 100%;
  max-height: 65svh;
  object-fit: contain;
  background: #eee8e4;
  image-rendering: pixelated;
}

.photo-memory-image.is-ready { display: block; }

.photo-memory-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #705f72;
  background: #f3eceb;
  text-align: center;
  font-weight: 800;
}

.photo-memory-loading.is-hidden { display: none; }

.photo-memory-polaroid figcaption {
  display: grid;
  gap: 5px;
  padding: 16px 9px 0;
  text-align: center;
  color: #2e2430;
}

.photo-memory-title {
  font-size: 1.12rem;
  font-weight: 950;
}

.photo-memory-caption {
  color: #705f72;
  font-size: .92rem;
  line-height: 1.35;
}

.photo-memory-close {
  position: fixed;
  z-index: 1001;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #2e2430;
  box-shadow: 0 7px 24px rgba(0,0,0,.2);
  cursor: pointer;
  font-size: 1.7rem;
  line-height: 1;
}

@keyframes memory-pop {
  from { opacity: 0; transform: translateY(14px) rotate(-2deg) scale(.97); }
  to { opacity: 1; transform: translateY(0) rotate(-1deg) scale(1); }
}

@media (max-width: 640px) {
  .photo-memory-modal { padding: 18px 12px; }
  .photo-memory-polaroid { width: min(94vw, 520px); padding: 10px 10px 18px; }
  .photo-memory-image { max-height: 61svh; }
  .photo-memory-loading { min-height: 190px; }
  .photo-memory-close { top: max(9px, env(safe-area-inset-top)); right: 9px; }
}
