*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #e6edf4 0%, #eef2f5 55%, #eef2f5 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { position: fixed; inset: 0; }
.scene { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; touch-action: none; }
.scene canvas { display: block; width: 100%; height: 100%; outline: none; }
.is-ready .scene { opacity: 1; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; transition: opacity .4s; }
.loading span { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
.is-ready .loading, .no-3d .loading { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- labels on the map ---------- */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pin {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; margin: 0;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 1px 2px rgba(5, 44, 88, .16), 0 6px 16px -6px rgba(5, 44, 88, .35);
  font-size: 13px; font-weight: 500; line-height: 1; color: var(--navy); white-space: nowrap;
  translate: -50% -100%;
  pointer-events: auto; cursor: pointer;
  transition: opacity .2s, padding .2s, background-color .2s;
  will-change: transform;
}
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 2px 0; box-shadow: 2px 2px 3px -1px rgba(5, 44, 88, .15); z-index: -1; }
.pin-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-50); color: var(--brand); flex: none; }
.pin-ico svg { width: 15px; height: 15px; }
.pin--urgent .pin-ico { background: var(--urgent); color: #fff; }
.pin--pharmacy .pin-ico { background: #178a4c; color: #fff; }
.pin--door .pin-ico { background: var(--navy); color: #fff; }
.pin.is-compact { padding: 3px; }
.pin.is-compact .pin-txt { display: none; }
.pin.is-hidden { opacity: 0; pointer-events: none; }
.pin.is-active { background: var(--brand); color: #fff; z-index: 2; padding-right: 12px; font-size: 14px; }
.pin.is-active .pin-ico { background: #fff; color: var(--brand); }
.pin:hover { z-index: 3; }
.tag { position: absolute; left: 0; top: 0; translate: -50% -50%; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; transition: opacity .2s; }
.tag--water { color: #3b7fae; font-style: italic; letter-spacing: .3em; font-size: 15px; }
.tag--street { color: #6b7280; }

/* ---------- panel ---------- */
.panel {
  position: absolute; z-index: 5; top: 16px; left: 16px; bottom: 16px; width: 372px;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .97);
  border-radius: var(--radius-l);
  box-shadow: 0 1px 2px rgba(5, 44, 88, .06), 0 18px 40px -18px rgba(5, 44, 88, .35);
  overflow: hidden;
}
.panel-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px; }
.brand { display: block; flex: none; border-radius: 10px; }
.brand img { display: block; }
.titles { flex: 1; min-width: 0; }
.titles h1 { margin: 0; font-size: 19px; font-weight: 500; color: var(--navy); letter-spacing: -.01em; }
.titles p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.sheet-toggle { display: none; }
.search { position: relative; margin: 0 18px 8px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 48px; padding: 0 14px 0 42px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; font-size: 15px; color: var(--ink);
}
.search input::placeholder { color: #7a828d; }
.search input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-100); }
.panel-body { flex: 1; overflow: auto; padding: 0 10px 14px; overscroll-behavior: contain; }

.cat { margin: 16px 10px 6px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.places { list-style: none; margin: 0; padding: 0; }
.place {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px;
  padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer;
}
.place:hover { background: var(--surface); }
.place:focus-visible, .pin:focus-visible, .ctrls button:focus-visible, .floors button:focus-visible, .back:focus-visible, .btn:focus-visible, .brand:focus-visible { outline: none; box-shadow: var(--focus); }
.place-ico, .d-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-50); color: var(--brand); }
.place-ico svg, .d-ico svg { width: 19px; height: 19px; }
.place--urgent .place-ico, .d-ico.place--urgent { background: var(--urgent-50); color: var(--urgent); }
.place--pharmacy .place-ico, .d-ico.place--pharmacy { background: var(--ok-50); color: #178a4c; }
.place-name { flex: 1; font-size: 15px; color: var(--ink); }
.chev { width: 18px; height: 18px; color: #a0a7b1; }
.empty { margin: 18px 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* detail */
.detail { padding: 4px 8px 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 10px -4px; padding: 8px 10px 8px 4px; border: 0; border-radius: 10px; background: none; color: var(--brand); font-size: 14px; font-weight: 500; cursor: pointer; }
.back svg { width: 18px; height: 18px; }
.back:hover { background: var(--brand-50); }
.d-head { display: flex; gap: 12px; align-items: center; }
.d-ico { width: 44px; height: 44px; border-radius: 12px; }
.d-ico svg { width: 24px; height: 24px; }
.d-cat { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.d-title { margin: 2px 0 0; font-size: 21px; font-weight: 500; line-height: 1.2; color: var(--navy); }
.status { display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 6px 12px; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--muted); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.is-open { background: var(--ok-50); color: var(--ok); }
.d-desc { margin: 14px 0 0; font-size: 15px; line-height: 1.55; color: var(--body); }
.phones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.phone { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); font-weight: 500; text-decoration: none; font-variant-numeric: tabular-nums; }
.phone::before { content: ""; width: 16px; height: 16px; margin-right: 8px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2' fill='black'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2' fill='black'/%3E%3C/svg%3E") center/contain no-repeat; }
.phone:hover { background: var(--brand-100); }
.route { margin-top: 18px; padding: 14px 14px 6px; border-radius: 16px; background: var(--surface); }
.route-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.route-from { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.route-meta { margin: 4px 0 0; font-size: 15px; color: var(--ink); }
.route-meta strong { font-weight: 500; color: var(--brand-700); }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--body); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #c9ced6; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.steps { margin: 12px 0 8px; padding: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; padding: 0 0 12px 34px; font-size: 14.5px; line-height: 1.5; color: var(--body); counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 500; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 10.5px; top: 25px; bottom: 3px; width: 1px; background: #c9d6e6; }
.steps--plain { margin-top: 16px; }
.d-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 500; color: var(--navy); cursor: pointer; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.no3d-note { display: none; margin: 0 18px 16px; padding: 12px 14px; border-radius: 12px; background: var(--warn-50); color: var(--warn); font-size: 14px; line-height: 1.45; }
.no-3d .no3d-note { display: block; }

/* ---------- floating controls ---------- */
.floors, .ctrls { position: absolute; z-index: 4; right: 16px; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.96); box-shadow: 0 1px 2px rgba(5,44,88,.08), 0 10px 24px -14px rgba(5,44,88,.4); }
.floors { top: 16px; }
.ctrls { top: 210px; }
.floors button, .ctrls button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; font-size: 15px; font-weight: 500; color: var(--navy); cursor: pointer; }
.floors button svg, .ctrls button svg { width: 20px; height: 20px; }
.floors button:hover:not(:disabled), .ctrls button:hover { background: var(--surface); }
.floors button:disabled { color: #b4bac3; cursor: not-allowed; }
.floors button.is-active { background: var(--brand); color: #fff; }
.legend { position: absolute; z-index: 3; left: 404px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 9px 14px; border-radius: 12px; background: rgba(255,255,255,.92); font-size: 12.5px; color: var(--body); box-shadow: 0 1px 2px rgba(5,44,88,.06); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(5,44,88,.12); }
.demo-badge { position: absolute; z-index: 6; right: 16px; bottom: 16px; margin: 0; padding: 7px 12px; border-radius: 999px; background: rgba(5,44,88,.82); color: #fff; font-size: 12.5px; text-decoration: none; letter-spacing: .01em; }

/* ---------- mobile: bottom sheet ---------- */
@media (max-width: 760px) {
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58vh; border-radius: 20px 20px 0 0; transform: translateY(calc(100% - 136px - env(safe-area-inset-bottom))); transition: transform .35s cubic-bezier(.2,.8,.2,1); padding-bottom: env(safe-area-inset-bottom); }
  .panel.is-open { transform: none; }
  .panel-head { padding: 14px 14px 10px; }
  .panel-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; border-radius: 4px; background: #d3d8df; translate: -50% 0; }
  .brand img { width: 34px; height: 35px; }
  .titles h1 { font-size: 17px; }
  .sheet-toggle { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--surface); cursor: pointer; }
  .sheet-toggle svg { width: 20px; height: 20px; transition: transform .3s; }
  .panel.is-open .sheet-toggle svg { transform: rotate(180deg); }
  .search { margin: 0 14px 10px; }
  .floors { top: 12px; right: 12px; flex-direction: row; }
  .ctrls { top: 72px; right: 12px; }
  .floors button, .ctrls button { width: 42px; height: 42px; }
  .legend { display: none; }
  .demo-badge { top: 12px; left: 12px; right: auto; bottom: auto; }
  .pin { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* embedded preview (used as an image/iframe teaser on the website) */
.embed .panel, .embed .floors, .embed .ctrls, .embed .legend, .embed .demo-badge { display: none; }
