:root {
  --night: #0b0907;
  --night-2: #15100c;
  --wood: #2a1a10;
  --lamp: #f2b56b;
  --lamp-soft: rgba(242, 181, 107, .16);
  --paper: #efe6d4;
  --paper-ink: #2a2018;
  --ink: #f1e9da;
  --muted: #bcae97;
  --rule: rgba(241, 233, 218, .18);
  --song: "LXGW WenKai TC", "Songti TC", "Noto Serif TC", "PMingLiU", serif;
  --hei: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --gut: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--night); -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }
body {
  margin: 0; background: var(--night); color: var(--ink);
  font-family: var(--hei); font-size: 18px; line-height: 1.75;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr-only, .mode-3d .ep-list, .mode-3d .shelf2d {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.mode-3d .ep-list:focus-within, .mode-3d .shelf2d:focus-within {
  position: fixed !important; width: auto; height: auto; clip: auto; clip-path: none; white-space: normal;
  left: var(--gut); right: var(--gut); bottom: 120px; z-index: 30; background: rgba(11,9,7,.94);
  padding: 12px; border: 1px solid var(--rule); border-radius: 10px;
}

/* ---------- canvas 與 2D 背景 ---------- */
#gl {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; display: block;
  z-index: 0; touch-action: pan-y; opacity: 0; transition: opacity 1.2s ease;
}
.mode-3d #gl { opacity: 1; }
.mode-2d #gl { display: none; }
.posters { position: fixed; inset: 0; z-index: 0; display: none; background: var(--night); }
.mode-2d .posters { display: block; }
.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: saturate(.92); }
.lampglow {
  position: absolute; left: 50%; top: 38%; width: 120vmax; height: 120vmax; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(242,181,107,.22), rgba(242,181,107,.06) 28%, transparent 55%);
  opacity: 0; pointer-events: none;
}
.veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,.35), transparent 18%, transparent 70%, rgba(0,0,0,.45));
}
.mode-2d .veil { background: radial-gradient(120% 90% at 50% 45%, rgba(0,0,0,.35), rgba(0,0,0,.78) 100%); }

/* ---------- 上方列 ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(var(--gut), env(safe-area-inset-right)) 12px max(var(--gut), env(safe-area-inset-left));
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand {
  font-family: var(--song); font-size: 17px; letter-spacing: .3em; text-decoration: none; color: var(--lamp);
  padding: 8px 0; opacity: .9;
}
.sound {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
  background: rgba(11,9,7,.55); border: 1px solid var(--rule); border-radius: 999px; cursor: pointer;
  font-size: 16px; letter-spacing: .08em; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color .3s, background .3s;
}
.sound:hover { border-color: rgba(242,181,107,.5); }
.sound[aria-pressed="true"] { border-color: rgba(242,181,107,.7); background: rgba(42,26,16,.7); }
.sound-icon { display: inline-flex; gap: 3px; align-items: flex-end; height: 14px; }
.sound-icon::before, .sound-icon::after { content: ""; width: 3px; height: 6px; background: currentColor; border-radius: 2px; opacity: .7; }
.sound-icon { position: relative; width: 16px; }
.sound-icon::after { height: 10px; }
.sound[aria-pressed="true"] .sound-icon::before { animation: eq 1.2s ease-in-out infinite; }
.sound[aria-pressed="true"] .sound-icon::after { animation: eq 1.2s ease-in-out .4s infinite; }
@keyframes eq { 50% { height: 14px; } }

/* ---------- 位置點 ---------- */
.dots {
  position: fixed; right: max(10px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); z-index: 35;
  display: flex; flex-direction: column; gap: 4px;
}
.dots button {
  position: relative; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; padding: 0;
}
.dots button::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: rgba(241,233,218,.35); transition: transform .4s, background .4s;
}
.dots button.is-on::after { background: var(--lamp); transform: scale(1.5); box-shadow: 0 0 12px rgba(242,181,107,.8); }
.dots span {
  position: absolute; right: 44px; top: 50%; transform: translateY(-50%); font-size: 15px; white-space: nowrap;
  opacity: 0; transition: opacity .3s; color: var(--ink); pointer-events: none; letter-spacing: .1em;
}
.dots button:hover span, .dots button:focus-visible span, .dots button.is-on span { opacity: .85; }
@media (max-width: 700px) { .dots button.is-on span { opacity: 0; } .dots { gap: 0; } }

/* ---------- 捲動軌道 ---------- */
main { position: relative; z-index: 2; }
.mode-3d main { pointer-events: none; }
.mode-3d .stage { position: relative; }
.mode-3d #s-entry { height: 130vh; }
.mode-3d #s-hall { height: 390vh; }
.mode-3d #s-study { height: 250vh; }
.mode-3d #s-desk { height: 140vh; }

