@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-Regular.subset.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-Bold.subset.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f7f5f0;
  --gold: #b8960c;
  --gold-soft: #f3ecd2;
  --ink: #2d2a24;
  --sub: #6b6558;
  --line: #e6e0d2;
  --card: #fff;
  --shadow: 0 4px 18px rgba(70, 58, 30, .1);
  --drawer-peek: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

button, a { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- 3D 舞台 ---------- */

#stage {
  position: fixed;
  inset: 0 0 calc(var(--drawer-peek) + var(--safe-bottom)) 0;
  overflow: hidden;
}
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 4px rgba(70, 58, 30, .14);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  pointer-events: auto;
  will-change: transform;
}
/* 手機上把透明觸控範圍撐到約 44px */
.label::after { content: ""; position: absolute; inset: -10px -2px; }
.label-tile { z-index: 3; font-weight: 700; }
.label-home {
  z-index: 4;
  border-color: var(--gold);
  background: var(--gold);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.label-port { z-index: 1; color: var(--sub); }
.label-sat { z-index: 2; border-color: var(--gold); color: var(--ink); }
.label.is-active { border-color: var(--gold); background: var(--gold-soft); }
.label-home.is-active { background: var(--gold); }

/* ---------- 文字清單（手機底部抽屜） ---------- */

#list {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 64dvh;
  padding-bottom: var(--safe-bottom);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 18px rgba(70, 58, 30, .08);
  transform: translateY(calc(100% - var(--drawer-peek) - var(--safe-bottom)));
  transition: transform .22s ease;
}
#list.is-open { transform: none; }

#list-toggle {
  position: sticky;
  top: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: var(--drawer-peek);
  background: var(--card);
  font-weight: 700;
}
#list-toggle::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto 3px;
  border-radius: 2px;
  background: var(--line);
}

.list-title { display: none; margin: 0; font-size: 20px; line-height: 1.4; }
#text-mode-note { margin: 0 16px 8px; color: var(--sub); font-size: 14px; }
#list-body { padding: 0 16px 16px; }
.list-group h2 {
  margin: 12px 0 4px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}
.list-group ul { margin: 0; padding: 0; list-style: none; }
.list-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: left;
  text-decoration: none;
  line-height: 26px;
}
.list-item:hover { background: var(--bg); }
.list-item.is-active { background: var(--gold-soft); font-weight: 700; }
a.list-item::after { content: " ↗"; color: var(--gold); }

/* ---------- 卡片 ---------- */

#card {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 56dvh;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 24px rgba(70, 58, 30, .14);
}
#card.is-wide { height: 72dvh; max-height: none; }
#card-close {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  color: var(--sub);
  font-size: 24px;
  line-height: 1;
}
#card-body {
  flex: 1;
  min-height: 0;
  padding: 18px 18px calc(22px + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.card-title { margin: 0 40px 8px 0; font-size: 21px; line-height: 1.4; }
.simple-line { margin: 0 0 16px; }
.button {
  display: inline-block;
  min-height: 44px;
  padding: 9px 22px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  text-decoration: none;
}
.button:hover { background: #a98a0a; }

.port { margin: 0; }
.port dt { margin-top: 10px; color: var(--gold); font-size: 13px; font-weight: 700; }
.port dd { margin: 0; }
.note { margin: 12px 0 0; color: var(--sub); font-size: 14px; }

.tabs {
  position: sticky;
  top: -18px;
  z-index: 1;
  display: flex;
  margin: 4px -18px 14px;
  padding: 0 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1;
  min-height: 44px;
  border-bottom: 3px solid transparent;
  color: var(--sub);
}
.tab[aria-selected="true"] { border-bottom-color: var(--gold); color: var(--ink); font-weight: 700; }

.motto { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.6; }
.motto + .motto { font-size: 16px; color: var(--sub); font-weight: 400; }
.section-title {
  margin: 22px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--gold);
  font-size: 17px;
  line-height: 1.4;
}
.tab-panel > .section-title:first-child { margin-top: 4px; }
.prose { margin: 0 0 12px; }

.person { padding: 12px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person-tag { margin: 0; color: var(--sub); font-size: 13px; }
.person-name { margin: 0 0 4px; font-size: 17px; line-height: 1.5; }
.person-titles { margin: 0; padding: 0; list-style: none; font-size: 15px; }
.person-motto { margin: 8px 0 0; padding: 6px 10px; border-radius: 6px; background: var(--gold-soft); font-size: 15px; }

.charter { margin: 0; padding: 0; list-style: none; counter-reset: rule; }
.charter li {
  position: relative;
  padding: 10px 0 10px 36px;
  border-bottom: 1px solid var(--line);
  counter-increment: rule;
}
.charter li:last-child { border-bottom: 0; }
.charter li::before {
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.timeline { margin-left: 6px; border-left: 2px solid var(--line); }
.timeline-year { position: relative; padding: 0 0 16px 18px; }
.timeline-year::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
}
.timeline-label { margin: 0 0 2px; font-size: 16px; line-height: 1.6; }
.timeline-event { margin: 0 0 6px; font-size: 15px; }

/* ---------- 導覽 ---------- */

#tour {
  position: fixed;
  z-index: 30;
  left: 16px;
  right: 16px;
  bottom: calc(var(--drawer-peek) + var(--safe-bottom) + 14px);
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
#tour-count { margin: 0; color: var(--gold); font-size: 13px; font-weight: 700; }
#tour-text { margin: 2px 0 12px; font-size: 18px; font-weight: 700; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; }
#tour-skip { min-height: 44px; padding: 0 8px 0 0; color: var(--sub); }

/* ---------- 載入畫面 ---------- */

#loader {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  color: var(--sub);
}
#loader p { margin: 0; }
.loader-hex {
  width: 56px;
  height: 64px;
  background: var(--gold);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; transform: scale(.92); } }

