.memory-editor:not([open]) { display: none; }
.memory-editor { width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); padding: 28px; box-shadow: 0 24px 80px #0006; }
.memory-editor::backdrop { background: #100d14b3; }
.memory-editor h3 { margin: 0 0 24px; font-size: 1.2rem; }
.memory-editor-actions { margin-top: 8px; }
body:has(.memory-editor[open]) { overflow: hidden; }
.memory-collection {
  display: flex;
  flex-direction: column;
  padding-top: 0;
}
.memory-collection-head { min-height: 28px; margin-bottom: 16px; gap: 12px; }
.memory-album-shell {
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 42px 42px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}
.memory-album-spread { grid-column: 1 / -1; grid-row: 1; min-height: 0; }
.memory-album-page { min-height: 0; max-height: none; overflow: visible; }
.memory-album-page .album-photo { height: auto; aspect-ratio: 4 / 3; }
.memory-album-shell > .album-turn { grid-row: 2; align-self: center; }
#previousMemoryPage { grid-column: 2; }
#nextMemoryPage { grid-column: 3; }
.memory-album-footer { margin-top: 8px; }
.memory-album-spread:has(.album-empty) {
  min-height: 320px;
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  padding: 24px;
}
.album-empty { margin: 0; padding: 24px 12px; border: 0; background: transparent; border-radius: 0; }
.memory-album-shell:has(.album-empty) > .album-turn,
.memory-collection:has(.album-empty) .memory-album-footer { display: none; }
.memory-album-shell:has(.album-empty) { grid-template-rows: minmax(0, 1fr); }
@media (max-width: 1100px) {
  .memory-collection { padding-top: 0; margin-top: 0; }
  .memory-album-spread:has(.album-empty) { min-height: 260px; }
}
@media (max-width: 620px) {
  .memory-editor { padding: 20px; }
  .memory-collection-head > .button { width: 100%; }
  .memory-collection-head { align-items: center; }
  .memory-collection-head h3 { font-size: .95rem; }
  .memory-album-spread { padding: 8px; }
  .memory-album-page { padding: 17px 16px; }
  .memory-album-spread:has(.album-empty) { min-height: 220px; padding: 16px; }
}
