/* 收藏室 · 3D 展厅
   整个页面就是一块画布，字压到最少：左上字标，右上声音和回首页，底部对焦环；著录从右边（手机上从下面）展开 */
:root {
  --ink: #ece5d6; --sub: rgba(236, 229, 214, .56); --line: rgba(236, 229, 214, .14); --gold: #c9a86a;
  --pad: clamp(18px, 4vw, 44px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #050404; color: var(--ink); overscroll-behavior: none; }
body { font: 300 14px/1.8 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus { outline: none; }
button:focus-visible, a:focus-visible { outline: 1px solid rgba(236, 229, 214, .4); outline-offset: 4px; }
.todo { display: inline; padding: 1px 8px; border: 1px dashed currentColor; border-radius: 3px; opacity: .5; font-size: .9em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.todo::after { content: '　' attr(data-todo); font-size: .8em; }

/* 画布铺满；对焦用的模糊加在画布上 */
.stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage.is-grabbing { cursor: grabbing; }
.curtain { position: fixed; inset: 0; background: #050404; pointer-events: none; z-index: 5; }

/* ---------- 顶上 ---------- */
.hud { position: fixed; z-index: 27; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 16px) var(--pad) 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud__left { display: flex; align-items: center; gap: 16px; }
.hud__wm { width: 60px; color: var(--ink); opacity: .9; }
/* 左上角「← 返回」：回到首页刚才停的位置（直接打开的就去首页的收藏室那一块） */
.hud__back { display: inline-flex; align-items: center; gap: 9px; padding: 8px 16px 8px 0; margin: -8px 0; border-right: 1px solid rgba(236, 229, 214, .2); font-size: 12.5px; letter-spacing: .2em; color: var(--sub); transition: color .3s; }
.hud__back:hover { color: var(--ink); }
.hud__back svg { width: 18px; height: 10px; transition: transform .3s; }
.hud__back:hover svg { transform: translateX(-3px); }
@media (max-width: 520px) { .hud__back span { display: none; } .hud__back { padding-right: 14px; } .hud__left { gap: 14px; } }
.hud__wm svg { width: 100%; height: auto; display: block; }
.hud__right { display: flex; align-items: center; gap: 22px; font-size: 12.5px; letter-spacing: .2em; color: var(--sub); }
.hud__right a:hover, .hud__right button:hover { color: var(--ink); }
.hud__sound i { font-style: normal; margin-left: .5em; color: var(--ink); opacity: .7; }

/* ---------- 序章 ---------- */
.preface { position: fixed; z-index: 10; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 13svh); text-align: center; pointer-events: none; opacity: 0; }
.preface__en { font: italic 500 16px/1 'Cormorant Garamond', serif; letter-spacing: .14em; color: var(--gold); }
.preface__title { margin-top: 16px; font: 600 clamp(30px, 8vw, 46px)/1.1 'Noto Serif SC', serif; letter-spacing: .36em; padding-left: .36em; }
.preface__line { margin-top: 18px; font: 400 13.5px/1.9 'Noto Serif SC', serif; color: var(--sub); padding: 0 var(--pad); }
/* 竖屏上画框很大，序章只放第一句，不压到画框 */
@media (max-aspect-ratio: 1/1) { .preface__more { display: none; } }

/* ---------- 展台上的字 ---------- */
.sample-tag { position: fixed; z-index: 10; top: calc(env(safe-area-inset-top) + 64px); right: var(--pad); font-size: 11px; letter-spacing: .24em; color: var(--sub); border: 1px dashed rgba(236, 229, 214, .28); padding: 2px 9px; }
/* 铭牌下面那一行：跟着铭牌在屏幕上的位置走（room.js 写 left/top） */
.plaque-hit { position: fixed; z-index: 10; transform: translate(-50%, 0); font-size: 12px; letter-spacing: .32em; padding: 8px 4px 6px .32em; color: rgba(236, 229, 214, .92); border-bottom: 1px solid rgba(236, 229, 214, .42); transition: color .3s, border-color .3s; white-space: nowrap; }
.plaque-hit:hover { color: #fff; border-color: var(--ink); }
/* 打开以后视线在面板上，这个开关退到暗处；面板右上角也有「合上」 */
.plaque-hit.is-record-toggle { z-index: 26; color: var(--sub); border-color: rgba(236, 229, 214, .14); }
.plaque-hit.is-record-toggle:hover { color: var(--ink); border-color: rgba(236, 229, 214, .4); }
.slot { position: fixed; z-index: 10; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 150px); text-align: center; padding: 0 var(--pad); }
.slot__line { font: 400 14px/1.9 'Noto Serif SC', serif; color: var(--sub); }
.slot__go { display: inline-flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 28px; border: 1px solid rgba(236, 229, 214, .35); font-size: 12.5px; letter-spacing: .3em; transition: background .4s, color .4s; }
.slot__go i { font-style: normal; }
.slot__go:hover { background: var(--ink); color: #050404; }

.hint { position: fixed; z-index: 10; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 136px); text-align: center; font-size: 12px; letter-spacing: .3em; color: var(--sub); pointer-events: none; opacity: 0; }
.hint--touch { display: none; }
@media (max-aspect-ratio: 1/1) { .hint { bottom: auto; top: calc(env(safe-area-inset-top) + 92px); } }
/* 竖屏：空位的那句话和按钮浮在台面上方、本该放展品的那块光里，不压铭牌 */
@media (max-aspect-ratio: 1/1) { .slot { bottom: auto; top: 40%; translate: 0 -50%; } }
@media (pointer: coarse) { .hint--fine { display: none; } .hint--touch { display: inline; } }

.loading { position: fixed; z-index: 10; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 128px); width: 72px; height: 1px; margin-left: -36px; background: rgba(236, 229, 214, .12); overflow: hidden; opacity: 0; transition: opacity .4s; pointer-events: none; }
.loading.is-on { opacity: 1; }
.loading i { position: absolute; inset: 0; width: 40%; background: var(--gold); animation: load 1.2s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- 对焦环 ---------- */
.dial { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: calc(env(safe-area-inset-bottom) + 112px); padding-bottom: env(safe-area-inset-bottom); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; touch-action: none; user-select: none; -webkit-user-select: none; }
.dial::before { content: ''; position: absolute; inset: -40px 0 0; background: linear-gradient(transparent, rgba(5, 4, 4, .85) 60%); pointer-events: none; }
.dial__num { position: relative; display: flex; align-items: baseline; gap: 6px; font: 400 26px/1 'Bodoni Moda', serif; color: var(--ink); letter-spacing: .04em; padding: 6px 10px; }
.dial__num small { font: italic 400 13px/1 'Bodoni Moda', serif; color: var(--gold); }
.odo { display: inline-flex; height: 1em; overflow: hidden; font-variant-numeric: lining-nums tabular-nums; }
.odo b { display: block; font-weight: 400; width: .62em; text-align: center; }
.odo b span { display: block; height: 1em; line-height: 1; }
.dial__peek { position: absolute; left: 0; right: 0; top: -10px; text-align: center; font-size: 12px; letter-spacing: .34em; padding-left: .34em; color: var(--gold); opacity: 0; transform: translateY(4px); transition: opacity .35s, transform .35s; pointer-events: none; white-space: nowrap; }
.dial__peek.is-on { opacity: 1; transform: none; }
.dial__ring { position: relative; width: min(100%, 720px); height: 56px; display: block; cursor: ew-resize; }
.dial__index { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 50px); width: 0; height: 0; margin-left: -4px; border: 4px solid transparent; border-top-color: var(--gold); pointer-events: none; }

.jump { position: fixed; z-index: 30; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 120px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: rgba(20, 18, 16, .92); border: 1px solid var(--line); backdrop-filter: blur(10px); font-size: 12.5px; letter-spacing: .2em; color: var(--sub); }
.jump[hidden] { display: none; }
.jump input { width: 4.2em; margin-left: 10px; padding: 4px 6px; background: transparent; border: 0; border-bottom: 1px solid rgba(236, 229, 214, .35); color: var(--ink); font: 400 20px/1 'Bodoni Moda', serif; text-align: center; letter-spacing: .1em; outline: none; }
.jump button { padding: 6px 12px; border: 1px solid rgba(236, 229, 214, .35); letter-spacing: .3em; color: var(--ink); }

/* ---------- 著录 ---------- */
.record { position: fixed; z-index: 25; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); padding: calc(env(safe-area-inset-top) + 86px) 36px 40px; overflow-y: auto; background: linear-gradient(90deg, rgba(8, 7, 6, 0), rgba(8, 7, 6, .92) 18%); }
.record[hidden] { display: none; }
.is-reading .sample-tag, .is-reading .hint { visibility: hidden; }
.record { scrollbar-width: thin; scrollbar-color: rgba(236, 229, 214, .28) transparent; overscroll-behavior: contain; }
.record__close { position: absolute; top: calc(env(safe-area-inset-top) + 92px); right: 36px; font-size: 12.5px; letter-spacing: .3em; color: var(--sub); }
.record__close:hover { color: var(--ink); }
.record__no { font: 400 30px/1 'Bodoni Moda', serif; color: var(--gold); letter-spacing: .04em; }
.record__title { margin-top: 12px; font: 500 22px/1.4 'Noto Serif SC', serif; letter-spacing: .14em; }
.record__list { margin-top: 24px; border-top: 1px solid var(--line); }
.record__list div { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.record__list dt { letter-spacing: .3em; color: var(--sub); }
.record__note { margin-top: 24px; }
.record__note h3 { font: italic 500 15px/1 'Cormorant Garamond', serif; letter-spacing: .1em; color: var(--gold); }
.record__note h3 span { font: 400 12px/1 'Noto Sans SC', sans-serif; letter-spacing: .3em; color: var(--sub); margin-left: 10px; }
.record__note p { margin-top: 12px; font: 400 14px/2 'Noto Serif SC', serif; color: rgba(236, 229, 214, .85); }
.record__go { margin-top: 28px; }
.record__go a { display: inline-flex; align-items: center; gap: 12px; padding: 12px 26px; background: var(--ink); color: #050404; font-size: 12.5px; letter-spacing: .3em; }
.record__go a i { font-style: normal; }
.record__go p { font-size: 12.5px; letter-spacing: .08em; color: var(--sub); }
.record__credit { margin-top: 26px; font-size: 10.5px; line-height: 1.7; letter-spacing: .04em; color: rgba(236, 229, 214, .32); }
.record__credit:empty { display: none; }
.record__credit a { color: inherit; text-decoration: underline; text-decoration-color: rgba(236, 229, 214, .18); text-underline-offset: 2px; }

@media (max-width: 760px) {
  /* 手机：从底下升起的面板，盖住对焦环（读著录时用不到）；展品被抬到面板上面；字段排两列，少占一点高度 */
  .record { top: auto; left: 0; bottom: 0; width: auto; max-height: 56svh; padding: 30px var(--pad) calc(env(safe-area-inset-bottom) + 26px); background: linear-gradient(rgba(8, 7, 6, 0), #080706 36px); }
  .record__close { top: 32px; right: var(--pad); }
  .record__no { font-size: 26px; }
  .record__title { margin-top: 8px; font-size: 19px; }
  .record__list { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .record__list div { grid-template-columns: 38px 1fr; gap: 8px; padding: 9px 0; font-size: 12.5px; }
  .record__note { margin-top: 18px; }
  .record__go { margin-top: 22px; }
  .is-reading .plaque-hit { visibility: hidden; }
}

/* 电脑横屏：序章放在左边，空位的按钮放在右边，都不压着展台 */
@media (min-aspect-ratio: 1/1) and (min-width: 761px) {
  .preface { left: 7vw; right: auto; top: 50%; translate: 0 -50%; text-align: left; max-width: 30vw; }
  .preface__title { padding-left: 0; }
  .preface__line { padding: 0; }
  .hint { left: var(--pad); right: auto; bottom: calc(env(safe-area-inset-bottom) + 40px); text-align: left; }
  .slot { left: auto; right: 9vw; bottom: auto; top: 50%; translate: 0 -50%; text-align: left; max-width: 26vw; padding: 0; }
}

/* Recovery stays entirely outside the working 3D layout. */
.recovery[hidden], .recovery [hidden], .recovery-emergency[hidden] { display: none; }
.is-recovering > :is(.stage, .curtain, .preface, .sample-tag, .plaque-hit, .slot, .hint, .loading, .dial, .jump, .record),
.is-recovering .hud__sound { visibility: hidden !important; pointer-events: none; }
.recovery { position: fixed; z-index: 20; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: calc(env(safe-area-inset-top) + 94px) var(--pad) calc(env(safe-area-inset-bottom) + 32px); background: #050404; }
.recovery__notice, .recovery__nav, .recovery__body { max-width: 1040px; margin: 0 auto; }
.recovery__notice { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.recovery__status { font: 500 clamp(19px, 3vw, 25px)/1.6 'Noto Serif SC', serif; letter-spacing: .1em; outline: none; }
.recovery__detail { margin-top: 8px; color: var(--sub); font-size: 13px; }
.recovery__retry { margin-top: 16px; padding: 10px 20px; min-height: 44px; border: 1px solid rgba(236,229,214,.4); letter-spacing: .15em; }
.recovery button:disabled { opacity: .4; cursor: default; }
.is-recovering .hud { background: #050404; padding-bottom: 14px; }
.recovery__nav { position: sticky; z-index: 1; top: calc(env(safe-area-inset-top) + 68px); display: flex; align-items: center; gap: 14px; padding: 14px 0; background: #050404; border-bottom: 1px solid var(--line); }
.recovery__nav button { flex: 0 0 44px; height: 44px; border: 1px solid var(--line); font-size: 19px; }
.recovery__nav label { flex: 1; min-width: 0; }
.recovery__label { display: block; color: var(--sub); font-size: 11px; letter-spacing: .2em; }
.recovery__select { width: 100%; min-height: 36px; padding: 4px 0; color: var(--ink); background: #050404; border: 0; font: inherit; }
.recovery__body { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); align-items: start; gap: 42px; padding-top: 24px; }
.recovery__image { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.recovery__image-note { display: grid; place-items: center; aspect-ratio: 1; padding: 30px; border: 1px solid var(--line); text-align: center; color: var(--sub); }
.recovery__figure figcaption { display: flex; justify-content: center; gap: 16px; color: var(--sub); font-size: 12px; letter-spacing: .15em; }
.recovery__sample { padding: 0 6px; border: 1px dashed var(--line); }
.recovery__record { padding: 18px 0 30px; }
.recovery__slot { padding: 30px 0; color: var(--sub); }
.recovery-emergency { position: fixed; z-index: 26; inset: 70px 0 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 24px; padding: 28px; background: #050404; text-align: center; }
.recovery-emergency button, .recovery-emergency a { padding: 10px 24px; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .recovery { padding-top: calc(env(safe-area-inset-top) + 82px); }
  .recovery__body { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .recovery__figure { width: min(100%, 460px); margin: 0 auto; }
  .recovery__image { max-height: 48svh; }
  .recovery__record { padding-top: 0; }
}