/* ---------- WebGL 不支援：文字清單版 ---------- */

.no-3d #list {
  inset: 0;
  max-height: none;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg);
  transform: none;
}
.no-3d #list-toggle { display: none; }
.no-3d .list-title { display: block; margin: 0 16px 8px; }

/* ---------- 桌機 ---------- */

@media (min-width: 900px) {
  #stage { inset: 0 0 0 296px; }

  #list {
    top: 16px;
    left: 16px;
    right: auto;
    bottom: 16px;
    width: 268px;
    max-height: none;
    padding: 18px 0 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transform: none;
    transition: none;
  }
  #list-toggle { display: none; }
  .list-title { display: block; margin: 0 16px 4px; }

  #card {
    top: 16px;
    left: auto;
    right: 16px;
    bottom: auto;
    width: 400px;
    max-height: calc(100dvh - 32px);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
  }
  #card.is-wide { bottom: 16px; width: 460px; height: auto; max-height: none; }
  #card-body { padding: 22px 24px 24px; }
  .tabs { top: -22px; margin-left: -24px; margin-right: -24px; padding: 0 14px; }

  #tour { left: 296px; right: 0; bottom: 28px; }

  .no-3d #list { top: 0; bottom: 0; left: 0; right: 0; width: auto; margin: 0 auto; padding: 32px 0; }
}

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

/* 建築裡的教室名牌（只在選到該區時出現） */
.label-room { z-index: 4; font-size: 11px; padding: 2px 7px; color: var(--sub); border-color: var(--gold-soft); }

