.stage-wrap {
    position: relative;
    width: 100%; min-height: 660px;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
    background: linear-gradient(180deg, #fafbff 0%, #f4f6ff 100%);
    border-radius: 20px;
    border: 1px solid rgba(102,126,234,.1);
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    isolation: isolate;
}
.stage-wrap.is-panning { cursor: grabbing; }

.stage-wrap::after {
    content: '拖动平移';
    position: absolute; left: 14px; bottom: 12px; z-index: 8;
    font-size: 12px; color: #7b8496;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(8px);
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid rgba(102,126,234,.16);
    pointer-events: none;
}
.stage-wrap.has-panned::after {
    content: '已偏移（点复位视图还原）';
    color: var(--primary);
    border-color: rgba(102,126,234,.4);
}

/* ============ 氛围背景 ============ */
.stage-bg {
    position: absolute; inset: 0; z-index: 0;
    overflow: hidden; opacity: 0;
    transition: opacity .7s ease;
    pointer-events: none;
}
.stage-wrap.has-bg .stage-bg { opacity: 1; }
.stage-bg-frame {
    position: absolute; top: 50%; left: 50%;
    width: 100%; height: 100%;
    transform: translate(-50%, -50%) scale(1.8);
    border: 0; pointer-events: none; background: #fff;
    filter: saturate(1.2) brightness(1.02) blur(8px);
}
.stage-bg-blur {
    position: absolute; inset: 0; z-index: 1;
    pointer-events: none; opacity: 0;
    transition: opacity .7s ease;
    backdrop-filter: blur(42px) saturate(155%) brightness(1.06);
    -webkit-backdrop-filter: blur(42px) saturate(155%) brightness(1.06);
    background:
        radial-gradient(900px 380px at 50% 45%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 70%),
        linear-gradient(180deg, rgba(255,255,255,.52) 0%, rgba(244,246,255,.58) 100%);
}
.stage-wrap.has-bg .stage-bg-blur { opacity: var(--ambient-opacity, .85); }

/* ============ 设备层 ============ */
.stage-holder {
    position: relative; z-index: 2; flex: 0 0 auto;
    transition: width .4s cubic-bezier(.4,0,.2,1),
                height .4s cubic-bezier(.4,0,.2,1),
                transform .08s linear;
}
.stage {
    position: absolute; top: 0; left: 0;
    transform-origin: top left;
    transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.stage.no-trans { transition: none !important; }

.device { position: absolute; flex: 0 0 auto; }
.device.is-hidden { display: none; }
.device.dragging { z-index: 9999 !important; transition: none; }

/* ============ 水印 ============ */
.stage-watermark {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    display: none;
    overflow: hidden;
}
.stage-wrap.has-watermark .stage-watermark { display: block; }
.stage-watermark::before {
    content: '';
    position: absolute;
    inset: -50%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent 0,
            transparent 60px,
            rgba(102,126,234,.14) 60px,
            rgba(102,126,234,.14) 61px,
            transparent 61px,
            transparent 200px
        );
    pointer-events: none;
}
.watermark-tile {
    position: absolute;
    font-size: 14px;
    font-weight: 600;
    color: rgba(102,126,234,.32);
    white-space: nowrap;
    transform: rotate(-30deg);
    letter-spacing: 2px;
    pointer-events: none;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ============ 遮罩 ============ */
.stage-overlay {
    position: absolute; inset: 0; z-index: 30;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    font-size: 14px; color: var(--text-light);
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    transition: opacity .35s ease, visibility .35s ease;
}
.stage-overlay.hidden { opacity: 0; visibility: hidden; }
.spinner {
    width: 34px; height: 34px;
    border: 3px solid rgba(102,126,234,.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-stage {
    position: absolute; inset: 0; z-index: 10;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    color: var(--text-light); font-size: 15px;
    pointer-events: none;
}
.empty-stage[hidden] { display: none; }
.empty-stage svg { opacity: .35; }

/* ============ 缩放缓动条 ============ */
.zoom-slider {
    position: absolute;
    top: 14px; left: 50%;
    transform: translateX(-50%);
    z-index: 8;
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px 5px 6px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(102,126,234,.24);
    border-radius: 999px;
    box-shadow: 0 4px 10px -6px rgba(102,126,234,.6);
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    user-select: none;
}
.zoom-btn {
    width: 24px; height: 24px;
    border-radius: 50%; border: 0; padding: 0;
    background: rgba(102,126,234,.1);
    color: var(--primary);
    font-size: 16px; font-weight: 700;
    font-family: inherit; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s, transform .15s;
    flex: 0 0 auto;
}
.zoom-btn:hover { background: var(--primary); color: #fff; transform: scale(1.08); }
.zoom-btn:active { transform: scale(0.95); }
.zoom-value {
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    padding-right: 2px;
}
.zoom-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 130px; height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(102,126,234,.25), rgba(102,126,234,.6));
    outline: 0; cursor: pointer;
}
.zoom-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 6px -2px rgba(102,126,234,.8);
    cursor: grab;
    transition: transform .15s;
}
.zoom-slider input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.zoom-slider input[type="range"]::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: grab;
}

@media (max-width: 720px) {
    .stage-wrap { min-height: 520px; border-radius: 14px; }
    .stage-wrap::after { font-size: 11px; left: 10px; bottom: 8px; }
    .zoom-slider { top: 10px; gap: 6px; padding: 4px 8px 4px 5px; }
    .zoom-btn { width: 22px; height: 22px; font-size: 14px; }
    .zoom-slider input[type="range"] { width: 90px; }
    .zoom-value { min-width: 36px; }
    .stage-bg-blur {
        backdrop-filter: blur(28px) saturate(145%);
        -webkit-backdrop-filter: blur(28px) saturate(145%);
    }
    .stage-bg-frame {
        transform: translate(-50%, -50%) scale(1.6);
        filter: saturate(1.2) brightness(1.02) blur(6px);
    }
}