:root {
  color-scheme: dark;
  --bg: #070608;
  --ink: #f8f5f6;
  --muted: rgba(248, 245, 246, .68);
  --line: rgba(255, 255, 255, .18);
  --accent: #ff8fb3;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; min-width: 280px; min-height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); }
body { font-family: "HackGenConsole", "Yu Gothic", Meiryo, monospace; -webkit-font-smoothing: antialiased; }
button, output { font: inherit; }
button, a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.book-viewer { position: relative; isolation: isolate; width: 100vw; height: 100svh; overflow: hidden; background: #000; }
.stage { position: absolute; z-index: 0; inset: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; background: #000; }
.photo-backdrop { position: absolute; inset: -40px; background-position: center; background-size: cover; filter: blur(34px) brightness(.24) saturate(.78); opacity: .64; transform: scale(1.08); transition: opacity .7s ease; }
#viewer-image { position: relative; z-index: 1; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; align-self: center; justify-self: center; object-fit: contain; object-position: center center; opacity: 0; transition: opacity .7s ease; }
#viewer-image.is-loaded { opacity: 1; }

.topbar, .bottombar { position: absolute; z-index: 10; left: 0; right: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 18px; padding-inline: max(18px, env(safe-area-inset-left)); transition: opacity .25s ease; }
.topbar { top: 0; min-height: 66px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: 12px; background: linear-gradient(to bottom, rgba(0, 0, 0, .72), transparent); }
.bottombar { bottom: 0; min-height: 70px; padding-top: 12px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0, 0, 0, .76), transparent); }
.topbar h1 { margin: 0; font-family: Baskerville, "Palatino Linotype", "Book Antiqua", Georgia, serif; font-size: clamp(21px, 2vw, 31px); font-weight: 400; letter-spacing: .025em; line-height: 1; white-space: nowrap; text-shadow: 0 2px 16px #000; }

.transport, .top-tools { display: flex; align-items: center; gap: 8px; }
.top-tools { justify-self: end; }
.transport button, .icon-button, .list-button { border: 1px solid rgba(255, 255, 255, .32); background: rgba(0, 0, 0, .36); color: rgba(255, 255, 255, .82); backdrop-filter: blur(12px); cursor: pointer; opacity: .68; transition: opacity .2s ease, color .2s ease, border-color .2s ease, background-color .2s ease; }
.transport button:hover, .transport button:focus-visible, .icon-button:hover, .icon-button:focus-visible, .list-button:hover, .list-button:focus-visible { border-color: var(--accent); color: #fff; opacity: 1; }
.transport button, .icon-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; padding: 0; font-size: 16px; }
.transport .pause { width: 40px; height: 40px; border-color: rgba(255, 143, 179, .7); background: rgba(255, 143, 179, .14); }
.pause svg { width: 17px; height: 17px; fill: currentColor; }
.pause .play-icon, .pause.is-paused .pause-icon { display: none; }
.pause.is-paused .play-icon { display: block; }
.transport #shuffle[aria-pressed="true"] { border-color: #ff73a2; background: rgba(218, 45, 108, .88); color: #fff; box-shadow: 0 0 0 1px rgba(255, 115, 162, .25), 0 0 14px rgba(218, 45, 108, .3); opacity: 1; }
button:disabled { cursor: default; opacity: .28; }

.page-status { display: grid; grid-template-columns: auto auto auto; align-items: center; column-gap: 7px; min-width: 94px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.progress { grid-column: 1 / -1; display: block; width: 100%; height: 2px; margin-top: 5px; overflow: hidden; background: rgba(255, 255, 255, .2); }
.progress i { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.progress i.is-running { animation: progress 6s linear forwards; }
@keyframes progress { to { transform: scaleX(1); } }

.icon-button svg, .list-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: square; stroke-width: 1.7; }
#shuffle svg { width: 20px; height: 18px; fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.fullscreen-exit, .icon-button.is-fullscreen .fullscreen-enter { display: none; }
.icon-button.is-fullscreen .fullscreen-exit { display: block; }
.back-link { justify-self: start; color: var(--muted); font-size: 11px; text-decoration: none; text-shadow: 0 1px 8px #000; }
.back-link:hover { color: var(--accent); }
.photo-credit { display: flex; min-width: 0; margin: 0; align-items: center; justify-content: center; gap: .48em; overflow: hidden; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", Georgia, serif; font-size: clamp(15px, 1.55vw, 22px); letter-spacing: .035em; line-height: 1.2; text-align: center; text-overflow: ellipsis; text-shadow: 0 2px 14px #000, 0 1px 3px #000; white-space: nowrap; }
.photo-credit__name, .photo-credit__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.photo-credit__title { color: rgba(248, 245, 246, .7); font-size: .88em; }
.book-viewer.is-gallery-open .photo-credit { visibility: hidden; }
.book-viewer.is-gallery-open .topbar { pointer-events: none; }
.book-viewer.is-gallery-open .topbar button { pointer-events: auto; }
.list-button { justify-self: end; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; border-radius: 999px; padding: 7px 11px; font-size: 11px; }
.list-button svg { fill: currentColor; stroke: none; }

.image-status { position: absolute; z-index: 3; max-width: min(560px, 82vw); margin: 0; border: 1px solid var(--line); background: rgba(0, 0, 0, .62); color: var(--muted); padding: 12px 16px; font-size: 13px; line-height: 1.7; text-align: center; backdrop-filter: blur(12px); }
.book-viewer.is-ui-hidden { cursor: none; }
.book-viewer.is-ui-hidden .controls { opacity: 0; pointer-events: none; }

.thumbnail-panel { position: absolute; z-index: 5; inset: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); grid-auto-rows: 160px; align-content: start; gap: 2px; overflow-y: auto; padding: 82px 2px 86px; background: rgba(7, 6, 8, .94); scrollbar-color: var(--accent) transparent; }
.thumbnail { position: relative; display: block; width: 100%; height: 160px; min-width: 0; overflow: hidden; border: 0; background: #111; color: var(--muted); padding: 0; cursor: pointer; text-align: left; }
.thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; background: #0c0b0d; opacity: .74; transition: opacity .2s ease; }
.thumbnail span { position: absolute; right: 0; bottom: 0; left: 0; overflow: hidden; padding: 18px 10px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .84)); font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif; font-size: 11px; text-overflow: ellipsis; text-shadow: 0 1px 5px #000; white-space: nowrap; }
.thumbnail:hover img, .thumbnail:focus-visible img, .thumbnail.is-current img { opacity: 1; }
.thumbnail.is-current::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--accent); pointer-events: none; }
.gallery-footer { grid-column: 1 / -1; grid-row: span 2; display: flex; min-height: 280px; align-items: center; justify-content: center; flex-direction: column; gap: 9px; padding: 54px 24px 92px; color: rgba(248, 245, 246, .7); font-family: Baskerville, "Palatino Linotype", "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif; font-size: clamp(12px, 1.15vw, 16px); letter-spacing: .035em; line-height: 1.45; text-align: center; }
.gallery-footer__thanks { margin-top: 8px; color: rgba(255, 143, 179, .82); font-style: italic; }

.unpublished { display: grid; place-content: center; min-height: 100svh; padding: 40px; background: radial-gradient(circle at 50% 45%, #351f2a, #09080a 64%); text-align: center; }
.unpublished p { color: var(--accent); font-size: 11px; letter-spacing: .18em; }
.unpublished h1 { margin: 18px 0 34px; font-family: Baskerville, "Palatino Linotype", Georgia, serif; font-size: clamp(40px, 7vw, 92px); font-weight: 400; }
.unpublished strong { color: var(--muted); font-weight: 400; }
.unpublished a { margin-top: 60px; color: var(--accent); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
noscript { position: fixed; z-index: 100; inset: 40% 10% auto; background: white; color: black; padding: 24px; text-align: center; }

@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 8px 12px; min-height: 92px; }
  .topbar h1 { grid-row: 1; grid-column: 1 / -1; justify-self: center; font-size: 20px; }
  .transport { grid-row: 2; grid-column: 1; }
  .top-tools { grid-row: 2; grid-column: 2; }
  .transport button, .icon-button { width: 30px; height: 30px; }
  .transport .pause { width: 34px; height: 34px; }
  .page-status { min-width: 76px; }
  .bottombar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .back-link { font-size: 0; }
  .back-link::first-letter { font-size: 17px; }
  .photo-credit { font-size: 14px; }
  .list-button span { display: none; }
  .list-button { width: 34px; padding: 7px; justify-content: center; }
  .thumbnail-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 140px; padding-top: 104px; }
  .thumbnail { height: 140px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .topbar { min-height: 48px; padding-block: 6px; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto; }
  .topbar h1 { grid-row: 1; grid-column: 2; font-size: 18px; }
  .transport { grid-row: 1; grid-column: 1; }
  .top-tools { grid-row: 1; grid-column: 3; }
  .bottombar { min-height: 48px; padding-block: 7px; }
  .thumbnail-panel { padding-top: 54px; padding-bottom: 54px; }
}

@media (max-width: 360px) {
  .topbar { padding-inline: 10px; gap: 8px; }
  .transport, .top-tools { gap: 5px; }
  .page-status { min-width: 66px; column-gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