/* 3D 模式下的字幕：固定在畫面上，依位置淡入淡出 */
.mode-3d .cap, .mode-3d .note, .mode-3d .desk-actions {
  position: fixed; z-index: 20; opacity: 0; visibility: hidden;
  transition: opacity .9s ease, visibility 0s linear .9s, transform .9s ease;
}
.mode-3d .is-on { opacity: 1; visibility: visible; transition: opacity .9s ease, visibility 0s, transform .9s ease; }
.mode-3d .is-on.cap, .mode-3d .is-on.desk-actions { pointer-events: auto; }

.cap-entry { text-align: center; }
.mode-3d .cap-entry { left: 0; right: 0; top: 14vh; bottom: max(24px, env(safe-area-inset-bottom)); padding: 0 var(--gut); display: flex; flex-direction: column; align-items: center; }
.mode-3d .cap-entry .skip { margin-top: auto; }
.mode-3d .cap-entry.is-on { pointer-events: none; }
.mode-3d .cap-entry.is-on .skip { pointer-events: auto; }
.title {
  margin: 0; font-family: var(--song); font-weight: 300; font-size: clamp(36px, 9.4vw, 92px); white-space: nowrap;
  letter-spacing: .32em; text-indent: .32em; line-height: 1.2; color: var(--paper);
  text-shadow: 0 0 40px rgba(242,181,107,.25);
}
.title .ch { display: inline-block; opacity: 0; filter: blur(8px); transform: translateY(14px); }
.sub { margin: 22px 0 0; font-family: var(--song); font-size: clamp(17px, 2.2vw, 21px); color: var(--muted); letter-spacing: .16em; opacity: 0; }
.hint { margin: 46px 0 0; font-size: 16px; color: var(--muted); letter-spacing: .3em; opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hint i { display: block; width: 1px; height: 46px; background: linear-gradient(var(--lamp), transparent); transform-origin: top; animation: drip 2.4s ease-in-out infinite; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 0; } 40% { opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

.cap-side { max-width: 520px; }
.mode-3d .cap-side {
  left: max(var(--gut), env(safe-area-inset-left)); bottom: max(28px, env(safe-area-inset-bottom));
  padding: 22px 24px 22px; border-left: 2px solid var(--lamp);
  background: linear-gradient(90deg, rgba(11,9,7,.78), rgba(11,9,7,.35) 85%, transparent);
  transform: translateY(16px);
}
.mode-3d .cap-side.is-on { transform: none; }
.kicker { margin: 0 0 6px; font-size: 16px; letter-spacing: .24em; color: var(--lamp); }
.cap-side h2 { margin: 0; font-family: var(--song); font-weight: 400; font-size: clamp(28px, 4vw, 40px); letter-spacing: .12em; line-height: 1.35; color: var(--paper); }
.lede { margin: 8px 0 0; font-size: 18px; color: var(--ink); opacity: .9; }
@media (max-width: 700px) {
  .mode-3d .cap-side { right: 64px; padding: 16px 18px; }
  .cap-side h2 { font-size: 28px; }
  .lede { font-size: 17px; }
}

/* 書桌上的紙（3D：位置由程式貼在紙上） */
.note { pointer-events: none; }
.mode-3d .note { left: 0; top: 0; width: 300px; height: 400px; display: flex; align-items: center; justify-content: center; transform-origin: 0 0; }
.mode-3d .note .note-text { font-size: 34px; font-weight: 600; letter-spacing: .04em; color: #1e160f; }
.note-text {
  margin: 0; font-family: var(--song); font-weight: 500; color: var(--paper-ink); letter-spacing: .08em;
  font-size: var(--note-size, 34px); line-height: 1.6; white-space: nowrap;
}
.mode-3d .note-text { mix-blend-mode: multiply; opacity: .92; }
.mode-3d .desk-actions { left: 0; right: 0; bottom: max(36px, env(safe-area-inset-bottom)); display: flex; justify-content: center; padding: 0 var(--gut); transform: translateY(20px); }
.mode-3d .desk-actions.is-on { transform: none; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px;
  border-radius: 999px; font-size: 18px; letter-spacing: .14em; text-decoration: none; cursor: pointer;
  transition: transform .25s ease, background .25s, box-shadow .25s, border-color .25s;
}
.btn-main { background: var(--lamp); color: #1a120a; border: 1px solid var(--lamp); box-shadow: 0 10px 30px rgba(242,181,107,.22); font-weight: 600; }
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(242,181,107,.35); }
.btn-ghost { background: transparent; color: var(--paper); border: 1px solid rgba(241,233,218,.4); }
.btn-ghost:hover { border-color: var(--paper); }
.btn:focus-visible, .close:focus-visible, .sound:focus-visible, .dots button:focus-visible, .ep-card:focus-visible, .spine2d:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
.close {
  margin-top: 18px; background: none; border: 0; color: var(--muted); font-size: 17px; letter-spacing: .14em;
  min-height: 44px; padding: 0 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 6px; text-decoration-color: rgba(188,174,151,.4);
}
.close:hover { color: var(--paper); }

/* ---------- 集數面板 ---------- */
.ep-panel {
  position: fixed; z-index: 50; right: max(var(--gut), 5vw); top: 50%; transform: translateY(-50%);
  width: min(400px, 34vw); padding: 30px 30px 22px; background: rgba(16,12,9,.9);
  border: 1px solid rgba(242,181,107,.28); border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.ep-panel[hidden], .reader[hidden] { display: none; }
.ep-num { margin: 0; font-size: 16px; letter-spacing: .3em; color: var(--lamp); }
.ep-title { margin: 10px 0 0; font-family: var(--song); font-weight: 500; font-size: 26px; line-height: 1.5; color: var(--paper); letter-spacing: .04em; }
.ep-line { margin: 14px 0 0; font-size: 18px; color: var(--ink); opacity: .9; }
.ep-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.ep-panel > * { opacity: 0; }
@media (max-width: 860px) {
  .ep-panel {
    left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto; max-height: 64vh; overflow: auto;
    padding: 24px max(20px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; border-width: 1px 0 0;
  }
  .ep-title { font-size: 23px; }
  .ep-actions .btn { flex: 1 1 0; padding: 0 12px; }
}

/* ---------- 翻開的書 ---------- */
.reader {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px var(--gut) max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(70% 60% at 50% 45%, rgba(40,26,14,.55), rgba(6,5,4,.92));
}
.reader-stage { perspective: 1800px; width: 100%; display: flex; justify-content: center; }
.book-open {
  --pw: min(300px, 42vw); --ph: calc(var(--pw) * 1.42);
  position: relative; width: calc(var(--pw) * 2); height: var(--ph); transform-style: preserve-3d;
}
.page {
  position: absolute; top: 0; width: var(--pw); height: var(--ph); padding: 12% 11%;
  background:
    linear-gradient(90deg, rgba(0,0,0,.10), transparent 12%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(60,40,20,.05) 31px 32px),
    #efe4cc;
  color: var(--paper-ink); display: flex; flex-direction: column; justify-content: center;
}
.page-right { left: var(--pw); border-radius: 0 4px 4px 0; box-shadow: 18px 22px 50px rgba(0,0,0,.5); }
.page-left { border-radius: 4px 0 0 4px; background:
    linear-gradient(270deg, rgba(0,0,0,.14), transparent 14%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(60,40,20,.05) 31px 32px),
    #ece0c6; }
.r-line { margin: 0; font-family: var(--song); font-size: clamp(19px, 2.4vw, 26px); line-height: 1.85; letter-spacing: .06em; }
.r-mark { margin-top: 18px; color: #8a6a44; }
.r-by { margin: 0; font-size: 16px; letter-spacing: .14em; color: #6a5a46; }
.r-title { margin: 10px 0 0; font-family: var(--song); font-weight: 600; font-size: clamp(26px, 3.6vw, 40px); letter-spacing: .14em; line-height: 1.35; }
.leaf {
  position: absolute; left: var(--pw); top: 0; width: var(--pw); height: var(--ph);
  transform-origin: 0 50%; transform-style: preserve-3d;
}
.leaf-front, .leaf-back { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.leaf-back { transform: rotateY(180deg); left: 0; }
.leaf-front {
  border-radius: 2px 5px 5px 2px; background:
    linear-gradient(90deg, rgba(0,0,0,.35) 0 7%, rgba(255,255,255,.05) 8%, transparent 20%),
    var(--cover, #5e2a22);
  color: var(--foil, #ecd9b4); display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 10px rgba(0,0,0,.08), 18px 22px 50px rgba(0,0,0,.55);
}
.lf-title { writing-mode: vertical-rl; font-family: var(--song); font-weight: 600; font-size: clamp(30px, 5vw, 54px); letter-spacing: .3em; }
.reader-actions { display: flex; flex-direction: column; align-items: center; margin-top: 30px; }
.reader-actions .close { margin-top: 8px; }
@media (max-width: 520px) {
  .book-open { --pw: calc((100vw - 32px) / 2); }
  .page { padding: 14% 9%; }
  .r-line { font-size: 18px; line-height: 1.8; }
  .r-title { font-size: 25px; letter-spacing: .08em; }
}

/* ---------- 2D 降級模式 ---------- */
.mode-2d .stage { min-height: 100vh; min-height: 100svh; padding: 110px max(var(--gut), 4vw) 90px; display: flex; flex-direction: column; justify-content: center; }
.mode-2d #s-entry { align-items: center; }
.mode-2d .cap-side { margin: 0 auto 36px; text-align: center; max-width: 640px; }
.mode-2d .cap-side h2 { font-size: clamp(30px, 6vw, 44px); }
.ep-list { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 40px; width: 100%; max-width: 1180px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ep-card {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; position: relative;
}
.ep-card .frame {
  display: block; padding: 12px; background: linear-gradient(135deg, #4a301b, #23160d 60%, #3a2414);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 24px 50px rgba(0,0,0,.6), inset 0 0 0 2px rgba(242,181,107,.14);
  transform-origin: 50% 100%; transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.ep-card img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; filter: brightness(.55) saturate(.8); transition: filter .8s; }
.ep-card.is-lit img { filter: none; }
.ep-card.is-lit .frame { transform: perspective(800px) rotateX(3deg); }
.ep-card::before {
  content: ""; position: absolute; left: 10%; right: 10%; top: -60px; height: 160px; pointer-events: none;
  background: radial-gradient(50% 60% at 50% 0, rgba(255,214,150,.4), transparent 70%); opacity: 0; transition: opacity .8s; z-index: 1;
}
.ep-card.is-lit::before { opacity: 1; }
.ep-card .meta { display: block; margin-top: 16px; }
.ep-card .n { display: block; font-size: 16px; color: var(--lamp); letter-spacing: .24em; }
.ep-card .t { display: block; margin-top: 4px; font-family: var(--song); font-size: 21px; line-height: 1.5; color: var(--paper); }
.shelf2d { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 0 18px; border-bottom: 16px solid #2a1a10; box-shadow: 0 18px 30px rgba(0,0,0,.5); }
.book-list { list-style: none; margin: 0; padding: 0 2%; display: flex; align-items: flex-end; justify-content: center; gap: 6px; min-height: 260px; }
.spine2d {
  display: flex; align-items: center; justify-content: center; width: clamp(36px, 9.5vw, 82px); height: var(--h, 220px);
  border: 0; border-radius: 3px 3px 1px 1px; cursor: pointer; padding: 10px 0;
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.08) 30%, rgba(0,0,0,.18) 80%), var(--cover);
  color: var(--foil); writing-mode: vertical-rl; font-family: var(--song); font-weight: 600; font-size: clamp(16px, 2.6vw, 22px); letter-spacing: .2em;
  box-shadow: inset 0 10px 0 rgba(255,255,255,.05), inset 0 -10px 0 rgba(0,0,0,.15);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.spine2d:hover, .spine2d.is-near { transform: translateY(-14px); }
.mode-2d .note {
  margin: 0 auto; width: min(420px, 100%); aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(0deg, transparent 0 35px, rgba(60,40,20,.07) 35px 36px), #ece2cc;
  box-shadow: 0 30px 60px rgba(0,0,0,.6); transform: rotate(-2deg);
}
.mode-2d .note-text { font-size: clamp(30px, 8vw, 40px); }
.mode-2d .desk-actions { display: flex; justify-content: center; margin-top: 36px; }
.noscript { position: fixed; inset: auto 0 40px; text-align: center; z-index: 99; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
  .title .ch { filter: none; transform: none; }
}

/* ---------- 追加：全部影片、跳過、書背字 ---------- */
.bar-right { display: flex; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  background: rgba(11,9,7,.55); border: 1px solid var(--rule); border-radius: 999px; cursor: pointer;
  font-size: 16px; letter-spacing: .08em; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pill:hover { border-color: rgba(242,181,107,.5); }
.pill:focus-visible, .skip:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
@media (max-width: 420px) { .brand { letter-spacing: .14em; font-size: 16px; } .pill { padding: 0 12px; } .bar-right { gap: 6px; } }
.skip {
  margin-top: 12px; background: none; border: 0; padding: 8px 0; min-height: 44px; cursor: pointer;
  color: var(--lamp); font-size: 16px; letter-spacing: .1em; text-decoration: underline; text-underline-offset: 6px; text-decoration-color: rgba(242,181,107,.35);
}
.cap-entry .skip { margin-top: 26px; opacity: 0; }
.mode-2d .skip { display: none; }
.labels { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.mode-2d .labels { display: none; }
.spine-label {
  position: absolute; left: 0; top: 0; writing-mode: vertical-rl; white-space: nowrap; font-family: var(--song); font-weight: 600;
  letter-spacing: .16em; line-height: 1; transform-origin: 0 0; will-change: transform, opacity; opacity: 0;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.all {
  position: fixed; inset: 0; z-index: 70; background: rgba(6,5,4,.9); display: flex; align-items: flex-start; justify-content: center;
  overflow: auto; padding: 80px var(--gut) 40px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.all[hidden] { display: none; }
.all-box { width: min(760px, 100%); }
.all-box h2 { margin: 0 0 20px; font-family: var(--song); font-weight: 400; font-size: 30px; letter-spacing: .16em; color: var(--paper); }
.all-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.all-list li { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.all-list img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; display: block; border-radius: 2px; }
.all-list .n { font-size: 16px; color: var(--lamp); letter-spacing: .2em; }
.all-list h3 { margin: 2px 0 8px; font-family: var(--song); font-weight: 500; font-size: 20px; line-height: 1.5; color: var(--paper); }
.all-list .links { display: flex; gap: 18px; flex-wrap: wrap; }
.all-list .links a { font-size: 17px; color: var(--paper); text-underline-offset: 5px; min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 520px) { .all-list li { grid-template-columns: 1fr; } }
.mode-3d .note, .mode-3d .note.is-on { transition: opacity .9s ease, visibility 0s; }
.mode-3d .note:not(.is-on) { transition: opacity .5s ease, visibility 0s linear .5s; }

/* ---------- v1（11/15 夜）：展廳導覽列、載入前不疊字 ---------- */
html:not(.mode-3d):not(.mode-2d) main,
html:not(.mode-3d):not(.mode-2d) .dots { visibility: hidden; }
.skip { display: none !important; }

.roombar {
  position: fixed; z-index: 38; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  width: min(440px, calc(100vw - 2 * var(--gut))); padding: 10px 10px 10px 20px;
  background: linear-gradient(180deg, rgba(30,21,14,.72), rgba(12,9,7,.82));
  border: 1px solid rgba(242,181,107,.22); border-radius: 999px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,236,200,.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  transition: opacity 1s ease, transform 1s cubic-bezier(.2,.8,.2,1);
}
.roombar.is-in { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.rb-line { position: absolute; left: 26px; right: 26px; top: -1px; height: 1px; background: rgba(241,233,218,.08); overflow: hidden; border-radius: 1px; }
.rb-line i { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(242,181,107,.2), var(--lamp)); transform-origin: 0 50%; transform: scaleX(0); box-shadow: 0 0 10px rgba(242,181,107,.8); }
.rb-no { font-family: var(--song); font-size: 22px; letter-spacing: .06em; color: var(--lamp); font-variant-numeric: tabular-nums; min-width: 2ch; }
.rb-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.rb-name > span { font-family: var(--song); font-size: 18px; letter-spacing: .3em; color: var(--paper); }
.rb-name small { font-size: 14px; letter-spacing: .12em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-next {
  position: relative; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(242,181,107,.55);
  background: radial-gradient(circle at 50% 35%, rgba(242,181,107,.32), rgba(242,181,107,.08) 70%); cursor: pointer; padding: 0;
  display: grid; place-items: center; color: var(--lamp); transition: transform .35s cubic-bezier(.2,.8,.2,1), background .35s, box-shadow .35s;
}
.rb-next svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.rb-next::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(242,181,107,.35); animation: rbPulse 2.8s ease-out infinite; }
@keyframes rbPulse { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.rb-next:hover { transform: translateY(2px); box-shadow: 0 0 24px rgba(242,181,107,.35); }
.rb-next.is-up svg { transform: rotate(180deg); }
.rb-next.is-up::after { animation: none; opacity: 0; }
.rb-next:focus-visible { outline: 2px solid var(--lamp); outline-offset: 4px; }

/* 導覽列出現後，字幕與按鈕往上讓位 */
.mode-3d .cap-side { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 88px); }
.mode-3d .desk-actions { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 92px); }
.mode-3d .cap-entry { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 80px); }
@media (max-width: 700px) {
  .dots { display: none; }
  .mode-3d .cap-side { right: var(--gut); }
}
.mode-2d .roombar { position: fixed; }

/* 導覽列已取代右側圓點 */
.dots { display: none !important; }

/* ---------- v1.1：膠片顆粒、博物館小標籤 ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 4; pointer-events: none; opacity: .085; mix-blend-mode: overlay;
  background: url(img/grain.png) repeat; background-size: 128px 128px; animation: grain .9s steps(6) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 20%{transform:translate(-7%,4%)} 40%{transform:translate(5%,-6%)} 60%{transform:translate(-3%,8%)} 80%{transform:translate(8%,2%)} 100%{transform:translate(0,0)} }
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

/* 字幕改成展覽牆上的小標籤：放在上方、不擋畫面 */
.mode-3d .cap-side {
  top: calc(max(12px, env(safe-area-inset-top)) + 64px); bottom: auto; left: max(var(--gut), env(safe-area-inset-left)); right: auto;
  max-width: min(420px, calc(100vw - 2 * var(--gut)));
  padding: 4px 0 4px 16px; border-left: 1px solid rgba(242,181,107,.7); background: none;
  text-shadow: 0 2px 14px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.6); transform: translateY(-10px);
}
.mode-3d .cap-side .kicker { font-size: 14px; margin-bottom: 4px; }
.mode-3d .cap-side h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: .14em; }
.mode-3d .cap-side .lede { font-size: 16px; margin-top: 6px; color: var(--muted); opacity: 1; }
@media (max-width: 700px) { .mode-3d .cap-side { right: var(--gut); } .mode-3d .cap-side h2 { font-size: 24px; } }

/* 開場：點一下，開燈 */
.light-on {
  position: relative; margin: 34px auto 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer; padding: 18px 26px; pointer-events: auto; color: var(--paper);
}
.light-on[hidden] { display: none; }
.lo-ring { width: 58px; height: 58px; border-radius: 50%; border: 1px solid rgba(242,181,107,.7); position: relative; margin-bottom: 10px;
  background: radial-gradient(circle, rgba(255,214,150,.55), rgba(242,181,107,.12) 45%, transparent 70%); box-shadow: 0 0 40px rgba(242,181,107,.35); }
.lo-ring::before, .lo-ring::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid rgba(242,181,107,.5); animation: loPulse 2.6s ease-out infinite; }
.lo-ring::after { animation-delay: 1.3s; }
@keyframes loPulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }
.lo-text { font-family: var(--song); font-size: 20px; letter-spacing: .3em; text-indent: .3em; }
.light-on small { font-size: 14px; color: var(--muted); letter-spacing: .14em; }
.light-on:hover .lo-ring { box-shadow: 0 0 60px rgba(242,181,107,.55); }
.light-on:focus-visible { outline: 2px solid var(--lamp); outline-offset: 4px; border-radius: 12px; }
.mode-3d .cap-entry.is-on .light-on { pointer-events: auto; }
.mode-2d .light-on { display: none; }
.r-line .ink { display: inline-block; will-change: transform, filter, opacity; }
.r-line { color: #231a12; text-shadow: 0 0 .5px rgba(35,26,18,.4); }

/* 點畫後：這一集的畫可以左右滑（像翻展覽目錄） */
.ep-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0; margin: 0 0 10px; border-radius: 3px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.ep-strip::-webkit-scrollbar { display: none; }
.ep-strip img { flex: 0 0 100%; width: 100%; height: auto; aspect-ratio: 1280 / 716; object-fit: cover; scroll-snap-align: center; display: block; }
.ep-dots { display: flex; gap: 6px; justify-content: center; margin: 0 0 14px; }
.ep-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(241,233,218,.25); transition: background .3s, transform .3s; }
.ep-dots i.on { background: var(--lamp); transform: scale(1.3); }


/* 載入畫面：暗暗的檯燈輪廓＋細進度線 */
.loader { position: fixed; inset: 0; z-index: 90; background: var(--night); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity 1s ease .2s, visibility 0s linear 1.2s; }
.is-ready .loader { opacity: 0; visibility: hidden; }
.ld-lamp { width: 72px; height: 96px; fill: none; stroke: rgba(242,181,107,.55); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(242,181,107,.25)); animation: ldBreath 2.4s ease-in-out infinite; }
@keyframes ldBreath { 50% { stroke: rgba(242,181,107,.85); filter: drop-shadow(0 0 18px rgba(242,181,107,.45)); } }
.ld-line { width: 140px; height: 1px; background: rgba(241,233,218,.12); overflow: hidden; }
.ld-line i { display: block; height: 100%; width: 100%; background: var(--lamp); transform-origin: 0 50%; transform: scaleX(0); animation: ldFill 4s cubic-bezier(.2,.7,.2,1) forwards; }
.is-ready .ld-line i { animation: none; transform: scaleX(1); transition: transform .4s; }
@keyframes ldFill { to { transform: scaleX(.88); } }
.ld-text { font-family: var(--song); font-size: 15px; letter-spacing: .3em; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .ld-lamp, .ld-line i { animation: none; } }

/* 全部影片：展覽目錄 */
.all-box h2 { font-size: 26px; letter-spacing: .3em; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 1px solid rgba(242,181,107,.3); }
.all-list { gap: 34px; }
.all-list li { grid-template-columns: minmax(0, 1.1fr) 1fr; gap: 22px; border-bottom: 0; padding-bottom: 0; }
.all-list img { border-radius: 2px; box-shadow: 0 0 0 8px #2a1a10, 0 0 0 9px rgba(242,181,107,.25), 0 20px 40px rgba(0,0,0,.6); }
.all-list .ln { margin: 0 0 14px; font-size: 16px; color: var(--muted); line-height: 1.7; }
.all-list .links { gap: 10px; }
.all-list .links .btn { min-height: 44px; padding: 0 18px; font-size: 16px; }
.all-list .links a.btn-main { color: #1a120a; }
@media (max-width: 520px) { .all-list li { grid-template-columns: 1fr; gap: 16px; } .all-list img { margin: 9px; width: calc(100% - 18px); } }

/* 語言切換：中 / EN / 日 */
.lang-switch { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border: 1px solid var(--rule); border-radius: 999px;
  background: rgba(11,9,7,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lang-switch a { min-width: 34px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; letter-spacing: .06em;
  color: var(--muted); text-decoration: none; border-radius: 999px; }
.lang-switch a[aria-current="true"] { color: #1a120a; background: var(--lamp); }
.lang-switch a:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
@media (max-width: 420px) { .lang-switch a { min-width: 30px; font-size: 13px; } .bar .pill { font-size: 14px; } }
/* 英文書背：字躺下來，像真的英文書 */
.lang-en .spine-label, .lang-en .spine2d { text-orientation: mixed; letter-spacing: .04em; font-size-adjust: none; }
.lang-en .lf-title { writing-mode: horizontal-tb; font-size: clamp(22px, 3.4vw, 34px); letter-spacing: .04em; text-align: center; padding: 0 12%; }
.lang-en .title { letter-spacing: .12em; text-indent: .12em; font-size: clamp(30px, 7vw, 76px); white-space: normal; }
.lang-ja .title { letter-spacing: .2em; text-indent: .2em; font-size: clamp(30px, 8vw, 84px); }

/* 上方列：手機只留圖示，名字一行 */
.pill-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; display: none; }
.brand { white-space: nowrap; }
.title .ch.sp { width: .3em; }
@media (max-width: 520px) {
  .brand { font-size: 14px; letter-spacing: .12em; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  .lang-en .brand, .lang-ja .brand { letter-spacing: .04em; }
  #all-btn .pill-label, .sound .sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #all-btn, .sound { width: 44px; padding: 0; justify-content: center; }
  .pill-ic { display: block; }
  .bar-right { gap: 6px; }
}
/* 顆粒變細變淡（原本被放大成一顆顆像素） */
.grain { opacity: .05; background-size: 128px 128px; image-rendering: auto; }
@media (max-width: 700px) { .grain { opacity: .035; } }

/* 翻開的書：怎麼讀＋看短片 */
.r-how { margin: 18px 0 0; font-size: 15px; line-height: 1.7; color: #4a3a28; letter-spacing: .02em; }
.r-how[hidden] { display: none; }
.r-how-l { display: block; font-size: 12px; letter-spacing: .24em; color: #8a6a44; margin-bottom: 4px; }
.r-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.r-btns .btn { min-height: 48px; }
.r-btns .btn[hidden] { display: none; }
@media (max-width: 520px) { .r-how { font-size: 13px; margin-top: 10px; line-height: 1.55; } .r-how-l { font-size: 11px; } .r-btns .btn { padding: 0 18px; font-size: 16px; } }

/* 書桌結尾：最新一集、訂閱、Podcast */
.mode-3d .desk-actions { flex-direction: column; align-items: center; gap: 14px; }
.desk-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.desk-more a { min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; letter-spacing: .08em; color: var(--paper);
  text-decoration: none; border-bottom: 1px solid rgba(242,181,107,.35); padding: 0 2px; text-shadow: 0 2px 10px rgba(0,0,0,.9); }
.desk-more a:hover { color: var(--lamp); border-color: var(--lamp); }
.mode-2d .desk-actions { flex-direction: column; align-items: center; gap: 14px; }

/* ---------- 11/16 審查修正 ---------- */
/* 2 小展牌在手機加淡淡的暗底，壓在書架上也讀得清楚 */
@media (max-width: 700px) {
  .mode-3d .cap-side { padding: 10px 14px 12px 16px; border-radius: 0 10px 10px 0;
    background: linear-gradient(90deg, rgba(11,9,7,.72), rgba(11,9,7,.5) 75%, rgba(11,9,7,.15)); }
  .lang-en .mode-3d .cap-side h2, .lang-en.mode-3d .cap-side h2 { font-size: 21px; letter-spacing: .06em; }
}
/* 3 手機點畫：面板不超過 64vh，五幕圖本身就是近看 */
@media (max-width: 860px) { .ep-panel { padding-top: 18px; } .ep-strip { margin-bottom: 8px; } }
/* 4 語言鍵與品牌字點擊區 ≥ 44px */
.lang-switch a { min-height: 44px; min-width: 40px; }
@media (max-width: 420px) { .lang-switch a { min-width: 36px; } .lang-switch { padding: 0 2px; } }
.brand { min-height: 44px; display: inline-flex; align-items: center; }
/* 9 怎麼讀：手機也不小於 14px */
@media (max-width: 520px) { .r-how { font-size: 14px; line-height: 1.6; } .r-how-l { font-size: 12px; } }
/* 10 日文不拉太開字距 */
.lang-ja .all-box h2, .lang-ja .ep-num, .lang-ja .kicker, .lang-ja .rb-name > span { letter-spacing: .08em; }
.lang-en .all-box h2, .lang-en .rb-name > span { letter-spacing: .08em; }
/* 11 導覽列副標 */
.rb-name small { font-size: 14px; }
/* 15 手機停掉顆粒動畫（省電），保留靜態顆粒 */
@media (max-width: 700px) { .grain { animation: none; } }
/* 書桌那句話放大寫在按鈕上方（紙上的字手機太小） */
.desk-line { margin: 0 0 4px; font-family: var(--song); font-size: clamp(26px, 6.4vw, 40px); letter-spacing: .18em; color: var(--paper);
  text-shadow: 0 0 24px rgba(242,181,107,.35), 0 2px 12px rgba(0,0,0,.9); text-align: center; }
.lang-en .desk-line { letter-spacing: .04em; }
/* 點畫面板：按鈕固定在面板底部，長標題也按得到 */
@media (max-width: 860px) {
  .ep-actions { position: sticky; bottom: calc(-1 * max(18px, env(safe-area-inset-bottom))); margin-top: 16px; padding: 12px 0 max(10px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(16,12,9,0), rgba(16,12,9,.96) 30%); z-index: 2; }
  .ep-title { font-size: 21px; }
  .ep-line { font-size: 16px; margin-top: 10px; }
}

/* ---------- 11/16 複審修正 ---------- */
/* 1 手機：書桌紙上的小字藏起來（上面已有大字） */
@media (max-width: 700px) { .mode-3d .note { display: none !important; } }
/* 2 點畫面板：回到走廊也固定在底部、面板不超過 58vh */
.ep-actions .close { flex-basis: 100%; margin-top: 2px; text-align: center; }
@media (max-width: 860px) { .ep-panel { max-height: 58vh; } }
/* 6 語言鍵寬度也 ≥ 44 */
.lang-switch a, .lang-switch a:only-child { min-width: 44px; }
@media (max-width: 420px) { .lang-switch a { min-width: 40px; } }
/* 8 手機：房間說明出現 6 秒後淡掉，留乾淨畫面（房名一直在下方導覽列） */
@media (max-width: 700px) {
  .mode-3d .cap-side.is-on { animation: capRest 1.2s ease 6s forwards; }
  @keyframes capRest { to { opacity: .0; visibility: hidden; } }
}

/* 電腦版紙條讀得清楚，大字只給手機 */
@media (min-width: 701px) { .desk-line { display: none; } }
/* 第三輪：手機點畫面板不再用固定按鈕（會蓋字），改成內容精簡、一屏放得下 */
@media (max-width: 860px) {
  .ep-actions { position: static; background: none; padding: 0; margin-top: 14px; }
  .ep-panel { max-height: 64vh; }
  .ep-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ep-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ep-strip img { aspect-ratio: 16 / 8; }
}

/* 第三輪：書桌手機下半部不擠——連結縮成一行小字；語言鍵 44 寬 */
@media (max-width: 700px) {
  .desk-more { gap: 0 14px; }
  .desk-more a { font-size: 14px; letter-spacing: .04em; border-bottom: 0; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: rgba(242,181,107,.4); }
  .mode-3d .desk-actions { gap: 8px; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 84px); }
  .desk-line { font-size: 26px; }
  .lang-switch a { min-width: 42px; }
  .brand { max-width: 28vw; }
}
@media (max-width: 700px) {
  .brand { max-width: 36vw; }
  .lang-en .brand, .lang-ja .brand { font-size: 13px; letter-spacing: .02em; }
  .lang-switch a { min-width: 40px; }
}

/* 簡化版：書多的時候自動換到下一層，不能把手機畫面撐寬 */
.mode-2d .book-list { flex-wrap: wrap; row-gap: 26px; min-height: 0; padding-bottom: 6px; }
.mode-2d .spine2d { width: clamp(34px, 10.5vw, 72px); }
.mode-2d .shelf2d { overflow: hidden; }
html.mode-2d, html.mode-2d body { overflow-x: hidden; }

/* 書名改印在 3D 書背上，網頁疊字不用了 */
.spine-label { display: none !important; }
