#building-dialog {
  width:min(640px,calc(100% - 24px)); max-width:none; max-height:min(85vh,790px);
  padding:0; overflow:hidden; background:#191d29; color:var(--txt); border:1px solid #565568;
  border-radius:14px; box-shadow:0 24px 90px #080a14b3;
}
@supports (height: 100dvh) { #building-dialog { max-height:min(85dvh,790px); } }

#building-dialog[open] { display:flex; flex-direction:column }
#building-dialog::backdrop { background:#080b16be }
#building-dialog :where(button,select,input,a):focus-visible { outline:2px solid var(--aqua); outline-offset:2px }
#building-dialog button { font:inherit; cursor:pointer }
.bd-header { flex:none; position:relative; padding:20px 64px 17px 23px; border-bottom:1px solid #3c4050; background:linear-gradient(110deg,#242a37,#222330 74%); }
.bd-header h2 { margin:0; color:#ffede6; font:italic 750 clamp(27px,4.5vw,39px)/1.1 Display,Arial,sans-serif; letter-spacing:-.025em; overflow-wrap:anywhere }
.bd-header h2:focus { outline:none }
#building-dialog .bd-close { position:absolute; right:10px; top:9px; width:44px; height:44px; display:grid; place-items:center; border-radius:8px; color:#dedbe6; background:transparent }
#building-dialog .bd-back { display:inline-flex; align-items:center; gap:4px; margin:-8px 0 3px -6px; padding:7px 6px; min-height:44px; color:#9fdfd7; background:transparent; font-size:12px; font-weight:650 }
#building-dialog .bd-close:hover,#building-dialog .bd-back:hover { background:#343848 }
.bd-directory { min-height:0; display:flex; flex-direction:column; padding:16px 20px 9px }
.bd-tools { display:flex; flex-wrap:wrap; gap:8px; align-items:stretch; flex:none }
.bd-search,#building-dialog select { display:flex; align-items:center; min-height:44px; min-width:0; border:1px solid #4d5162; border-radius:7px; background:#141925; color:var(--txt) }
.bd-search { flex:1 1 240px; gap:6px; padding:0 10px; color:#b7b8c7 }
.bd-search:focus-within { border-color:var(--aqua) }
.bd-search input { width:100%; min-width:0; padding:6px 0; border:0; color:var(--txt); background:transparent; font:inherit; font-size:14px }
.bd-search input:focus { outline:0!important }
.bd-search input::placeholder { color:#a9aabc }
#building-dialog select { padding:4px 8px; font:600 12px/1.3 AtlasSans,Arial,sans-serif; color-scheme:dark }
#bd-count { flex:none; margin:12px 0 3px; font:600 11px/1.4 var(--mono); color:#a8b2bc }
#bd-scroll,.bd-profile { min-height:0; overflow:auto; scrollbar-color:#535265 transparent; overscroll-behavior:contain }
#bd-results { list-style:none; margin:0; padding:0 }
#bd-results li+li { border-top:1px solid #373b49 }
#bd-results button { width:100%; min-height:58px; display:flex; gap:10px; align-items:center; padding:8px 5px; border:0; background:transparent; text-align:left; border-radius:4px }
#bd-results button:hover,#bd-results button:focus-visible { background:#262b3a }
.bd-name { min-width:0; flex:1 }
.bd-name strong,.bd-name small { display:block; overflow-wrap:anywhere }
.bd-name strong { font-weight:650; font-size:14px; color:#f0e9ed }
.bd-name small { font-size:12px; color:#aaa9bc; margin-top:2px }
#bd-results button>svg { flex:none; color:#b0b0c4 }
.bd-status { display:inline-flex; gap:5px; align-items:center; font:600 11px/1.3 AtlasSans,Arial,sans-serif; color:var(--bd-status) }
.bd-status svg { flex:none }
.bd-enterable { --bd-status:#98dfbd }.bd-restricted { --bd-status:#f7c68a }.bd-closed { --bd-status:#f0a3a9 }.bd-unverified { --bd-status:#bbbace }
#bd-tail:empty { display:none }
#building-dialog .bd-secondary,.bd-sources a { display:inline-flex; align-items:center; justify-content:center; gap:5px; min-height:44px; font:600 12px/1.3 AtlasSans,Arial,sans-serif; color:var(--aqua); text-decoration:none }
#building-dialog .bd-secondary { padding:4px 12px; border:1px solid #42555b; border-radius:6px; background:#243139; margin:6px 0 }
.bd-profile { padding:18px 23px 22px }
.bd-meta { display:flex; align-items:center; gap:10px 17px; flex-wrap:wrap; margin-bottom:14px }
.bd-meta>span { display:inline-flex; align-items:center; gap:5px; font-size:12px }
.bd-meta>span:not(.bd-status) { color:#c1bccb }
#building-dialog h3 { margin:0; font:700 16px/1.35 AtlasSans,Arial,sans-serif; letter-spacing:-.025em }
.bd-access-card { border-left:3px solid #8dc6bb; padding:11px 13px; background:#222d35; border-radius:3px 7px 7px 3px }
#building-dialog .bd-access-card p,.bd-stops p,.bd-empty,.bd-loading p { margin:5px 0 0; font-size:13px; color:#d2cfd9; line-height:1.55 }
#building-dialog .bd-entrance-photo { display:inline-flex; align-items:center; min-height:44px; color:#9de3da; font-weight:650; text-underline-offset:3px }
#building-dialog .bd-map-action { display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:7px 13px; margin-top:12px; color:#211f26; background:var(--coral); border-radius:7px; font-size:12px; font-weight:700 }
.bd-route { margin-top:22px }
.bd-route-head { display:flex; align-items:center; justify-content:space-between; gap:7px 13px; flex-wrap:wrap; padding-bottom:10px; border-bottom:1px solid #393e4d }
.bd-level-name { font:600 11px/1.4 var(--mono); color:#aac6c4 }
.bd-stops { list-style:none; margin:15px 0; padding:0; counter-reset:bd-stop }
.bd-stops li { position:relative; counter-increment:bd-stop; padding:0 0 16px 37px; }
.bd-stops li::before { content:counter(bd-stop); z-index:1; position:absolute; left:0; top:0; width:23px; height:23px; display:grid; place-items:center; color:#adede0; background:#24343a; border:1px solid #517470; border-radius:7px; font:600 11px var(--mono) }
.bd-stops li:not(:last-child)::after { content:""; position:absolute; left:12px; top:23px; bottom:0; border-left:1px dashed #52716f }
.bd-stops h4 { font-size:14px; margin:0; padding-top:2px; color:#f3e9ea }
.bd-stops li p { margin:3px 0 0 }
.bd-stops li:last-child { padding-bottom:0 }
.bd-sources { margin-top:20px; padding-top:13px; border-top:1px solid #393e4d }
.bd-sources>div { display:flex; gap:0 16px; flex-wrap:wrap }
.bd-sources a:hover { text-decoration:underline }
.bd-profile>.bd-empty { margin-top:18px }
.bd-loading { margin:0; padding:19px 23px }
@media(max-width:480px) {
  #building-dialog { width:calc(100% - 14px); max-height:90vh }
@supports (height: 100dvh) { #building-dialog { max-height:90dvh; } }

  .bd-header { padding:15px 51px 13px 14px }.bd-header .bd-close { top:4px }
  .bd-directory,.bd-profile { padding-left:13px; padding-right:13px }
  .bd-tools { gap:6px }.bd-search { flex-basis:100% }
  #bd-access { width:100% }
  #bd-results button { display:grid; grid-template-columns:minmax(0,1fr) 16px; gap:3px; padding:9px 4px }
  #bd-results .bd-name { grid-row:1; grid-column:1 }
  #bd-results .bd-status { grid-row:2; grid-column:1 }
  #bd-results button>svg { grid-row:1 / span 2; grid-column:2 }
  .bd-route-head select { width:100% }
}
#building-directory[hidden] { display:none!important }
.bd-graph { padding:13px; margin-top:17px; border:1px solid #40535a; background:linear-gradient(145deg,#202d34,#202530); border-radius:8px }
.bd-graph-head { display:flex; justify-content:space-between; align-items:center; gap:4px 12px; flex-wrap:wrap }
.bd-graph-head p { margin:3px 0 0; color:#b0c7c6; font:600 11px/1.4 var(--mono) }
.bd-graph-tools { display:flex; align-items:center; gap:3px }
#building-dialog .bd-graph-tools button { min-width:44px; min-height:44px; display:grid; place-items:center; padding:4px 6px; background:#25373d; color:#b5e5d9; border:1px solid #466063; border-radius:5px; font-weight:650; font-size:12px }
#building-dialog .bd-graph-tools button:disabled { opacity:.4; cursor:default }
#bd-zoom-value { min-width:4ch; color:#dfeced; font:600 11px var(--mono); text-align:center }
.bd-graph-scroll { width:100%; aspect-ratio:78 / 41; max-height:51vh; overflow:auto; overscroll-behavior:contain; touch-action:pan-x pan-y; margin-top:10px; border:1px solid #476066; border-radius:5px; background-color:#18272e; background-image:radial-gradient(#466066 1px,transparent 1px); background-size:17px 17px; scrollbar-color:#6a8888 #233239 }
@supports (height: 100dvh) { .bd-graph-scroll { max-height:51dvh; } }

.bd-graph-scroll:focus-visible { outline:2px solid var(--aqua); outline-offset:2px }
.bd-graph-scroll.bd-zoomed { cursor:grab }.bd-graph-scroll.bd-zoomed:active { cursor:grabbing }
.bd-floor-svg { display:block; width:100%; max-width:none; height:auto; user-select:none }
.bd-paths line { stroke:#83b5ae; stroke-width:3; stroke-linecap:round }
.bd-rooms circle { fill:#cdf0db; stroke:#3f6c67; stroke-width:3 }
.bd-rooms text { font:650 17px AtlasSans,Arial,sans-serif; stroke:#18272e; fill:#edeee9; stroke-width:4; stroke-linejoin:round; paint-order:stroke }
.bd-connections { margin-top:4px }
.bd-connections summary { width:fit-content; min-height:44px; padding:12px 3px; color:#c0dfd9; font-size:12px; font-weight:650; cursor:pointer }
.bd-connections summary:focus-visible { outline:2px solid var(--aqua); outline-offset:2px }
.bd-connections dl { margin:0; font-size:12px; line-height:1.5 }
.bd-connections dl>div { padding:7px 0; border-top:1px solid #37464d }
.bd-connections dt { font-weight:650; color:#ece8ea }.bd-connections dd { margin:2px 0 0; color:#bebfcb }
.bd-graph-source { display:inline-flex; align-items:center; gap:5px; min-height:44px; color:var(--aqua); font-size:12px }
@media(max-width:480px) {
  .bd-graph { padding:9px }
  .bd-rooms text { font-size:21px }
}

.roof-detail { position:absolute; right:14px; bottom:50px; z-index:7; width:min(265px,calc(100% - 28px)); padding:12px 15px; color:#e9edf0; background:#1c2630f7; border:1px solid #69808e; border-radius:7px; box-shadow:0 4px 14px #0b151d55; }
.roof-detail[hidden]{display:none}.roof-title{display:flex;align-items:center;gap:7px}.roof-title strong{font-size:14px}.roof-title button{margin-left:auto;font-size:20px;padding:0 3px;cursor:pointer}
.roof-swatch{width:15px;height:15px;border-radius:2px;border:1px solid #d1d9df}.roof-swatch.interior{background:#92aac2}.roof-swatch.exterior{background:#acbdcf}
.roof-detail p{font-size:13px;line-height:1.4;margin:7px 0}.roof-detail small{display:block;font-size:11px;margin:5px 0;color:#c9d6df}.roof-guide{display:block;text-align:left;color:#c4e4f5;padding:3px 0;text-decoration:underline;cursor:pointer}

.map-load-status{position:absolute;pointer-events:none;z-index:6;top:11px;left:50%;transform:translateX(-50%);padding:4px 9px;border-radius:14px;background:#26363de8;color:#f6f9f9;font:12px/1.35 system-ui;white-space:nowrap}.map-load-status[hidden]{display:none}

.bd-level-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:10px 0 14px; }
#building-dialog .bd-level-tabs button { flex:0 1 auto; max-width:100%; min-height:44px; padding:7px 12px; border:1px solid #456168; border-radius:8px; color:#c5d7d9; background:#202e37; font-size:13px; line-height:1.25; text-align:start; overflow-wrap:anywhere; }
#building-dialog .bd-level-tabs button[aria-selected=true] { border-color:#94dbce; background:#a8e4d9; color:#172b30; font-weight:750; }
#bd-floor-panel:focus-visible { outline:2px solid var(--aqua); outline-offset:3px; }
.bd-floor-photo { margin:14px 0 4px; background:#16252d; border:1px solid #3d595d; border-radius:9px; overflow:hidden; }
.bd-floor-frame { position:relative; margin-inline:auto; }
.bd-floor-frame img { display:block; width:100%; height:auto; border:0; }
.bd-floor-photo figcaption { display:flex; flex-wrap:wrap; gap:2px 10px; justify-content:space-between; padding:9px 12px 2px; color:#dce8e8; font-size:13px; }
.bd-floor-photo figcaption span { color:#abc7c8; font-size:12px; }
.bd-photo-mark,.bd-photo-key b { display:inline-grid; place-items:center; min-width:20px; height:20px; border-radius:100%; color:#13262c; background:#b7f0df; font:700 12px/1 var(--mono); }
.bd-photo-mark { position:absolute; border:2px solid white; outline:1px solid #202f36; transform:translate(-50%,-50%); pointer-events:none; }
.bd-photo-key { display:flex; flex-wrap:wrap; margin:4px 12px 0; padding:0; list-style:none; gap:4px 10px; }
.bd-photo-key li { display:flex; align-items:center; gap:6px; font-size:12px; }
.bd-floor-reference { display:inline-flex; align-items:center; gap:6px; padding:4px 0; min-height:44px; color:var(--aqua); text-underline-offset:3px; font-size:13px; }
.bd-floor-photo>.bd-floor-reference { margin:0 12px; }
.bd-room-key { color:#b5eade; margin:8px 0 3px; font-size:12px; }
.bd-room-key[hidden] { display:none; }
.bd-rooms .bd-room-selected circle { fill:#18292e; stroke:#b4f3e2; stroke-width:5; r:10; }
.bd-rooms .bd-room-context circle { fill:#678083; stroke:#50666e; }
.bd-rooms .bd-room-context text { fill:#b1bec2; }
.bd-connections .bd-room-selected { border-left:3px solid #95d5c8; padding-left:8px; }
