@media screen and (max-width: 1400px) {
    .ai3d-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .ai3d-preview-hud {
        max-width: calc(100% - 320px);
    }

    .ai3d-preview-workbench {
        width: min(288px, calc(100% - 40px));
    }
}

/* ===== AI3D workstation refresh ===== */

.ai3d-page {
    padding: 18px;
    background:
        radial-gradient(circle at 14% 10%, rgba(64, 110, 255, 0.14), transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(52, 204, 255, 0.1), transparent 24%),
        linear-gradient(180deg, #05070b 0%, #03050a 100%);
}

.ai3d-shell {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    max-width: 1920px;
}

.ai3d-left {
    position: sticky;
    top: var(--ai3d-frame-gap, 22px);
    width: auto;
    min-width: 0;
    max-height: var(--ai3d-workspace-height, calc(100vh - 140px));
    padding: 14px 18px 18px;
    overflow: auto;
    border-radius: 24px;
    background:
        radial-gradient(circle at 12% 12%, rgba(80, 132, 255, 0.16), transparent 28%),
        linear-gradient(180deg, rgba(18, 24, 36, 0.98), rgba(8, 12, 20, 0.98));
    border-color: rgba(137, 166, 225, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 26px 56px rgba(0, 0, 0, 0.28);
}

.ai3d-left-hero {
    padding: 18px 18px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(14, 21, 33, 0.92), rgba(9, 13, 22, 0.92));
    box-shadow: inset 0 0 0 1px rgba(73, 103, 167, 0.08);
}

.ai3d-left-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(48, 88, 195, 0.24);
    border: 1px solid rgba(110, 147, 241, 0.22);
    color: #9fc3ff;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ai3d-left-title {
    margin: 14px 0 10px;
    color: #f5f8ff;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 600;
}

.ai3d-left-desc {
    margin: 0;
    color: #97a7c6;
    font-size: 13px;
    line-height: 1.8;
}

.ai3d-left .sec,
.ai3d-left-submit {
    margin-top: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.ai3d-left-panel--mode {
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ai3d-left-panel--upload {
    margin-top: 14px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ai3d-left-config-grid {
    display: grid;
    gap: 12px;
}

#ai3dGenerateTypeSection,
#ai3dPolygonTypeSection {
    display: none;
}

.ai3d-left .sec {
    margin-top: 0;
}

.ai3d-task-restore {
    display: none !important;
    gap: 10px;
}

.ai3d-task-history-panel {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(143, 167, 211, 0.14);
    background: linear-gradient(180deg, rgba(14, 20, 31, 0.96), rgba(9, 13, 21, 0.96));
}

.ai3d-task-history-panel[hidden] {
    display: none !important;
}

.ai3d-task-history-status {
    color: #95a9c8;
    font-size: 12px;
    line-height: 1.6;
}

.ai3d-task-history-list {
    display: grid;
    gap: 8px;
    max-height: 264px;
    overflow: auto;
    padding-right: 2px;
    align-content: start;
    grid-template-columns: minmax(0, 1fr);
}

.ai3d-task-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    height: auto !important;
    min-height: 168px;
    align-self: start;
    padding: 8px;
    overflow: hidden;
    border: 1px solid rgba(77, 136, 214, 0.48);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 12%, rgba(70, 137, 255, 0.18), transparent 44%),
        linear-gradient(180deg, rgba(11, 26, 50, 0.98), rgba(5, 15, 31, 0.98));
    color: #d7e3f8;
    font-size: 14px !important;
    line-height: 1.35;
    white-space: normal;
    text-align: left;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ai3d-task-history-item:focus-visible {
    outline: none;
    border-color: rgba(112, 205, 255, 0.9);
    box-shadow:
        0 10px 22px rgba(0, 12, 28, 0.32),
        0 0 0 3px rgba(66, 139, 255, 0.18);
}

.ai3d-task-history-item:hover {
    transform: translateY(-1px);
    border-color: rgba(86, 198, 255, 0.82);
    box-shadow: 0 10px 22px rgba(0, 12, 28, 0.32), 0 0 0 1px rgba(86, 198, 255, 0.14);
}

.ai3d-task-history-item.is-active {
    border-color: rgba(91, 209, 255, 0.92);
    background:
        radial-gradient(circle at 50% 12%, rgba(68, 178, 255, 0.26), transparent 48%),
        linear-gradient(180deg, rgba(13, 43, 79, 0.98), rgba(6, 18, 37, 0.98));
    box-shadow: inset 0 0 0 1px rgba(124, 210, 255, 0.2), 0 10px 24px rgba(0, 14, 34, 0.36);
}

.ai3d-task-history-thumb {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 96px;
    aspect-ratio: 1.55 / 1;
    height: auto;
    overflow: hidden;
    border-radius: 10px;
    background:
        radial-gradient(circle at 50% 38%, rgba(95, 169, 255, 0.2), transparent 44%),
        linear-gradient(180deg, rgba(18, 43, 78, 0.96), rgba(6, 18, 36, 0.98));
}

.ai3d-task-history-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.ai3d-task-history-thumb-placeholder {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(58, 109, 205, 0.26);
    color: rgba(214, 233, 255, 0.84);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0;
}

.ai3d-task-history-format {
    position: absolute;
    top: 8px;
    left: 8px;
    min-height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(6, 18, 34, 0.78);
    color: #eef7ff;
    font-size: 11px;
    line-height: 22px;
    box-shadow: inset 0 0 0 1px rgba(161, 207, 255, 0.14);
}

.ai3d-task-history-item-body {
    display: grid;
    gap: 6px;
    align-content: start;
    min-width: 0;
}

.ai3d-task-history-item-body > * {
    min-width: 0;
}

.ai3d-task-history-item-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.ai3d-task-history-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(58, 109, 205, 0.22);
    color: #d8ebff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ai3d-task-history-progress-value {
    color: #dff1ff;
    font-size: 12px;
    font-weight: 700;
}

