.masterplan {
    width: 100vw;
    margin-left: calc(50% - 50vw);
}

.masterplan__stage {
    position: relative;
    overflow: hidden;
    background: #fff; /* чтобы не было "черной" секции если что-то сместилось */
}

/* Desktop/default */
.masterplan__content {
    position: relative;
    --mp-scale: 1;     /* set by JS */
    --pin-scale: 1;    /* set by JS = 1 / mp-scale */
    --spot-rot: 0deg;  /* set by JS */
}

.masterplan__img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

/* Spots: keep readable size even when content scaled */
.masterplan__spot {
    position: absolute;
    transform: translate(-50%, -50%) rotate(var(--spot-rot)) scale(var(--pin-scale));

    width: 44px;
    height: 44px;
    border-radius: 999px;

    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile rotate mode */
@media (max-width: 450px) {
    .masterplan__stage.masterplan--rotated {
        height: auto;
        max-height: 100svh;
        aspect-ratio: 9 / 16;
    }

    .masterplan__stage.masterplan--rotated .masterplan__content {
        position: absolute;
        left: 50%;
        top: 50%;
        transform-origin: center center;

        /* rotate + scale into viewport */
        transform: translate(-50%, -50%) rotate(90deg) scale(var(--mp-scale));
    }
}

.masterplan__popover {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
}

@media (max-width: 450px) {
    .masterplan__spot {
        width: 32px;
        height: 32px;
        font-size: 13px;
        border-width: 2px;
    }

    .masterplan__popover {
        position: absolute;
        z-index: 3;
        min-width: 180px;
        max-width: 240px;

        transform: translate(-50%, calc(-100% - 10px));
        padding: 10px 12px;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.85);
        color: #fff;
        backdrop-filter: blur(6px);
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    }

    .masterplan__popover::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: -6px;
        transform: translateX(-50%);
        width: 12px;
        height: 12px;
        background: rgba(0, 0, 0, 0.85);
        transform: translateX(-50%) rotate(45deg);
    }

    .masterplan__popover-title {
        font-weight: 600;
        margin-bottom: 4px;
    }

    .masterplan__popover-sub {
        font-size: 12px;
        opacity: 0.85;
        margin-bottom: 10px;
    }

    .masterplan__popover-actions {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    .masterplan__popover-open {
        flex: 1 1 auto;
        border: 0;
        border-radius: 10px;
        padding: 8px 10px;
        background: #fff;
        color: #000;
        font-weight: 600;
    }

    .masterplan__popover-close {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        border: 0;
        background: rgba(255, 255, 255, 0.14);
        color: #fff;
        font-size: 18px;
        line-height: 1;
    }
}