.ai3d-preview-mount,
.ai3d-preview-canvas-frame,
.ai3d-model-viewer {
    min-height: 620px;
    height: 100%;
}

.ai3d-preview-stage-panel {
    padding: 24px;
}

.ai3d-preview-stage-card {
    width: min(500px, calc(100% - 12px));
    padding: 24px 24px 22px;
}

.ai3d-preview-stage-panel--polling {
    align-items: center;
    justify-content: center;
    padding: 26px;
    pointer-events: none;
}

.ai3d-preview-stage-panel--particles-only {
    inset: 0;
    z-index: 4;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: transparent;
    border: 0;
    pointer-events: none;
    overflow: hidden;
}

.ai3d-preview-stage-card--polling {
    width: min(680px, calc(100% - 12px));
    padding: 0;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.ai3d-preview-stage-panel--particles-only .ai3d-preview-stage-card--polling,
.ai3d-preview-stage-panel--particles-only .ai3d-preview-stage-waiting {
    width: 100%;
    height: 100%;
}

.ai3d-preview-stage-card--model-loading {
    min-height: 0;
    padding: 22px 24px 20px;
    border-radius: 18px;
    background: rgba(8, 13, 22, 0.78);
    border: 1px solid rgba(146, 201, 255, 0.16);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.ai3d-preview-stage-waiting {
    display: grid;
    gap: 0;
    justify-items: center;
    text-align: center;
}

.ai3d-preview-stage-source {
    display: grid;
    gap: 0;
    justify-items: center;
    margin: 0;
}

.ai3d-preview-stage-panel--particles-only .ai3d-preview-stage-source {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
}

.ai3d-preview-stage-source-frame {
    position: relative;
    width: 640px;
    max-width: calc(100vw - 48px);
    height: 410px;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
}

.ai3d-preview-stage-panel--particles-only .ai3d-preview-stage-source-frame {
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ai3d-preview-stage-source-img {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    filter: saturate(1.12) brightness(0.64);
    transform: scale(1.01);
    animation: ai3dPollingSourceFloat 3.4s ease-in-out infinite;
}

.ai3d-preview-stage-panel--particles-only .ai3d-preview-stage-source-img {
    opacity: 0;
    visibility: hidden;
    padding: 0;
}

.ai3d-preview-stage-source-particles {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    mix-blend-mode: screen;
    /* Keep particle canvas pixel box locked to the source frame, not content-box drift. */
    box-sizing: border-box;
}

.ai3d-preview-stage-source-progress {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 24px;
    z-index: 8;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(6, 13, 25, 0.58);
    border: 1px solid rgba(137, 206, 255, 0.18);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(110, 215, 255, 0.06);
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.ai3d-preview-stage-panel--particles-only .ai3d-preview-stage-source-progress {
    right: 132px;
    bottom: 128px;
}

.ai3d-preview-stage-source-progress-track {
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(235, 247, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(178, 225, 255, 0.1);
}

.ai3d-preview-stage-source-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--ai3d-source-progress, 8%);
    min-width: 18px;
    border-radius: inherit;
    background: linear-gradient(90deg, #5ce8ff 0%, #9dfff2 46%, #ffd66b 100%);
    box-shadow: 0 0 18px rgba(92, 232, 255, 0.42), 0 0 30px rgba(255, 214, 107, 0.2);
}

.ai3d-preview-stage-source-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.32) 42%, transparent 76%);
    animation: ai3dPreviewProgressSweep 1.8s linear infinite;
}

.ai3d-preview-stage-source-progress-text {
    color: #f5fbff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-shadow: 0 0 14px rgba(92, 232, 255, 0.28);
    white-space: nowrap;
}

.ai3d-preview-stage-source-frame::before {
    content: "";
    position: absolute;
    inset: 8px;
    z-index: 5;
    border-radius: 18px;
    border: 1px solid rgba(178, 229, 255, 0.08);
    box-shadow: inset 0 0 22px rgba(66, 190, 255, 0.06);
    pointer-events: none;
}

.ai3d-preview-stage-source-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    background:
        radial-gradient(circle at 18% 20%, rgba(121, 219, 255, 0.2), transparent 18%),
        radial-gradient(circle at 78% 74%, rgba(255, 216, 122, 0.16), transparent 20%);
    mix-blend-mode: screen;
    pointer-events: none;
    animation: ai3dPollingSourceGlow 2.6s ease-in-out infinite alternate;
}

