
/* ===== Leaflet critical local fallback =====
   This keeps the map functional even if the external Leaflet CSS is blocked. */
.leaflet-container{
  position:relative;
  overflow:hidden;
  width:100%;
  height:100%;
  outline:0;
  background:#dcefed;
  -webkit-tap-highlight-color:transparent;
}
.leaflet-container:focus,
.leaflet-container:focus-visible{outline:none!important}
.leaflet-map-pane,
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane>svg,
.leaflet-pane>canvas,
.leaflet-zoom-box{
  position:absolute;
  left:0;
  top:0;
}
.leaflet-map-pane{z-index:200}
.leaflet-tile-pane{z-index:200}
.leaflet-overlay-pane{z-index:400}
.leaflet-shadow-pane{z-index:500}
.leaflet-marker-pane{z-index:600}
.leaflet-tooltip-pane{z-index:650}
.leaflet-popup-pane{z-index:700}
.leaflet-map-pane canvas{z-index:100}
.leaflet-map-pane svg{z-index:200}
.leaflet-vml-shape{width:1px;height:1px}
.lvml{display:inline-block;position:absolute}
.leaflet-control{
  position:relative;
  z-index:800;
  pointer-events:auto;
  float:left;
  clear:both;
}
.leaflet-top,
.leaflet-bottom{
  position:absolute;
  z-index:1000;
  pointer-events:none;
}
.leaflet-top{top:0}
.leaflet-right{right:0}
.leaflet-bottom{bottom:0}
.leaflet-left{left:0}
.leaflet-top .leaflet-control{margin-top:10px}
.leaflet-bottom .leaflet-control{margin-bottom:10px}
.leaflet-left .leaflet-control{margin-left:10px}
.leaflet-right .leaflet-control{margin-right:10px}
.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}
.leaflet-zoom-animated{transform-origin:0 0}
.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile{transition:none}
.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}
.leaflet-tile{
  width:256px;
  height:256px;
  border:0;
  margin:0;
  padding:0;
  visibility:hidden;
  user-select:none;
  -webkit-user-drag:none;
}
.leaflet-tile-loaded{visibility:inherit}
.leaflet-container img.leaflet-tile,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile{
  max-width:none!important;
  max-height:none!important;
}
.leaflet-container .leaflet-overlay-pane svg{
  max-width:none!important;
  max-height:none!important;
}
.leaflet-marker-icon,
.leaflet-marker-shadow{
  display:block;
  user-select:none;
  -webkit-user-drag:none;
}
.leaflet-interactive{cursor:pointer}
.leaflet-grab{cursor:grab}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive{cursor:grabbing}
.leaflet-bar{
  border-radius:8px;
  box-shadow:0 2px 10px rgba(0,0,0,.16);
}
.leaflet-bar a{
  display:block;
  width:30px;
  height:30px;
  line-height:30px;
  text-align:center;
  text-decoration:none;
  color:#173735;
  background:#fff;
  border-bottom:1px solid #d9e9e7;
}
.leaflet-bar a:first-child{border-radius:8px 8px 0 0}
.leaflet-bar a:last-child{border-bottom:0;border-radius:0 0 8px 8px}
.leaflet-control-zoom-in,
.leaflet-control-zoom-out{font-size:20px;font-weight:700}
.leaflet-control-attribution{
  margin:0;
  padding:2px 5px;
  color:#54706e;
  background:rgba(255,255,255,.85);
  font-size:9px;
}
.leaflet-control-attribution a{color:#078282;text-decoration:none}
.leaflet-popup{
  position:absolute;
  text-align:center;
  margin-bottom:20px;
}
.leaflet-popup-content-wrapper{
  padding:1px;
  text-align:left;
  border-radius:12px;
  background:#fff;
  box-shadow:0 3px 14px rgba(0,0,0,.22);
}
.leaflet-popup-content{margin:12px 14px;line-height:1.4}
.leaflet-popup-tip-container{
  width:40px;
  height:20px;
  position:absolute;
  left:50%;
  margin-left:-20px;
  overflow:hidden;
  pointer-events:none;
}
.leaflet-popup-tip{
  width:17px;
  height:17px;
  margin:-10px auto 0;
  transform:rotate(45deg);
  background:#fff;
  box-shadow:3px 3px 12px rgba(0,0,0,.15);
}
.leaflet-tooltip{
  position:absolute;
  padding:6px 9px;
  border:1px solid #d9e9e7;
  border-radius:8px;
  color:#173735;
  background:rgba(255,255,255,.96);
  white-space:nowrap;
  pointer-events:none;
  box-shadow:0 2px 8px rgba(0,0,0,.12);
}
.leaflet-tooltip-top:before{
  position:absolute;
  pointer-events:none;
  border:6px solid transparent;
  content:"";
  left:50%;
  margin-left:-6px;
  bottom:-12px;
  border-top-color:#fff;
}

:root{
  --teal:#0abab5;--teal-dark:#078282;--teal-deep:#045f5c;--teal-soft:#e4f8f6;
  --ink:#173735;--muted:#66807d;--line:#d9e9e7;--white:#fff;--cream:#fff9e8;
  --panel-width:390px;--topbar-height:72px;--shadow:0 10px 30px rgba(4,95,92,.14);
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans TC","PingFang TC",Arial,sans-serif;color:var(--ink);background:#eef7f6}
body{overflow:hidden}
button,input,select{font:inherit}
button{border:0;cursor:pointer}

.app-shell{height:100dvh;display:flex;flex-direction:column;overflow:hidden}
.topbar{height:var(--topbar-height);flex:0 0 var(--topbar-height);display:flex;align-items:center;justify-content:space-between;gap:16px;padding:8px 18px;border-bottom:1px solid var(--line);background:linear-gradient(120deg,#fff 0%,#f1fbfa 72%,#fff8dc 100%);z-index:1000}
.brand-block{display:flex;align-items:center;gap:11px;min-width:0}
.brand-copy{min-width:0}
.mascot-frame{display:flex;align-items:center;justify-content:center;flex:0 0 auto;overflow:visible}
.mascot-frame img{display:block;width:100%;height:100%;max-width:100%;object-fit:contain;object-position:center}
.header-mascot{width:54px;height:54px}
.eyebrow{margin:0 0 2px;color:var(--teal-dark);font-size:11px;font-weight:900;letter-spacing:.06em}
.topbar h1{margin:0;font-size:21px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-actions{display:flex;align-items:center;gap:9px;flex:0 0 auto}
.ghost-button,.line-button{min-height:40px;padding:9px 14px;border-radius:12px;font-weight:800}
.ghost-button{border:1px solid var(--line);background:#fff;color:var(--teal-dark)}
.line-button{display:inline-flex;align-items:center;color:#fff;background:var(--teal-dark);text-decoration:none;box-shadow:0 7px 18px rgba(7,130,130,.2)}
.main-layout{min-height:0;flex:1;display:grid;grid-template-columns:minmax(0,1fr) var(--panel-width)}
.map-section{position:relative;min-width:0;min-height:0;background:#dcefed;order:1}
#map{width:100%;height:100%;z-index:1;touch-action:pan-x pan-y}
.control-panel{order:2;min-height:0;overflow:auto;overscroll-behavior:contain;padding:14px;background:#f5fbfa;border-left:1px solid var(--line);scrollbar-width:thin}
.panel-card{margin:0 0 12px;padding:16px;border:1px solid var(--line);border-radius:16px;background:rgba(255,255,255,.98);box-shadow:0 5px 16px rgba(4,95,92,.07)}
.section-heading{display:flex;align-items:flex-start;gap:10px;margin-bottom:13px}.section-heading.compact{margin-bottom:11px}
.section-heading h2,.layer-card h2,.result-card h2{margin:0;font-size:17px;line-height:1.35}
.section-heading p,.result-card p,.layer-card p{margin:4px 0 0;color:var(--muted);font-size:13px;line-height:1.5}
.step-badge{flex:0 0 auto;padding:5px 8px;border-radius:8px;background:var(--teal-soft);color:var(--teal-dark);font-size:10px;font-weight:900;letter-spacing:.05em}
.field-label{display:block;margin:0 0 7px;font-size:13px;font-weight:800}
.search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
input,select{width:100%;min-height:44px;border:1px solid #cfe3e1;border-radius:12px;padding:0 12px;background:#fff;color:var(--ink);outline:none}
input:focus,select:focus{border-color:var(--teal);box-shadow:0 0 0 3px rgba(10,186,181,.13)}
.primary-button{min-width:70px;border-radius:12px;padding:0 15px;color:#fff;background:linear-gradient(135deg,var(--teal),var(--teal-dark));font-weight:900}
.primary-button:disabled{opacity:.55;cursor:wait}
.secondary-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:9px}
.secondary-button{padding:8px 11px;border-radius:10px;color:var(--teal-dark);background:var(--teal-soft);font-weight:800}
.privacy-note{color:#8a9c9a;font-size:11px;text-align:right}
.search-status{margin-top:8px;color:var(--muted);font-size:12px}.search-status:empty{display:none}.search-status.error{color:#b04839}.search-status.success{color:var(--teal-dark)}
.search-suggestions{margin-top:9px;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.suggestion-button{display:block;width:100%;padding:10px 12px;text-align:left;border-bottom:1px solid var(--line);background:#fff;color:var(--ink);font-size:12px;line-height:1.4}.suggestion-button:last-child{border-bottom:0}
.result-card{min-height:132px;border-color:rgba(255,216,106,.75);background:linear-gradient(155deg,#fff 0%,#fffdf5 100%)}
.result-empty{display:grid;grid-template-columns:76px minmax(0,1fr);gap:12px;align-items:center}.result-mascot{width:76px;height:76px}
.result-empty h2{margin:2px 0 4px}.result-empty p{margin:0}
.result-kicker{margin:0!important;color:var(--teal-dark)!important;font-size:11px!important;font-weight:900;letter-spacing:.05em}
.result-header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.result-title{margin:2px 0 0!important;font-size:23px!important;color:var(--teal-deep)}
.result-badge{display:inline-flex;padding:5px 8px;border-radius:999px;background:var(--teal-soft);color:var(--teal-dark);font-size:11px;font-weight:900;white-space:nowrap}
.result-meta{display:flex;flex-wrap:wrap;gap:7px;margin:12px 0}.meta-chip{display:inline-flex;padding:6px 9px;border-radius:999px;background:#f3f8f7;color:#436c69;font-size:11px;font-weight:700}
.result-copy{font-size:13px;line-height:1.65}.nearby-block{margin-top:13px;padding-top:12px;border-top:1px solid var(--line)}.nearby-block h3{margin:0 0 8px;font-size:13px}.nearby-list{display:grid;gap:6px}.nearby-item{display:flex;justify-content:space-between;gap:8px;padding:7px 9px;border-radius:10px;background:#f5faf9;font-size:12px}.nearby-item strong{color:var(--teal-dark);font-size:11px;text-align:right}
.result-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:13px}.result-actions a{display:flex;align-items:center;justify-content:center;min-height:39px;padding:8px;border-radius:11px;text-decoration:none;font-size:12px;font-weight:900}.website-link{color:var(--teal-dark);background:var(--teal-soft)}.consult-link{color:#fff;background:var(--teal-dark)}
.no-match{text-align:center;padding:5px 4px}.no-match .result-mascot{margin:0 auto 4px}
.layer-title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.text-button{padding:4px;background:transparent;color:var(--teal-dark);font-size:12px;font-weight:900}.layer-note{margin-top:8px!important;font-size:11px!important}.layer-controls{display:grid;gap:8px;margin-top:12px}.layer-control{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;border-radius:11px;background:#f7fbfa}.layer-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:12px;font-weight:800}.layer-label span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layer-symbol{width:10px;height:10px;border-radius:50%;flex:0 0 auto}.switch{position:relative;width:38px;height:22px;flex:0 0 auto}.switch input{position:absolute;opacity:0;width:0;height:0}.switch-track{position:absolute;inset:0;border-radius:999px;background:#cbd9d7;cursor:pointer}.switch-track::after{content:"";position:absolute;width:16px;height:16px;left:3px;top:3px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.18);transition:transform .18s}.switch input:checked+.switch-track{background:var(--teal)}.switch input:checked+.switch-track::after{transform:translateX(16px)}
.panel-footer{padding:2px 4px 15px;color:#809492;font-size:11px;line-height:1.55}.panel-footer p{margin:5px 0}
.map-loading{position:absolute;inset:0;z-index:800;display:flex;align-items:center;justify-content:center;gap:9px;background:#eef7f6;color:var(--teal-dark);font-size:13px;font-weight:800;transition:opacity .2s}.map-loading.is-hidden{opacity:0;pointer-events:none}.loading-spinner{width:20px;height:20px;border:3px solid #bce8e4;border-top-color:var(--teal-dark);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
.map-hint{position:absolute;top:14px;left:50%;transform:translateX(-50%);z-index:700;display:flex;align-items:center;gap:8px;max-width:calc(100% - 150px);padding:7px 10px;border:1px solid rgba(10,186,181,.24);border-radius:999px;background:rgba(255,255,255,.97);box-shadow:0 7px 20px rgba(4,95,92,.12);font-size:12px}.hint-mascot{width:32px;height:32px}.map-hint button{padding:0;background:transparent;color:#718985;font-size:21px;line-height:1}.map-hint.is-hidden{display:none}
.map-legend{position:absolute;left:13px;bottom:18px;z-index:700;min-width:154px;border-radius:13px;background:rgba(255,255,255,.97);box-shadow:0 7px 20px rgba(4,95,92,.13);overflow:hidden}.legend-toggle{width:100%;padding:8px 11px;background:#fff;color:var(--teal-dark);text-align:left;font-size:12px;font-weight:900}.legend-content{display:grid;gap:7px;padding:0 11px 10px;color:#4f6f6c;font-size:11px}.legend-content span{display:flex;align-items:center;gap:7px}.map-legend.collapsed .legend-content{display:none}.legend-swatch{width:18px;height:11px;border-radius:3px;background:rgba(10,186,181,.38);border:2px solid #078282}.legend-dot{width:10px;height:10px;border-radius:50%}.metro{background:#0f8dc7}.railway{background:#7954a3}.benefit{background:#f6a623}.seed{background:#0abab5}
.custom-marker{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border:3px solid #fff;border-radius:50%;box-shadow:0 2px 7px rgba(0,0,0,.23);color:#fff;font-size:9px;font-weight:900}.custom-marker.highway{background:#2878b5}.custom-marker.metro{background:#0f8dc7}.custom-marker.railway{background:#7954a3}.custom-marker.benefit{background:#f6a623}.custom-marker.facility{background:#d85c73}.custom-marker.seed{background:#0abab5}.location-marker{width:18px;height:18px;border:4px solid #fff;border-radius:50%;background:#e14b3f;box-shadow:0 0 0 3px rgba(225,75,63,.2),0 3px 9px rgba(0,0,0,.22)}
.leaflet-control-attribution{font-size:9px}.leaflet-popup-content-wrapper{border-radius:13px}.leaflet-popup-content{margin:11px 13px;font-family:inherit}.popup-name{font-weight:900;color:var(--teal-deep)}.popup-folder{margin-top:3px;color:var(--muted);font-size:11px}
@media(max-width:980px){:root{--panel-width:345px}.topbar{padding-inline:13px}.ghost-button{display:none}}
@media(max-width:760px){
  body{overflow:auto}.app-shell{height:auto;min-height:100dvh;overflow:visible}.topbar{position:sticky;top:0;height:64px;min-height:64px;flex-basis:64px;padding:7px 10px}.header-mascot{width:46px;height:46px}.eyebrow{font-size:9px}.topbar h1{font-size:17px}.line-button{min-height:38px;padding:8px 10px;font-size:11px}
  .main-layout{display:flex;flex-direction:column}.map-section{order:1;height:58svh;min-height:390px;max-height:620px;flex:none}.control-panel{order:2;overflow:visible;padding:11px 10px 24px;border:0;background:#f3faf9}.panel-card{margin-bottom:10px;padding:14px;border-radius:16px;box-shadow:0 5px 15px rgba(4,95,92,.08)}
  .map-hint{top:10px;max-width:calc(100% - 22px);font-size:11px}.map-legend{left:9px;bottom:12px}.result-empty{grid-template-columns:68px minmax(0,1fr)}.result-mascot{width:68px;height:68px}
}
@media(max-width:430px){.topbar-actions .line-button{width:40px;height:40px;padding:0;border-radius:50%;font-size:0}.topbar-actions .line-button::after{content:"LINE";font-size:9px}.search-card,.quick-card,.result-card,.layer-card{padding:13px}.secondary-actions{align-items:flex-start}.privacy-note{max-width:128px}.result-actions{grid-template-columns:1fr}.map-section{height:55svh;min-height:360px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}.loading-spinner{animation-duration:1.6s}}

/* V3 stability and performance hardening */
.map-section{overflow:hidden}
#map{position:absolute;inset:0;width:100%;height:100%;min-height:320px}
.leaflet-container canvas,
.leaflet-container svg{display:block}
.leaflet-tile-container{will-change:transform}
.panel-card{backdrop-filter:none}
@media(max-width:760px){
  #map{position:absolute;inset:0}
  .map-section{width:100%;overflow:hidden}
}


/* ===== V4 address accuracy UI ===== */
.search-status.warning{
  color:#8a5a00;
}
.suggestion-button{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  width:100%;
  text-align:left;
}
.suggestion-button span{
  min-width:0;
  line-height:1.45;
}
.suggestion-button small{
  flex:0 0 auto;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
  background:#fff3c7;
  color:#7a5700;
}
.suggestion-button.is-exact small{
  background:#dcf7f4;
  color:#056d69;
}
.address-match-notice{
  display:grid;
  gap:4px;
  margin:14px 0;
  padding:11px 12px;
  border-radius:12px;
  font-size:13px;
  line-height:1.5;
}
.address-match-notice.is-exact{
  background:#e6f8f6;
  border:1px solid #b7e9e4;
  color:#075e5a;
}
.address-match-notice.is-approximate{
  background:#fff6d8;
  border:1px solid #f1d77d;
  color:#785500;
}
.address-match-notice strong{
  font-size:13px;
}

/* V6 mascot marker */
.mascot-query-icon{filter:drop-shadow(0 4px 10px rgba(0,0,0,.18));}