.ai3d-task-history-progress {
    position: relative;
    width: 100%;
    height: 8px;
    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-task-history-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(112, 205, 255, 0.96), rgba(255, 225, 137, 0.92));
    box-shadow: 0 0 12px rgba(112, 205, 255, 0.28);
}

.ai3d-task-history-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.14) 42%, transparent 76%);
    animation: ai3dHistoryProgressSweep 1.6s linear infinite;
}

.ai3d-task-history-item-kicker {
    color: #f1f6ff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}

.ai3d-task-history-item-meta {
    color: #9eb3d5;
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

.ai3d-task-history-item-status-row {
    flex-wrap: wrap;
}

.ai3d-task-history-status-badge,
.ai3d-task-history-progress-value {
    flex: 0 0 auto;
}

.ai3d-task-history-progress {
    grid-column: 1 / -1;
}

.ai3d-task-history-item-id {
    color: #7f94b7;
    font-size: 12px;
    line-height: 1.45;
    font-family: 'Consolas', 'Courier New', monospace;
    word-break: break-all;
    white-space: normal;
    margin-top: 1px;
}

.ai3d-task-history-item-hint {
    color: #9db8db;
    font-size: 12px;
    line-height: 1.55;
    word-break: break-word;
}

.ai3d-task-history-item.is-live {
    border-color: rgba(112, 205, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(112, 205, 255, 0.16), 0 12px 26px rgba(0, 12, 28, 0.34);
}

.ai3d-task-history-item.is-status-waiting .ai3d-task-history-status-badge {
    background: rgba(71, 130, 255, 0.22);
}

.ai3d-task-history-item.is-status-running .ai3d-task-history-status-badge {
    background: rgba(255, 189, 84, 0.18);
    color: #fff0cb;
}

.ai3d-task-history-item.is-status-done .ai3d-task-history-status-badge {
    background: rgba(87, 210, 160, 0.18);
    color: #dffff3;
}

.ai3d-task-history-item.is-status-fail .ai3d-task-history-status-badge {
    background: rgba(255, 126, 126, 0.18);
    color: #ffd9d9;
}

.ai3d-task-history-item.is-status-fail .ai3d-task-history-progress-fill {
    background: linear-gradient(90deg, rgba(255, 120, 120, 0.94), rgba(255, 184, 146, 0.92));
}

@keyframes ai3dHistoryProgressSweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(180%);
    }
}

.ai3d-task-restore-input {
    width: 100%;
}

.ai3d-task-restore-btn {
    margin-top: 0;
}

