:root {
    --brand: #414b43;
    --brand-dark: #2e352f;
    --brand-light: #5b655e;
    --surface: #f7f7f5;
    --panorama-split-height: 50vh;
}

@supports (height: 100dvh) {
    :root {
        --panorama-split-height: 50dvh;
    }

    body,
    .container {
        height: 100dvh;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--surface);
    overflow: hidden;
    height: 100vh;
    color: #1a1a1a;
}

.container {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background: var(--surface);
}

.developer-mode-button {
    position: fixed;
    top: auto;
    left: auto;
    right: max(16px, env(safe-area-inset-right, 0px) + 16px);
    bottom: max(16px, env(safe-area-inset-bottom, 0px) + 16px);
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(65, 75, 67, 0.26);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    color: var(--brand-dark);
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    z-index: 2300;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.developer-mode-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
}

.developer-mode-button.is-active {
    background: var(--brand);
    color: #ffffff;
}

.developer-mode-button__icon {
    width: 20px;
    height: 20px;
}

.developer-mode-button__icon--unlocked {
    display: none;
}

.developer-mode-button.is-active .developer-mode-button__icon--locked {
    display: none;
}

.developer-mode-button.is-active .developer-mode-button__icon--unlocked {
    display: block;
}

.mobile-test-button {
    display: none;
    position: fixed;
    top: 50%;
    right: max(10px, env(safe-area-inset-right, 0px) + 10px);
    transform: translateY(-50%);
    min-width: 40px;
    height: 24px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(65, 75, 67, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
    z-index: 2250;
    cursor: pointer;
}

.mobile-test-button:active {
    transform: translateY(-50%) scale(0.96);
}

.google-map-base {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: none;
}

.map-mode-control {
    position: absolute;
    top: max(16px, env(safe-area-inset-top, 0px) + 16px);
    left: max(16px, env(safe-area-inset-left, 0px) + 16px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
    z-index: 1001;
}

.map-mode-control__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #666666;
}

.map-mode-control__select {
    appearance: none;
    border: 1px solid rgba(65, 75, 67, 0.18);
    border-radius: 12px;
    padding: 10px 38px 10px 12px;
    background:
        linear-gradient(45deg, transparent 50%, #414b43 50%),
        linear-gradient(135deg, #414b43 50%, transparent 50%),
        linear-gradient(to right, #ffffff, #ffffff);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 13px) calc(50% - 2px),
        0 0;
    background-size: 5px 5px, 5px 5px, 100% 100%;
    background-repeat: no-repeat;
    color: var(--brand-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    min-width: 170px;
    cursor: pointer;
}

.map-mode-control__select:focus {
    outline: none;
    border-color: rgba(65, 75, 67, 0.36);
    box-shadow: 0 0 0 3px rgba(65, 75, 67, 0.12);
}

.map-view-toggle {
    position: fixed;
    top: 50%;
    right: max(16px, env(safe-area-inset-right, 0px) + 16px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateY(-50%);
    z-index: 1200;
}

.map-view-toggle__button {
    min-width: 126px;
    border: 1px solid rgba(65, 75, 67, 0.16);
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    color: var(--brand-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.map-view-toggle__button:hover {
    transform: translateX(-2px);
}

.map-view-toggle__button.is-active {
    background: var(--brand);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(36, 49, 39, 0.24);
}

.office-trace-panel {
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px) + 16px);
    bottom: max(16px, env(safe-area-inset-bottom, 0px) + 16px);
    width: min(540px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
    z-index: 1200;
}

.office-trace-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.office-trace-panel__copy {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.office-trace-panel__eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(65, 75, 67, 0.62);
}

.office-trace-panel__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-dark);
    line-height: 1.2;
}

.office-trace-panel__status {
    font-size: 13px;
    line-height: 1.5;
    color: #5f6761;
}

.office-trace-panel__toggle,
.office-trace-panel__action {
    border: none;
    border-radius: 14px;
    padding: 11px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.office-trace-panel__toggle {
    white-space: nowrap;
    background: rgba(65, 75, 67, 0.12);
    color: var(--brand-dark);
}

.office-trace-panel.is-active .office-trace-panel__toggle {
    background: var(--brand);
    color: #ffffff;
}

.office-trace-panel__progress {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.office-trace-panel__progress-text {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(65, 75, 67, 0.08);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
}

.office-trace-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.office-trace-panel__action {
    background: rgba(65, 75, 67, 0.1);
    color: var(--brand-dark);
}

.office-trace-panel__action.is-active {
    background: var(--brand);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(36, 49, 39, 0.2);
}

.office-trace-panel__action--primary {
    background: var(--brand);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(36, 49, 39, 0.2);
}

.office-trace-panel__action--secondary {
    background: rgba(65, 75, 67, 0.06);
}

.office-trace-panel__toggle:hover,
.office-trace-panel__action:hover,
.map-view-toggle__button:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.office-trace-panel__toggle:disabled,
.office-trace-panel__action:disabled,
.map-view-toggle__button:disabled {
    cursor: default;
    opacity: 0.46;
    box-shadow: none;
    transform: none;
}

/* Landing logo (centered, larger) */
.landing-logo {
    height: 96px;
    width: auto;
    align-self: center;
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.14));
}

@media (max-width: 420px) {
    .landing-logo {
        height: 78px;
    }

    .landing-content {
        gap: 22px;
        margin-top: -4vh;
    }

    .landing-title {
        font-size: 28px;
    }
}

/* Landing Menu Overlay */
.landing-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.landing-content {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-top: -6vh; /* Slight optical adjustment upwards */
}

.landing-title {
    font-size: 34px;
    font-weight: 700;
    color: var(--brand-dark);
    text-align: center;
    line-height: 1.3;
}

.landing-search {
    position: relative;
    width: 100%;
}

.landing-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.testing-mode-entry {
    border: none;
    border-radius: 999px;
    padding: 13px 20px;
    background: rgba(65, 75, 67, 0.12);
    color: var(--brand-dark);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.testing-mode-entry:hover {
    background: rgba(65, 75, 67, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.testing-mode-entry:active {
    transform: scale(0.98);
}

.testing-mode-entry__note {
    font-size: 12px;
    font-weight: 600;
    color: #6a6a6a;
    text-align: center;
}

/* Map Layer */
#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: top 0.24s ease, bottom 0.24s ease, height 0.24s ease;
}

body.map-mode-google .google-map-base {
    display: block;
}

body.map-mode-google #map,
body.map-mode-google .leaflet-container {
    background: transparent;
}

/* Status Message */
.status-message {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 17, 17, 0.92);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 1002;
    display: none;
    max-width: 90%;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.status-message.show {
    display: block;
    animation: statusFade 3s ease-in-out;
}

.test-location-panel {
    position: fixed;
    top: max(72px, env(safe-area-inset-top, 0px) + 72px);
    left: max(16px, env(safe-area-inset-left, 0px) + 16px);
    width: min(420px, calc(100% - 32px));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    padding: 12px 14px;
    z-index: 1200;
}

.test-location-panel__content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.test-location-panel__copy {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.test-location-panel__label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #606060;
}

.test-location-panel__status {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
    line-height: 1.3;
}

.test-location-action {
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(65, 75, 67, 0.12);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.test-location-action:hover {
    background: rgba(65, 75, 67, 0.18);
    transform: translateY(-1px);
}

.test-location-action:active {
    transform: scale(0.98);
}

.test-location-action:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.test-location-action--secondary {
    background: var(--brand-dark);
    color: #ffffff;
}

.test-location-panel__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.test-location-icon-button {
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(65, 75, 67, 0.1);
    color: var(--brand-dark);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.test-location-icon-button:hover {
    background: rgba(65, 75, 67, 0.16);
    transform: translateY(-1px);
}

.test-location-icon-button:active {
    transform: scale(0.97);
}

.test-location-icon-button.is-active {
    background: var(--brand);
    color: #fff;
}

@media (max-width: 640px) {
    .test-location-panel {
        left: 12px;
        width: calc(100% - 24px);
    }

    .test-location-panel__content {
        align-items: stretch;
        flex-direction: column;
    }

    .test-location-panel__actions {
        justify-content: flex-end;
    }
}

body.testing-mode-targeting .leaflet-container,
body.testing-mode-targeting .leaflet-container * {
    cursor: crosshair !important;
}

body.trace-mode-active #map {
    cursor: crosshair;
}

@media (max-width: 640px) {
    .map-view-toggle {
        top: auto;
        right: max(16px, env(safe-area-inset-right, 0px) + 16px);
        bottom: max(176px, env(safe-area-inset-bottom, 0px) + 176px);
        transform: none;
    }

    .map-view-toggle__button {
        min-width: 112px;
    }

    .office-trace-panel {
        padding: 14px;
        border-radius: 20px;
        max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
    }

    .office-trace-panel__header {
        flex-direction: column;
    }

    .office-trace-panel__toggle {
        width: 100%;
    }

    .office-trace-panel__actions > * {
        flex: 1 1 calc(50% - 5px);
    }
}

@keyframes statusFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    10%, 90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

#officeSearch {
    width: 100%;
    padding: 20px 24px;
    font-size: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    outline: none;
    transition: all 0.2s ease;
    background: #fafafa;
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#officeSearch:focus {
    border-color: var(--brand);
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    max-height: 40vh;
    overflow-y: auto;
    z-index: 2001;
    display: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    -webkit-overflow-scrolling: touch;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 16px 24px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.search-result-item:hover,
.search-result-item:active {
    background-color: #f8f8f8;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-header {
    padding: 14px 24px;
    background: #f8f8f8;
    border-bottom: 1px solid #e8e8e8;
    font-size: 13px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.search-result-name {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    font-size: 16px;
}

.search-result-description {
    font-size: 14px;
    color: #666;
}

/* Destination Panel (Redesigned Top Overlay) */
.destination-panel {
    position: absolute;
    top: max(72px, env(safe-area-inset-top, 0px) + 72px); /* Clear top controls and notch */
    left: 50%;
    transform: translateX(-50%);
    width: min(600px, calc(100% - 24px));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.destination-info {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 12px;
    width: 100%;
    align-items: start;
}

.destination-logo {
    grid-column: 2;
    grid-row: 2;
    height: 42px;
    width: auto;
    max-width: 120px;
    opacity: 0.95;
    pointer-events: none;
    justify-self: end;
    align-self: end;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.12));
}

.destination-copy {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 4px;
}

.destination-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a7a7a;
}

.destination-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.destination-name {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    white-space: normal; /* Allow wrapping */
    line-height: 1.3;
    width: 100%;
}

.destination-distance-pill {
    grid-column: 1;
    grid-row: 2;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(65, 75, 67, 0.12);
    color: var(--brand-dark);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    align-self: flex-start; /* Align left */
}

.panorama-access-btn {
    position: fixed;
    top: 50%;
    right: max(16px, env(safe-area-inset-right, 0px) + 16px);
    transform: translateY(-50%);
    width: min(180px, calc(100% - 32px));
    border: none;
    border-radius: 18px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    color: var(--brand-dark);
    z-index: 1100;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.panorama-access-btn:hover {
    transform: translateY(calc(-50% - 2px));
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.panorama-access-btn:active {
    transform: translateY(-50%) scale(0.98);
}

.panorama-access-btn__eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #666;
}

.panorama-access-btn__title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

/* Updated Search Button inside Panel */
.return-search-btn {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    width: 48px;
    height: 48px;
    background: rgba(65, 75, 67, 0.1);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.return-search-btn:hover {
    background: rgba(65, 75, 67, 0.16);
    transform: translateY(-1px);
}

.return-search-btn:active {
    transform: scale(0.95);
}

/* Pano Overlay - Full Coverage */
#panoOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2100; /* Above landing menu (2000) and map controls */
    background: #000;
    touch-action: none;
}

#panoOverlay .google-panorama-container,
#panoOverlay .gm-style,
#panoOverlay .pnlm-container {
    width: 100% !important;
    height: 100% !important;
}

/* Close Pano Button - Ensure Visibility */
#panoClose {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 2200; /* Above overlay */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#panoClose:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(1px);
}

body.panorama-split-active #panoOverlay {
    height: var(--panorama-split-height);
}

body.panorama-split-active #map {
    top: var(--panorama-split-height);
    bottom: 0;
    height: auto;
}

body.panorama-split-active .destination-panel,
body.panorama-split-active .panorama-access-btn,
body.panorama-split-active .test-location-panel,
body.panorama-split-active .map-mode-control,
body.panorama-split-active .office-trace-panel,
body.panorama-split-active .map-view-toggle {
    display: none !important;
}

body.panorama-split-active .developer-mode-button {
    display: none !important;
}

body.panorama-split-active .mobile-test-button {
    display: none !important;
}

body.panorama-split-active .leaflet-routing-container,
body.panorama-split-active .leaflet-routing-alternatives-container,
body.panorama-split-active .leaflet-routing-alt {
    display: none !important;
}

.leaflet-routing-container,
.leaflet-routing-alternatives-container,
.leaflet-routing-alt {
    display: none !important;
}

body.panorama-split-active #panoClose {
    top: 14px;
    right: 14px;
    padding: 9px 16px;
}

/* Ensure zoom controls (if any) are visible */
.psv-container .psv-navbar {
    bottom: 20px !important; /* Adjust default viewer controls */
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #2c2c2c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 14px;
    font-size: 14px;
}

/* Location Instructions Box */
.location-instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    max-width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    display: none;
}

.location-instructions strong {
    color: #1a1a1a;
}

.location-instructions button {
    display: block;
    margin: 16px auto 0;
    width: 100%;
    max-width: 300px;
}

/* Panorama context markers shown on the bottom map while 360 view is open */
.panorama-context-marker,
.map-banner-marker-anchor {
    background: transparent;
    border: none;
}

.map-banner-marker {
    display: inline-flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
}

.map-banner-marker__icon {
    position: relative;
    flex: 0 0 auto;
}

.map-banner-marker__label {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    margin-left: -2px;
    padding: 0 11px 0 10px;
    border-radius: 0 999px 999px 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    color: #111111;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: none;
}

.map-banner-marker__icon--door {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    border: 2px solid var(--brand-dark);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    z-index: 1;
    backdrop-filter: blur(4px);
}

.map-banner-marker__door {
    position: absolute;
    left: 7px;
    right: 7px;
    top: 5px;
    bottom: 4px;
    border: 2px solid var(--brand-dark);
    border-bottom-width: 3px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    background: rgba(65, 75, 67, 0.08);
}

.map-banner-marker__door-window {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: rgba(36, 49, 39, 0.55);
}

.map-banner-marker__icon--camera {
    width: 38px;
    height: 38px;
    z-index: 1;
    overflow: visible;
}

.map-banner-marker__camera-pulse {
    position: absolute;
    inset: 6px;
    border-radius: 999px;
    background: rgba(65, 75, 67, 0.1);
    border: 1px solid rgba(65, 75, 67, 0.14);
    z-index: 2;
}

.map-banner-marker__camera-core {
    position: absolute;
    inset: 10px;
    border-radius: 999px;
    background: rgba(65, 75, 67, 0.82);
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
    z-index: 3;
}

.map-banner-marker__camera-lens {
    position: absolute;
    inset: 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 2px rgba(36, 49, 39, 0.18);
    z-index: 4;
}

.map-banner-marker__camera-cone {
    position: absolute;
    left: 50%;
    top: -97px;
    width: 72px;
    height: 116px;
    background: linear-gradient(180deg, rgba(119, 151, 205, 0.05), rgba(119, 151, 205, 0.14) 52%, rgba(119, 151, 205, 0.3) 100%);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 116' preserveAspectRatio='none'%3E%3Cpath d='M6 12Q36 -8 66 12Q55 48 42 84L36 116L30 84Q17 48 6 12Z' fill='white'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 116' preserveAspectRatio='none'%3E%3Cpath d='M6 12Q36 -8 66 12Q55 48 42 84L36 116L30 84Q17 48 6 12Z' fill='white'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-size: 100% 100%;
    transform: translateX(-50%) rotate(var(--panorama-camera-heading));
    transform-origin: 50% 100%;
    filter: blur(0.8px) drop-shadow(0 6px 12px rgba(66, 96, 146, 0.18));
    pointer-events: none;
    z-index: 1;
}

.leaflet-tooltip.map-caption-tooltip {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    color: #111111;
    border: none;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: none;
    padding: 5px 9px;
}

.leaflet-tooltip.map-caption-tooltip::before {
    display: none;
}

.map-caption-tooltip__inner {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.map-caption-tooltip__icon {
    display: inline-flex;
    width: 11px;
    height: 11px;
    color: #111111;
}

.map-caption-tooltip__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.leaflet-tooltip.map-caption-tooltip--user,
.leaflet-tooltip.map-caption-tooltip--entrance {
    margin-top: 0;
}

@media (max-width: 640px) {
    body.panorama-split-active #panoClose {
        top: 10px;
        right: 10px;
        padding: 8px 14px;
        font-size: 13px;
    }
}
.compass-label {
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compass-distance {
    color: var(--brand);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.compass-coordinate-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.compass-coordinate-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.88);
}

.compass-coordinate-key {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.compass-coordinate-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-align: right;
}

/* Pulse animation for compass */
.compass-arrow circle {
    animation: compassPulse 2s ease-in-out infinite;
}

@keyframes compassPulse {
    0%, 100% {
        stroke: white;
        stroke-width: 2;
    }
    50% {
        stroke: var(--brand);
        stroke-width: 3;
    }
}

/* Office marker */
.office-marker {
    background: transparent;
    border: none;
}

.office-marker .office-pin {
    position: relative;
    width: 36px;
    height: 46px;
    cursor: pointer;
}

.office-pin__svg {
    display: block;
    width: 36px;
    height: 46px;
    overflow: visible;
    transform-origin: center bottom;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.office-pin.is-expanded .office-pin__svg {
    transform: scale(1.26);
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22));
}

.street-view-point-marker {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.18));
    transition: transform 0.16s ease, filter 0.16s ease;
}

