/* 3D 展間・大廳原型（2026-10-15）：全螢幕 3D 場景＋展品檢視器。手機、平板、電腦共用一套版面。 */
/* 罕用字（2026-10-17）：人生格言「黃紅𣒙 點傳師」的 𣒙（U+23499，擴展 B）各家系統字型都沒有，只收這一字的字型檔
   （Plangothic 子集，授權見 vendor/fonts/LICENSE.txt）。unicode-range 只含這一字，其他字照常用原本的字型。 */
@font-face{font-family:"BGSH Rare";src:url("../vendor/fonts/rare-names.woff") format("woff");unicode-range:U+23499;font-weight:100 900;font-display:swap;}
:root {
  --navy: #0d2757;
  --navy-2: #1b4a8c;
  --gold: #d9a521;
  --cream: #f7f3ec;
  --ink: #1f2430;
  --ink-2: #5b6170;
  --line: rgba(13, 39, 87, .14);
  --bar-h: 52px;
  --font: "BGSH Rare", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --serif: "BGSH Rare", "Noto Serif TC", "Songti TC", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* 頂列 */
.h3-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex; align-items: center; gap: 12px;
  background: rgba(13, 39, 87, .92); color: #fff;
  backdrop-filter: blur(6px);
}
.h3-bar a { color: #fff; text-decoration: none; font-size: 14px; white-space: nowrap; }
.h3-back { font-weight: 700; }
.h3-title { flex: 1; margin: 0; text-align: center; font-family: var(--serif); font-size: 18px; letter-spacing: .1em; }
.h3-title small { font-family: var(--font); font-size: 12px; font-weight: 400; letter-spacing: .04em; opacity: .75; margin-left: 6px; }
.h3-home { opacity: .85; }
@media (max-width: 520px) {
  .h3-back span, .h3-home { display: none; }
  .h3-back { font-size: 20px; padding: 6px 10px 6px 0; }
  .h3-title small { display: block; margin: 0; }
  .h3-title { line-height: 1.15; }
}

/* 展區切換（頂列下方） */
.h3-rooms {
  position: fixed; z-index: 10; left: 0; right: 0; top: calc(var(--bar-h) + env(safe-area-inset-top));
  display: flex; gap: 6px; justify-content: center; overflow-x: auto; padding: 8px 16px;
  background: rgba(247, 243, 236, .9); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
.h3-rooms button {
  flex: none; font: inherit; font-size: 14px; cursor: pointer; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.h3-rooms button.is-on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.h3-rooms button:disabled { cursor: default; color: var(--ink-2); background: transparent; border-style: dashed; }
.h3-rooms button small { font-size: 11px; margin-left: 4px; }
@media (max-width: 520px) { .h3-rooms { justify-content: flex-start; } .h3-rooms button { font-size: 13px; padding: 0 11px; } }

/* 3D 場景 */
.h3-stage { position: fixed; inset: 0; }
#h3-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.h3-loading, .h3-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--cream); color: var(--ink-2); font-size: 15px; text-align: center; padding: 16px;
}
.h3-loading[hidden], .h3-fallback[hidden] { display: none; }
.h3-fallback p { margin: 6px 0; }
.h3-fallback a { color: var(--navy-2); font-weight: 700; }
.h3-fade { position: absolute; inset: 0; background: var(--cream); opacity: 0; pointer-events: none; transition: opacity .2s; }
.h3-fade.is-on { opacity: 1; }
.h3-toast {
  position: absolute; z-index: 6; left: 50%; top: 130px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: rgba(13, 39, 87, .94); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
}
.h3-toast[hidden] { display: none; }
.h3-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  background: rgba(13, 39, 87, .94); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4;
  white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.h3-tip small { display: block; opacity: .8; font-size: 11.5px; }

/* 底部導覽 */
.h3-hud {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px;
  background: linear-gradient(to top, rgba(247, 243, 236, .96) 60%, rgba(247, 243, 236, 0));
  pointer-events: none;
}
.h3-hud > * { pointer-events: auto; }
.h3-stops, .h3-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.h3-hud button {
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 999px; padding: 9px 16px; min-height: 40px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(13, 39, 87, .1);
}
.h3-hud button:hover { border-color: var(--navy-2); }
.h3-hud button.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.h3-hud a.h3-write { display: inline-flex; align-items: center; text-decoration: none; font-size: 14px; border-radius: 999px; padding: 9px 16px; min-height: 40px; background: #fff; color: var(--navy); border: 1px solid var(--gold); font-weight: 700; }
.h3-hud .h3-open { background: var(--gold); border-color: var(--gold); color: #2b1d00; font-weight: 700; }
.h3-hint { flex-basis: 100%; margin: 0; text-align: center; font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 520px) { .h3-hud button { font-size: 13px; padding: 8px 12px; } }

/* 展品檢視器：載入預先準備好的高解析圖；局部放大圖是另外的圖檔 */
.vw {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column;
  background: #14171d; color: #fff;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.vw[hidden] { display: none; }
.vw-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.vw-heading { flex: 1; min-width: 0; }
.vw-heading h2 { margin: 0; font-family: var(--serif); font-size: 17px; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-heading p { margin: 2px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-btn {
  font: inherit; font-size: 13.5px; cursor: pointer; min-height: 40px; min-width: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: #fff;
}
.vw-btn[aria-pressed="true"] { background: #fff; color: var(--ink); }
.vw-close { font-size: 18px; padding: 0; }

.vw-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.vw-body.is-actual { overflow: auto; -webkit-overflow-scrolling: touch; }
.vw-frame { position: absolute; inset: 12px 56px; display: flex; align-items: center; justify-content: center; }
.vw-body.is-actual .vw-frame { position: relative; inset: auto; display: block; width: max-content; margin: 0 auto; padding: 12px; }
.vw-frame img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.vw-body.is-actual .vw-frame img { max-width: none; max-height: none; }
.vw-body:not(.is-actual) .vw-frame img { cursor: zoom-in; }
.vw-body.is-actual .vw-frame img { cursor: zoom-out; }
@media (max-width: 720px) { .vw-frame { inset: 8px 8px; } }

.vw-spots { position: absolute; pointer-events: none; }
.vw-spot {
  position: absolute; pointer-events: auto; cursor: pointer; padding: 0; background: transparent;
  border: 2px solid rgba(217, 165, 33, .0); border-radius: 6px; transition: border-color .15s, background .15s;
}
.vw-spot:hover, .vw-spot:focus-visible { border-color: var(--gold); background: rgba(217, 165, 33, .14); outline: none; }
.vw-spots.is-hint .vw-spot { border-color: rgba(217, 165, 33, .75); }

.vw-wait {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .6); padding: 8px 14px; border-radius: 999px; font-size: 13px;
}
.vw-wait[hidden] { display: none; }
.vw-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 64px; border: 0; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #fff; font-size: 30px; line-height: 1;
}
.vw-nav:hover { background: rgba(255, 255, 255, .2); }
.vw-prev { left: 6px; }
.vw-next { right: 6px; }
.vw-body.is-actual .vw-nav { position: fixed; top: 50%; }
@media (max-width: 720px) { .vw-nav { width: 36px; height: 52px; font-size: 24px; background: rgba(0, 0, 0, .35); } }

.vw.is-video .vw-strip, .vw.is-video #vw-mode, .vw.is-video .vw-nav, .vw.is-video .vw-frame { display: none; }
.vw-video { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); background: #000; object-fit: contain; border: 0; }
@media (max-width: 720px) { .vw-video { inset: 0; width: 100%; height: 100%; } }
.vw-caption { margin: 0; padding: 8px 16px 4px; font-size: 13.5px; color: rgba(255, 255, 255, .85); text-align: center; min-height: 1.6em; }
.vw-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 12px; scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.vw-chip {
  flex: none; scroll-snap-align: center; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
  padding: 8px 12px; min-height: 38px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); color: #fff;
}
.vw-chip.is-group { border-style: dashed; }
.vw-chip[aria-selected="true"] { background: var(--gold); border-color: var(--gold); color: #2b1d00; font-weight: 700; }
.vw-sep { flex: none; align-self: center; font-size: 11.5px; color: rgba(255, 255, 255, .5); padding: 0 2px 0 6px; }

/* 天燈祝福卡（2026-10-15） */
.h3-card { position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 13, 36, .72); }
.h3-card[hidden] { display: none; }
.h3-card-box {
  position: relative; width: min(420px, 100%); max-height: 100%; overflow: auto; text-align: center;
  background: linear-gradient(#0b1633, #1d2f5c); color: #fff; border-radius: 16px; padding: 18px 18px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4);
}
.h3-card-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 18px; cursor: pointer; }
.h3-card-lantern canvas { display: block; width: min(260px, 70%); height: auto; margin: 0 auto; }
.h3-card-text { margin: 4px 0 2px; font-family: "BiauKai", "Kaiti TC", "STKaiti", var(--serif); font-size: 24px; font-weight: 700; line-height: 1.5; }
.h3-card-name { margin: 0 0 6px; font-size: 15px; color: rgba(255, 255, 255, .85); }
.h3-card-meta { margin: 0 0 12px; font-size: 12.5px; color: rgba(255, 255, 255, .65); }
.h3-card-nav { display: flex; gap: 10px; justify-content: center; }
.h3-card-nav button { font: inherit; font-size: 14px; min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.h3-card-nav button:hover { background: rgba(255,255,255,.16); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 中文斷行（2026-10-17，../cjk-wrap.js）：詞包在 .nw 裡不拆；標題兩行等長、說明避免短尾行 */
.nw { white-space: nowrap; }
#vw-title { text-wrap: balance; }
.vw-caption { text-wrap: pretty; }
@media (max-width: 310px) { .nw { white-space: normal; } }
