/* 政策島版面：左 3D 舞台（含浮動工具列與詳情卡）、右政策索引；手機上索引成底部抽屜 */
:root {
  --paper: #FFFBF1; --cream: #FBF3E6; --ink: #2B2420; --ink-2: #6B5F57; --line: #E9DFC9; --sun: #FFD23F; --orange: #F2762E; --leaf: #6FA83C; --sky: #D9EEF4; --panel: #FFFFFF;
  --display: "Huninn", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
h1, h2, h3, h4, h5 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); margin: 0 0 4px; }
.primary { background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 18px; font-weight: 600; }

#app { height: 100%; display: grid; grid-template-columns: 1fr 360px; }
.stage { position: relative; background: var(--sky); overflow: hidden; touch-action: none; }
#scene { position: absolute; inset: 0; }
#scene canvas { display: block; }
#scene .labels { position: absolute; inset: 0; z-index: 1; isolation: isolate; cursor: grab; touch-action: none; }
#scene .labels:active { cursor: grabbing; }

/* 3D 場景裡的 HTML 名牌 */
.tname { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 999px; background: rgba(255,255,255,.95); border: 1.5px solid #E4D9C3; font-family: var(--display); font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; pointer-events: auto; box-shadow: 0 2px 8px rgba(60,40,20,.14); transition: transform .15s, opacity .25s; }
.tname b { font-family: var(--mono); font-size: 11px; font-weight: 500; }
.tname:hover { transform: translateY(-2px); }
.tname.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.tname.sel b { color: var(--sun) !important; }
.num { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--c, var(--orange)); color: var(--c, var(--orange)); font-size: 13px; font-weight: 700; line-height: 1; display: grid; place-items: center; pointer-events: auto; box-shadow: 0 2px 6px rgba(60,40,20,.18); transition: transform .15s, opacity .25s; }
.num:hover { transform: scale(1.15); }
.num.sel { background: var(--c, var(--orange)); color: #fff; transform: scale(1.2); }
.num.dim { opacity: .28; }
.labels.far .num { opacity: 0; pointer-events: none; }
.labels.far .num.sel { opacity: 1; pointer-events: auto; }
.iname { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 5px; border-radius: 999px; background: rgba(43,36,32,.84); color: #fff; font-size: 11px; white-space: nowrap; pointer-events: auto; transition: opacity .25s, transform .15s; }
.iname span { font-size: 13px; }
.iname:hover { transform: translateY(-2px); }
.iname.sel { background: var(--orange); }
.iname.dim { opacity: .25; }
.labels.far .iname:not(.sel) { opacity: 0; pointer-events: none; }
.labels.nolabels .tname, .labels.nolabels .iname, .labels.nolabels .num:not(.sel), .labels.nolabels .mename, .labels.nolabels .cname, .labels.nolabels .board { opacity: 0; pointer-events: none; }
.log h4 small { font-weight: 400; color: var(--ink-2); margin-left: 8px; font-size: 11px; }
.logrow .face { font-size: 14px; }
.ta { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); }
.ta:hover { background: #fff; }
.ta.on { background: #FFF6DF; }
.ta .face { font-size: 24px; }
.ta b { font-family: var(--display); font-size: 15px; display: block; }
.ta small { font-size: 11.5px; color: var(--ink-2); }
.ta .ct { font-family: var(--mono); font-size: 11px; color: var(--ink-2); text-align: right; line-height: 1.5; }
.mename { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 5px; border-radius: 999px; background: #fff; border: 1.5px solid var(--ink); font-size: 12px; white-space: nowrap; pointer-events: none; }
.mename b { background: var(--orange); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; } /* 昇翰與吳琪銘團隊的名牌同一種橘 */
.bubble { font-family: var(--display); font-size: 13px; background: #fff; color: var(--ink); padding: 5px 11px; border-radius: 14px 14px 14px 3px; box-shadow: 0 3px 10px rgba(60,40,20,.18); white-space: nowrap; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; pointer-events: none; }
.bubble.on { opacity: 1; transform: none; }
.bubble.egg { pointer-events: none; max-width: 230px; white-space: normal; text-align: center; border-radius: 14px; }

/* 浮動元件 */
.logo { position: absolute; left: 16px; top: 14px; text-align: left; cursor: pointer; font: inherit; color: inherit; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 14px; background: rgba(255,251,241,.94); box-shadow: 0 6px 18px rgba(60,40,20,.14); text-decoration: none; color: var(--ink); z-index: 3; }
.logo b { font-family: var(--display); font-size: 26px; line-height: .95; color: var(--orange); letter-spacing: .02em; }
.logo span { display: flex; flex-direction: column; gap: 1px; border-left: 1.5px solid var(--line); padding-left: 10px; }
.logo em { font-style: normal; font-family: var(--display); font-size: 15px; font-weight: 700; }
.logo small { font-size: 10.5px; color: var(--ink-2); letter-spacing: .04em; }
.logo small i { font-style: normal; margin-left: 6px; color: var(--orange); font-weight: 700; }
/* 3 號印章：橘底白字的圓章，樣式刻意和島上的 01–09 編號（白底、等寬字）不同，避免被認成第 3 格 */
.no3 { --s: 34px; flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: var(--s); height: var(--s); border-radius: 50%; background: var(--orange); color: #fff; font-style: normal; line-height: 1; transform: rotate(-8deg); box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--orange), 0 4px 10px rgba(242,118,46,.35); }
i.no3 b, i.no3 small { color: #fff; line-height: 1; } /* 用 i.no3 提高優先度，蓋過 .logo b 的橘字與手機版字級，否則印章裡的 3 會變成橘字在橘底上 */
i.no3 b { font-family: var(--display); font-weight: 700; font-size: calc(var(--s) * .56); letter-spacing: -.02em; margin-top: calc(var(--s) * .04); }
i.no3 small { font-size: calc(var(--s) * .22); font-weight: 700; letter-spacing: .08em; margin-top: calc(var(--s) * -.03); }
.logo .no3 { --s: 34px; margin: 0 2px 0 4px; }
.ld-head { display: flex; align-items: center; gap: 18px; }
.ld-head .no3 { --s: 64px; }
.ld-sub em strong { color: var(--orange); font-weight: 700; }
.box .no3 { --s: 52px; margin: 0 0 12px; }
.char-card .no3 { --s: 40px; margin-left: auto; }
.topbar { position: absolute; left: 16px; right: 16px; top: 14px; z-index: 3; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.nav { display: flex; justify-content: flex-end; gap: 6px; }
.nav button { padding: 7px 12px; border-radius: 10px; background: rgba(255,255,255,.94); border: 1.5px solid var(--line); font-size: 13px; font-weight: 500; box-shadow: 0 3px 10px rgba(60,40,20,.1); }
.nav button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.nav button i { font-style: normal; margin-right: 4px; }
.nav .mob, .tools .mob { display: none; }
.bar { position: absolute; right: 0; top: 46px; max-width: calc(100% - 270px); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; } /* 電腦版：時間與顯示開關靠右，排在上方按鈕列正下方，不會壓到左上角的標誌 */
.times, .tools { display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,.94); border: 1.5px solid var(--line); box-shadow: 0 3px 10px rgba(60,40,20,.1); }
.times button { width: 40px; height: 34px; border-radius: 9px; font-size: 15px; display: grid; place-items: center; }
.times button span { display: none; }
.times button.on { background: var(--ink); }
.tools button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 9px; border-radius: 9px; font-size: 10.5px; color: var(--ink-2); min-width: 46px; }
.tools button i { font-style: normal; font-size: 14px; line-height: 1.1; }
.tools button.on { background: var(--ink); color: #fff; }
.zoom { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 4px; z-index: 3; }
.zoom button { width: 36px; height: 36px; border-radius: 10px; background: #fff; border: 1.5px solid var(--line); font-size: 18px; font-weight: 700; display: grid; place-items: center; }

/* 詳情卡 */
.detail { position: absolute; left: 16px; top: 112px; bottom: 16px; width: 340px; max-width: calc(100% - 32px); background: rgba(255,251,241,.97); border-radius: 18px; box-shadow: 0 16px 40px rgba(60,40,20,.2); z-index: 4; display: flex; flex-direction: column; animation: pop .25s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
#detail-back { position: absolute; left: 12px; top: 12px; z-index: 1; padding: 6px 12px; border-radius: 999px; background: var(--cream); border: 1.5px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
#detail-back:hover { color: var(--ink); border-color: var(--ink); }
#detail-body { padding-top: 48px !important; }
.list .flash { background: #FFE9B8 !important; transition: background .6s; }
#detail-close { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; background: var(--cream); font-size: 18px; z-index: 1; }
#detail-body { overflow: auto; padding: 18px 18px 22px; }
#detail-body h2 { font-size: 24px; line-height: 1.2; margin: 2px 32px 8px 0; }
#detail-body h4 { font-size: 12px; color: var(--ink-2); font-family: var(--body); font-weight: 500; margin: 16px 0 6px; letter-spacing: .04em; }
.crumb { color: inherit; text-decoration: underline; text-underline-offset: 3px; font: inherit; letter-spacing: inherit; }
.lead { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; line-height: 1.6; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #fff; border: 1.5px solid var(--line); color: var(--ink-2); }
.tag[style] { color: var(--c); border-color: color-mix(in srgb, var(--c) 40%, #fff); background: color-mix(in srgb, var(--c) 10%, #fff); }
.tag.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag.pp { color: var(--ink); }
.who { font-size: 13px; background: var(--cream); border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; }
.quote { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--orange); background: #fff; border-radius: 0 10px 10px 0; font-size: 15.5px; line-height: 1.75; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats .st { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stats .st b { font-family: var(--display); font-size: 18px; line-height: 1.15; color: var(--ink); }
.stats .st small { font-size: 11.5px; color: var(--ink-2); line-height: 1.4; }
.pts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.pts li { background: #fff; border-radius: 8px; padding: 7px 10px 7px 26px; position: relative; font-size: 13.5px; }
.pts li::before { content: ""; position: absolute; left: 11px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.stages { display: flex; gap: 3px; }
.stages span { flex: 1; text-align: center; font-size: 11px; padding: 6px 2px 4px; border-top: 4px solid var(--line); color: var(--ink-2); }
.stages span.past { border-color: #F6D9BE; }
.stages span.on { border-color: var(--orange); color: var(--ink); font-weight: 700; }
.howtxt { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; border: 1.5px solid #F6D9BE; border-radius: 10px; padding: 8px 10px; background: #FFF8F0; }
.howtxt b { display: block; color: var(--ink); margin-bottom: 2px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; margin: 14px 0 0; }
.meta dt { color: var(--ink-2); }
.meta dd { margin: 0; }
.subs { display: flex; flex-direction: column; gap: 6px; }
.sub-it { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); transition: border-color .15s, transform .15s; }
.sub-it:hover { border-color: var(--c, var(--orange)); transform: translateX(2px); }
.sub-it .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--orange)); color: #fff; font-size: 12px; font-weight: 700; }
.sub-it .t { font-weight: 600; font-size: 14px; }
.sub-it small { font-size: 11px; color: var(--ink-2); }
.sub-it i { font-style: normal; color: var(--ink-2); }
.lrows { display: flex; flex-direction: column; gap: 5px; }
.lrow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1.5px solid var(--line); font-size: 13px; }
.lrow:hover { border-color: var(--orange); }
.lrow b { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--orange); background: #FFF0E3; padding: 2px 6px; border-radius: 6px; }
.lrow span { display: flex; flex-direction: column; }
.lrow small { font-size: 11px; color: var(--ink-2); }
.lrow i { font-style: normal; color: var(--ink-2); }
.cargo { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px dashed var(--orange); border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; }
.cargo span { font-size: 12px; color: var(--ink-2); }
.cargo b { font-family: var(--display); font-size: 18px; }
.cargo small { font-size: 11.5px; color: var(--ink-2); margin-left: auto; }
.primary.wide { width: 100%; margin-top: 14px; }
.lrow b.face { font-family: var(--body); font-size: 18px; background: none; padding: 0; }
.src { font-size: 11.5px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 10px; margin: 16px 0 0; }

/* 日誌 */
.log { position: absolute; left: 16px; bottom: 16px; width: 320px; max-width: calc(100% - 80px); max-height: 38vh; background: rgba(255,251,241,.96); border-radius: 14px; box-shadow: 0 10px 30px rgba(60,40,20,.18); z-index: 3; display: flex; flex-direction: column; }
.log h4 { font-size: 13px; padding: 10px 14px 6px; }
#log-list { overflow: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 3px; }
.logrow { text-align: left; font-size: 12px; padding: 6px 8px; border-radius: 8px; background: #fff; display: flex; gap: 8px; align-items: baseline; }
.logrow time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); }
.logrow b { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--orange); }
#log-list:empty::before { content: "島民走到政見、資源船卸貨時會寫在這裡。"; font-size: 12px; color: var(--ink-2); padding: 0 8px 6px; }

/* 右側索引 */
.side { position: relative; background: var(--cream); border-left: 2px solid var(--line); overflow: hidden; overflow: clip; /* clip：避免 focus 或 scrollIntoView 把隱藏的主角頁橫向捲出來 */ display: flex; flex-direction: column; }
.side-index, .side-char { position: absolute; inset: 0; overflow: auto; padding: 22px 18px 24px; display: flex; flex-direction: column; }
.side-char { transform: translateX(100%); transition: transform .25s; background: var(--cream); }
.side.char .side-char { transform: none; }
.sheet-handle { display: none; }
.sheet-x { display: none; position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); font-size: 18px; place-items: center; z-index: 2; } /* 手機版清單面板右上角的關閉鈕 */
.side h2 { font-size: 26px; margin: 0 0 4px; }
.stat { font-size: 13px; margin: 0; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--ink-2); margin: 0 0 12px; }
.cta { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; padding: 12px 14px; border-radius: 14px; background: #FFF8EC; border: 1.5px solid #F1DDB8; margin-bottom: 10px; }
.cta b { font-size: 14.5px; }
.cta span { font-size: 12px; color: var(--ink-2); grid-column: 1; }
.cta i { grid-row: 1 / 3; align-self: center; font-style: normal; font-size: 20px; color: var(--ink-2); }
.cta:hover { border-color: var(--orange); }
.pnow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 12px; margin-bottom: 10px; }
.pnow .face { font-size: 18px; }
.pnow b { font-size: 13px; }
.pnow #persona-clear { margin-left: auto; text-decoration: underline; text-underline-offset: 3px; color: var(--sun); }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; padding: 9px; border-radius: 10px; background: #fff; border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 600; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.list { flex: 1; }
.grp { border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 6px; transition: background .15s; border-radius: 8px; }
.row:hover { background: #fff; }
.row .no { font-family: var(--mono); font-size: 16px; color: var(--c); letter-spacing: .04em; }
.row .nm { font-family: var(--display); font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.row .nm small { font-family: var(--body); font-size: 11px; color: var(--ink-2); font-weight: 400; }
.row .ct { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.grp.open .row { background: #FFF6DF; }
.grp .sub { display: none; padding: 0 6px 10px 12px; flex-direction: column; gap: 3px; }
.grp.open .sub { display: flex; }
.explore { color: var(--orange); font-weight: 700; font-size: 13px; text-align: left; padding: 6px 8px; border-radius: 8px; }
.explore:hover { background: #FFF0E3; }
.it { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; transition: opacity .2s, background .15s; }
.it:hover { background: #fff; }
.it .n { color: var(--c); font-weight: 700; }
.it.dim { opacity: .35; }
.lk { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; width: 100%; text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lk:hover { background: #fff; }
.lk b { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--orange); background: #FFF0E3; padding: 2px 6px; border-radius: 6px; margin-top: 2px; }
.lk span { display: flex; flex-direction: column; gap: 1px; }
.lk small { font-size: 11px; color: var(--ink-2); }
.empty { font-size: 13px; color: var(--ink-2); padding: 20px 6px; }

/* 角色 */
.char-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
#char-close { width: 32px; height: 32px; border-radius: 50%; background: #fff; font-size: 18px; }
#char-body label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
#char-body input { padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: 14px; color: var(--ink); }
#char-body h5 { font-size: 12.5px; color: var(--ink-2); font-family: var(--body); font-weight: 500; margin: 10px 0 5px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { padding: 6px 11px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: 12.5px; }
.pill.on { background: var(--orange); color: #fff; border-color: var(--orange); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); }
.sw.on { box-shadow: 0 0 0 2.5px var(--orange); transform: scale(1.1); }
.char-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); margin-bottom: 10px; }
.char-card .char-face { width: 44px; height: 44px; border-radius: 50%; background: #2F6B4F; color: #fff; display: grid; place-items: center; font-size: 24px; }
.char-card b { display: block; font-family: var(--display); font-size: 18px; }
.char-card small { color: var(--ink-2); font-size: 12.5px; }
.char-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.char-actions { display: flex; gap: 6px; margin-top: 16px; }
.char-actions button { padding: 9px 12px; border-radius: 10px; background: #fff; border: 1.5px solid var(--line); font-size: 13px; }
.char-actions .primary { margin-left: auto; background: var(--ink); color: #fff; border-color: var(--ink); }

/* 導覽與測驗 */
.modal { position: fixed; inset: 0; background: rgba(43,36,32,.42); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 20; }
.box { position: relative; background: var(--paper); border-radius: 18px; padding: 24px 24px 20px; max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .25s ease-out; }
.box h3 { font-size: 24px; margin: 0 0 8px; }
.box p { color: var(--ink-2); font-size: 14px; margin: 0 0 14px; line-height: 1.65; }
.box .x { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--cream); font-size: 18px; }
.tour-actions { display: flex; justify-content: space-between; gap: 8px; }
.tour-actions button { padding: 10px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; }
.tour-actions .primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.opts button { text-align: left; padding: 11px 14px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); font-size: 14px; transition: border-color .15s, transform .15s; }
.opts button:hover { border-color: var(--orange); transform: translateX(3px); }
.opts.small { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.opts.small button { display: flex; flex-direction: column; font-size: 13px; padding: 8px 10px; }
.opts.small small { font-size: 11px; color: var(--ink-2); }
.res { text-align: center; margin-bottom: 12px; }
.res .face { font-size: 44px; display: block; }
.res h3 { margin: 4px 0 6px; }

/* ===== 載入畫面：頁面一開就蓋住整個畫面，3D 場景建好、畫出第一張畫面後淡出 ===== */
#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--paper); background-image: radial-gradient(circle at 50% 120%, #D9EEF4 0, rgba(217,238,244,0) 55%); transition: opacity .55s ease, visibility .55s; }
#loading.out { opacity: 0; visibility: hidden; pointer-events: none; }
.ld-box { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 24px 6vh; animation: pop .5s ease both; }
.ld-logo { font-family: var(--display); font-size: 64px; line-height: .95; color: var(--orange); letter-spacing: .02em; font-weight: 700; }
.ld-sub { margin: 14px 0 0; display: flex; flex-direction: column; gap: 3px; }
.ld-sub em { font-style: normal; font-family: var(--display); font-size: 18px; color: var(--ink); }
.ld-sub small { font-size: 12.5px; color: var(--ink-2); letter-spacing: .04em; }
.ld-sub small i { font-style: normal; color: var(--orange); font-weight: 700; margin-left: 6px; }
.ld-hex { display: flex; gap: 8px; margin: 34px 0 22px; }
.ld-hex i { width: 22px; height: 24px; background: var(--leaf); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); animation: ld-rise 1.3s ease-in-out infinite; }
.ld-hex i:nth-child(2) { background: var(--sun); animation-delay: .12s; }
.ld-hex i:nth-child(3) { background: var(--orange); animation-delay: .24s; }
.ld-hex i:nth-child(4) { background: #3E7CB1; animation-delay: .36s; }
.ld-hex i:nth-child(5) { background: #D6558C; animation-delay: .48s; }
@keyframes ld-rise { 0%, 100% { transform: translateY(0); opacity: .55; } 40% { transform: translateY(-12px); opacity: 1; } }
.ld-bar { width: min(260px, 70vw); height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.ld-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--sun), var(--orange)); transition: width .4s ease; }
.ld-msg { margin: 12px 0 0; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 手機 */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .stage { height: 100%; }
  .logo { left: 10px; top: 10px; padding: 6px 10px 6px 8px; gap: 7px; }
  .logo b { font-size: 20px; }
  .logo .no3 { --s: 28px; margin: 0 0 0 2px; }
  .logo em .x { display: none; } /* 手機版標誌只留「吳昇翰」，讓位給右側窄欄 */
  .ld-head { gap: 14px; }
  .ld-head .no3 { --s: 52px; }
  .logo em { font-size: 13px; }
  .logo small { font-size: 9.5px; }
  /* 手機版：主要按鈕改成右側一條窄欄（圖示＋小字），與右下的縮放鈕同一欄；顯示開關與時間收成浮層，從欄位左側彈出 */
  .topbar { left: auto; right: 10px; top: 10px; width: 48px; display: flex; flex-direction: column; gap: 6px; }
  .nav { flex-direction: column; gap: 5px; justify-content: flex-start; }
  .nav button { width: 48px; padding: 5px 0 4px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10px; line-height: 1.2; white-space: nowrap; }
  .nav button i { margin: 0; font-size: 17px; line-height: 1.1; }
  .nav .mob { display: flex; }
  .nav #btn-home, .nav #btn-help { display: none; }
  .bar { position: absolute; right: 54px; top: 0; width: calc(100vw - 74px); max-width: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; } /* 浮層的容器要給明確寬度，否則會被 48px 的窄欄限制而擠成直排 */
  .bar > * { pointer-events: auto; }
  /* 浮層各自貼在自己的按鈕旁（時間＝第 4 顆、更多＝第 5 顆），不會壓到左上角的標誌 */
  .times { display: none; position: absolute; right: 0; top: 145px; }
  .topbar.show-times .times { display: flex; }
  .tools { display: none; position: absolute; right: 0; top: 191px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar.show-more .tools { display: flex; }
  .tools .mob { display: flex; }
  .tools button { min-width: 44px; padding: 3px 7px; }
  .detail { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 62vh; }
  .log { left: 10px; bottom: 10px; width: calc(100% - 70px); max-height: 30vh; }
  .zoom { right: 10px; bottom: 10px; }
  .zoom button { width: 48px; height: 40px; border-radius: 12px; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; height: 70vh; border-left: 0; border-top: 2px solid var(--line); border-radius: 18px 18px 0 0; transform: translateY(100%); transition: transform .25s; z-index: 6; box-shadow: 0 -10px 30px rgba(60,40,20,.2); }
  .side.up { transform: none; }
  .side-index, .side-char { padding: 10px 16px 24px; }
  .sheet-handle { display: block; width: 100%; padding: 4px 0 8px; }
  .sheet-x { display: grid; }
  .side.char .sheet-x { display: none; }
  .side-char { transform: none; visibility: hidden; transition: none; } /* 手機版主角頁不橫向滑入，直接整張顯示，面板升起時不會露出底下的清單 */
  .side.char .side-char { visibility: visible; } /* 主角頁蓋上來時，清單的 × 要藏起來，否則會和主角頁自己的 × 疊成兩個 */
  .sheet-handle i { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto; }
  .side h2 { font-size: 22px; }
}

/* 上游資源：箱子名牌、看板、吳琪銘與資源船的名牌 */
.cname { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 5px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-size: 11px; white-space: nowrap; pointer-events: auto; box-shadow: 0 2px 6px rgba(60,40,20,.15); transition: opacity .4s, transform .15s; cursor: pointer; }
.cname b { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--orange); }
.cname:hover { transform: translateY(-2px); }
.cname.hide, .labels.far .cname { opacity: 0; pointer-events: none; }
.mename.porter, .mename.barge { pointer-events: auto; cursor: pointer; }
.mename.porter b { background: var(--orange); }
.mename.barge b { background: #2A9D8F; }
.mename.porter:hover, .mename.barge:hover { transform: translateY(-2px); }
.board { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 12px; background: rgba(43,36,32,.92); color: #fff; font-size: 11.5px; white-space: nowrap; text-align: left; pointer-events: auto; cursor: pointer; box-shadow: 0 6px 16px rgba(60,40,20,.25); line-height: 1.5; }
.board b { font-family: var(--display); font-size: 13px; color: var(--sun); }
.board em { font-style: normal; font-family: var(--mono); color: var(--sun); font-weight: 700; }
.labels.far .board { transform: scale(.85); }
/* 爭取成果分頁與卡片 */
.rsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 8px; }
.rsum div { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.rsum b { display: block; font-family: var(--display); font-size: 17px; line-height: 1.2; }
.rsum span { font-size: 11px; color: var(--ink-2); }
.it.res { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; align-items: center; }
.it.res .amt { grid-row: 1 / 3; font-family: var(--mono); font-size: 11px; font-weight: 700; color: #fff; background: var(--ink); border-radius: 6px; padding: 2px 6px; min-width: 56px; text-align: center; }
.it.res .amt.na { background: #7A8A99; }
.it.res small { grid-column: 2; font-size: 11px; color: var(--ink-2); }
.where { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px dashed #2A9D8F; border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; font-size: 12.5px; color: var(--ink-2); }
.where b { font-family: var(--display); font-size: 15px; color: var(--ink); }
.where small { margin-left: auto; font-size: 11.5px; }
.klist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.klist li { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 5px 8px; background: #fff; border-radius: 8px; }
.klist li small { font-family: var(--mono); color: var(--ink-2); white-space: nowrap; }
.sub-it .amt { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--ink); }
.logrow.res .face { color: #2A9D8F; }
.logrow .amt { font-family: var(--mono); font-size: 11px; font-weight: 700; color: #2A9D8F; }

.logrow.me { background: #FFF6EC; }
