:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;
  color: #253447;
  background: #f3f5f5;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: #285b83; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 28px;
  min-height: 108px; padding: 18px clamp(18px, 3vw, 44px);
  background: #fff; border-bottom: 1px solid #d9e0e3;
}
.brand h1 { margin: 2px 0 3px; font-size: clamp(23px, 2.2vw, 32px); letter-spacing: .025em; }
.brand p { margin: 0; font-size: 13px; color: #61717d; }
.eyebrow { color: #57718a; font-size: 11px; font-weight: 750; letter-spacing: .14em; }
.mode-switch { display: flex; padding: 4px; gap: 3px; border-radius: 12px; background: #edf1f2; white-space: nowrap; }
.mode-switch button { min-width: 86px; border: 0; border-radius: 9px; background: transparent; color: #536a79; padding: 9px 15px; font-weight: 700; }
.mode-switch button.active { background: #fff; color: #1d4d6a; box-shadow: 0 1px 5px #2c496022; }
.mode-switch button:hover, .view-controls button:hover { color: #194e73; }
.layout { display: grid; grid-template-columns: minmax(225px, 285px) minmax(460px, 1fr) minmax(250px, 310px); height: calc(100vh - 170px); min-height: 620px; }
.panel { background: #fff; overflow: auto; }
.left-panel { padding: 20px 16px; border-right: 1px solid #d9e0e3; }
.right-panel { padding: 24px 20px; border-left: 1px solid #d9e0e3; }
.panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.panel-heading h2 { margin: 0 0 16px; font-size: 18px; }
#count { color: #778893; font-size: 12px; white-space: nowrap; }
.field-label, .filter-grid label { display: block; color: #536879; font-size: 12px; font-weight: 700; }
#search, select { width: 100%; border: 1px solid #cad5dc; border-radius: 8px; background: #fff; color: #263d50; padding: 9px 10px; outline-color: #4483ab; }
#search { margin-top: 7px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 15px 0; }
.filter-grid select { margin-top: 6px; font-size: 12px; }
.directory { border-top: 1px solid #e1e7eb; }
.school-group { padding: 10px 0; border-bottom: 1px solid #e6ebee; }
.school-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 5px; padding: 4px 5px; font-size: 13px; color: #445b6c; }
.swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; }
.point-link { display: flex; align-items: center; gap: 7px; margin: 1px 0; padding: 7px 8px 7px 22px; border-radius: 7px; color: #334b5d; text-decoration: none; font-size: 13px; line-height: 1.35; }
.point-link:hover, .point-link:focus-visible { background: #eef5f8; color: #125780; outline: none; }
.source-mark { margin-left: auto; color: #886e31; font-size: 10px; font-weight: 700; white-space: nowrap; }
.source-mark.muted { color: #8b8990; }
.no-results { padding: 20px 4px; color: #667c8b; font-size: 13px; }
.map-area { position: relative; overflow: hidden; background: radial-gradient(circle at 55% 40%, #fff 0%, #edf2f3 78%); }
#canvas-wrap { position: absolute; inset: 0; cursor: grab; }
#canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.view-controls { position: absolute; top: 15px; left: 15px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 2; }
.view-controls button { border: 1px solid #c9d6dd; border-radius: 7px; background: #ffffffeb; padding: 7px 10px; color: #395568; font-size: 12px; font-weight: 650; }
.map-legend, .map-note { position: absolute; z-index: 1; border: 1px solid #d5e0e5; border-radius: 9px; background: #ffffffeb; box-shadow: 0 2px 13px #24435b10; font-size: 11px; line-height: 1.5; }
.map-legend { top: 65px; right: 13px; width: 185px; padding: 10px 12px; }
.map-legend strong { display: block; margin-bottom: 3px; color: #2b4051; font-size: 12px; }
.map-legend span { display: block; color: #516575; }
.map-legend small { display: block; margin-top: 5px; color: #8a543c; }
.map-note { bottom: 14px; left: 15px; max-width: 360px; padding: 10px 12px; pointer-events: none; }
.map-note strong { font-size: 12px; }
.map-note p { margin: 3px 0 0; color: #526778; }
#tooltip { position: absolute; z-index: 5; max-width: 235px; padding: 7px 9px; border-radius: 6px; background: #22384b; color: #fff; box-shadow: 0 5px 14px #18344f3d; font-size: 11px; line-height: 1.4; pointer-events: none; }
.map-error { position: absolute; top: 45%; left: 10%; right: 10%; text-align: center; color: #8a4e44; font-size: 14px; }
.empty-state { margin: 78px 10px; text-align: center; color: #667a88; font-size: 13px; line-height: 1.7; }
.empty-state h2 { margin: 8px 0; color: #344e62; font-size: 18px; }
.empty-icon { color: #9bb1bd; font-size: 44px; }
.detail-eyebrow { color: #637c8d; font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.details h2 { margin: 7px 0 4px; font-size: 23px; line-height: 1.3; }
.details .subtitle { margin: 0 0 13px; color: #697c88; font-size: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.badge { border-radius: 5px; background: #e8f1f6; color: #2f5c76; padding: 4px 7px; font-size: 11px; font-weight: 700; }
.badge.figure { background: #fff4df; color: #87621c; }
.badge.warning { background: #f6ece5; color: #885d46; }
.coordinate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 18px; }
.coordinate div { min-height: 65px; border: 1px solid #dce5e8; border-radius: 7px; background: #f7fafb; padding: 8px 5px; text-align: center; color: #627482; font-size: 10px; }
.coordinate b { display: block; margin-top: 5px; color: #254e68; font-size: 16px; }
.details h3 { margin: 19px 0 7px; font-size: 14px; }
.summary { margin: 0; color: #4d6270; font-size: 13px; line-height: 1.7; }
.open-button { display: block; margin-top: 20px; border-radius: 8px; background: #2d6e93; color: #fff; padding: 11px 12px; text-align: center; text-decoration: none; font-size: 13px; font-weight: 700; }
.open-button:hover { background: #205875; }
.source-link { display: block; margin-top: 12px; text-align: center; font-size: 12px; }
.footer { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; min-height: 62px; border-top: 1px solid #d9e0e3; background: #fff; color: #687b88; padding: 8px 16px; text-align: center; font-size: 11px; line-height: 1.4; }
@media (max-width: 1050px) { .layout { grid-template-columns: 225px minmax(360px, 1fr) 255px; } .map-legend { top: auto; bottom: 110px; } }
@media (max-width: 800px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .layout { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .left-panel { order: 2; border-right: 0; border-top: 1px solid #d9e0e3; max-height: 310px; }
  .map-area { order: 1; height: 520px; }
  .right-panel { order: 3; border-left: 0; border-top: 1px solid #d9e0e3; min-height: 230px; }
  .empty-state { margin: 28px 10px; }
  .map-legend { right: 10px; bottom: 99px; width: 160px; }
  .map-note { max-width: calc(100% - 195px); }
}
@media (max-width: 480px) {
  .topbar { padding: 15px; }
  .brand h1 { font-size: 22px; }
  .map-area { height: 455px; }
  .view-controls { top: 9px; left: 9px; gap: 4px; }
  .view-controls button { padding: 6px 7px; font-size: 10px; }
  .map-legend { display: none; }
  .map-note { left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 7px 9px; font-size: 10px; }
  .map-note::after { content: "X 物質／理念 · Y 個體／整體 · Z 研究取向"; display: block; margin-top: 4px; padding-top: 3px; border-top: 1px solid #dce5e8; color: #36546d; font-weight: 650; }
}