.street-view-point-marker.map-banner-marker__icon--camera {
    width: 30px;
    height: 30px;
}

.street-view-point-marker .map-banner-marker__camera-pulse {
    display: none;
}

.street-view-point-marker .map-banner-marker__camera-core {
    inset: 6px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(180deg, rgba(88, 95, 93, 0.98), rgba(60, 66, 64, 0.98));
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.street-view-point-marker .map-banner-marker__camera-lens {
    inset: 11px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: inset 0 0 0 1px rgba(38, 45, 42, 0.16);
}

.street-view-point-marker.is-active {
    transform: scale(1.08);
    filter: drop-shadow(0 7px 14px rgba(0, 0, 0, 0.22));
}

.street-view-point-marker.is-active .map-banner-marker__camera-core {
    background: linear-gradient(180deg, rgba(74, 82, 79, 0.98), rgba(49, 55, 53, 0.98));
}

.street-view-legend {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom, 0px) + 10px);
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(247, 247, 245, 0.68);
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 920;
}

.street-view-legend__copy {
    color: #111111;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.street-view-legend .street-view-point-marker {
    width: 32px;
    height: 32px;
}

.street-view-legend .map-banner-marker__camera-cone {
    display: none;
}

body.panorama-split-active .street-view-legend {
    display: none !important;
}