/* 卡片多個按鈕 */
.card-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* 綠佳利島（公司）的島名：淡綠色，跟 A Plus 的金色區分 */
.label-company { z-index: 3; background: #eef6ea; border-color: #7fae5a; color: #3c6b33; font-weight: 700; }
/* 獎勵旅遊島的島名：淡藍色（天空），跟 A Plus 的金色、綠佳利島的綠色區分 */
.label-travel { z-index: 3; background: #eaf3fb; border-color: #6fa3d4; color: #2b5d8c; font-weight: 700; }
/* 獎勵旅遊島卡片：兩顆大按鈕；航班看板（深色底、亮黃字）一趟一列；字放大給長輩看 */
.travel-buttons .button { flex: 1 1 140px; min-height: 56px; font-size: 19px; line-height: 38px; }
.board { margin-top: 12px; border-radius: 12px; overflow: hidden; background: #171c26; color: #f4f1e6; }
.board-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; background: #0e121a; color: #9aa3b5; font-size: 13px; }
.board-code { margin-right: auto; color: #ffc93c; font-weight: 700; letter-spacing: .16em; }
.flight { display: flex; align-items: center; gap: 12px; padding: 14px; border-top: 1px solid #2b3342; color: inherit; text-decoration: none; }
.flight-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.flight-when { color: #ffc93c; font-size: 16px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.flight-where { font-size: 21px; line-height: 1.45; }
.flight-name { color: #c9cfdb; font-size: 16px; line-height: 1.5; }
.flight-note { color: #98a1b3; font-size: 15px; line-height: 1.5; }
.flight-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.flight-status { padding: 3px 10px; border: 1px solid #4a5468; border-radius: 6px; color: #9aa3b5; font-size: 14px; font-weight: 700; white-space: nowrap; }
.flight-status.is-open { border-color: #57d98a; color: #57d98a; }
.flight-status.is-open::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #57d98a; animation: board-blink 1.4s steps(2, jump-none) infinite; }
.flight-go { color: #ffc93c; font-size: 17px; font-weight: 700; white-space: nowrap; }
a.flight:hover, a.flight:focus-visible { background: #212a3a; }
@keyframes board-blink { 50% { opacity: .25; } }

/* 公司總部卡片：每個地區沙龍之間加分隔線、標題縮小 */
.simple .simple { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.simple .simple .card-title { font-size: 18px; margin-bottom: 4px; }

/* 卡片第一句勾子 */
.card-hook { margin: 4px 0 6px; font-size: 17px; font-weight: 700; line-height: 1.5; color: var(--ink); }

/* 首頁右上角的會員入口 */
#member-btn { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; min-height: 40px; border: 1px solid var(--gold); border-radius: 999px; background: rgba(255,255,255,.94);
  box-shadow: var(--shadow); font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; }
#member-btn[hidden] { display: none; }
#member-btn .member-pic { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
#member-btn .member-name { padding-left: 6px; font-weight: 700; }
#member-btn .member-vip { padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 12px; font-weight: 700; }
.button-sub { background: var(--gold-soft) !important; color: var(--ink) !important; }
@media (min-width: 900px) { body:has(#card:not([hidden])) #member-btn { visibility: hidden; } } /* 桌機卡片在右上角，打開時讓位，不壓到關閉鈕 */
#member-btn .member-wait { background: var(--gold-soft); color: var(--ink); }

/* 官網 QR Code（2026-11-15）：右上角會員入口下面一顆小按鈕，按了彈出大 QR Code 給別人掃。圖是靜態檔 island/qr-home.svg（內容 https://unpaplus.com.tw/） */
#qr-btn { position: fixed; top: calc(max(12px, env(safe-area-inset-top)) + 52px); right: 12px; z-index: 30; min-height: 40px; padding: 6px 14px; border: 1px solid var(--gold); border-radius: 999px;
  background: rgba(255,255,255,.94); box-shadow: var(--shadow); font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; }
@media (min-width: 900px) { body:has(#card:not([hidden])) #qr-btn { visibility: hidden; } }
#qr-pop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(23,28,38,.6); }
#qr-pop[hidden] { display: none; }
.qr-card { width: 100%; max-width: 380px; padding: 22px 22px 20px; border-radius: 18px; background: #fff; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.qr-card h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.4; }
.qr-card img { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.qr-url { margin: 8px 0 14px; font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.qr-card .button { width: 100%; min-height: 52px; font-size: 20px; }

/* 首頁註冊表（會員入口打開的卡片）：字大、一格一件事，輸入框 17px 以上手機才不會自動放大 */
@media (max-width: 899px) { #card.is-wide:has(.reg) { height: 86dvh; } }
.reg { display: flex; flex-direction: column; gap: 16px; }
.reg .card-title, .reg .simple-line { margin-bottom: 0; }
.reg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.reg-label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; font-weight: 700; }
.reg-tag { padding: 1px 8px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 20px; }
.reg-tag.reg-opt { background: var(--gold-soft); color: var(--sub); }
.reg-input, .reg-select { width: 100%; min-width: 0; min-height: 50px; padding: 10px 12px; border: 1px solid #cfc6ad; border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit; font-size: 18px; line-height: 28px; }
.reg-input:focus, .reg-select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.reg-row { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: 8px; }
.reg-stack { display: flex; flex-direction: column; gap: 8px; }
.reg-chips { display: flex; gap: 10px; }
.reg-chip { flex: 1; min-height: 50px; border: 1px solid #cfc6ad; border-radius: 8px; background: #fff; font-size: 18px; font-weight: 700; }
.reg-chip[aria-pressed="true"] { border-color: var(--gold); background: var(--gold); box-shadow: inset 0 0 0 2px var(--ink); }
.reg-hint { margin: 0; color: var(--sub); font-size: 15px; font-weight: 400; line-height: 1.5; }
.reg-more { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
.reg-more summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 50px; padding: 8px 0; font-size: 17px; font-weight: 700; cursor: pointer; }
.reg-more[open] { padding-bottom: 12px; }
.reg-more .reg-field + .reg-field { margin-top: 12px; }
.reg-err { margin: 0; padding: 10px 12px; border-radius: 8px; background: #fdecea; color: #b3261e; font-size: 17px; font-weight: 700; }
.reg-coop { padding: 14px; border: 2px solid var(--gold); border-radius: 10px; background: var(--gold-soft); }
.reg-coop p { margin: 0 0 12px; font-size: 17px; line-height: 1.6; }
.reg-coop .button-sub { background: #fff !important; border: 1px solid #cfc6ad; }
.reg-actions { margin-top: 4px; }
.reg-actions .button[type="submit"] { flex: 1 1 100%; min-height: 52px; font-size: 19px; }
.reg-actions .button:disabled, .reg-coop .button:disabled { opacity: .6; cursor: default; }
