/* 政策島，沿用 styles.css 的色彩與按鈕 */
:root {
  --sea: #8fd3e8;
  --sea-deep: #6fc0dc;
  --shoal: #c4ebf3;
  --wave: rgba(255, 255, 255, 0.75);
  --strait: rgba(10, 36, 99, 0.35);
  --top-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sea: #12395c;
    --sea-deep: #0d2c4a;
    --shoal: #2b6a8c;
    --wave: rgba(255, 255, 255, 0.35);
    --strait: rgba(255, 255, 255, 0.35);
  }
}

.isle-page { min-height: 100vh; }

.i-top {
  position: sticky; top: 0; z-index: 10;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.i-top-in { display: flex; align-items: center; gap: 12px; height: var(--top-h); max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.i-back { min-width: 72px; color: rgba(255, 255, 255, 0.8); text-decoration: none; font-size: 0.9rem; font-weight: 700; }
.i-brand { flex: 1; text-align: center; font-family: var(--serif); font-size: 1.15rem; color: var(--gold); letter-spacing: 0.1em; }
.i-share {
  min-width: 72px; min-height: 36px;
  border: 2px solid var(--gold); border-radius: 999px;
  background: transparent; color: var(--gold);
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
}

/* ---------- 地圖 ---------- */
.i-map {
  position: sticky; top: var(--top-h); z-index: 5;
  height: 54vh; min-height: 300px;
  background: radial-gradient(ellipse at 50% 40%, var(--sea), var(--sea-deep));
  box-shadow: 0 6px 18px rgba(10, 36, 99, 0.18);
  overflow: hidden;
}
#map { display: block; width: 100%; height: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#map .sea { fill: transparent; }
#map .shoal { fill: var(--shoal); transition: opacity 0.3s; }
#map .wave { fill: none; stroke: var(--wave); stroke-width: 3; stroke-linecap: round; }
#map .land { fill: #9fcf79; stroke: #f0dcaa; stroke-width: 1.4; stroke-linejoin: round; }
#map .strait { fill: var(--strait); font-size: 2.6px; letter-spacing: 0.3em; }
#map .site { cursor: pointer; outline: none; transition: opacity 0.3s; }
#map .site .dot { fill: var(--red); stroke: #fff; stroke-width: 0.4; }
#map .site .dot.quiet { fill: #fff; stroke: #8aa; }
#map .site .cnt { fill: #fff; font-size: 1.7px; font-weight: 900; pointer-events: none; }
#map .site .nm { fill: #13213f; font-size: 1.5px; font-weight: 700; paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 0.5px; pointer-events: none; }
#map .site:hover .dot, #map .site:focus-visible .dot, #map .site.on .dot { stroke: var(--gold); stroke-width: 0.8; }
#map.has-focus .site:not(.on) { opacity: 0.5; }

.i-reset {
  position: absolute; right: 12px; top: 12px;
  min-height: 40px; padding: 6px 14px;
  border: 0; border-radius: 999px;
  background: rgba(10, 36, 99, 0.88); color: #fff;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  box-shadow: var(--shadow);
}
.i-reset[hidden] { display: none; }

/* ---------- 3D 模式 ---------- */
.i-map.is-3d { height: 60vh; background: #bfe6f5; }
.i-gl { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.i-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.i-tag {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.94); color: #13213f;
  box-shadow: 0 2px 8px rgba(10, 36, 99, 0.25);
  font: 700 0.85rem/1.2 var(--sans); white-space: nowrap;
  pointer-events: auto; cursor: pointer;
  transition: opacity 0.25s;
}
.i-tag b {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 5px; border-radius: 99px;
  background: var(--navy); color: var(--gold); font-size: 0.75rem;
}
.i-tag small { color: var(--red); font-weight: 900; }
.i-tag.isle { font-size: 0.95rem; }
.i-tag.dim { opacity: 0.55; }
.i-tag.spot { padding: 3px 9px 3px 6px; background: rgba(255, 248, 230, 0.9); color: #7a4a1c; font-size: 0.78rem; }
.i-tag.bridge { padding: 4px 10px; background: var(--red); color: #fff; font-size: 0.78rem; }
.i-tag.bridge.on { box-shadow: 0 0 0 3px var(--gold); }
.i-tag.pin { padding-right: 10px; background: #fffbea; border: 2px solid var(--gold); font-size: 0.8rem; }
.i-tag.pin b { background: var(--red); color: #fff; }
.i-tag:hover, .i-tag:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; z-index: 2; }

.i-tools { position: absolute; left: 10px; top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.i-tools[hidden] { display: none; }
.i-seg, .i-seg-one {
  display: flex; padding: 3px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 10px rgba(10, 36, 99, 0.2);
}
.i-seg button, .i-seg-one {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 44px; min-height: 40px; padding: 2px 8px;
  border: 0; border-radius: 999px; background: transparent; color: #13213f;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.i-seg button span, .i-seg-one span { margin-top: 2px; font-size: 0.62rem; font-weight: 700; }
.i-seg button[aria-pressed="true"] { background: var(--navy); color: var(--gold); }
.i-seg-one { border: 0; background: rgba(255, 255, 255, 0.9); }
.i-seg-one[aria-pressed="false"] { opacity: 0.55; }
#motion[aria-pressed="false"] { opacity: 1; background: #e4e9ee; }
.i-seg-one:focus-visible, .i-seg button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.is-3d .i-reset { top: auto; bottom: 12px; }
.i-hint {
  position: absolute; left: 50%; bottom: 14px; margin: 0;
  transform: translateX(-50%);
  padding: 6px 14px; border-radius: 999px;
  background: rgba(10, 36, 99, 0.75); color: #fff;
  font-size: 0.8rem; font-weight: 700; white-space: nowrap; pointer-events: none;
  animation: hint 6s ease forwards;
}
.i-map:not(.is-3d) .i-hint { display: none; }
@keyframes hint { 0%, 70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.is-3d .i-hint { left: 12px; transform: none; }

.pol-stat { position: relative; }
.pol-stat i {
  position: absolute; left: -8px; top: -8px;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: #fff; font-style: normal; font-size: 0.75rem;
}
.i-map:not(.is-3d) ~ .i-side .pol-stat i { display: none; }
.pol.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* 手機：圖釘只顯示編號，避免擋住島 */
@media (max-width: 599px) {
  .i-tag.pin span { display: none; }
  .i-tag.pin { padding: 2px; }
  .i-tag { font-size: 0.78rem; }
  .i-tag.isle { font-size: 0.85rem; }
  .i-seg button span, .i-seg-one span { display: none; }
  .i-seg button, .i-seg-one { min-width: 38px; min-height: 36px; padding: 2px 6px; }
}

/* ---------- 面板 ---------- */
.i-side { padding: 18px 16px 0; }
.i-panel { max-width: 640px; margin: 0 auto; }
.i-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  animation: rise 0.35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.i-card > p { margin: 0 0 12px; }
.i-kicker { margin: 0 0 4px !important; color: var(--red); font-weight: 900; font-size: 0.85rem; letter-spacing: 0.08em; }
.i-title { margin: 0 0 10px; font-family: var(--serif); font-size: clamp(1.45rem, 6vw, 2rem); line-height: 1.3; }
.i-landmark { font-weight: 700; color: var(--navy-2); }
.i-sub { margin: 18px 0 8px !important; font-weight: 900; font-size: 0.9rem; color: var(--muted); }
.i-up { margin-bottom: 8px; padding: 0; border: 0; background: none; color: var(--muted); font-weight: 700; cursor: pointer; }
.i-life { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid #5b9d85; border-radius: 12px; background: var(--bg); font-size: 0.88rem; }
.i-life p { margin: 4px 0 0; color: var(--muted); }
.i-life .chip-btn { min-height: 40px; padding: 5px 10px; border-width: 1px; font-size: 0.82rem; }
.i-map:not(.is-3d) ~ .i-side .i-life { display: none; }

.i-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 42px; padding: 6px 14px;
  border: 2px solid var(--navy); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-weight: 700; cursor: pointer;
}
.chip-btn small { min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--navy); color: var(--gold); font-size: 0.78rem; text-align: center; }
.chip-btn.red { border-color: var(--red); color: var(--red); }
.chip-btn.spot { border-style: dashed; }

.pols { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.pol {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; width: 100%;
  padding: 14px; border: 0; border-radius: 14px; background: var(--chip);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pol:hover, .pol:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gold); transform: translateY(-1px); }
.pol-stat {
  display: flex; align-items: center; justify-content: center; min-height: 64px;
  padding: 6px; border-radius: 10px;
  background: var(--navy); color: var(--gold);
  font-weight: 900; font-size: 0.95rem; line-height: 1.2; text-align: center; word-break: break-word;
}
.pol-body { display: grid; gap: 2px; min-width: 0; }
.pol strong { display: block; font-size: 1.05rem; line-height: 1.4; }
.pol-desc { color: var(--muted); font-size: 0.92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pol-more { margin-top: 4px; color: var(--red); font-weight: 700; font-size: 0.9rem; }

/* ---------- 政見詳細說明 ---------- */
.d-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.d-head .i-title { margin: 0; }
.d-stat {
  flex: none; display: grid; place-items: center; min-width: 88px; min-height: 72px; padding: 8px 10px;
  border-radius: 14px; background: var(--navy); color: var(--gold);
  font-weight: 900; font-size: 1.1rem; line-height: 1.2; text-align: center;
}
.i-detail .d-h { margin: 16px 0 4px !important; font-weight: 900; color: var(--navy-2); }
.d-lead { font-size: 1.08rem; line-height: 1.7; }
.d-box { margin: 14px 0 0; padding: 4px 16px 14px; border-radius: 14px; background: var(--chip); }
.d-box .d-h:first-child { margin-top: 12px !important; }
.d-box p { margin: 0; }
.d-src { margin: 0; padding-left: 1.2em; font-size: 0.88rem; color: var(--muted); }
.d-src li + li { margin-top: 4px; }
.d-src a { color: inherit; text-underline-offset: 3px; }
.d-share { display: grid; gap: 10px; margin-top: 22px; padding: 16px; border-radius: 16px; border: 2px dashed var(--gold); }
.d-share-h { margin: 0 !important; font-weight: 900; text-align: center; }
.d-share .btn { width: 100%; }
.d-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
.d-nav .link-btn { max-width: 48%; font-weight: 700; text-align: left; }
.d-nav .link-btn:last-child { text-align: right; }
.i-tag.pin.on { background: var(--gold); border-color: var(--red); transform-origin: center; z-index: 3; }
.i-tag.pin.dim { opacity: 0.6; }

.i-next { margin-top: 18px; }
.i-next .btn { width: 100%; }

.i-foot { max-width: 640px; margin: 0 auto; padding: 20px 0 40px; color: var(--muted); font-size: 0.82rem; }

@media (prefers-color-scheme: dark) {
  .i-landmark { color: var(--gold); }
  .chip-btn { border-color: var(--gold); }
  .pol-more, .chip-btn.red { color: #ff8a9a; border-color: #ff8a9a; }
  .i-detail .d-h { color: var(--gold); }
}

/* 桌機：地圖在左、面板在右 */
@media (min-width: 900px) {
  .i-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); }
  .i-map, .i-map.is-3d { align-self: start; height: calc(100vh - var(--top-h)); box-shadow: none; }
  .i-side { padding: 24px 24px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .i-card, .pol.flash { animation: none; }
}

/* ---------- 首頁頂端：號次、品牌、附加功能 ---------- */
.i-home { display: inline-flex; align-items: center; gap: 4px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.i-home .candno-sm { margin: 0; }
.i-home .candno-sm b { display: inline-grid; place-items: center; box-sizing: border-box; width: 1.8rem; height: 1.8rem; border: 0.2rem solid #d4101f; border-radius: 50%; background: #fff; color: #d4101f; font-weight: 900; font-size: 1rem; line-height: 1; }
.i-home .i-brand { flex: 0 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.i-nav { display: flex; gap: 6px; }
.i-nav a {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff;
  text-decoration: none; font-weight: 700; font-size: 0.88rem; white-space: nowrap;
}
.i-nav a:hover, .i-nav a:focus-visible { background: rgba(255, 255, 255, 0.24); }
@media (max-width: 520px) {
  .i-top-in { gap: 8px; padding: 0 10px; }
  .i-home .i-brand { font-size: 1rem; letter-spacing: 0.04em; }
  .i-nav a { padding: 0 9px; font-size: 0.8rem; }
  .i-share { min-width: 56px; }
}
@media (max-width: 380px) { .i-nav a span { display: none; } }

.i-count { margin: 0 0 12px; font-weight: 700; color: var(--navy-2); }
.i-count b { color: var(--red); font-size: 1.2em; }
.i-extras { display: grid; gap: 10px; }
.i-extra {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: var(--chip); color: var(--ink); text-decoration: none;
}
.i-extra:hover, .i-extra:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.i-extra-ic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--navy); font-size: 1.4rem; }
.i-extra > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.i-extra strong { font-size: 1rem; }
.i-extra small { color: var(--muted); font-size: 0.85rem; }
.i-extra-go { color: var(--red); font-weight: 900; }
.i-foot a { color: inherit; font-weight: 700; }
@media (prefers-color-scheme: dark) { .i-count { color: var(--gold); } }
