:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #pano { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #071426; color: #fff; }

.topbar {
  position: fixed;
  z-index: 20;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background: rgba(7,20,38,.82);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  backdrop-filter: blur(14px);
}

.topbar strong, .topbar span { display: block; }
.topbar strong { font-size: 14px; }
.topbar span { margin-top: 2px; color: #bfdbfe; font-size: 12px; }
.top-actions { display: flex; gap: 8px; }

button, .tour-arrow {
  border: 1px solid rgba(255,255,255,.24);
  color: #fff;
  background: rgba(15,43,78,.92);
  cursor: pointer;
}

button { padding: 9px 12px; border-radius: 10px; font-weight: 700; }
button:hover, button:focus-visible, .tour-arrow:hover, .tour-arrow:focus-visible { background: #1663b7; outline: none; }

.tour-arrow {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.38);
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.tour-arrow.jump { background: rgba(126,34,206,.92); }
.tour-arrow.branch { background: rgba(217,119,6,.96); }
.department-hotspot {
  display: block;
  min-width: 150px;
  padding: 10px 14px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: rgba(109,40,217,.96);
  box-shadow: 0 8px 26px rgba(0,0,0,.42);
  transform: translate(-50%, -50%);
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}
.department-hotspot span { display: block; color: #ddd6fe; font-size: 10px; }
.department-map-marker {
  display: grid;
  width: 42px !important;
  height: 42px !important;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #6d28d9;
  box-shadow: 0 4px 14px rgba(0,0,0,.38);
  font-size: 11px;
  font-weight: 900;
}
.department-popup strong { display: block; margin-bottom: 8px; color: #111827; }
.department-popup a { display: block; margin-top: 6px; color: #1d4ed8; font-weight: 800; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #fff; color: #111827; }

.map-panel {
  position: fixed;
  z-index: 30;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(440px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  background: rgba(7,20,38,.94);
  box-shadow: 0 18px 48px rgba(0,0,0,.4);
  backdrop-filter: blur(16px);
}

.map-heading { display: flex; align-items: center; justify-content: space-between; }
.map-heading button { padding: 4px 10px; font-size: 22px; }
#route-map { display: block; width: 100%; height: 330px; margin-top: 10px; border-radius: 12px; background: #0b223e; }
.leaflet-container { font-family: inherit; }
.map-panel p { margin: 10px 2px 0; color: #bfdbfe; font-size: 12px; }

.loading, .error {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(7,20,38,.9);
  box-shadow: 0 12px 36px rgba(0,0,0,.4);
  font-weight: 700;
}
.error { max-width: min(520px, calc(100vw - 30px)); background: rgba(127,29,29,.95); }

@media (max-width: 620px) {
  .topbar { align-items: flex-start; }
  .top-actions { flex-direction: column; }
  .topbar button { padding: 7px 9px; font-size: 12px; }
  .tour-arrow { width: 58px; height: 58px; }
}