.ai3d-preview-stage-source-frame::before,
.ai3d-preview-stage-source-frame::after {
    display: none;
}

.ai3d-preview-stage-source-scan,
.ai3d-preview-stage-source-grid,
.ai3d-preview-stage-source-pulse {
    position: absolute;
    pointer-events: none;
}

.ai3d-preview-stage-source-scan,
.ai3d-preview-stage-source-grid,
.ai3d-preview-stage-source-pulse {
    display: none;
}

.ai3d-preview-stage-source-scan {
    left: 10px;
    right: 10px;
    top: -36px;
    z-index: 6;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(180deg, transparent, rgba(112, 205, 255, 0.7), transparent);
    box-shadow: 0 0 24px rgba(112, 205, 255, 0.58);
    animation: ai3dPollingSourceScan 2.1s linear infinite;
}

.ai3d-preview-stage-source-grid {
    inset: 0;
    z-index: 1;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(112, 205, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(112, 205, 255, 0.2) 1px, transparent 1px);
    background-size: 22px 22px;
    animation: ai3dPollingSourceGrid 4.8s linear infinite;
}

.ai3d-preview-stage-source-pulse {
    z-index: 7;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #dff7ff;
    box-shadow: 0 0 18px rgba(112, 205, 255, 0.82);
    animation: ai3dPollingSourcePulse 1.5s ease-in-out infinite;
}

.ai3d-preview-stage-source-pulse--a {
    left: 18%;
    top: 24%;
}

.ai3d-preview-stage-source-pulse--b {
    right: 20%;
    bottom: 22%;
    animation-delay: 0.52s;
}

.ai3d-preview-stage-source-label {
    display: none;
    color: #cfeaff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.ai3d-preview-stage-card--polling .ai3d-preview-stage-waiting-kicker,
.ai3d-preview-stage-card--polling .ai3d-preview-stage-waiting-title,
.ai3d-preview-stage-card--polling .ai3d-preview-stage-waiting-desc,
.ai3d-preview-stage-card--polling .ai3d-preview-stage-waiting-meta,
.ai3d-preview-stage-card--polling .ai3d-preview-stage-progress {
    display: none;
}

.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-waiting {
    gap: 14px;
}

.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-waiting-kicker,
.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-waiting-title,
.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-waiting-desc,
.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-waiting-meta,
.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-progress {
    display: flex;
}

.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-waiting-desc {
    display: block;
}

.ai3d-preview-stage-card--model-loading .ai3d-preview-stage-progress {
    width: min(520px, 100%);
}

.ai3d-preview-stage-waiting-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 26px;
    padding: 0 11px;
    border-radius: 999px;
    background: rgba(57, 110, 217, 0.22);
    color: #cae8ff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ai3d-preview-stage-waiting-title {
    color: #f5f9ff;
    font-size: 24px;
    line-height: 1.2;
}

.ai3d-preview-stage-waiting-desc {
    margin: 0;
    color: #aabdd8;
    font-size: 14px;
    line-height: 1.75;
}

.ai3d-preview-stage-progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.ai3d-preview-stage-progress-track {
    position: relative;
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(161, 207, 255, 0.08);
}

.ai3d-preview-stage-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(112, 205, 255, 0.98), rgba(255, 219, 128, 0.94));
    box-shadow: 0 0 18px rgba(112, 205, 255, 0.34);
}

.ai3d-preview-stage-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.18) 42%, transparent 76%);
    animation: ai3dPreviewProgressSweep 1.4s linear infinite;
}