/* Location prompt & buttons */
.location-prompt {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(247, 247, 245, 0.92);
    backdrop-filter: blur(10px);
    z-index: 2050;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.location-prompt-content {
    background: #fff;
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
    width: min(420px, 100%);
    max-height: calc(100dvh - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.location-prompt-content h3 {
    color: var(--brand-dark);
    margin-bottom: 10px;
}

.enable-location-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 8px 18px rgba(65, 75, 67, 0.25);
}

.enable-location-btn:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(65, 75, 67, 0.28);
}

.location-prompt-note {
    color: #5c5c5c;
    margin-top: 10px;
    font-size: 13px;
}

/* Google Panorama Container */
.google-panorama-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .map-mode-control {
        right: 16px;
        left: 16px;
        justify-content: space-between;
        gap: 12px;
    }

    .office-marker .office-pin {
        width: 28px;
        height: 36px;
    }

    .office-pin__svg {
        width: 28px;
        height: 36px;
    }

    .map-banner-marker__label {
        min-height: 22px;
        padding: 0 9px 0 8px;
        font-size: 9px;
    }

    .map-banner-marker__icon--door {
        width: 24px;
        height: 24px;
        border-radius: 8px;
    }

    .map-banner-marker__door {
        left: 6px;
        right: 6px;
        top: 4px;
        bottom: 3px;
    }

    .map-banner-marker__door-window {
        top: 8px;
        left: 10px;
    }

    .street-view-point-marker {
        width: 28px;
        height: 28px;
    }

    .street-view-point-marker.map-banner-marker__icon--camera {
        width: 28px;
        height: 28px;
    }

    .street-view-point-marker .map-banner-marker__camera-core {
        inset: 5px;
    }

    .street-view-point-marker .map-banner-marker__camera-lens {
        inset: 9px;
    }

    .street-view-legend {
        gap: 8px;
        padding: 6px 10px;
    }

    .street-view-legend .street-view-point-marker {
        width: 28px;
        height: 28px;
    }

    .map-mode-control__select {
        min-width: 0;
        flex: 1;
    }

    .search-container {
        padding: 12px;
    }

    #officeSearch {
        font-size: 16px;
        padding: 12px 14px;
    }

    .clear-btn {
        padding: 12px 16px;
        font-size: 13px;
    }

    .instructions {
        font-size: 12px;
        padding: 12px;
    }

    .status-message {
        top: 70px;
        font-size: 13px;
        padding: 10px 20px;
        width: min(420px, calc(100% - 24px));
    }

    .location-prompt-content {
        padding: 28px 24px;
        border-radius: 14px;
    }

    .destination-panel {
        padding: 12px;
        width: calc(100% - 24px);
    }

    .destination-info {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        row-gap: 10px;
    }

    .streetview-compass-overlay {
        bottom: 130px;
    }

    .panorama-access-btn {
        top: auto;
        bottom: max(140px, env(safe-area-inset-bottom, 0px) + 140px);
        right: 16px;
        transform: none;
        width: calc(100% - 32px);
        max-width: 240px;
    }

    .panorama-access-btn:hover {
        transform: translateY(-2px);
    }

    .panorama-access-btn:active {
        transform: scale(0.98);
    }

    .pano-btn {
        width: 100%;
    }

    /* Make panorama marker larger on mobile for easier tapping */
    .panorama-map-marker svg {
        width: 40px;
        height: 40px;
    }

    /* Adjust compass size for mobile */
    .compass-arrow {
        width: 50px;
        height: 50px;
    }
    
    .compass-info {
        padding: 8px 16px;
    }

    .compass-coordinate-list {
        min-width: 190px;
    }
    
    .compass-label {
        font-size: 11px;
    }
    
    .compass-distance {
        font-size: 16px;
    }
}

@media (hover: none) and (pointer: coarse), (max-width: 900px) {
    .mobile-test-button {
        display: inline-flex;
    }
}
