:root {
  --sea: #087e8b;
  --deep: #0b4350;
  --sand: #f4a261;
  --foam: #f7faf8;
  --ink: #18363a;
  --muted: #688085;
  --line: #e3eeeb;
  --shadow: 0 12px 32px rgba(11, 67, 80, .18);
  font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body, #map { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--foam); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.maplibregl-map { font-family: inherit; }
.maplibregl-ctrl-bottom-left { left: 344px; }
.maplibregl-ctrl-group { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow) !important; }

.maplibregl-popup-content {
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(11, 67, 80, .25);
}
.maplibregl-popup-close-button { z-index: 1; padding: 7px 11px; color: var(--muted); font-size: 22px; }
.popup { min-width: 235px; }
.popup-head { padding: 16px 38px 14px 17px; color: #fff; background: linear-gradient(145deg, var(--sea), var(--deep)); }
.popup-head small { color: #d8f3f0; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.popup-head h3 { margin: 5px 0 0; font-size: 17px; }
.popup-body { padding: 14px 17px 16px; }
.popup-body dl { display: grid; grid-template-columns: 62px 1fr; gap: 8px; margin: 0; font-size: 13px; }
.popup-body dt { color: var(--muted); }
.popup-body dd { margin: 0; overflow-wrap: anywhere; }
.popup-link { display: block; margin-top: 14px; padding: 10px 12px; border-radius: 15px; color: #fff; background: var(--sea); font-weight: 800; text-align: center; text-decoration: none; }
.popup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.popup-actions .popup-link { margin-top: 0; padding: 10px 8px; }
.popup-actions .street-view-link { color: var(--deep); background: #e6f3f1; }
.popup-head.live-popup { background: linear-gradient(145deg, #d9485f, #8f1830); }
.popup-head.pole-popup { background: linear-gradient(145deg, #d78324, #8a551c); }
.live-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.pole-note { margin: 13px 0 0; padding: 9px 10px; border-radius: 12px; color: #704b16; background: #fff0dd; font-size: 10px; line-height: 1.5; }
.parking-alert { margin: 13px 0 0; padding: 10px 11px; border-radius: 14px; color: #704b16; background: #fff0dd; font-size: 11px; font-weight: 800; line-height: 1.5; }
.parking-alert small { display: block; margin-top: 3px; color: #846f55; font-size: 9px; font-weight: 500; }
.law-links { display: flex; gap: 10px; margin-top: 9px; font-size: 10px; }
.law-links a { color: var(--sea); font-weight: 800; text-decoration: none; }

.topbar {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 366px;
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--sea), var(--deep)); font-weight: 900; box-shadow: 0 7px 17px rgba(8, 126, 139, .3); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .03em; }
.brand p { margin: 3px 0 0; color: var(--sea); font-size: 11px; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 15px; color: var(--sea); background: #e6f3f1; }
.menu-button { display: none; margin-right: 10px; pointer-events: auto; }

.panel {
  position: absolute;
  z-index: 5;
  inset: 14px auto 14px 14px;
  width: 330px;
  display: flex;
  flex-direction: column;
  padding: 25px 22px 20px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 28px;
  background: rgba(247, 250, 248, .97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.eyebrow { color: var(--sea); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.panel h2 { margin: 5px 0 0; font-size: 27px; line-height: 1.15; }
.close-button { display: none; font-size: 24px; }
.field { display: block; margin-bottom: 17px; }
.field > span, .field legend { display: block; margin-bottom: 7px; color: #436267; font-size: 12px; font-weight: 800; }
.input-wrap { display: flex; align-items: center; gap: 8px; height: 47px; padding: 0 13px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 5px 18px rgba(23, 74, 73, .07); }
.input-wrap:focus-within { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(8, 126, 139, .1); }
.input-wrap input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-key { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; margin: -7px 0 17px; color: var(--muted); font-size: 10px; }
.type-key span { display: flex; align-items: center; min-width: 0; gap: 5px; white-space: nowrap; }
.type-key canvas { width: 22px; height: 26px; flex: 0 0 auto; }
.field select { width: 100%; height: 44px; padding: 0 30px 0 11px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #fff; }
fieldset.field { padding: 0; border: 0; margin-top: 3px; }
.source-field label { display: flex; align-items: center; gap: 8px; margin: 11px 0; font-size: 13px; }
.source-field input { accent-color: var(--sea); }
.source-dot, .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.water { background: var(--sea); }
.taipei { background: var(--sand); }
.live { background: #d9485f; }
.pole { background: #d78324; }
.live-option em { margin-left: auto; padding: 2px 6px; border-radius: 8px; color: #fff; background: #d9485f; font-size: 9px; font-style: normal; font-weight: 900; letter-spacing: .08em; }
.live-status { margin: -3px 0 14px 25px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.live-status.loading { color: var(--sea); }
.live-status.error { color: #b4233b; }
.data-updated { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -3px 0 14px 25px; color: var(--muted); font-size: 10px; }
.data-updated time { color: var(--deep); font-weight: 800; }
.pole-field { margin: 2px 0 15px; padding: 13px !important; border: 1px solid #f0dcc2 !important; border-radius: 17px; background: #fffaf4; }
.pole-field legend { padding: 0 5px; }
.pole-option { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pole-option input { accent-color: #d78324; }
.pole-option em { margin-left: auto; padding: 2px 6px; border-radius: 8px; color: #704b16; background: #ffe3bd; font-size: 9px; font-style: normal; font-weight: 900; }
.pole-status { margin: 7px 0 9px 25px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.pole-status.loading { color: #a86117; }
.pole-status.error { color: #b4233b; }
.pole-search { display: grid; grid-template-columns: 1fr 58px; gap: 7px; }
.pole-search input, .pole-search button { height: 38px; border: 1px solid #ead4b9; border-radius: 12px; }
.pole-search input { min-width: 0; padding: 0 10px; color: var(--ink); background: #fff; }
.pole-search button { padding: 0; color: #fff; background: #d78324; font-size: 11px; font-weight: 800; }
.pole-search input:disabled, .pole-search button:disabled { cursor: not-allowed; opacity: .55; }
.pole-help { margin: 7px 0 9px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.pole-field .data-updated { margin: 0; }
.secondary-button { width: 100%; height: 43px; border: 1px solid #cfe1dd; border-radius: 16px; color: var(--sea); background: #e6f3f1; font-weight: 800; }
.secondary-button:hover { background: #d8eeeb; }
.panel-foot { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.panel-foot p { display: flex; align-items: baseline; gap: 7px; margin: 0 0 10px; }
.panel-foot strong { color: var(--sea); font-size: 28px; }
.panel-foot span { color: var(--muted); font-size: 12px; }
details { color: var(--muted); font-size: 11px; line-height: 1.55; }
summary { margin-bottom: 4px; cursor: pointer; font-weight: 700; }
.legal-block { padding: 10px 11px; border-radius: 14px; color: #704b16; background: #fff0dd; }
.legal-block strong { color: #8a551c; font-size: 12px; }
.legal-block p { margin: 5px 0; }
.legal-block nav { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 7px 0; }
.legal-block a { color: var(--sea); font-weight: 800; text-decoration: none; }
.seo-copy { margin: 10px 0; padding-top: 8px; border-top: 1px solid rgba(138, 85, 28, .18); }
.seo-copy h3 { margin: 8px 0 3px; color: #8a551c; font-size: 11px; }
.seo-copy p { display: block; margin: 0 0 7px; line-height: 1.6; }
.source-dates { margin-top: 9px; padding: 8px 9px 3px; border-radius: 10px; background: rgba(255,255,255,.56); }
.source-dates p { display: grid; grid-template-columns: 86px 1fr; gap: 5px; }
.source-dates b { color: #704b16; }
.legal-block small { display: block; color: #776652; line-height: 1.5; }

.map-action { position: absolute; z-index: 3; right: 17px; width: 46px; height: 46px; border: 0; border-radius: 15px; color: var(--sea); background: #fff; box-shadow: var(--shadow); font-size: 22px; }
.locate-button { bottom: 82px; }
.legend { position: absolute; z-index: 3; right: 17px; bottom: 24px; display: flex; gap: 13px; padding: 10px 13px; border-radius: 15px; background: rgba(255, 255, 255, .95); box-shadow: var(--shadow); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.scrim { display: none; }
.toast { position: absolute; z-index: 8; bottom: 28px; left: 50%; padding: 11px 16px; border-radius: 15px; color: #fff; background: var(--deep); opacity: 0; transform: translate(-50%, 18px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .panel { inset: 10px auto 10px 10px; width: min(88vw, 340px); transform: translateX(-115%); transition: transform .24s ease; }
  .panel.open { transform: translateX(0); }
  .panel-foot { position: static; margin-top: 40px; }
  .close-button, .menu-button { display: block; }
  .topbar { top: 10px; left: 10px; padding: 8px 12px; border-radius: 18px; }
  .brand-mark { display: none; }
  .brand h1 { font-size: 16px; }
  .scrim { display: block; position: absolute; z-index: 4; inset: 0; background: rgba(9, 47, 53, .5); opacity: 0; transition: .2s; pointer-events: none; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .maplibregl-ctrl-bottom-left { left: 0; }
  .legend { bottom: 18px; }
  .locate-button { bottom: 70px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
