/* 島嶼交流大廳：畫面疊層（標誌、按鈕、名字牌、對話泡泡、載入畫面）
   品牌色：主色 #0c7078、深青 #0a4e55、沙金 #c8862a、橘點 #c2560c、紙白 #fbfcfb
   尺寸照共用規則：按鈕 36px（小按鈕 30px）、相鄰 8px、頁邊 24／20／16px */
:root { --main: #0c7078; --deep: #0a4e55; --sand: #c8862a; --dot: #c2560c; --paper: #fbfcfb; --ink: #23343a; --edge: 24px; --font: "MatsuRare","PingFang TC", "Noto Sans TC", "Heiti TC", "Microsoft JhengHei", sans-serif; }
@media (max-width: 1100px) { :root { --edge: 20px; } }
@media (max-width: 700px) { :root { --edge: 16px; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe3ee; font-family: var(--font); color: var(--ink); }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none; }
#hud > * { pointer-events: auto; }
#hud .labels { pointer-events: none; }
button { font-family: inherit; }

/* 左上標誌 */
.brand { position: absolute; left: var(--edge); top: max(20px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; padding: 10px 20px 10px 12px; background: rgba(255, 255, 255, 0.94); border-radius: 22px; box-shadow: 0 6px 22px rgba(10, 78, 85, 0.16), 0 1px 0 rgba(255, 255, 255, 0.9) inset; text-decoration: none; }
button.brand { border: 0; cursor: pointer; font-family: inherit; text-align: left; color: inherit; }
button.brand:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
.brand .mark { width: 54px; height: 54px; flex: none; }
.brand .txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 26px; font-weight: 900; color: var(--deep); letter-spacing: 0.08em; }
.brand i { font-style: normal; font-size: 14px; font-weight: 600; color: var(--main); letter-spacing: 0.34em; margin-top: 3px; }

/* 按鈕 */
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.95); color: var(--ink); font-size: 15px; font-weight: 700; box-shadow: 0 4px 16px rgba(10, 78, 85, 0.16); cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.pill svg { width: 24px; height: 24px; flex: none; }
.pill:hover { box-shadow: 0 6px 20px rgba(10, 78, 85, 0.22); }
.pill:active { transform: scale(0.96); }
.pill:focus-visible, .round:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
.top-right { position: absolute; right: var(--edge); top: max(20px, env(safe-area-inset-top)); display: flex; gap: 8px; }
.bottom { position: absolute; left: 50%; bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); transform: translateX(-50%); display: flex; gap: 12px; }
.pill.big { height: 48px; padding: 0 22px 0 14px; font-size: 16px; }
.pill.big svg { width: 28px; height: 28px; }
.cam { position: absolute; right: var(--edge); bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); display: grid; grid-template-columns: 36px 36px; gap: 8px; }
.round { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); box-shadow: 0 3px 12px rgba(10, 78, 85, 0.16); display: grid; place-items: center; cursor: pointer; padding: 0; }
.round svg { width: 20px; height: 20px; }
.round:active { transform: scale(0.94); }

