:root { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; color: #111; background: #fff; }
* { box-sizing: border-box; }
body { margin: 0; }
.archive-page { width: min(100vw, 154.54545dvh); margin: max(0px, 50dvh - 32.35294vw) auto 0; padding: min(2.35vw, 3.631dvh); container-type: inline-size; }
nav { display: flex; justify-content: flex-end; gap: 1.5cqw; font-size: 1.23cqw; line-height: 1.4; }
button, a { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
nav a, .memory-entry { text-decoration: none; }
button:disabled { color: #888; cursor: default; }
button:focus-visible, a:focus-visible { outline: 1px solid #111; outline-offset: 3px; }
.memory-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.35vw; margin-top: 3cqw; }
.memory-entry { display: block; min-width: 0; }
.memory-entry > .snapshot { outline: 1px solid #ddd; }
.memory-name { margin: 10px 0 4px; font-size: 12px; font-weight: normal; overflow-wrap: anywhere; }
.memory-date { display: block; color: #888; font-size: 10px; }
#archive-message, #more, .archive-return { font-size: 12px; line-height: 1.4; }
#archive-message { color: #888; }
#more { margin: 24px 0; text-decoration: underline; }
.archive-return { display: inline-block; margin-top: 2cqw; }
.snapshot { position: relative; width: 100%; overflow: hidden; background: white; }
.snapshot-sheet { position: absolute; left: 0; top: 0; transform-origin: top left; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; }
.snapshot-text, .snapshot-link { margin: 0; padding: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.snapshot-link { text-decoration: underline; }
.snapshot-image { display: block; object-fit: fill; }
.snapshot-image.unavailable { color: #888; font-size: 10px; }
.saved-detail { height: 100dvh; overflow: hidden; display: grid; place-items: center; }
.saved-detail .archive-page { width: min(100vw, 154.54545dvh); aspect-ratio: 17 / 11; margin: 0; padding: min(2.35vw, 3.631dvh); position: relative; }
.saved-detail nav { position: absolute; z-index: 1; top: min(2.35vw, 3.631dvh); right: min(2.35vw, 3.631dvh); left: min(2.35vw, 3.631dvh); }
.saved-detail #archive-message { position: absolute; top: 10%; left: min(2.35vw, 3.631dvh); }
#saved-canvas { position: absolute; inset: 0; width: 100%; margin: 0; }
.saved-heading { font-size: 12px; font-weight: normal; margin: 16px 0 4px; }
@media (max-width: 600px) { .memory-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.memory-slot { position: relative; min-width: 0; }
.memory-delete { position: absolute; top: 2px; left: 2px; z-index: 1; width: 22px; height: 22px; color: #555; background: #fff; font: 20px/1 "Helvetica Neue", Helvetica, Arial, sans-serif; opacity: 0; pointer-events: none; }
.memory-slot:hover .memory-delete, .memory-slot:focus-within .memory-delete { opacity: 1; pointer-events: auto; }
.admin-page { max-width: 320px; margin: 10vh auto; padding: 20px; font-size: 14px; }
.admin-page h1 { font-size: 16px; font-weight: normal; }
.admin-page input { display: block; width: 100%; margin: 8px 0 16px; padding: 4px; font: inherit; border: 1px solid #aaa; background: #fff; }
.admin-page button, .admin-page a { text-decoration: underline; }
.admin-page #admin-message { color: #888; }

nav [aria-current="page"] { color: #888; }

@media screen and (max-width: 767px) {
  .archive-page { width: 100%; margin: 0; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  nav { gap: clamp(8px, 2.7vw, 16px); font-size: clamp(13px, 3.7vw, 17px); white-space: nowrap; }
  .memory-list { grid-template-columns: 1fr; margin-top: 2.5em; row-gap: calc(2.35vw + 16px); }
  .saved-detail { min-height: 100dvh; height: auto; }
  .saved-detail .archive-page { width: 100%; }
}

.mobile-saved { display: none; }
@media screen and (max-width: 767px) {
  .saved-detail { display: block; overflow: auto; }
  .saved-detail .archive-page { aspect-ratio: auto; min-height: 100dvh; position: relative; }
  .saved-detail nav { position: static; }
  .saved-detail #saved-canvas { display: none; }
  .mobile-saved { display: block; padding-top: 2.5em; font: 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif; }
  .mobile-saved figure { margin: 20px 0; }
  .mobile-saved figure:first-of-type { margin-top: calc(2em + 2.14cqw + max(0px, 2.4cqw - 28px)); }
  .mobile-saved img { display: block; width: 100%; height: auto; }
  .mobile-saved figcaption { color: #888; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
  .mobile-saved figcaption a { color: inherit; }
  .mobile-saved footer { display: flex; justify-content: space-between; gap: 8px; color: #888; font-size: 10px; margin-top: 24px; }
}
