:root {
  --ink: #14213d;
  --ink-soft: #3d4a66;
  --paper: #fbf8f2;
  --paper-2: #f2ede3;
  --line: rgba(20, 33, 61, .12);
  --glass: rgba(251, 248, 242, .86);
  --shadow: 0 10px 30px rgba(20, 33, 61, .16);
  --radius: 18px;
  --st-done: #2e9e5b;
  --st-in_progress: #2f7dd3;
  --st-proposal: #d99a14;
  --st-pledge: #d0457a;
  --font: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-num: "Space Grotesk", var(--font);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
body.night {
  --ink: #eef2fb;
  --ink-soft: #b7c1d8;
  --paper: #121a2e;
  --paper-2: #1a2440;
  --line: rgba(238, 242, 251, .14);
  --glass: rgba(18, 26, 46, .84);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #cfe6f2;
  -webkit-font-smoothing: antialiased;
  transition: color .4s;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; touch-action: none; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 20; top: 12px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 10px 12px 10px 14px;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: radial-gradient(circle at 50% 38%, #f08c3a 0 28%, transparent 29%),
              linear-gradient(180deg, transparent 55%, #20a39e 55% 72%, #2f7dd3 72%);
  border: 1px solid var(--line);
}
.brand h1 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: .04em; line-height: 1.1; }
.brand-sub { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub strong { color: var(--st-pledge); font-weight: 700; }
.views { display: flex; background: var(--paper-2); border-radius: 12px; padding: 3px; gap: 2px; }
.view-btn { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.view-btn.is-active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.tools { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: var(--paper); }
.icon-btn svg { width: 19px; height: 19px; fill: var(--ink); stroke: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: fixed; z-index: 15; left: 24px; bottom: 28px; width: min(420px, calc(100vw - 48px));
  padding: 22px 22px 20px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  transition: opacity .5s, transform .5s;
}
.hero.is-hidden { opacity: 0; transform: translateY(16px); pointer-events: none; }
.hero-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--ink-soft); }
.hero h2 { margin: 0 0 8px; font-size: 28px; font-weight: 900; line-height: 1.25; }
.hero-body { margin: 0 0 14px; font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); }
.hero-stats { display: flex; gap: 18px; margin-bottom: 16px; }
.stat b { display: block; font-family: var(--font-num); font-size: 26px; line-height: 1; }
.stat span { font-size: 12px; color: var(--ink-soft); }
.hero-note { margin: -4px 0 14px; font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); padding-left: 10px; border-left: 3px solid var(--st-pledge); }
.cta { border: 0; background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 12px; font-weight: 700; font-size: 15px; }
.cta:hover { filter: brightness(1.15); }

/* ---------- legend ---------- */
.legend {
  position: fixed; z-index: 14; right: 16px; bottom: 44px; padding: 10px 12px;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.legend-title { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); letter-spacing: .08em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-width: 360px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 13px; font-weight: 500;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
}
.chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { font-family: var(--font-num); opacity: .7; }

/* ---------- island labels (CSS2D) ---------- */
.isle-label {
  pointer-events: auto; cursor: pointer; user-select: none;
  padding: 5px 10px 5px 8px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  background: rgba(255,255,255,.92); color: #14213d; border: 1px solid rgba(20,33,61,.12);
  box-shadow: 0 4px 12px rgba(20,33,61,.18); display: flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: transform .2s, opacity .3s;
}
.isle-label i { width: 10px; height: 10px; border-radius: 3px; }
.isle-label em { font-style: normal; font-family: var(--font-num); font-weight: 700; font-size: 11.5px; letter-spacing: .02em; }
.isle-label small { font-family: var(--font-num); font-weight: 500; color: #3d4a66; }
.isle-label:hover, .isle-label.is-hover { transform: translateY(-3px) scale(1.05); }
.isle-label.is-dim { opacity: .35; }
.isle-label.is-hidden-label { opacity: 0; pointer-events: none; }
.center-label { pointer-events: none; text-align: center; color: #14213d; text-shadow: 0 1px 0 rgba(255,255,255,.8); }
.center-label b { display: block; font-size: 15px; font-weight: 900; letter-spacing: .2em; }
.center-label span { font-size: 11px; letter-spacing: .1em; }
body.night .center-label { color: #eef2fb; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.hide-labels .isle-label, .hide-labels .center-label { opacity: 0; pointer-events: none; }

/* ---------- panel ---------- */
.panel {
  position: fixed; z-index: 25; top: 84px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px));
  background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  transform: translateX(110%); transition: transform .45s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.panel.is-open { transform: none; }
.panel-grip { display: none; }
.panel-close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); font-size: 22px; line-height: 1; z-index: 2;
}
.panel-inner { overflow-y: auto; padding: 22px 22px 28px; -webkit-overflow-scrolling: touch; }
.panel-head { padding-right: 40px; }
.panel-tag { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--ink-soft); }
.panel-tag i { width: 12px; height: 12px; border-radius: 4px; }
.panel-head h2 { margin: 6px 0 8px; font-size: 26px; font-weight: 900; }
.panel-head p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); }
.status-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; margin: 16px 0 6px; background: var(--paper-2); }
.status-bar span { display: block; }
.status-count { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; }
.status-count b { font-family: var(--font-num); color: var(--ink); }

