/* Bản đồ quy hoạch King Park (/ban-do/) — dùng chung màu với web chính */
:root {
  --paper: #f6f4ee;
  --surface: #ffffff;
  --ink: #15231f;
  --ink-2: #3a4a45;
  --muted: #62716c;
  --line: #e2ddd0;
  --teal: #0e8077;
  --teal-700: #0b675f;
  --teal-900: #073f3a;
  --teal-50: #e8f4f2;
  --teal-100: #cfe8e4;
  --gold: #99702a;
  --red: #a3402b;
  --shadow: 0 2px 6px rgba(7, 30, 26, .12), 0 12px 32px rgba(7, 30, 26, .16);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cta-h: 0px;
  --panel-w: 372px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #0c1418; color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; background: #0c1418; }
.leaflet-container { font: 13px/1.4 var(--font); background: #0c1418; }

/* ---------- khung trái (máy tính) / thẻ trên cùng + ngăn kéo dưới (điện thoại) ---------- */
.panel {
  position: fixed; z-index: 1000; top: 12px; left: 12px; bottom: 12px; width: var(--panel-w);
  display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.head { padding: 14px 16px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.head-top { display: flex; align-items: flex-start; gap: 10px; }
.back { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--teal-50); color: var(--teal-900); text-decoration: none; font-size: 18px; line-height: 1; }
.titles { min-width: 0; flex: 1; }
.eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
h1 { margin: 1px 0 0; font-size: 19px; line-height: 1.25; font-weight: 700; color: var(--teal-900); text-wrap: balance; }
.sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.more-btn { display: none; }
.more-btn svg { width: 16px; height: 16px; flex: none; }

.search { position: relative; }
.search input {
  width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper);
  font-size: 15px; font-weight: 500; letter-spacing: .01em;
}
.search input::placeholder { color: #8a9692; font-weight: 400; }
.search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.msg { font-size: 12.5px; color: var(--red); }
.msg:empty { display: none; }
.msg button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 2px 8px; margin: 4px 4px 0 0; font-size: 12.5px; font-weight: 600; color: var(--teal-900); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.chip::before { content: ""; width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid currentColor; }
.chip[aria-pressed="true"] { background: var(--teal-900); border-color: var(--teal-900); color: #fff; }
.chip[aria-pressed="true"]::before { background: currentColor; box-shadow: inset 0 0 0 2px var(--teal-900); }
.chip small { font-weight: 500; font-size: 11px; opacity: .8; }

.more { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px 16px 18px; display: grid; gap: 18px; align-content: start; }
.more-head { display: none; }
.brand { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; }
.brand img { width: 88px; height: 88px; }
.brand b { display: block; font-size: 16px; color: var(--teal-900); }
.brand span { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; }
.brand strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.group { display: grid; gap: 8px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checks input { width: 17px; height: 17px; accent-color: var(--teal); margin: 0; }
.checks i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.row { display: flex; align-items: center; gap: 10px; }
.row input[type=range] { flex: 1; accent-color: var(--teal); }
.val { width: 42px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg button { border: 0; padding: 8px; background: var(--surface); font-size: 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--teal-900); color: #fff; font-weight: 600; }
.tk { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.tk div { background: var(--surface); padding: 8px 10px; display: grid; }
.tk span { font-size: 12px; color: var(--muted); }
.tk strong { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--ink); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.3; }
.legend i { flex: none; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); }
.legend i.ln { height: 0; border: 0; border-top: 2px dashed; }
.lg-road { flex: none; font-size: 11px; font-weight: 700; color: #0b4f8a; background: #fff; border: 1px solid #cfd8dc; border-radius: 4px; padding: 0 4px; }
.lg-dim { flex: none; font-size: 12px; font-weight: 700; color: #1d1206; }
.lg-poi { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--ink); background: #fff; border: 1.5px solid #b4485a; border-radius: 999px; padding: 0 7px 0 5px; }
.lg-poi::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #b4485a; }
.note { margin: 0; font-size: 13px; color: var(--muted); }
.disclaimer { margin: 0; font-size: 12.5px; line-height: 1.55; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; }
.disclaimer b { color: var(--red); }
.site-link { display: block; text-align: center; padding: 11px; border-radius: 11px; border: 1px solid var(--teal-900); color: var(--teal-900); font-weight: 600; text-decoration: none; }

/* ---------- thanh liên hệ ---------- */
.cta {
  position: fixed; z-index: 1001; left: calc(var(--panel-w) + 24px); bottom: 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 8px 10px 8px 8px; max-width: 460px;
}
.cta-qr { display: block; width: 58px; height: 58px; }
.cta-qr img { width: 58px; height: 58px; }
.cta-who b { display: block; font-size: 14.5px; color: var(--teal-900); line-height: 1.25; }
.cta-who span { display: block; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cta-who span { white-space: nowrap; }
.cta-mt { grid-column: 1 / -1; border: 0; background: none; padding: 0; margin-top: -2px; font-size: 11.5px; line-height: 1.35; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; text-align: left; }
.cta-act { display: flex; gap: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 11px; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn-zalo { background: var(--teal); color: #fff; }
.btn-goi { background: var(--teal-50); color: var(--teal-900); }

/* hoa gió: ghim góc trên bên phải; bản đồ luôn hướng Bắc lên trên nên hoa gió đứng yên */
.compass { position: fixed; z-index: 999; top: 12px; right: 12px; width: 74px; height: 74px; pointer-events: none; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .35)); }
.compass svg { display: block; width: 100%; height: 100%; }
.leaflet-top.leaflet-right { top: 92px; }          /* nút phóng to/thu nhỏ nằm dưới hoa gió */

/* ô ảnh vẽ bằng canvas trong suốt: hiện ngay, không mờ dần (tránh thấy ô cũ và ô mới chồng nhau khi phóng) */
.kp-tile { opacity: 1 !important; transition: none !important; }

/* ---------- chữ gợi ý, highlight, popup ---------- */
.toast { position: fixed; z-index: 1100; left: 50%; top: 18px; transform: translateX(-50%); background: var(--teal-900); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); pointer-events: none; }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 14px 16px 14px; font: 14px/1.45 var(--font); min-width: 220px; }
.pp h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: var(--teal-900); letter-spacing: .01em; }
.pp .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--paper); margin-bottom: 8px; }
.pp .tag i { width: 9px; height: 9px; border-radius: 50%; }
.pp dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0 0 8px; }
.pp dt { color: var(--muted); font-size: 13px; }
.pp dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pp .sizes { font-size: 13px; margin: 0 0 8px; line-height: 1.5; }
.pp .warn { font-size: 12.5px; line-height: 1.45; color: var(--red); margin: 0 0 8px; }
.pp .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pp .acts a, .pp .acts button { display: inline-flex; align-items: center; min-height: 34px; padding: 0 11px; border-radius: 9px; font-size: 13px; font-weight: 700; text-decoration: none; border: 0; }
.pp .acts .z { background: var(--teal); color: #fff; }
.pp .acts .g, .pp .acts .s { background: var(--paper); color: var(--teal-900); border: 1px solid var(--line); }
.leaflet-container a.leaflet-popup-close-button { width: 32px; height: 32px; font-size: 22px; line-height: 30px; color: var(--muted); }

.loading { position: fixed; z-index: 900; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(7, 63, 58, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; }

/* ---------- điện thoại ---------- */
@media (max-width: 760px) {
  :root { --cta-h: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .panel { top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; bottom: auto; width: auto; overflow: visible; border-radius: 14px; }
  .head { padding: 10px 12px; gap: 8px; border-bottom: 0; }
  .head-top { align-items: center; }
  .back { display: none; }               /* link về trang chủ nằm trong ngăn Chú giải */
  h1 { font-size: 16.5px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .eyebrow, .sub { display: none; }
  .more-btn { display: inline-flex; align-items: center; gap: 5px; flex: none; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 6px 9px; font-size: 13px; font-weight: 700; color: var(--teal-900); white-space: nowrap; }
  .search input { padding: 8px 10px 8px 34px; font-size: 16px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { padding: 5px 10px; font-size: 12.5px; }
  .chip small { display: none; }
  .chip.wait { background: var(--teal-50); border-color: var(--teal-100, #cfe8e4); color: var(--teal-900); }
  .chip.wait::before { background: currentColor; box-shadow: inset 0 0 0 2px var(--teal-50); }

  .more {
    position: fixed; left: 0; right: 0; bottom: 0; max-height: 78%; z-index: 1200; background: var(--surface);
    border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.35); padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(105%); transition: transform .22s ease; visibility: hidden;
  }
  .panel.open { z-index: 1300; }        /* ngăn kéo nằm trong khung này: nâng cả khung lên trên lớp phủ và thanh liên hệ */
  .panel.open .more { transform: none; visibility: visible; }
  .more-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 12px 0 8px; margin-bottom: -6px; }
  .more-head b { font-size: 16px; color: var(--teal-900); }
  .more-head button { border: 0; background: var(--paper); border-radius: 10px; padding: 7px 12px; font-weight: 700; color: var(--teal-900); }
  .scrim { position: fixed; inset: 0; z-index: 1150; background: rgba(0,0,0,.35); }

  .cta {
    left: 0; right: 0; bottom: 0; max-width: none; border-radius: 16px 16px 0 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 8px; gap: 6px 8px;
  }
  .cta-mt { text-align: center; }
  .cta-qr, .cta-qr img { width: 54px; height: 54px; }
  .btn { padding: 0 12px; min-height: 42px; }
  .btn-goi span { display: none; }
  .leaflet-bottom { bottom: var(--cta-h); }
  .leaflet-control-zoom { display: none; }
  .compass { width: 58px; height: 58px; right: 10px; top: calc(var(--ui-top, 150px) + 8px); }
  .toast { top: auto; bottom: calc(var(--cta-h) + 14px); }
}
@media (max-width: 380px) {
  h1 { font-size: 15.5px; }
  .chips { gap: 5px; }
  .chip { padding: 5px 8px; gap: 5px; }
}
@media (max-width: 360px) {
  .cta-who span { font-size: 11.5px; }
  .btn { padding: 0 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .more { transition: none; }
  .leaflet-zoom-anim .leaflet-zoom-animated { transition: none !important; }
}