/* 抵達區域提示 */
.toast { position: absolute; left: 50%; top: max(96px, calc(env(safe-area-inset-top) + 84px)); transform: translate(-50%, -8px); padding: 8px 18px; border-radius: 999px; background: rgba(10, 78, 85, 0.9); color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.06em; opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none !important; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast small { font-weight: 500; opacity: 0.85; margin-left: 8px; font-size: 13px; }

/* 名字牌與對話泡泡 */
.labels { position: absolute; inset: 0; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; will-change: transform; }
.lbl > * { position: absolute; left: 0; transform: translateX(-50%); white-space: nowrap; }
.lbl .nm { bottom: 2px; display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.86); color: var(--deep); font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.lbl .nm b { font-size: 10px; color: #fff; background: var(--sand); border-radius: 999px; padding: 0 5px; font-weight: 800; }
.lbl.self .nm { background: var(--main); color: #fff; }
.lbl.far .nm { display: none !important; }
.lbl .bubble { bottom: 30px; padding: 6px 12px; border-radius: 14px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14); opacity: 0; transform: translate(-50%, 6px) scale(0.9); transition: opacity 0.18s ease, transform 0.18s ease; }
.lbl .bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.lbl .bubble.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.lbl .bubble.heart { color: #e2483a; font-size: 18px; padding: 3px 10px; }
.lbl.far .bubble { display: none; }
.lbl.far .bubble.on { bottom: 4px; }
.lbl.self.far .bubble { display: block; font-size: 12px; padding: 4px 9px; }

/* 載入畫面 */
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #ffffff, #e7f3f2 70%); z-index: 20; transition: opacity 0.6s ease; }
#loading.out { opacity: 0; pointer-events: none; }
#loading .box { width: min(340px, calc(100% - 48px)); text-align: center; }
#loading .mark { width: 88px; height: 88px; }
#loading .title { margin: 10px 0 22px; font-size: 20px; font-weight: 900; color: var(--deep); letter-spacing: 0.08em; }
#loading .bar { height: 10px; border-radius: 999px; background: #d8ebea; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--main), #3aa6a8); transition: width 0.25s ease; }
#loading .meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--main); }
#loading.err .step { color: var(--dot); }
#loading .scene-note-ld { margin: 22px 0 0; font-size: 12px; line-height: 1.6; color: #5d7378; }

/* 手機 */
@media (max-width: 700px) {
  .brand { padding: 7px 14px 7px 8px; gap: 8px; border-radius: 18px; }
  .brand .mark { width: 40px; height: 40px; }
  .brand b { font-size: 19px; }
  .brand i { font-size: 11px; letter-spacing: 0.26em; }
  .top-right { flex-direction: column; align-items: flex-end; }
  .pill { height: 44px; padding: 0 12px 0 8px; font-size: 14px; gap: 6px; }
  .pill svg { width: 22px; height: 22px; }
  .bottom { gap: 8px; left: var(--edge); right: var(--edge); transform: none; justify-content: center; }
  .cam { bottom: max(88px, calc(env(safe-area-inset-bottom) + 76px)); }
  .getoff { bottom: max(236px, calc(env(safe-area-inset-bottom) + 224px)); }
  .caption { bottom: max(180px, calc(env(safe-area-inset-bottom) + 168px)); font-size: 15px; }
  .isles { top: max(232px, calc(env(safe-area-inset-top) + 220px)); }
  .pill.big { height: 44px; padding: 0 12px 0 8px; font-size: 14px; }
  .pill.big svg { width: 24px; height: 24px; }
  .cam { grid-template-columns: 36px 36px; }
  .toast { top: max(130px, calc(env(safe-area-inset-top) + 118px)); font-size: 14px; }
}
@media (max-width: 380px) { .pill.big { padding: 0 10px 0 6px; } .pill.big span { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .pill, .toast, .lbl .bubble, #loading { transition: none; } }

/* 碼頭、機場的對話框 */
.dlg { position: absolute; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 84px)); transform: translate(-50%, 12px); width: min(420px, calc(100% - 32px)); padding: 16px; border-radius: 18px; background: rgba(255, 255, 255, 0.97); box-shadow: 0 10px 32px rgba(10, 78, 85, 0.24); opacity: 0; pointer-events: none !important; transition: opacity 0.2s ease, transform 0.2s ease; }
.dlg.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto !important; }
.dlg-h { font-size: 18px; font-weight: 900; color: var(--deep); padding-right: 36px; }
.dlg-sub { font-size: 12px; color: #5d7378; margin-top: 2px; }
.dlg-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.dlg-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 4px 4px 12px; border-radius: 12px; background: #f1f6f5; }
.dlg-row .nm { flex: 1; font-size: 14px; font-weight: 700; }
.tag { height: 22px; line-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #e3efe9; color: #2f6f4f; }
.tag.cancelled, .tag.none { background: #fde7dc; color: var(--dot); }
.tag.unknown { background: #eef0f1; color: #5d6a70; }
.tag.charter { background: #f6ecd9; color: #8a5a1a; }
.go { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--main); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.go:disabled { background: #c9d3d4; color: #fff; cursor: not-allowed; }
.dlg-x { position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #eef3f2; color: var(--deep); font-size: 18px; line-height: 30px; cursor: pointer; padding: 0; }
.fade { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(251, 252, 251, 0.94); color: var(--deep); font-size: 20px; font-weight: 900; letter-spacing: 0.06em; opacity: 0; pointer-events: none !important; transition: opacity 0.5s ease; z-index: 5; }
.fade.on { opacity: 1; }
/* 列島地圖 */
.isles { position: absolute; inset: max(84px, calc(env(safe-area-inset-top) + 72px)) var(--edge) max(96px, calc(env(safe-area-inset-bottom) + 84px)); padding: 16px; border-radius: 20px; background: rgba(233, 246, 247, 0.97); box-shadow: 0 10px 32px rgba(10, 78, 85, 0.24); display: none; flex-direction: column; z-index: 4; }
.isles.on { display: flex; }
.isles-h { font-size: 18px; font-weight: 900; color: var(--deep); padding-right: 36px; }
.isles-h small { display: block; font-size: 12px; font-weight: 500; color: #5d7378; margin-top: 2px; }
.isles:not(.iso) > svg { flex: 1; width: 100%; min-height: 0; margin-top: 8px; }
.isles:not(.iso) .isle ellipse { fill: #b9dca0; stroke: #f3e2b4; stroke-width: 2.5; }
.isles:not(.iso) .isle.seen ellipse { fill: #9fcd7f; }
.isles:not(.iso) .isle.here ellipse { fill: #f2c94c; }
.isles:not(.iso) .isle { cursor: pointer; }
.isles:not(.iso) .isle:hover ellipse { fill: #ffd86b; }
.isles:not(.iso) .isle text { font-size: 15px; font-weight: 900; fill: var(--deep); text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 4px; pointer-events: none; }
.isles .rt { stroke: var(--main); stroke-width: 1.6; stroke-dasharray: 5 4; }
.isles .rt.cancelled, .isles .rt.none { stroke: var(--dot); }
/* 龜島遊覽：說明字幕、下來按鈕 */
.caption { position: absolute; left: 50%; bottom: max(92px, calc(env(safe-area-inset-bottom) + 80px)); transform: translate(-50%, 8px); max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 14px; background: rgba(10, 78, 85, 0.88); color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.04em; opacity: 0; transition: opacity 0.4s ease, transform 0.4s ease; pointer-events: none !important; text-align: center; }
.caption.on { opacity: 1; transform: translate(-50%, 0); }
.getoff { position: absolute; right: var(--edge); bottom: max(124px, calc(env(safe-area-inset-bottom) + 112px)); display: none; padding: 0 18px; background: var(--dot); color: #fff; }
.getoff.on { display: inline-flex; }
/* 到不了的說明卡、龜島計程車 */
.dlg-why { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.go.big { display: block; width: 100%; height: 44px; margin-top: 12px; font-size: 15px; }
.go.big.turtle { background: #3c8a5a; }
.go.big.line { background: #fff; color: var(--main); box-shadow: inset 0 0 0 1.5px var(--main); margin-top: 8px; }
.dlg-row.wrap { flex-wrap: wrap; padding-bottom: 8px; }
.dlg-row .go.turtle { flex-basis: 100%; margin-right: 4px; background: #3c8a5a; height: 34px; }
.dlg-list.sched { max-height: 40vh; overflow-y: auto; }
.isles:not(.iso) .isle.off ellipse { fill: #d9e6dc; opacity: 0.75; }
.isles:not(.iso) .isle.off text { fill: #7d8e8f; }
.isles:not(.iso) .isle.can ellipse { fill: #9fcd7f; }
.isles:not(.iso) .isle text.st { font-size: 11px; font-weight: 700; fill: var(--main); }
.isles .pin { cursor: pointer; }
.isles .pin circle + circle { fill: #c2560c; stroke: #fff; stroke-width: 1.4; }
.isles .pin text { font-size: 9px; font-weight: 900; fill: #8a3a0a; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.isles:not(.iso) .isle.off text.st { fill: var(--dot); }
