* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Noto Sans TC', 'PingFang TC', sans-serif; color: #EDEDED; }
#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#wrap { position: relative; flex: 0 0 auto; }
#book { width: 100%; height: 100%; }

/* 一頁 = 2:1 跨頁畫布的一半 */
.page { background: #3A3A3A; overflow: hidden; container-type: size; }
.canvas { position: absolute; top: 0; width: 200%; height: 100%; }
.page.L .canvas { left: 0; }
.page.R .canvas { left: -100%; }
.page.L::after, .page.R::after { content: ''; position: absolute; top: 0; bottom: 0; width: 3.3%; pointer-events: none; z-index: 99; }
.page.L::after { right: 0; background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,.14)); }
.page.R::after { left: 0;  background: linear-gradient(270deg, rgba(0,0,0,0), rgba(0,0,0,.14)); }
.page.blank { background: #141414; }

.it { position: absolute; }
.it.block { }
.it.photo, .it.image { display: block; height: auto; }
.it.photo { cursor: zoom-in; background: #222; }
.it.photo.shadow { box-shadow: .67cqh 1.17cqh 1.67cqh rgba(0,0,0,.27); }
.it.photo.white  { border: .83cqh solid #FAFAFA; box-shadow: .67cqh 1.17cqh 1.67cqh rgba(0,0,0,.27); box-sizing: content-box; transform: translate(-.83cqh, -.83cqh); }
.it.text { white-space: pre; line-height: 1.85; margin: 0; }
.it.text.title { font-family: 'Noto Serif TC', serif; font-weight: 700; }
.it.text.en, .it.text.f-en { font-family: 'Cormorant Garamond', serif; font-weight: 600; letter-spacing: .04em; }
.it.text.vertical { writing-mode: vertical-rl; line-height: 1.9; letter-spacing: .12em; }

.nav { position: fixed; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 20; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: #bbb; font-size: 28px; line-height: 40px; }
#prev { left: max(10px, env(safe-area-inset-left)); }
#next { right: max(10px, env(safe-area-inset-right)); }
#pageno { position: fixed; bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); left: 50%; transform: translateX(-50%);
  font: 600 13px 'Cormorant Garamond', serif; letter-spacing: .2em; color: #777; z-index: 20; }
#rotate { display: none; position: fixed; top: calc(env(safe-area-inset-top) + 18px); left: 0; right: 0; text-align: center; color: #888; font-size: 14px; }
@media (orientation: portrait) { #rotate { display: block; } }
@media (max-height: 500px) { .nav, #pageno { opacity: .55; } }

#zoom { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  opacity: 0; transition: opacity .25s; cursor: zoom-out; }
#zoom.on { opacity: 1; }
#zoom[hidden] { display: none; }
#zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }
