/* 台北未來島：文章內 3D 畫布與浮層 */
.tpi-root {
  position: relative;
  width: 100%;
  height: 72vh;
  min-height: 460px;
  /* 文章欄太窄，讓畫布破版到接近全寬 */
  width: calc(100vw - 32px);
  max-width: 1280px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 16px;
  overflow: hidden;
  background: #cfe3e6;
  border: 2px solid #b5c7c9;
  touch-action: none;
  user-select: none;
  margin: 1rem 0 1.5rem;
}
.tpi-root canvas { display: block; }
.tpi-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tpi-labels > div { position: absolute; top: 0; left: 0; will-change: transform; }
.tpi-island-tag {
  pointer-events: auto; cursor: pointer; background: #1f1d1b; color: #fff8f2;
  padding: 4px 12px 4px 8px; border-radius: 999px; font-size: 15px; font-weight: 700;
  white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.25); display: inline-flex; align-items: center; gap: 8px; z-index: 2;
}
.tpi-island-tag i { font-style: normal; background: #fff; color: #1f1d1b; border-radius: 999px; padding: 0 7px; font-size: 13px; }
.tpi-island-tag.rival { background: #6b6b6b; }
.tpi-bld-tag {
  pointer-events: auto; cursor: pointer; background: rgba(255,255,255,.95); color: #1f1d1b;
  padding: 2px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.18); border: 1px solid rgba(0,0,0,.08); z-index: 1;
}
.tpi-bld-tag b { color: #c0392b; margin-left: 6px; font-weight: 600; }
.tpi-pills { position: absolute; top: 10px; left: 12px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; }
.tpi-pills button {
  font-size: 14px; min-height: 34px; padding: 4px 13px; border-radius: 999px; border: 1px solid rgba(31,29,27,.14);
  background: #fff; color: #1f1d1b; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.tpi-pills button[aria-pressed="true"] { background: #1f1d1b; color: #fff; }
.tpi-card {
  position: absolute; right: 12px; bottom: 12px; z-index: 9; width: 360px; max-width: calc(100% - 24px);
  background: rgba(31,29,27,.93); color: #fff8f2; border-radius: 16px; padding: 14px 16px 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.35); font-size: 15px; line-height: 1.55; display: none;
}
.tpi-card.show { display: block; }
.tpi-card .tpi-axis { font-size: 12px; letter-spacing: .08em; opacity: .7; text-transform: uppercase; }
.tpi-card h4 { margin: 2px 0 6px; font-size: 20px; color: #fff; }
.tpi-card .tpi-num { display: inline-block; background: #ffd666; color: #1f1d1b; border-radius: 999px; padding: 1px 10px; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.tpi-card .tpi-who { opacity: .8; font-size: 14px; }
.tpi-card a { color: #8fd3ff; font-size: 13px; }
.tpi-card .tpi-close { position: absolute; right: 10px; top: 8px; border: none; background: transparent; color: #fff; font-size: 18px; cursor: pointer; }
.tpi-caption {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 8; pointer-events: none;
  background: rgba(31,29,27,.88); color: #fff; padding: 8px 16px; border-radius: 12px; font-size: 15px; max-width: 80%; text-align: center; display: none;
}
.tpi-caption.show { display: block; }
.tpi-rival-sign { pointer-events: none; background: #fff3cd; color: #7a5a00; border: 1px dashed #c9a227; padding: 2px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; z-index: 2; }
.tpi-loop { pointer-events: none; background: rgba(0,0,0,.75); color: #ffd666; padding: 2px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; z-index: 2; }
@media (max-width: 600px) {
  .tpi-root { height: 64vh; min-height: 380px; }
  .tpi-card { right: 8px; left: 8px; width: auto; bottom: 8px; font-size: 14px; }
  .tpi-card h4 { font-size: 18px; }
  .tpi-pills button { font-size: 13px; min-height: 30px; padding: 3px 10px; }
}

/* v2：島清單、政見卡子項目、HEART 標籤、時段按鈕 */
.tpi-island-tag i { font-family: ui-monospace, Menlo, monospace; }
.tpi-bld-tag i { font-style: normal; color: #db6a41; font-weight: 700; margin-right: 5px; }
.tpi-bld-tag.rival i { color: #666; }
.tpi-list {
  position: absolute; top: 56px; right: 12px; bottom: 12px; width: 300px; max-width: calc(100% - 24px); z-index: 7;
  background: rgba(255, 248, 244, 0.96); border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.25); overflow: auto;
  padding: 8px; display: none; font-size: 14px;
}
.tpi-list.open { display: block; }
.tpi-list-head { padding: 8px 10px 10px; font-weight: 700; color: #211d1d; font-size: 15px; border-bottom: 1px solid rgba(0,0,0,.08); margin-bottom: 6px; }
.tpi-list-head small { display: block; font-weight: 400; color: #777; font-size: 12px; margin-top: 2px; }
.tpi-list button { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: transparent; padding: 7px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; color: #211d1d; }
.tpi-list button:hover, .tpi-list button.on { background: #ffe9df; }
.tpi-list button i { font-style: italic; color: #db6a41; font-family: Georgia, serif; width: 26px; }
.tpi-list button span { flex: 1 1 auto; }
.tpi-list button em { font-style: normal; color: #999; font-size: 12px; }
.tpi-list button b u { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 2px; }
.tpi-card { width: 380px; max-height: calc(100% - 70px); overflow: auto; left: 12px; right: auto; bottom: 12px; }
.tpi-card .tpi-sub { font-size: 12px; letter-spacing: .06em; opacity: .7; margin-top: 10px; }
.tpi-card .tpi-items { list-style: none; margin: 6px 0 0; padding: 0; }
.tpi-card .tpi-items li { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.06); margin-bottom: 4px; cursor: pointer; }
.tpi-card .tpi-items li:hover { background: rgba(255,255,255,.14); }
.tpi-card .tpi-items li small { opacity: .65; font-size: 12px; white-space: nowrap; }
.tpi-card .tpi-facts { margin: 8px 0 0; padding-left: 18px; font-size: 14px; opacity: .9; }
.tpi-card .tpi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tpi-card .tpi-chip { --c: #ffd666; display: inline-block; border: 1px solid var(--c); color: #fff; border-radius: 999px; padding: 1px 10px; font-size: 12px; background: rgba(255,255,255,.06); }
.tpi-card .tpi-link { cursor: pointer; }
.tpi-card .tpi-link:hover { background: rgba(255,255,255,.18); }
.tpi-card .tpi-back { color: #8fd3ff; cursor: pointer; font-size: 13px; }
@media (max-width: 600px) {
  .tpi-list { top: 50px; width: auto; left: 8px; right: 8px; }
  .tpi-card { left: 8px; right: 8px; width: auto; max-height: 52%; }
}

/* 全景時島名牌只顯示編號 */
.tpi-labels.far .tpi-island-tag span { display: none; }
.tpi-labels.far .tpi-island-tag { padding: 4px 6px; gap: 0; }
.tpi-jack-tag { pointer-events: none; background: #fff3cd; color: #7a5a00; border: 1px solid #c9a227; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; z-index: 2; }

/* 全螢幕（真全螢幕或 fixed 蓋版） */
.tpi-root.fs, .tpi-root:fullscreen, .tpi-root:-webkit-full-screen {
  position: fixed; inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh;
  left: 0; transform: none; margin: 0; border-radius: 0; border: none; z-index: 99999; background: #cfe3e6;
}
.tpi-root.fs .tpi-pills, .tpi-root:fullscreen .tpi-pills { top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
.tpi-root.fs .tpi-card, .tpi-root:fullscreen .tpi-card { bottom: max(12px, env(safe-area-inset-bottom)); }