.ai3d-preview-stage-progress-value {
    color: #f6fbff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ai3d-preview-stage-waiting-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #99afcc;
    font-size: 12px;
    line-height: 1.6;
}

@keyframes ai3dPreviewProgressSweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(180%);
    }
}

@keyframes ai3dPollingSourceFloat {
    0%,
    100% {
        transform: translateY(0) scale(1.01);
    }
    50% {
        transform: translateY(-3px) scale(1.025);
    }
}

@keyframes ai3dPollingSourceScan {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    12% {
        opacity: 1;
    }
    88% {
        opacity: 1;
    }
    100% {
        transform: translateY(250px);
        opacity: 0;
    }
}

@keyframes ai3dPollingSourceGrid {
    0% {
        background-position: 0 0, 0 0;
    }
    100% {
        background-position: 0 44px, 44px 0;
    }
}

@keyframes ai3dPollingSourceGlow {
    0% {
        opacity: 0.55;
    }
    100% {
        opacity: 0.9;
    }
}

@keyframes ai3dPollingSourcePulse {
    0%,
    100% {
        opacity: 0.35;
        transform: scale(0.72);
    }
    50% {
        opacity: 1;
        transform: scale(1.16);
    }
}

.ai3d-preview-format-badge {
    top: auto;
    bottom: 18px;
    left: 18px;
    background: rgba(7, 12, 20, 0.8);
}

.ai3d-preview-hud {
    left: auto;
    right: 18px;
    bottom: 18px;
    justify-content: flex-end;
    max-width: calc(100% - 360px);
}

.ai3d-preview-workbench {
    position: static;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 100%;
    gap: 12px;
    padding: 16px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(12, 17, 27, 0.94), rgba(8, 12, 20, 0.9));
}

.ai3d-preview-workbench-stack {
    display: grid;
    gap: 12px;
    flex: 1;
}

.ai3d-preview-workbench-block {
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.025));
}

.ai3d-preview-workbench-title {
    margin-top: 4px;
    font-size: 19px;
}

.ai3d-preview-workbench-status strong {
    font-size: 16px;
}

.ai3d-preview-workbench-coordinates,
.ai3d-preview-coordinates {
    display: grid;
    gap: 8px;
}

.ai3d-preview-workbench-coordinates span,
.ai3d-preview-coordinates span,
.ai3d-preview-tips span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #9fb2d0;
    font-size: 12px;
}

.ai3d-preview-actions {
    justify-content: flex-start;
}

.ai3d-preview-actions--stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.ai3d-preview-control,
.ai3d-preview-link {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(18, 24, 35, 0.96), rgba(10, 15, 24, 0.96));
}

.ai3d-preview-control:focus-visible,
.ai3d-preview-link:focus-visible {
    outline: none;
    border-color: rgba(122, 190, 255, 0.56);
    box-shadow: 0 0 0 3px rgba(66, 139, 255, 0.18);
}

.ai3d-preview-workbench-results ul {
    display: grid;
    gap: 8px;
}

.ai3d-preview-stage-footer {
    align-items: center;
    padding-top: 14px;
}

.ai3d-preview-stage-statusline {
    flex: 1;
    margin-top: 0;
    min-height: 34px;
    display: flex;
    align-items: center;
}

.ai3d-preview-tips {
    justify-content: flex-end;
}

.ai3d-preview-stage:fullscreen {
    padding: 20px;
}

.ai3d-preview-stage:fullscreen .ai3d-preview-stage-body {
    grid-template-columns: minmax(0, 1fr) 340px;
}

.ai3d-preview-stage:fullscreen .ai3d-preview-stage-viewport,
.ai3d-preview-stage:fullscreen .ai3d-preview-mount,
.ai3d-preview-stage:fullscreen .ai3d-preview-canvas-frame,
.ai3d-preview-stage:fullscreen .ai3d-model-viewer {
    min-height: calc(100vh - 168px);
    height: calc(100vh - 168px);
}
