:root {
  color-scheme: light;
  --ink: #1d2734;
  --muted: #5c6870;
  --paper: #faf8f1;
  --paper-dark: #efece3;
  --sea: #aac6c2;
  --line: #d8d9d1;
  --debate-1: #e8ba43;
  --debate-2: #32b7c8;
  --debate-3: #ef9238;
  --debate-4: #7d72dc;
  --shadow: 0 15px 44px rgb(22 40 48 / 17%);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; }
body { background: var(--sea); color: var(--ink); }
button, input, a { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #1c6b90; outline-offset: 3px; }
a { color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 80; left: 12px; top: -100px; padding: 12px 16px; background: #fff; border-radius: 8px; }
.skip-link:focus { top: 12px; }

.archipelago { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 27%); min-height: 100vh; min-height: 100dvh; overflow: hidden; }
.scene-pane { position: relative; min-width: 0; min-height: 620px; height: 100vh; height: 100dvh; overflow: hidden; background: var(--sea); }
.scene-canvas { position: absolute; inset: 0; }
.scene-canvas canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.scene-pane::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgb(13 31 46 / 6%), transparent 29%, transparent 69%, rgb(17 42 46 / 12%)); }
.scene-header { position: absolute; z-index: 8; left: 22px; right: 22px; top: 22px; display: flex; align-items: flex-start; flex-wrap: wrap; gap: 14px; pointer-events: none; }
.brand-card, .scene-tools { pointer-events: auto; }
.mobile-map-link { display: none; }
.brand-card { min-height: 62px; max-width: 280px; background: rgb(252 250 244 / 95%); border: 1px solid rgb(255 255 255 / 80%); border-radius: 15px; box-shadow: 0 7px 24px rgb(31 58 68 / 12%); padding: 11px 15px; }
.brand-kicker { margin: 0 0 3px; font-size: .69rem; font-weight: 700; letter-spacing: .02em; }
.brand-card h1 { margin: 0; font-size: .93rem; line-height: 1.22; font-weight: 800; white-space: nowrap; }
.brand-card h1 span { margin-left: 6px; font-size: .63rem; font-weight: 700; letter-spacing: .055em; }
.scene-tools { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; max-width: calc(100% - 300px); background: rgb(255 255 255 / 95%); border: 1px solid rgb(255 255 255 / 72%); border-radius: 999px; box-shadow: 0 6px 22px rgb(31 58 68 / 14%); }
.tool-button { min-width: 48px; min-height: 48px; padding: 3px 7px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; font-size: .59rem; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.tool-button span:first-child { font-size: 1.16rem; line-height: 1; }
.tool-button:hover { background: #e8ece9; }
.tool-button.is-on, .tool-button[aria-pressed="true"] { background: var(--ink); color: white; }
.tool-link { min-width: 61px; }
.scene-message { position: absolute; z-index: 9; top: 103px; left: 22px; max-width: min(620px, calc(100% - 44px)); padding: 10px 14px; border-radius: 10px; background: rgb(255 255 255 / 94%); box-shadow: var(--shadow); font-size: .79rem; line-height: 1.5; }

.timeline { position: absolute; z-index: 7; left: 22px; right: 22px; bottom: 22px; min-height: 124px; padding: 12px 17px 11px; border: 1px solid rgb(255 255 255 / 82%); border-radius: 17px; background: rgb(255 255 255 / 96%); box-shadow: var(--shadow); }
.timeline-current { display: flex; align-items: center; gap: 12px; min-width: 0; }
.play-button { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: var(--ink); color: white; font-size: .88rem; }
.play-button:hover { background: #394653; }
.timeline-heading { min-width: 0; }
.timeline-heading p { margin: 0; }
.timeline-heading p:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: .79rem; font-weight: 700; }
.timeline-heading strong { font-size: 1.08rem; }
.timeline-subtitle { max-width: 43ch; color: var(--muted); font-size: .68rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeline-help { margin-left: auto; color: #37444c; font-size: .67rem; white-space: nowrap; }
.tour-controls { display: flex; gap: 4px; margin-left: auto; }
.tour-controls button { min-width: 44px; min-height: 44px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #f3f2ec; color: var(--ink); font-size: .75rem; font-weight: 700; }
.tour-controls button:hover { background: #e8ece9; }
.year-range-wrap { padding: 3px 0 0 55px; }
#year-range { display: block; width: 100%; height: 22px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; --period-color: var(--debate-1); --progress: 0%; }
#year-range::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: linear-gradient(to right, var(--period-color) 0%, var(--period-color) var(--progress), #d8dbe0 var(--progress), #d8dbe0 100%); }
#year-range::-moz-range-track { height: 5px; border-radius: 99px; background: #d8dbe0; }
#year-range::-moz-range-progress { height: 5px; border-radius: 99px; background: var(--period-color); }
#year-range::-webkit-slider-thumb { width: 15px; height: 15px; margin-top: -5px; border: 3px solid white; border-radius: 50%; background: var(--period-color); box-shadow: 0 0 0 1px var(--period-color); appearance: none; -webkit-appearance: none; }
#year-range::-moz-range-thumb { width: 11px; height: 11px; border: 3px solid white; border-radius: 50%; background: var(--period-color); box-shadow: 0 0 0 1px var(--period-color); }
.range-ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: .56rem; line-height: 1; }
.period-buttons { display: flex; gap: 4px; padding-left: 55px; margin-top: 6px; }
.period-button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 4px 8px; border: 1px solid transparent; border-radius: 9px; background: #f4f3ec; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); font-size: .67rem; font-weight: 700; line-height: 1.1; }
.period-button::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--period-color); }
.period-button:hover { border-color: var(--period-color); }
.period-button.is-current { background: var(--period-color); color: #152333; }
.period-button.is-current::before { background: currentColor; }
.period-button small { font-size: .58rem; font-weight: 600; opacity: .75; }
.period-short { display: none; }

.loading-overlay { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; background: rgb(160 193 192 / 84%); backdrop-filter: blur(6px); }
.loading-card { width: min(330px, calc(100% - 38px)); min-height: 160px; padding: 28px; border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.loading-mark { display: block; margin-bottom: 9px; color: #447c7d; font-size: 2.1rem; animation: loading-bob 1.6s ease-in-out infinite; }
.loading-card strong { font-size: 1rem; }
.loading-card p { margin: 8px 0 0; font-size: .76rem; color: var(--muted); line-height: 1.5; }
@keyframes loading-bob { 50% { transform: translateY(-7px); } }

.side-panel { z-index: 6; height: 100vh; height: 100dvh; overflow-y: auto; overflow-anchor: none; background: var(--paper); border-left: 1px solid #fff; padding: 23px 19px 22px; scrollbar-color: #b9b8ad transparent; }
.sheet-handle { display: none; }
.eyebrow { margin: 0 0 13px; color: #9a3146; font-size: .64rem; font-weight: 900; letter-spacing: .18em; }
.side-panel h2 { margin: 0 0 10px; font-size: 1.14rem; line-height: 1.38; letter-spacing: .01em; }
.panel-intro, .period-caveat { margin: 0 0 11px; color: #344149; font-size: .76rem; line-height: 1.52; }
.period-caveat { border-left: 3px solid #a4bfc1; padding-left: 9px; color: var(--muted); font-size: .68rem; }
.search-field { display: flex; align-items: center; gap: 7px; min-height: 44px; margin: 17px 0 10px; padding: 0 11px; background: #fff; border: 1px solid #dddcd4; border-radius: 9px; color: #52626b; }
.search-field span { font-size: 1.1rem; }
.search-field input { width: 100%; height: 42px; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; font-size: .75rem; }
.search-field:focus-within { outline: 3px solid #9ac7d7; }
.index-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.index-tabs button { flex: 1 1 0; min-height: 44px; border: 1px solid #e0ded5; border-radius: 8px; background: #fff; color: var(--ink); font-size: .75rem; font-weight: 700; }
.index-tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: white; }
.family-filter { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.family-filter:empty { display: none; }
.family-filter button { min-height: 44px; padding: 4px 10px; border: 1px solid #d7d7d0; border-radius: 999px; background: #fff; color: #344149; font-size: .65rem; }
.family-filter button.is-active { border-color: var(--ink); background: #e8ece9; color: var(--ink); font-weight: 700; }
.index-list { margin: 0; padding: 0; list-style: none; }
.index-list li { border-bottom: 1px solid #e6e5dc; }
.index-list button { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; width: 100%; min-height: 56px; gap: 7px; padding: 5px 2px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.index-list button:hover { background: #f0eee7; }
.index-list .index-number { font-size: .65rem; color: var(--muted); font-weight: 700; }
.index-name { display: block; font-size: .76rem; line-height: 1.24; font-weight: 800; overflow-wrap: anywhere; }
.index-subtitle { display: block; margin-top: 3px; font-size: .65rem; line-height: 1.25; color: var(--muted); }
.index-extra { color: #43505a; font-size: .61rem; white-space: nowrap; }
.index-extra::after { content: " ↗"; font-size: .78rem; }
.empty-result { padding: 17px 4px; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.panel-footer { margin-top: 24px; border-top: 1px solid var(--line); }
.panel-footer p { color: #677078; font-size: .65rem; line-height: 1.55; }

.detail-top { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.detail-type { margin: 0 0 8px; color: #9a3146; font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.detail-close, .detail-back { min-width: 44px; min-height: 44px; border: 1px solid #dddcd4; border-radius: 50%; background: #fff; color: var(--ink); font-size: 1.08rem; }
.detail-back { border-radius: 9px; padding: 0 11px; font-size: .74rem; }
.detail-view h2 { font-size: 1.15rem; margin: 4px 0 5px; }
.detail-meta { margin: 0 0 16px; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.detail-section { margin: 14px 0; padding: 13px 12px; border: 1px solid #ebe9e1; border-radius: 10px; background: #fff; }
.detail-section h3 { margin: 0 0 8px; font-size: .72rem; color: #49515a; }
.detail-section p { margin: 0; font-size: .76rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-section p + h3 { margin-top: 13px; }
.detail-list { list-style: none; margin: 0; padding: 0; }
.detail-list li { border-top: 1px solid #edece6; }
.detail-list li:first-child { border-top: 0; }
.detail-list button, .detail-list a { display: flex; justify-content: space-between; width: 100%; min-height: 44px; align-items: center; gap: 9px; padding: 7px 0; background: transparent; border: 0; font-size: .72rem; font-weight: 700; text-align: left; text-decoration: none; }
.detail-list button:hover, .detail-list a:hover { text-decoration: underline; }
.evidence-tag { display: inline-block; margin: 7px 0 0; padding: 4px 8px; border-radius: 999px; background: #f0e9d8; color: #5f4e1f; font-size: .65rem; font-weight: 700; }
.read-link { display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 14px; padding: 10px 14px; border-radius: 9px; background: #a83143; color: #fff; text-decoration: none; font-size: .79rem; font-weight: 800; }
.read-link:hover { background: #862338; }
.detail-muted { color: var(--muted); font-size: .73rem; line-height: 1.5; }

.noscript { position: fixed; z-index: 90; inset: 20px auto auto 20px; padding: 15px; background: white; }

@media (max-width: 1150px) {
  .archipelago { grid-template-columns: minmax(0, 1fr) minmax(300px, 29%); }
  .scene-header { left: 14px; right: 14px; top: 14px; gap: 7px; }
  .brand-card { padding: 8px 11px; }
  .scene-tools { max-width: 100%; }
  .timeline { left: 14px; right: 14px; bottom: 14px; }
  .timeline-help { display: none; }
}

@media (max-width: 760px) {
  .archipelago { display: block; min-height: 100vh; min-height: 100dvh; }
  .scene-pane { width: 100%; height: 76vh; height: 76dvh; min-height: 450px; }
  .scene-header { left: 10px; right: 10px; top: max(9px, env(safe-area-inset-top)); }
  .brand-card { min-height: 44px; max-width: calc(100% - 56px); padding: 7px 10px; }
  .mobile-map-link { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-left: auto; padding: 0 11px; border-radius: 11px; background: rgb(252 250 244 / 95%); box-shadow: 0 7px 24px rgb(31 58 68 / 12%); color: var(--ink); font-size: .68rem; font-weight: 800; text-decoration: none; pointer-events: auto; }
  .brand-kicker { font-size: .6rem; }
  .brand-card h1 { font-size: .73rem; }
  .brand-card h1 span { display: none; }
  .scene-tools { width: 100%; order: 2; justify-content: space-between; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; border-radius: 13px; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 0%, #000 91%, transparent 100%); mask-image: linear-gradient(to right, #000 0%, #000 91%, transparent 100%); }
  .scene-tools::-webkit-scrollbar { display: none; }
  .tool-button { flex: 0 0 48px; min-width: 48px; }
  .scene-message { top: 116px; left: 10px; max-width: calc(100% - 20px); }
  .timeline { left: 8px; right: 8px; bottom: 8px; min-height: 111px; padding: 9px 10px; border-radius: 12px; }
  .timeline-current { gap: 8px; }
  .timeline-heading p:first-child { font-size: .69rem; gap: 5px; }
  .timeline-heading strong { font-size: .86rem; }
  .timeline-subtitle { max-width: 33ch; font-size: .6rem; }
  .year-range-wrap, .period-buttons { padding-left: 0; }
  .range-ticks { font-size: .49rem; }
  .range-ticks span:nth-child(even) { display: none; }
  .period-buttons { gap: 3px; }
  .period-button { min-height: 44px; padding: 4px 2px; font-size: .61rem; }
  .period-long { display: none; }
  .period-short { display: inline; }
  .period-button small { display: none; }
  .tour-controls button { padding: 0 6px; }
  .side-panel { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 25vh; height: 25dvh; min-height: 190px; max-height: 76vh; z-index: 30; overflow-y: auto; padding: 8px 16px max(16px, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid #fff; border-radius: 17px 17px 0 0; box-shadow: 0 -8px 30px rgb(13 33 47 / 22%); transition: height .28s ease; }
  .side-panel.is-expanded { height: 74vh; height: 74dvh; }
  .sheet-handle { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; margin: -8px 0 0; border: 0; background: transparent; }
  .sheet-handle span { display: block; width: 42px; height: 4px; background: #c9c7bd; border-radius: 99px; }
  .eyebrow { margin-bottom: 5px; }
  .side-panel h2 { font-size: .95rem; margin-bottom: 5px; }
  .panel-intro, .period-caveat { font-size: .67rem; margin-bottom: 5px; }
  .search-field { margin: 10px 0 8px; }
  .detail-section { margin: 10px 0; }
}

@media (max-width: 420px) {
  .scene-tools { padding: 3px; }
  .tool-button { flex-basis: 46px; min-width: 46px; }
  .tool-link { flex-basis: 54px; }
  .tool-button span:last-child { font-size: .53rem; }
  .timeline-heading { max-width: calc(100% - 52px); }
  .timeline-subtitle { max-width: 27ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
