:root {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #242e39;
  background: #edf0eb;
  --blue: #2256a8;
  --muted: #52606d;
  --divider: #dce2e5;
  --surface: #fff;
  --shadow: 0 2px 6px #1b302417, 0 8px 28px #1b302414;
  --inset: 18px;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid #3877c6; outline-offset: 2px;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library { position: absolute; width: 0; height: 0; pointer-events: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.workspace { position: relative; width: 100%; height: 100%; }
.map { position: absolute; inset: 0; isolation: isolate; overflow: hidden; background: #edf0eb; }
#mapSurface { position: absolute; inset: 0; touch-action: none; cursor: grab; outline-offset: -3px; }
#mapSurface, #mapWorld { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#mapWorld img { -webkit-user-drag: none; }
#mapSurface.dragging { cursor: grabbing; }
#mapSurface:focus-visible { outline: 3px solid #397bc9; }
#mapCanvas { display: block; height: 100%; width: 100%; pointer-events: none; transform-origin: 0 0; will-change: transform; }
#mapWorld { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: none; }
#mapWorld canvas, #mapWorld img { position: absolute; display: block; transform-origin: 0 0; }
#selectedMarker { position: absolute; top: -7px; left: -7px; width: 14px; height: 14px; border: 2px solid white; border-radius: 50%; background: #245cbb; box-shadow: 0 0 0 1px #245cbb, 0 0 0 4px #245cbb46; pointer-events: none; }

.search-tools, .app-brand, .map-tools, .panel { position: absolute; z-index: 3; }
.search-tools { top: var(--inset); left: var(--inset); width: min(368px, calc(100% - 192px)); }
.address-form, .app-brand, .map-tools > button, .zoom-pair, .panel, .readout, .address-results {
  background: var(--surface); border: 1px solid #a9b6af99; box-shadow: var(--shadow);
}
.address-form { position: relative; display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 4px 5px 4px 13px; }
.address-form > svg { width: 19px; color: #5b6874; }
.address-form input { flex: 1; width: 0; min-width: 0; height: 36px; padding: 0; background: transparent; color: #253240; border: 0; border-radius: 4px; font-size: .97rem; }
.address-form input:focus-visible { outline: 0; }
.address-form:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px #356bc62b, var(--shadow); }
.address-form button { border: 0; background: transparent; }
.address-form > button[type=submit] { min-height: 34px; padding: 0 10px; white-space: nowrap; color: var(--blue); font-weight: 600; border-radius: 9px; font-size: .875rem; }
.address-form .scope-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; background: #edf2f7; color: #354e64; border-radius: 5px; font-size: .8rem; white-space: nowrap; }
.scope-chip svg { width: 12px; height: 12px; }
.address-form > button:hover, .text-button:hover, .icon-button:hover { background: #edf2f7; }
.address-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; padding: 5px; border-radius: 13px; max-height: min(46dvh,390px); overflow: auto; }
.address-results p { padding: 7px 8px; font-size: .8rem; color: var(--muted); }
.address-results ul { list-style: none; padding: 0; margin: 0; }
.address-results button { width: 100%; min-height: 39px; text-align: left; padding: 7px 8px; border-radius: 6px; }
.address-results button:hover, .address-results button:focus { background: #ecf2f7; }
.app-brand { top: var(--inset); right: var(--inset); display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 7px; border-radius: 12px; background: #fdfefbf2; box-shadow: 0 1px 3px #24352820; pointer-events: none; }
.app-brand img { width: 34px; height: 34px; }
.app-brand span { font-size: .91rem; line-height: .98; font-weight: 650; letter-spacing: -.025em; color: #233b4b; }
.map-tools { top: calc(var(--inset) + 56px); right: var(--inset); display: grid; gap: 7px; }
.map-tools button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; background: var(--surface); color: #364758; }
.map-tools > button, .zoom-pair { border-radius: 12px; }
.zoom-pair { overflow: hidden; }
.zoom-pair button { border: 0; width: 40px; height: 40px; }
.zoom-pair button + button { border-top: 1px solid var(--divider); }
.map-tools button:hover, .map-tools button[aria-expanded=true] { background: #e9f0fa; color: var(--blue); }
.zoom-pair button:focus-visible { outline-offset: -3px; }
.load-status { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); padding: 4px 9px; background: #fffffff2; color: var(--muted); border-radius: 7px; font-size: .8rem; pointer-events: none; }
.load-status button { pointer-events: auto; border: 0; color: var(--blue); background: none; }

.panel { top: calc(var(--inset) + 56px); right: calc(var(--inset) + 51px); width: min(328px,calc(100vw - 92px)); max-height: calc(100dvh - 110px); border-radius: 16px; overflow-y: auto; overscroll-behavior: contain; }
.panel-body { padding: 10px 16px 8px; }
.panel-title, .dialog-head, .readout-top, .readout-verdict { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.panel-title h2 { font-size: 1.13rem; font-weight: 670; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #526174; flex: none; }
.icon-button svg { width: 17px; height: 17px; }
.panel h3, .layer { font-size: .93rem; }
.panel h3 { font-weight: 640; }
.preset-section { padding: 11px 0 14px; margin-bottom: 12px; border-bottom: 1px solid var(--divider); }
input[type=range] { --fill: 100%; appearance: none; -webkit-appearance: none; cursor: pointer; width: 100%; height: 25px; margin: 2px 0 0; display: block; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 8px; background: linear-gradient(to right,var(--blue) var(--fill),#d3dae5 var(--fill)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 8px; background: linear-gradient(to right,var(--blue) var(--fill),#d3dae5 var(--fill)); }
input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 17px; height: 17px; border: 2px solid #fff; background: var(--blue); border-radius: 50%; margin-top: -6.5px; box-shadow: 0 0 0 1px var(--blue); }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #fff; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 1px var(--blue); }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; }
.ticks .selected { color: var(--blue); font-weight: 700; }
.district-field { position: relative; display: flex; align-items: center; border: 1px solid #ced7dc; border-radius: 8px; padding-left: 9px; gap: 8px; }
.district-field label { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.district-field select { flex: 1; min-width: 0; height: 35px; appearance: none; padding: 0 26px 0 5px; color: #28465b; font-weight: 600; border: 0; border-radius: 6px; background: transparent; }
.district-field svg { position: absolute; right: 8px; width: 15px; pointer-events: none; }
.layer { display: flex; align-items: center; gap: 9px; position: relative; min-height: 36px; padding: 2px 3px; border-radius: 6px; cursor: pointer; }
.layer:hover { background: #f0f4f6; }
.layer input { position: absolute; opacity: 0; right: 0; width: 38px; height: 32px; margin: 0; }
.toggle { height: 20px; width: 34px; border-radius: 12px; background: #d6dde2; box-shadow: inset 0 0 0 1px #a7b2ba; margin-left: auto; position: relative; flex: none; }
.toggle::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #687785; position: absolute; left: 3px; top: 3px; transition: transform .14s; }
input:checked + .toggle { background: var(--blue); box-shadow: none; }
input:checked + .toggle::after { transform: translateX(14px); background: #fff; }
input:focus-visible + .toggle { outline: 3px solid #397bc9; outline-offset: 2px; }
.label-option { margin: 4px 0; }
.rank-section, .layer-section, .terrain-settings, .panel-actions { border-top: 1px solid var(--divider); }
.rank-section { padding: 3px 0 12px; }
#rankLegend, #rankLegend > span, .hit-types > span { display: flex; align-items: center; }
#rankLegend { gap: 14px; padding: 0 3px; font-size: .82rem; color: var(--muted); }
#rankLegend > span, .hit-types > span { gap: 5px; }
.swatch { display: inline-block; flex: none; width: 15px; height: 10px; border: 1px solid var(--color); border-radius: 3px; background: var(--paint); }
.setting-note { padding: 4px 3px 0; font-size: .81rem; line-height: 1.5; color: var(--muted); }
.rank-locate { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; margin-top: 7px; border: 1px solid #d6c6e1; border-radius: 7px; background: #f7f2fb; color: #602f86; }
.rank-locate svg { width: 15px; height: 15px; }
.rank-locate b { font-size: .82rem; font-weight: 600; }
.rank-locate:hover { background: #efe7f5; }
.rank-locate:disabled { background: #f6f5f7; color: var(--muted); cursor: default; }
.layer-section { padding: 10px 0 7px; }
.layer-section h3 { padding-bottom: 3px; }
.layer-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 7px; }
.layer-name small { color: var(--muted); font-size: .76rem; }
.terrain-settings { padding: 2px 0 4px; }
#terrainControls { padding: 0 3px 5px; }
.panel-actions { display: flex; justify-content: space-between; gap: 3px; padding-top: 4px; }
.text-button { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: #385968; background: transparent; border: 0; border-radius: 6px; padding: 3px 4px; font-size: .8rem; }
.text-button svg { width: 15px; height: 15px; }

.readout { position: absolute; left: var(--inset); bottom: 40px; width: min(355px,calc(100% - 80px)); max-height: min(58dvh,430px); border-radius: 14px; overflow: auto; overscroll-behavior: contain; padding: 9px 14px 13px; }
.readout.with-terrain { max-height: min(74dvh,570px); }
.readout-top { align-items: flex-start; }
#selectedAddress { padding: 4px 0 0; color: #435869; font-size: .93rem; font-weight: 560; line-height: 1.5; }
.readout-verdict { justify-content: flex-start; margin: 1px 0 6px; }
.readout h2 { font-size: 1.16rem; font-weight: 670; }
#readPreset { font-size: .75rem; font-weight: 600; border: 1px solid #cdd5dc; border-radius: 5px; padding: 1px 5px; color: #455766; }
.readout[data-rank=first] h2 { color: #632b93; }
.readout[data-rank=second] h2 { color: #77548f; }
.read-text { font-size: .87rem; color: var(--muted); line-height: 1.58; overflow-wrap: anywhere; }
.hit-types { display: flex; flex-wrap: wrap; gap: 3px 13px; }
.hit-types > span { font-weight: 600; }
.hit-types .swatch { width: 10px; height: 8px; }
.source-details { margin: 8px 0 1px; border-top: 1px solid var(--divider); }
.source-details summary { padding: 7px 0 2px; font-size: .83rem; color: #32546d; }
.hit-group > strong, .embrace-sources strong { display: block; font-size: .82rem; margin-top: 7px; }
.hit-row { padding: 4px 0; border-bottom: 1px solid #edf0f2; }
.hit-row:last-child { border-bottom: 0; }
.hit-line { font-weight: 560; color: #293847; }
.hit-meta { display: block; font-size: .8rem; }
.embrace-sources { padding: 4px 0; }
.base-verdict { display: block; color: #35475d; margin: 4px 0; }
.reveal { display: inline-flex; align-items: center; gap: 5px; color: #164da5; background: #e8f0ff; border: 0; border-radius: 7px; padding: 5px 9px; margin-top: 6px; font-size: .84rem; }
.reveal svg { width: 16px; }
#terrainPrompt { color: var(--blue); margin-top: 6px; }
#terrainDetails { border-top: 1px solid var(--divider); padding: 7px 0 0; margin-top: 7px; }
#terrainDetails > h3 { font-size: .93rem; }
#terrainDetails[data-status=exclude] #terrainVerdict, #directions [data-status=hit] small { color: #98472e; }
#terrainDetails[data-status=review] #terrainVerdict { color: #835e23; }
#terrainDetails[data-status=keep] #terrainVerdict { color: #346651; }
.profile-heading { display: flex; align-items: baseline; justify-content: space-between; padding-top: 7px; }
.profile-heading h3 { font-size: .875rem; }
.profile-heading span { font-size: .75rem; color: var(--muted); }
#directions { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin: 7px 0 4px; }
#directions button { min-height: 40px; background: #f8fafd; border: 1px solid #dce2e8; border-radius: 7px; font-size: .8rem; font-weight: 600; }
#directions button[aria-pressed=true] { border-color: var(--blue); background: #eaf1ff; color: #164da5; }
#directions small { display: block; font-size: .73rem; font-weight: 450; color: var(--muted); }
#profile { display: block; width: 100%; height: 100px; }
#profileText { font-size: .81rem; line-height: 1.5; color: #394758; }

.map-footer { pointer-events: none; position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; padding: 5px var(--inset); }
.credits, .scale { color: #3b4c4d; background: #fffffff0; border-radius: 3px; font-size: .75rem; line-height: 1.4; }
.credits { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 8px; padding: 2px 6px; }
.credits a { pointer-events: auto; color: #405b62; }
.scale { display: grid; justify-items: center; padding: 1px 3px 3px; }
.scale i { border: solid #465656; border-width: 0 1px 2px; height: 4px; }

dialog { border: 1px solid #d0d9df; color: #263747; border-radius: 16px; padding: 16px 22px 22px; width: min(515px,92vw); max-height: 84dvh; box-shadow: 0 16px 65px #18283832; }
dialog::backdrop { background: #1b283d69; }
dialog h2 { font-size: 1.21rem; }
dialog h3 { font-size: .98rem; margin: 14px 0 5px; }
dialog p { color: var(--muted); line-height: 1.63; font-size: .93rem; }
dialog .product-name { margin: 10px 0 3px; font-weight: 600; color: #334c60; }
.version-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.version-row .text-button { min-height: 25px; color: var(--blue); }
dialog details { border-top: 1px solid var(--divider); margin-top: 11px; }
dialog summary { padding: 10px 0 2px; font-weight: 600; font-size: .94rem; }
dialog details p { margin-top: 6px; }
dialog .source { font-size: .84rem; }
dialog a { color: #245a91; }
.terrain-presets { border-collapse: collapse; width: 100%; text-align: center; font-size: .81rem; }
.terrain-presets caption { text-align: left; margin: 10px 0 4px; }
.terrain-presets th, .terrain-presets td { padding: 4px 2px; border-bottom: 1px solid var(--divider); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
