/* Deep rose paper echoes the final letter while fireworks remain visible. */
#memory-dialog.memory-reader {
  position: fixed;
  inset: 0;
  width: min(880px, calc(100vw - 64px));
  max-width: none;
  max-height: min(740px, calc(100dvh - 112px));
  margin: auto;
  padding: 0;
  border: 1px solid #75465f;
  border-radius: 4px;
  overflow: auto;
  overscroll-behavior: contain;
  color: #f1dfe9;
  background: #231820;
  box-shadow: 0 18px 90px #05010466;
  font-family: var(--serif, 'Noto Serif SC', 'Songti SC', serif);
}
#memory-dialog::backdrop { background: rgb(9 2 7 / 24%); }
.memory-sheet { position: relative; display: grid; grid-template-columns: 1.04fr 1fr; min-height: 440px; }
#memory-dialog .memory-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #472637;
  color: #f6dfeb;
  font: 28px/1 sans-serif;
  cursor: pointer;
}
.memory-picture { display: flex; flex-direction: column; margin: 0; min-width: 0; padding: 24px; background: #2d202b; }
#memory-image { display: block; width: 100%; height: 100%; min-height: 260px; max-height: 460px; flex: 1; object-fit: contain; }
#memory-caption { padding-top: 14px; text-align: center; color: #cda1b8; font-size: 14px; line-height: 1.5; }
.memory-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 70px 34px 32px; }
#memory-title { margin: 0 0 24px; color: #e9adca; font: 500 29px/1.4 var(--serif, 'Noto Serif SC', serif); letter-spacing: 0; overflow-wrap: anywhere; }
#memory-title:focus { outline: none; }
#memory-prose { width: 100%; }
#memory-prose p { margin: 0 0 16px; color: #f1dfe9; font-size: 16px; line-height: 1.9; overflow-wrap: anywhere; white-space: pre-line; }
#memory-dialog .memory-done { margin: auto 0 0; padding: 12px 0; min-height: 48px; border: 0; color: #e9adca; background: transparent; font: inherit; font-size: 16px; cursor: pointer; }
#memory-dialog button:focus-visible { outline: 3px solid #efabc9; outline-offset: 4px; }
#memory-dialog button { transition: transform 160ms ease, background-color 160ms ease; }
#memory-dialog .memory-close:hover { background: #593346; }
#memory-dialog button:active { transform: scale(.96); }
@media (max-width: 600px) {
  #memory-dialog.memory-reader { width: calc(100vw - 32px); max-height: calc(100dvh - 72px); }
  .memory-sheet { display: block; min-height: 0; }
  .memory-picture { padding: 20px 20px 16px; }
  #memory-image { height: min(31dvh, 260px); min-height: 145px; max-height: 260px; flex: none; }
  #memory-caption { font-size: 13px; padding-top: 8px; }
  .memory-copy { padding: 26px 24px 20px; }
  #memory-title { font-size: 25px; margin-bottom: 18px; padding-right: 0; }
  #memory-prose p { font-size: 16px; line-height: 1.85; }
  #memory-dialog .memory-done { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { #memory-dialog button { transition: none; } }
