:root {
    --tpo-glass-card: rgba(21, 29, 40, 0.92);
    --tpo-glass-card-45: rgba(21, 29, 40, 0.45);
    --tpo-glass-card-82: rgba(21, 29, 40, 0.82);
    --tpo-glass-border: rgba(61, 81, 109, 0.9);
}
/**
 * Tour panorama option switcher — soft-tile segment + Compare wipe (lab style C).
 */

.tour-pano-options {
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 3010; /* token-oneoff: pano options above sheet */
    display: none;
    max-width: min(920px, calc(100vw - 24px));
    pointer-events: none;
}

.tour-pano-options.is-visible {
    display: block;
    pointer-events: auto;
}

.tour-pano-options-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--luma-space-2);
    width: max-content;
    max-width: 100%;
    margin: 0 auto; /* token-oneoff: center */
    pointer-events: auto;
}

.tour-pano-options-seg {
    --tour-pano-opt-ease: cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    width: max-content;
    max-width: 100%;
    overflow: visible;
    padding: var(--luma-space-1);
    gap: 2px; /* token-oneoff: hairline */
    background: var(--tpo-glass-card);
    border: 1px solid var(--luma-border-strong, #3d516d);
    border-radius: 14px; /* token-oneoff: off-scale radius */
    box-shadow: var(--luma-shadow-md, 0 10px 28px -6px rgba(0, 0, 0, 0.4));
    backdrop-filter: blur(8px); /* token-oneoff: glass */
    pointer-events: auto;
}

.tour-pano-opt-btn {
    position: relative;
    z-index: 2; /* token-oneoff: local stacking */
    flex: 0 0 auto;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: var(--luma-font-md);
    font-weight: var(--luma-weight-semibold);
    white-space: nowrap;
    color: #9ca3af; /* token-oneoff: public HUD grey frozen with --luma-tile-fg until Phase 12 A/B */
    outline: none;
    padding: 8px 14px; /* token-oneoff: off-scale spacing */
    border-radius: 10px; /* token-oneoff: off-scale radius */
    transition: color 0.25s var(--luma-ease-out);
    font-family: inherit;
}

.tour-pano-opt-btn:hover { color: var(--luma-text-heading, #ffffff); }

.tour-pano-opt-btn.is-active {
    color: var(--luma-vista-accent-2, #7dd3fc);
    transition: color 0.15s var(--luma-ease-out) 0.08s;
}

.tour-pano-opt-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.tour-pano-opt-divider {
    position: relative;
    z-index: 2; /* token-oneoff: local stacking */
    flex: 0 0 auto;
    width: 1px;
    align-self: stretch;
    margin: 6px 2px; /* token-oneoff: off-scale spacing */
    background: var(--tpo-glass-border);
}

.tour-pano-opt-pill {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: 0;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    background: rgba(0, 163, 224, 0.28); /* token-oneoff: glass */
    border: 1px solid var(--luma-color-accent, #00a3e0);
    border-radius: 10px; /* token-oneoff: off-scale radius */
    transition:
        left 0.35s var(--tour-pano-opt-ease),
        width 0.35s var(--tour-pano-opt-ease),
        opacity 0.15s var(--luma-ease-out);
}

.tour-pano-compare-btn {
    position: relative;
    z-index: 2; /* token-oneoff: local stacking */
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--luma-border-strong, #3d516d);
    background: var(--tpo-glass-card);
    box-shadow: var(--luma-shadow-md, 0 10px 28px -6px rgba(0, 0, 0, 0.4));
    cursor: pointer;
    color: #9ca3af; /* token-oneoff: public HUD grey frozen with --luma-tile-fg until Phase 12 A/B */
    outline: none;
    border-radius: 10px; /* token-oneoff: off-scale radius */
    transition: color 0.2s var(--luma-ease-out), background 0.2s var(--luma-ease-out), border-color 0.2s var(--luma-ease-out);
    backdrop-filter: blur(8px); /* token-oneoff: glass */
}

.tour-pano-compare-btn:hover { color: var(--luma-text-heading, #ffffff); }

.tour-pano-compare-btn.is-on {
    color: var(--luma-vista-accent-2, #7dd3fc);
    border-color: var(--luma-color-accent, #00a3e0);
    background: rgba(0, 163, 224, 0.28); /* token-oneoff: glass */
}

.tour-pano-compare-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.tour-pano-compare-btn[hidden] {
    display: none !important;
}

.tour-pano-compare-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

#tour-overlay .tour-pano-options-veil,
.tour-pano-options-veil {
    position: absolute;
    inset: 0;
    z-index: 2500; /* token-oneoff: pano options above sheet */
    pointer-events: none;
    opacity: 0;
    background: transparent;
}

#tour-overlay #pano-native-container,
#tour-overlay #pano-compare-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--luma-surface-body, #0b1117);
    transform-origin: center center;
    will-change: filter, transform;
}

#tour-overlay #pano-native-container {
    display: block;
}

#tour-overlay #pano-compare-container {
    z-index: 1;
    pointer-events: none;
    display: none;
}

/* ID rules must not override the HTML hidden attribute (was covering the master pano). */
#tour-overlay #pano-compare-container:not([hidden]) {
    display: block;
}

.tour-wipe-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 44px;
    margin-left: -22px; /* token-oneoff: negative inset */
    z-index: 2600; /* token-oneoff: pano options above sheet */
    cursor: ew-resize;
    touch-action: none;
    pointer-events: auto;
    will-change: transform;
}

.tour-wipe-line::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px; /* token-oneoff: negative inset */
    background: var(--luma-text-heading, #ffffff);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.28),
        0 0 14px rgba(0, 163, 224, 0.35);
    transition: box-shadow 0.12s var(--luma-ease-out), width 0.12s var(--luma-ease-out);
}

.tour-wipe-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 32px;
    margin: -16px 0 0 -24px; /* token-oneoff: negative inset */
    border-radius: var(--luma-radius-pill);
    border: 2px solid #fff; /* token-oneoff: glass */
    background: var(--luma-color-accent, #00a3e0);
    color: var(--luma-text-heading, #ffffff);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.4),
        0 0 0 0 rgba(0, 163, 224, 0.35);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
    transition: transform 0.12s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.12s var(--luma-ease-out), background 0.12s var(--luma-ease-out);
}

.tour-wipe-handle-icon {
    display: block;
    width: 28px;
    height: 16px;
}

.tour-wipe-line:hover::before,
.tour-wipe-line.is-dragging::before {
    width: 3px;
    margin-left: -1.5px; /* token-oneoff: negative inset */
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.28),
        0 0 18px rgba(0, 163, 224, 0.55);
}

.tour-wipe-line:hover .tour-wipe-handle {
    transform: scale(1.08);
}

.tour-wipe-line.is-dragging .tour-wipe-handle {
    transform: scale(1.18);
    background: var(--luma-color-accent-2, #5ce1ff);
    color: var(--luma-surface-body, #0b1117);
    box-shadow:
        0 3px 14px rgba(0, 0, 0, 0.45),
        0 0 0 6px rgba(0, 163, 224, 0.22);
}

.tour-wipe-line.is-animating {
    pointer-events: none;
}

.tour-wipe-line.is-animating .tour-wipe-handle,
.tour-wipe-line.is-coasting .tour-wipe-handle {
    transform: scale(1.1);
    background: var(--luma-color-accent-2, #5ce1ff);
    color: var(--luma-surface-body, #0b1117);
}

.tour-compare-badges {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    z-index: 2550; /* token-oneoff: pano options above sheet */
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    gap: 72px; /* token-oneoff: off-scale spacing */
}

/* Author display must not override the HTML hidden attribute (setCompareChrome). */
.tour-compare-badges:not([hidden]) {
    display: flex;
}

.tour-compare-badges[hidden] {
    display: none !important;
}

.tour-compare-badge {
    max-width: min(42vw, 360px);
    padding: 12px 18px; /* token-oneoff: off-scale spacing */
    border-radius: var(--luma-radius-md);
    font-size: 18px; /* token-oneoff: off-scale type */
    font-weight: var(--luma-weight-bold);
    letter-spacing: 0.03em;
    line-height: 1.2; /* token-oneoff: leading */
    text-transform: none;
    color: #f8fafc; /* token-oneoff: public HUD badge grey held for Phase 12 */
    background: var(--tpo-glass-card-45);
    border: 1px solid rgba(255, 255, 255, 0.18); /* token-oneoff: glass */
    box-shadow: var(--luma-shadow-md, 0 10px 28px -6px rgba(0, 0, 0, 0.4));
    backdrop-filter: blur(14px); /* token-oneoff: glass */
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tour-compare-badge.is-master { color: #e2e8f0; /* token-oneoff: public HUD badge grey held for Phase 12 */ }
.tour-compare-badge.is-option { color: var(--luma-color-success, #2ecc71); }
.tour-compare-badge.is-active { color: #f8fafc; /* token-oneoff: public HUD badge grey held for Phase 12 */ }

/* Follower-only: active panorama name (top-left) when not in Compare. */
.tour-follower-pano-label {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    z-index: 2550; /* token-oneoff: pano options above sheet */
    pointer-events: none;
    display: none;
}

.tour-follower-pano-label:not([hidden]) {
    display: block;
}

.tour-follower-pano-label[hidden] {
    display: none !important;
}

body.live-tour-following .tour-follower-pano-label:not([hidden]) {
    display: block;
}

/* Followers must not switch design options independently — hide the option dock.
   Wipe line + corner badges stay visible so Compare tracks the presenter (interaction
   is blocked separately via pointer-events in tour_engine.php). */
body.live-tour-following .tour-pano-options {
    display: none !important;
}

@media (max-width: 768px) {
    .tour-pano-options {
        bottom: max(14px, env(safe-area-inset-bottom));
        max-width: calc(100vw - 16px);
    }
    .tour-pano-options-seg,
    .tour-pano-compare-btn {
        backdrop-filter: none;
    }
    .tour-pano-opt-btn {
        padding: 10px 14px; /* token-oneoff: off-scale spacing */
        min-height: 44px;
    }
    .tour-pano-compare-btn {
        width: 44px;
        height: 44px;
        min-height: 44px;
    }
    .tour-wipe-handle {
        width: 48px;
        height: 44px;
        margin: -22px 0 0 -24px; /* token-oneoff: negative inset */
    }
    .tour-compare-badges {
        gap: 64px; /* token-oneoff: off-scale spacing */
    }
    .tour-compare-badge {
        font-size: 15px; /* token-oneoff: off-scale type */
        padding: 10px 14px; /* token-oneoff: off-scale spacing */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--tpo-glass-card-82);
    }
}

@media (pointer: coarse) {
    .tour-pano-opt-btn {
        min-height: var(--luma-touch-min, 44px);
        padding: 10px 14px; /* token-oneoff: off-scale spacing */
    }
    .tour-pano-compare-btn {
        width: var(--luma-touch-min, 44px);
        height: var(--luma-touch-min, 44px);
        min-width: var(--luma-touch-min, 44px);
        min-height: var(--luma-touch-min, 44px);
    }
    .tour-wipe-line {
        width: var(--luma-touch-min, 44px);
        margin-left: calc(var(--luma-touch-min, 44px) / -2); /* token-oneoff: negative inset */
    }
    .tour-wipe-handle {
        width: 48px;
        height: var(--luma-touch-min, 44px);
        margin: calc(var(--luma-touch-min, 44px) / -2) 0 0 -24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tour-pano-opt-pill {
        transition: none;
    }
    .tour-wipe-handle,
    .tour-wipe-line::before {
        transition: none;
    }
}

/* Public tour: read-only polygon / text annotation hotspots */
.luma-pano-ann-poly {
    position: absolute;
    inset: 0;
    z-index: 4; /* token-oneoff: local stacking */
    pointer-events: none;
    overflow: hidden;
}
.luma-pano-ann-poly-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.luma-pano-ann-text {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 5; /* token-oneoff: local stacking */
    transform: translateZ(0);
    pointer-events: none;
}
.luma-pano-ann-text-inner {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
}
.luma-pano-ann-text-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.luma-pano-ann-text.is-rollover {
    opacity: 0;
    transition: opacity 0.15s var(--luma-ease-out);
}
.luma-pano-ann-text.is-rollover:hover {
    opacity: 1;
}