.item {
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; margin-top: 12px; background: var(--paper);
  transition: box-shadow .3s, border-color .3s;
}
.item.is-flash { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(47,125,211,.25); }
.panel .item { cursor: pointer; }
.panel .item.is-staged { border-color: color-mix(in srgb, var(--ink) 55%, transparent); }
.panel .item.is-staged .item-top::after {
  content: "▲ 場景演出中"; order: 3; font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-left: 8px;
}
.item.is-filtered { display: none; }
.item-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: #fff; white-space: nowrap; }
.item-date { font-family: var(--font-num); font-size: 12px; color: var(--ink-soft); }
.item h3 { margin: 8px 0 6px; font-size: 16.5px; line-height: 1.45; }
.item ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.item ul li::marker { color: var(--line); }
.sources { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.src {
  font-size: 12px; text-decoration: none; padding: 3px 8px; border-radius: 8px; background: var(--paper-2); color: var(--ink-soft);
  border: 1px solid transparent; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src:hover { border-color: var(--line); color: var(--ink); }
.panel-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
.panel-nav button { flex: 1; border: 1px solid var(--line); background: var(--paper-2); border-radius: 12px; padding: 10px; font-size: 14px; font-weight: 700; }

/* ---------- overlay views ---------- */
.overlay-view {
  position: fixed; z-index: 18; inset: 0; padding: 88px 12px 12px; overflow-y: auto;
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px);
}
.overlay-inner { max-width: 980px; margin: 0 auto; padding-bottom: 60px; }
.overlay-inner > h2 { font-size: 26px; font-weight: 900; margin: 12px 0 4px; }
.overlay-inner > p.lead { margin: 0 0 18px; color: var(--ink-soft); font-size: 14.5px; }
.theme-block { margin-top: 26px; }
.theme-block > h3 { display: flex; align-items: center; gap: 8px; font-size: 19px; margin: 0 0 4px; }
.theme-block > h3 i { width: 14px; height: 14px; border-radius: 4px; }
.theme-block > p { margin: 0 0 4px; color: var(--ink-soft); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 12px; }
.tl-year { font-family: var(--font-num); font-size: 34px; font-weight: 700; margin: 30px 0 4px; }
.tl-row { display: grid; grid-template-columns: 92px 1fr; gap: 14px; border-left: 2px solid var(--line); margin-left: 8px; padding: 6px 0 6px 16px; position: relative; }
.tl-row::before { content: ""; position: absolute; left: -7px; top: 22px; width: 12px; height: 12px; border-radius: 50%; background: var(--dot, #999); border: 2px solid var(--paper); }
.tl-when { font-family: var(--font-num); font-size: 13px; color: var(--ink-soft); padding-top: 18px; }
.tl-row .item { margin-top: 6px; }
.tl-theme { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-right: auto; }
.tl-row .item-date { display: none; }
.tl-row .item-top { justify-content: flex-start; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 30; pointer-events: none; max-width: 260px; padding: 8px 10px; border-radius: 10px;
  background: #14213d; color: #fff; font-size: 13px; line-height: 1.5; box-shadow: var(--shadow);
  transform: translate(-50%, calc(-100% - 14px));
}
.tooltip b { display: block; }
.tooltip span { opacity: .8; font-size: 12px; }

/* ---------- about ---------- */
.about {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px 24px 20px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
.about::backdrop { background: rgba(10, 16, 32, .45); }
.about h2 { margin: 0 0 10px; font-size: 22px; }
.about h3 { margin: 18px 0 6px; font-size: 15px; }
.about p, .about li { font-size: 14px; line-height: 1.75; color: var(--ink-soft); }
.about ul { padding-left: 20px; margin: 0; }
.about b, .about strong { color: var(--ink); }
.about .panel-close { position: absolute; }
.about-tech { font-size: 12.5px !important; margin-top: 16px; }
.about-links a { font-weight: 700; }

/* ---------- misc ---------- */
.footnote {
  position: fixed; z-index: 12; left: 50%; bottom: calc(8px + var(--safe-b)); transform: translateX(-50%);
  font-size: 11.5px; color: var(--ink-soft); background: var(--glass); padding: 4px 12px; border-radius: 999px; white-space: nowrap;
}
.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px; background: #dfeef5; transition: opacity .6s; }
.loading.is-done { opacity: 0; pointer-events: none; }
.loading p { margin: 0; font-weight: 700; color: #3d4a66; letter-spacing: .1em; }
.loading-isle { width: 72px; height: 36px; border-radius: 50% 50% 46% 46% / 30% 30% 70% 70%; background: linear-gradient(#8cc084 0 34%, #b98b5e 34%); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.noscript { position: fixed; inset: 40% 20px auto; text-align: center; font-weight: 700; }
.is-hidden-ui { opacity: 0 !important; pointer-events: none !important; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .topbar { top: 8px; left: 8px; right: 8px; padding: 8px; gap: 8px; flex-wrap: wrap; }
  .brand { flex: 1; }
  .brand h1 { font-size: 16px; }
  .views { order: 3; width: 100%; }
  .view-btn { flex: 1; padding: 7px 6px; }
  .icon-btn { width: 36px; height: 36px; }
  .hero { left: 10px; right: 10px; bottom: calc(52px + var(--safe-b)); width: auto; padding: 18px; }
  .hero h2 { font-size: 23px; }
  .legend { left: 8px; right: 8px; bottom: calc(34px + var(--safe-b)); padding: 8px; }
  .legend-title { display: none; }
  body:not(.started) .legend { opacity: 0; pointer-events: none; }
  body:has(.panel.is-open) .legend { opacity: 0; pointer-events: none; }
  .chips { max-width: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: none; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 54vh; border-radius: 22px 22px 0 0;
    transform: translateY(105%);
  }
  .panel-grip { display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 8px auto 0; }
  .panel-inner { padding: 12px 16px calc(24px + var(--safe-b)); }
  .overlay-view { padding-top: 124px; }
  .tl-row { grid-template-columns: 1fr; gap: 0; }
  .tl-when { padding-top: 4px; }
  .isle-label { font-size: 11px; padding: 3px 7px 3px 6px; gap: 4px; }
  .isle-label small { display: none; }
  .footnote { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* 政策場景演出時，隱藏各島名牌，避免蓋住特寫 */
.staging .isle-label, .staging .center-label { opacity: 0; pointer-events: none; }

/* =========================================================
   第二階段：索引側欄、搜尋、時段切換、插畫
   ========================================================= */

/* 時段切換（桌機：分段按鈕；手機：單一按鈕循環） */
.tod { display: flex; gap: 2px; padding: 3px; border-radius: 13px; background: var(--paper-2); border: 1px solid var(--line); }
.tod-btn {
  border: 0; background: none; border-radius: 10px; padding: 5px 9px 4px; display: grid; justify-items: center; gap: 1px;
  color: var(--ink-soft); font-size: 10.5px; font-weight: 700; line-height: 1.1;
}
.tod-btn svg, .tod-cycle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tod-btn[data-tod="night"] svg, .tod-btn[data-tod="day"] svg circle { fill: currentColor; stroke: none; }
.tod-btn[data-tod="day"] svg path { stroke: currentColor; }
.tod-btn.is-active { background: var(--ink); color: var(--paper); }
.tod-cycle { display: none; color: var(--ink); }
.tod-cycle svg { stroke: var(--ink); }

/* 首頁主視覺 */
.hero-art {
  display: block; width: calc(100% + 44px); margin: -22px -22px 16px; height: 150px; object-fit: cover; object-position: center 40%;
  border-radius: 22px 22px 0 0; background: var(--paper-2);
}

/* 載入畫面：主視覺當背景 */
.loading { background: #e8efe9 var(--art) center / cover no-repeat; }
.loading::before { content: ""; position: absolute; inset: 0; background: rgba(251, 248, 242, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.loading > * { position: relative; }

/* 面板頂部主題插畫 */
.panel-art {
  display: block; width: calc(100% + 44px); margin: -22px -22px 14px; aspect-ratio: 4 / 3; max-height: 210px; object-fit: cover;
  border-radius: 22px 22px 0 0; background: var(--paper-2);
}

/* 清單檢視的主題縮圖 */
.theme-head { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.theme-art { width: 112px; height: 84px; object-fit: cover; border-radius: 14px; flex: none; background: var(--paper-2); }
.theme-head h3 { display: flex; gap: 8px; align-items: baseline; font-size: 19px; margin: 0 0 4px; }
.theme-head h3 em { font-style: normal; font-family: var(--font-num); font-size: 15px; }
.theme-head p { margin: 0; color: var(--ink-soft); font-size: 14px; }

/* 政策索引側欄（寬螢幕才顯示） */
.index { display: none; }
@media (min-width: 1100px) {
  .index {
    display: flex; flex-direction: column; position: fixed; z-index: 16; top: 84px; right: 12px; bottom: 12px; width: 330px;
    padding: 20px 18px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  }
  .legend { display: none; }
  .footnote { left: calc((100% - 342px) / 2); }
}
.index-kicker { margin: 0; font-family: var(--font-num); font-size: 11.5px; font-weight: 700; letter-spacing: .2em; color: #c0603a; }
.index h2 { margin: 6px 0 6px; font-size: 22px; font-weight: 900; line-height: 1.35; }
.index-meta { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-soft); }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper-2);
}
.search:focus-within { border-color: var(--ink); }
.search svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 14.5px; color: var(--ink); }
.index .chips { margin: 10px 0 6px; flex-wrap: wrap; max-width: none; }
.index .chip { font-size: 12px; padding: 4px 9px; }
.index-list, .index-hits { flex: 1; overflow-y: auto; margin: 4px -6px 0; padding: 0 6px; list-style: none; }
.idx-row {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto 14px; align-items: center; gap: 6px; text-align: left;
  border: 0; border-bottom: 1px solid var(--line); background: none; padding: 13px 6px; border-radius: 10px;
}
.idx-row em { font-style: italic; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1; }
.idx-row span { font-size: 15.5px; font-weight: 700; }
.idx-row small { font-family: var(--font-num); font-size: 12px; color: var(--ink-soft); }
.idx-row i { font-style: normal; font-size: 12px; color: var(--ink-soft); }
.idx-row:hover, .idx-row.is-active { background: var(--paper-2); }
.idx-row.is-active span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.idx-row.is-empty { opacity: .4; }
.hits-count { margin: 8px 4px; font-size: 12.5px; color: var(--ink-soft); }
.idx-hit {
  width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; text-align: left;
  border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 6px; border-radius: 10px;
}
.idx-hit:hover { background: var(--paper-2); }
.idx-hit b { font-size: 14px; line-height: 1.45; }
.idx-hit small { grid-column: 2; font-size: 12px; color: var(--ink-soft); }

/* 夜晚時的側欄與時段按鈕維持可讀 */
body.night .index-kicker { color: #f0a27e; }

@media (max-width: 760px) {
  .tod { display: none; }
  .tod-cycle { display: grid; }
  .hero-art { height: 96px; margin-bottom: 12px; }
  .panel-art { max-height: 150px; }
  .theme-art { width: 84px; height: 63px; }
}
@media (max-width: 760px) {
  .hero-art { width: calc(100% + 36px); margin: -18px -18px 12px; }
  .panel-art { width: calc(100% + 32px); margin: -12px -16px 12px; border-radius: 0; }
}

/* 3D 無法啟動時的說明 */
.fallback-note {
  margin: 8px 0 4px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.7;
  background: #fff4e0; color: #6b4a1f; border: 1px solid #f2d39b;
}
.fallback-note button {
  margin: 0 4px; padding: 2px 10px; border-radius: 8px; border: 1px solid #d9a85a; background: #fff; font-weight: 700; color: inherit;
}

/* =========================================================
   互動：任期時間軸、居民對話泡泡
   ========================================================= */
.timebar {
  position: fixed; z-index: 14; top: 96px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 40px));
  display: flex; gap: 12px; align-items: center; padding: 10px 14px 10px 10px;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
@media (min-width: 1100px) { .timebar { left: calc((100% - 342px) / 2); width: min(560px, calc(100vw - 420px)); } }
body:has(.panel.is-open) .timebar, .hide-labels .timebar { display: none; }
.tb-play {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
}
.tb-play svg { width: 20px; height: 20px; fill: currentColor; }
.tb-play .i-pause, .timebar.is-playing .tb-play .i-play { display: none; }
.timebar.is-playing .tb-play .i-pause { display: block; }
.tb-main { flex: 1; min-width: 0; }
.tb-top { display: flex; align-items: baseline; gap: 8px; }
.tb-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--ink-soft); }
.tb-date { font-family: var(--font-num); font-size: 16px; }
.tb-count { font-family: var(--font-num); font-size: 12.5px; color: var(--ink-soft); margin-left: auto; }
.tb-reset { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.tb-track { position: relative; height: 30px; }
.tb-track input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 2px 0 0; background: none; cursor: pointer;
  --pct: 100%;
}
.tb-track input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 9px; background: linear-gradient(90deg, var(--st-done) 0 var(--pct), var(--paper-2) var(--pct));
}
.tb-track input[type=range]::-moz-range-track { height: 6px; border-radius: 9px; background: var(--paper-2); }
.tb-track input[type=range]::-moz-range-progress { height: 6px; border-radius: 9px; background: var(--st-done); }
.tb-track input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--paper);
  border: 3px solid var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.tb-track input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 3px solid var(--ink); }
.tb-ticks { position: absolute; left: 0; right: 0; bottom: -4px; height: 10px; pointer-events: none; }
.tb-ticks span { position: absolute; transform: translateX(-50%); font-family: var(--font-num); font-size: 10px; color: var(--ink-soft); }
.tb-ticker {
  display: flex; gap: 6px; align-items: center; width: 100%; margin-top: 6px; padding: 0; border: 0; background: none; text-align: left;
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-ticker i { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.tb-ticker span { flex: none; font-family: var(--font-num); font-weight: 500; color: var(--ink-soft); }
.tb-ticker:hover { text-decoration: underline; }

/* 居民泡泡：外層由 CSS2D 定位在人頭上，內層往上長 */
.bubble-anchor { width: 0; height: 0; pointer-events: none; }
.bubble {
  position: absolute; left: 0; bottom: 10px; transform: translateX(-50%); width: 236px; pointer-events: auto;
  padding: 12px 14px 12px; border-radius: 16px; background: #fff; color: #14213d; border: 1px solid rgba(20,33,61,.12);
  box-shadow: 0 10px 28px rgba(20,33,61,.25); font-size: 13px; line-height: 1.55; animation: pop .22s ease-out;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: #fff; transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid rgba(20,33,61,.12); border-bottom: 1px solid rgba(20,33,61,.12);
}
.bubble-top { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; padding-right: 20px; }
.bubble-top .badge { font-size: 11px; padding: 2px 7px; }
.bubble-theme { font-size: 11.5px; font-weight: 700; color: #3d4a66; }
.bubble b { display: block; font-size: 14px; line-height: 1.45; }
.bubble p { margin: 4px 0 8px; color: #3d4a66; }
.bubble-more { border: 0; padding: 6px 10px; border-radius: 10px; background: #14213d; color: #fff; font-size: 12.5px; font-weight: 700; }
.bubble-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #f2ede3; font-size: 16px; line-height: 1; }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(.96); } }

@media (max-width: 760px) {
  .timebar { top: 124px; left: 8px; right: 8px; width: auto; transform: none; padding: 8px 10px 8px 8px; gap: 10px; }
  .tb-play { width: 38px; height: 38px; }
  .tb-kicker { display: none; }
  .bubble { width: 210px; }
}
.tb-hint { margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); }
/* 泡泡打開時，島名標籤退到後面 */
.bubbling .isle-label, .bubbling .center-label { opacity: .18; pointer-events: none; }
/* 手機：介紹卡還在時先不顯示時間軸，避免地圖被上下夾住 */
@media (max-width: 760px) { body:not(.started) .timebar { display: none; } }
