    /* workbench.css - 核心工作台布局与三栏逻辑 */

    body {
        height: 100vh;
        height: -webkit-fill-available;
        /* iOS Safari fix */
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow: hidden;
        background: #fff;
        position: fixed;
        /* Prevents iOS bounce scroll issues */
        width: 100%;
        top: 0;
        left: 0;
    }

    .workbench-layout {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: -webkit-fill-available;
        /* iOS Safari fix */
        width: 100vw;
        overflow: hidden;
        position: relative;
    }

    .workbench-main {
        display: flex;
        flex: 1;
        width: 100%;
        justify-content: flex-start;
        overflow: hidden;
    }

    /* --- Top Navigation --- */
    .top-nav {
        min-height: 64px;
        height: auto;
        background: #fff;
        border-bottom: 1px solid #f3f4f6;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 24px;
        /* Reduced vertical padding for multi-row */
        flex-shrink: 0;
        position: relative;
        z-index: 2000;
        flex-wrap: wrap;
        /* Allows wrapping on smaller screens */
        gap: 12px;
    }

    .brand {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-shrink: 0;
        order: 1;
    }

    .brand-logo-img {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        flex-shrink: 0;
        object-fit: contain;
    }

    /* 📢 Announcement Widget */
    .announcement-widget {
        background: linear-gradient(90deg, #FFF9C4 0%, #FFFDE7 100%);
        border: 1px solid #FFF59D;
        padding: 6px 16px;
        border-radius: 50px;
        display: flex;
        align-items: center;
        gap: 10px;
        max-width: 600px;
        height: 34px;
        overflow: hidden;
        color: #333;
        font-size: 14px;
        font-weight: 600;
        order: 2;
        flex-shrink: 0;
        /* Prevent squeezing */
        /* Default on Desktop */
    }

    @media (max-width: 1080px) {
        .announcement-widget {
            order: 3;
            /* Move below on narrow screens */
            flex: 1 1 100%;
            /* Force breaking to new line */
            max-width: none;
            margin: 4px 0;
        }
    }

    .announcement-track {
        flex: 1;
        overflow: hidden;
        white-space: nowrap;
        position: relative;
    }

    .announcement-text {
        display: inline-block;
        padding: 0 40px;
        animation: announcement-scroll 15s linear infinite;
    }

    @keyframes announcement-scroll {
        from {
            transform: translateX(50%);
        }

        to {
            transform: translateX(-100%);
        }
    }

    .top-nav-actions {
        display: flex;
        align-items: center;
        gap: 16px;
        flex-shrink: 0;
        order: 2;
    }

    @media (max-width: 1080px) {
        .top-nav-actions {
            order: 2;
        }
    }

    /* User Profile Header (New Mature Design) */
    .user-profile-header {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .header-credit-badge {
        display: flex;
        align-items: center;
        gap: 6px;
        background: rgba(0, 0, 0, 0.05);
        padding: 4px 10px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .header-credit-badge:hover {
        background: #000;
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .user-avatar-wrap {
        position: relative;
        cursor: pointer;
    }

    .avatar-sm {
        width: 36px;
        height: 36px;
        background: #fdf2f8;
        /* Light pink */
        border: 2px solid #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: transform 0.2s;
    }

    .user-avatar-wrap:hover .avatar-sm {
        transform: scale(1.05);
    }

    /* Popover Menu */
    .user-menu-popover {
        position: absolute;
        top: calc(100% + 12px);
        right: 0;
        width: 180px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        padding: 8px 0;
        z-index: 3000;
        transform-origin: top right;
        transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    }

    .user-menu-popover.hidden {
        display: block !important;
        opacity: 0;
        visibility: hidden;
        transform: scale(0.9) translateY(-10px);
    }

    .popover-header {
        padding: 8px 16px 12px;
    }

    .user-id {
        font-size: 14px;
        font-weight: 700;
        color: #1f2937;
        margin-bottom: 2px;
    }

    .user-tier {
        font-size: 11px;
        font-weight: 600;
        color: #9333ea;
        background: #fae8ff;
        padding: 2px 6px;
        border-radius: 4px;
        display: inline-block;
    }

    .popover-divider {
        height: 1px;
        background: rgba(0, 0, 0, 0.05);
        margin: 4px 8px;
    }

    .popover-body {
        padding: 4px 8px;
    }

    .popover-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 10px;
        color: #374151;
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.15s;
        width: 100%;
        border: none;
        background: transparent;
        cursor: pointer;
        text-align: left;
    }

    .popover-item:hover {
        background: #f3f4f6;
        color: #000;
    }

    .popover-item .icon {
        font-size: 16px;
    }

    .sidebar-left {
        width: 90px;
        background: #f8f9fa;
        border-right: 1px solid #e5e7eb;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 0;
        flex-shrink: 0;
        z-index: 20;
        overflow-y: auto;
        overflow-x: hidden;
        height: 100%;
        scrollbar-width: thin;
        scrollbar-color: #e5e7eb transparent;
    }

    .sidebar-left::-webkit-scrollbar {
        width: 4px;
    }

    .sidebar-left::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 10px;
    }

    .template-nav-list {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        align-items: center;
        padding-top: 24px;
        padding-bottom: 60px;
        flex: 1;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 72px;
        height: 72px;
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
        margin: 0 auto;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        color: #4b5563;
        border: 1px solid transparent;
        position: relative;
        user-select: none;
        box-sizing: border-box;
        padding: 8px;
    }

    .nav-item:hover {
        background: #e5e7eb;
        color: #111;
    }

    .nav-item.selected {
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        color: #2563eb;
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.08),
            inset 0 0 0 1px rgba(255, 255, 255, 0.4);
        border: 1px solid rgba(37, 99, 235, 0.2);
    }

    .nav-icon {
        font-size: 24px;
        margin-bottom: 2px;
        display: block;
        line-height: 1.2;
    }

    .nav-label {
        font-size: 10px;
        font-weight: 500;
        white-space: nowrap;
    }

    /* HOT 徽章 */
    .nav-badge {
        position: absolute;
        top: 4px;
        right: 4px;
        font-size: 8px;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 4px;
    }

    .nav-badge.hot {
        background: linear-gradient(135deg, #ef4444, #f97316);
        color: #fff;
    }

    /* 导航分隔线 */
    .nav-divider {
        width: 100%;
        padding: 8px 12px;
        margin: 4px 0;
    }

    .nav-divider-text {
        font-size: 9px;
        font-weight: 600;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* --- Column 2: Configuration Sidebar (Middle) --- */
    .sidebar-middle {
        width: 360px;
        background: #ffffff;
        border-right: 1px solid #e5e7eb;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        z-index: 10;
    }

    .panel-header {
        padding: 24px 24px 16px;
        border-bottom: 1px solid #f3f4f6;
    }

    .panel-header h2 {
        font-size: 1.1rem;
        font-weight: 700;
        margin: 0 0 6px 0;
        color: #111;
    }

    .panel-desc {
        font-size: 0.8rem;
        color: #6b7280;
        line-height: 1.4;
        margin: 0;
    }

    /* 移动端融合标题内的描述 - 默认隐藏 */
    .template-desc-inline {
        display: none;
    }

    .panel-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 24px;
    }

    /* Control Group Shared */
    .control-group {
        margin-bottom: 24px;
    }

    .group-label {
        display: block;
        font-size: 0.85rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 10px;
    }

    /* Framed Input Container */
    .input-container-framed {
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 12px;
        background: #f9fafb;
        transition: all 0.2s;
    }

    .input-container-framed:focus-within {
        border-color: #3b82f6;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    textarea#prompt-input {
        width: 100%;
        min-height: 120px;
        /* Initial height */
        max-height: 300px;
        /* Desktop max height */
        overflow-y: hidden;
        /* Hide scrollbar initially, JS will toggle if needed? No, auto is better */
        border: none;
        background: transparent;
        font-family: inherit;
        font-size: 0.95rem;
        resize: none;
        color: #374151;
        padding: 0;
        /* padding handled by container? */
    }

    /* Mobile handling for textarea max-height */
    @media (max-width: 600px) {
        textarea#prompt-input {
            max-height: 35vh;
            /* Limit height on mobile to ensure button visibility */
            overflow-y: auto;
        }
    }

    textarea#prompt-input:focus {
        outline: none;
    }

    /* Form Sections */
    .advanced-form {
        background: #f9fafb;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 24px;
        border: 1px solid #f3f4f6;
    }

    .form-section-title {
        font-size: 0.75rem;
        font-weight: 600;
        color: #4b5563;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 12px;
    }

    /* Chip Group Elements */
    .chip-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .chip {
        padding: 6px 14px;
        border: 1px solid #e5e7eb;
        background: #fff;
        color: #4b5563;
        border-radius: 99px;
        font-size: 0.85rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .chip:hover {
        background: #f9fafb;
        border-color: #d1d5db;
    }

    .chip.active {
        background: #000;
        color: #fff;
        border-color: #000;
    }

    /* Panel Footer & Generate Button */
    .panel-footer {
        padding: 16px 20px;
        border-top: 1px solid #f3f4f6;
        background: #fff;
    }

    /* Credit Dashboard Styles */
    .credit-dashboard {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
        border: 1px solid #f0f0f0;
        border-radius: 14px;
        padding: 12px 16px;
        margin-bottom: 16px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    }

    .dashboard-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .user-badge {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .badge-icon {
        font-size: 20px;
    }

    .badge-info {
        display: flex;
        flex-direction: column;
    }

    .tier-name {
        font-size: 14px;
        font-weight: 700;
        color: #333;
    }

    .tier-desc {
        font-size: 11px;
        color: #999;
    }

    .upgrade-btn {
        background: #FF9800;
        color: #fff;
        font-size: 12px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 6px;
        text-decoration: none;
        transition: transform 0.2s;
    }

    .upgrade-btn:hover {
        transform: scale(1.05);
        background: #F57C00;
    }

    .dashboard-right {
        text-align: right;
    }

    .cost-info {
        font-size: 13px;
        color: #666;
        margin-bottom: 2px;
    }

    .balance-info {
        font-size: 13px;
        color: #666;
    }

    .highlight-orange {
        color: #FF9800;
        font-weight: 800;
        font-size: 15px;
        margin: 0 2px;
    }

    .highlight-blue {
        color: #3b82f6;
        font-weight: 800;
        font-size: 15px;
        margin: 0 2px;
    }

    @media (max-width: 600px) {
        .credit-dashboard {
            padding: 10px 12px;
        }

        .tier-name,
        .cost-info,
        .balance-info {
            font-size: 12px;
        }
    }

    #generate-btn {
        width: 100%;
        background: linear-gradient(135deg, #111 0%, #333 100%);
        color: #fff;
        border: none;
        padding: 16px;
        border-radius: 12px;
        font-weight: 600;
        cursor: pointer;
        position: relative;
        overflow: hidden;
        transition: all 0.2s;
    }

    #generate-btn:hover {
        opacity: 0.9;
        transform: translateY(-1px);
    }

    #generate-btn:active {
        transform: translateY(0);
    }

    /* --- Column 3: Main Stage / Preview --- */
    .main-stage {
        flex: 1;
        background-color: #f9fafb;
        background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
        background-size: 20px 20px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 0;
        /* Remove padding to allow full-width canvas */
        position: relative;
    }

    .canvas-container {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .image-wrapper {
        background: #fff;
        padding: 0;
        /* Remove padding for clean look with overlay button */
        border-radius: 12px;
        box-shadow: var(--shadow-lg);
        position: relative;
        max-width: 100%;
        max-height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        /* Ensure button doesn't spill if needed, though usually fine */
        user-select: none;
        /* Disable selection */
        -webkit-user-select: none;
    }

    .image-wrapper img {
        display: block;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        /* Ensure full visibility */
        border-radius: 12px;
        /* Remove fixed max-height calc to allow flex container to control it */
    }

    .mobile-save-hint {
        display: none;
        margin-top: 12px;
        font-size: 0.8rem;
        color: #6b7280;
    }

    /* Hero Mode */
    .hero-content {
        text-align: center;
        max-width: 600px;
    }

    .hero-title {
        font-size: 2.5rem;
        font-weight: 850;
        margin-bottom: 24px;
        color: #000;
    }

    .highlight {
        background: linear-gradient(120deg, #fff9c4 0%, #fff9c4 100%);
        background-repeat: no-repeat;
        background-size: 100% 40%;
        background-position: 0 80%;
    }

    /* Loading States */
    .loading-state {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .surreal-orb {
        width: 80px;
        height: 80px;
        background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 50%, #4ECDC4 100%);
        background-size: 200% 200%;
        animation: blob-bounce 3s infinite ease-in-out, gradient-move 3s ease infinite;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        /* 边缘渐变过渡到背景 - 使用 mask 实现柔和边缘或者简单的 box-shadow */
        /* 由于背景复杂，这里使用 box-shadow + inset shadow 来增加立体感 */
        box-shadow:
            inset 0 0 20px rgba(255, 255, 255, 0.5),
            0 10px 20px rgba(0, 0, 0, 0.15);
        filter: blur(0.5px);
        /* 微弱模糊增加高级感 */
    }

    @keyframes blob-bounce {

        0%,
        100% {
            border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
            transform: scale(1);
        }

        50% {
            border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
            transform: scale(1.1);
        }
    }

    @keyframes gradient-move {
        0% {
            background-position: 0% 50%;
        }

        50% {
            background-position: 100% 50%;
        }

        100% {
            background-position: 0% 50%;
        }
    }


    /* --- New Toolbar Styles (Doubao Style) --- */
    .input-actions-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        /* Allow wrapping for safety */
        /* Compact spacing */
        margin-top: 12px;
        position: relative;
    }

    .tool-wrapper {
        position: relative;
    }

    .tool-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 6px 12px;
        /* Revert to compact padding */
        background: #f3f4f6;
        border: 1px solid transparent;
        border-radius: 8px;
        /* Rounded corners like Doubao */
        color: #374151;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        user-select: none;
        white-space: nowrap;
        /* Prevent wrapping */
        flex-shrink: 0;
        /* Prevent shrinking */
    }

    .tool-btn:hover {
        background: #e5e7eb;
        color: #111;
    }

    .tool-btn:active {
        background: #d1d5db;
        transform: translateY(1px);
    }

    .tool-btn .icon {
        font-size: 15px;
        flex-shrink: 0;
        line-height: 1;
        /* Fix vertical alignment */
    }

    /* Popover Styles */
    .tool-popover {
        position: absolute;
        bottom: calc(100% + 8px);
        /* Open upwards */
        left: 50%;
        transform: translateX(-50%);
        width: 260px;
        /* Widened to fit text */
        background: #fff;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
        padding: 6px;
        z-index: 9999;
        /* Ensure on top */
        transform-origin: bottom center;
        animation: popover-in 0.15s ease-out;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .tool-popover.hidden {
        display: none;
    }

    @keyframes popover-in {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(8px);
        }

        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }

    .popover-title {
        font-size: 11px;
        color: #9ca3af;
        padding: 4px 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .popover-options {
        display: flex;
        flex-direction: column;
    }

    /* Ratio Icons */
    .ratio-icon {
        display: inline-block;
        border: 2px solid currentColor;
        border-radius: 2px;
        margin-right: 10px;
        flex-shrink: 0;
        opacity: 0.8;
    }

    .ratio-1-1 {
        width: 14px;
        height: 14px;
    }

    .ratio-2-3 {
        width: 12px;
        height: 16px;
    }

    .ratio-3-4 {
        width: 13px;
        height: 16px;
    }

    .ratio-4-3 {
        width: 16px;
        height: 13px;
    }

    .ratio-9-16 {
        width: 10px;
        height: 16px;
    }

    .ratio-16-9 {
        width: 16px;
        height: 10px;
    }

    .ratio-21-9 {
        width: 18px;
        height: 8px;
    }

    .popover-item:hover .ratio-icon {
        opacity: 1;
    }

    .popover-item {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 8px 10px;
        border-radius: 6px;
        border: none;
        background: transparent;
        color: #374151;
        font-size: 13px;
        text-align: left;
        cursor: pointer;
        transition: background 0.1s;
    }

    .popover-item:hover {
        background: #f3f4f6;
    }

    .popover-item.active {
        color: #2563eb;
        background: #eff6ff;
        font-weight: 600;
    }

    .popover-item.active::after {
        content: '✓';
        margin-left: auto;
        font-size: 14px;
    }

    @media (max-width: 800px) {
        .workbench-layout {
            height: 100vh;
            /* Locked to viewport height */
            overflow-y: auto;
            /* Enable internal scrolling */
        }

        .workbench-main {
            flex-direction: column;
            height: auto;
            overflow: visible;
        }

        /* Top Nav Sticky on Mobile */
        .sidebar-left {
            width: 100%;
            height: auto;
            flex-direction: row;
            position: sticky;
            top: 0;
            z-index: 1000;
            padding-top: 0;
            border-right: none;
            border-bottom: 1px solid #f3f4f6;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            overflow-x: auto;
            /* Allow horizontal scrolling */
            overflow-y: hidden;
        }

        .template-nav-list {
            flex-direction: row;
            padding: 10px 16px;
            gap: 12px;
            overflow-x: auto;
            justify-content: flex-start;
            /* 隐藏滚动条但保持可滚动 */
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .template-nav-list::-webkit-scrollbar {
            display: none;
        }

        /* 滑动暗示：右侧渐变遮罩（覆盖在模板区右侧） */
        .sidebar-left::after {
            content: '';
            position: fixed;
            top: 45px;
            right: 0;
            width: 50px;
            height: 95px;
            background: linear-gradient(to left, #ffffff 20%, rgba(255, 255, 255, 0) 100%);
            pointer-events: none;
            z-index: 1001;
        }

        /* 首次进入的滑动提示动画 */
        .template-nav-list.hint-scroll {
            animation: scrollHint 1.5s ease-in-out;
        }

        @keyframes scrollHint {

            0%,
            100% {
                transform: translateX(0);
            }

            30% {
                transform: translateX(-15px);
            }

            60% {
                transform: translateX(0);
            }
        }

        .nav-item {
            width: 72px !important;
            height: 72px !important;
            flex-shrink: 0;
            /* Prevent squeezing */
        }

        .sidebar-middle {
            width: 100%;
            height: auto;
            border-right: none;
        }

        /* 移动端紧凑布局优化 */
        .panel-header {
            padding: 12px 16px 8px;
            border-bottom: none;
            /* 移除分割线，与输入区融合 */
        }

        .panel-header h2 {
            font-size: 1rem;
            margin-bottom: 0;
        }

        /* 标题后内联描述 */
        .template-desc-inline {
            display: block !important;
            font-size: 0.75rem !important;
            font-weight: 400 !important;
            color: #6b7280 !important;
            margin-top: 4px;
        }

        .panel-desc {
            display: none;
            /* 隐藏描述，通过输入框上方显示 */
        }

        .panel-scroll {
            padding: 12px 16px;
        }

        .control-group {
            margin-bottom: 12px;
        }

        .group-label {
            font-size: 0.8rem;
            margin-bottom: 6px;
        }

        .input-container-framed {
            padding: 10px;
        }

        textarea#prompt-input {
            height: 80px;
            font-size: 0.9rem;
        }

        .input-hint-text {
            font-size: 0.7rem;
            margin-top: 6px;
            padding-top: 6px;
        }

        /* 比例和画质双列布局 */
        .chip-group {
            gap: 6px;
        }

        .chip {
            padding: 6px 10px;
            font-size: 0.8rem;
        }

        /* 底部面板紧凑 */
        .panel-footer {
            padding: 12px 16px 16px;
        }

        .credit-dashboard {
            padding: 8px 10px;
            margin-bottom: 8px;
        }

        #generate-btn {
            padding: 14px;
        }

        .main-stage {
            width: 100%;
            padding: 0;
            /* 移除边距，图片铺满 */
            min-height: auto;
        }

        .mobile-save-hint {
            display: block;
        }

        /* Force Announcement Wrap on Mobile */
        .announcement-widget {
            order: 3 !important;
            flex: 1 1 100% !important;
            margin-top: 8px !important;
            max-width: none !important;
        }
    }

    /* 中等手机 (iPhone Plus/Max 等 414px 左右) */
    @media (max-width: 480px) {
        .nav-item {
            width: 64px !important;
            height: 64px !important;
        }

        .nav-icon {
            font-size: 1.4rem;
        }

        .nav-label {
            font-size: 0.6rem;
        }

        textarea#prompt-input {
            height: 70px;
        }
    }

    /* 小屏手机 (iPhone SE/Mini 等 375px 左右) */
    @media (max-width: 390px) {
        .panel-header {
            padding: 10px 12px 6px;
        }

        .panel-header h2 {
            font-size: 0.95rem;
        }

        .panel-scroll {
            padding: 10px 12px;
        }

        .control-group {
            margin-bottom: 10px;
        }

        .group-label {
            font-size: 0.75rem;
            margin-bottom: 4px;
        }

        textarea#prompt-input {
            height: 60px;
            font-size: 0.85rem;
        }

        .input-container-framed {
            padding: 8px;
        }

        .input-hint-text {
            display: none;
            /* 极小屏隐藏提示 */
        }

        .chip {
            padding: 5px 8px;
            font-size: 0.75rem;
        }

        .chip-group {
            gap: 4px;
        }

        .panel-footer {
            padding: 10px 12px 14px;
        }

        .credit-dashboard {
            padding: 6px 8px;
            font-size: 0.8rem;
        }

        #generate-btn {
            padding: 12px;
            font-size: 0.95rem;
        }

        .nav-item {
            width: 56px !important;
            height: 56px !important;
        }

        .nav-icon {
            font-size: 1.2rem;
        }

        .nav-label {
            font-size: 0.55rem;
        }
    }

    /* --- History Drawer & Overlay --- */
    .history-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(4px);
        z-index: 2999;
        /* Just below drawer */
        opacity: 1;
        transition: opacity 0.3s ease;
    }

    .history-overlay.hidden {
        opacity: 0;
        pointer-events: none;
    }

    .history-drawer {
        position: fixed;
        top: 0;
        right: 0;
        width: 360px;
        height: 100vh;
        background: #fff;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
        z-index: 3000;
        transform: translateX(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
    }

    .history-drawer.hidden {
        transform: translateX(100%);
    }

    .history-header {
        padding: 20px;
        border-bottom: 1px solid #f3f4f6;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .history-header h3 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 700;
        color: #111;
    }

    .history-actions {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .history-close {
        background: none;
        border: none;
        font-size: 24px;
        color: #9ca3af;
        cursor: pointer;
        line-height: 1;
        padding: 0;
    }

    .history-close:hover {
        color: #111;
    }

    .history-list {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        align-content: flex-start;
        padding-bottom: 20px;
    }

    .history-item {
        width: calc(50% - 6px);
        background: #f9fafb;
        background: #f9fafb;
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #eee;
        break-inside: avoid;
        margin-bottom: 0;
        /* Gap handles spacing now */
    }

    .history-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .history-thumb-box {
        width: 100%;
        /* Remove fixed aspect-ratio to allow natural image height (Masonry) */
        /* aspect-ratio: 1; */
        background: #e5e7eb;
        overflow: hidden;
        cursor: pointer;
        line-height: 0;
        /* Fix ghost spacing below image */
    }

    .history-thumb {
        width: 100%;
        height: auto;
        /* Allow natural height */
        display: block;
        /* Remove inline gap */
        object-fit: cover;
        transition: transform 0.3s, opacity 0.3s;
    }

    /* 图片加载占位符 - 骨架屏效果 */
    .thumb-placeholder {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        min-height: 80px;
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
    }

    @keyframes shimmer {
        0% {
            background-position: 200% 0;
        }

        100% {
            background-position: -200% 0;
        }
    }

    /* 图片加载中状态 - 淡入效果 */
    .history-thumb.loading {
        opacity: 0;
    }

    .history-thumb-box {
        position: relative;
    }

    .history-thumb:hover {
        transform: scale(1.05);
    }

    .history-meta {
        padding: 8px 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
    }

    .history-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .history-time {
        font-size: 10px;
        color: #9ca3af;
    }

    .history-tag {
        font-size: 10px;
        font-weight: 600;
        color: #374151;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }

    .history-del-btn {
        background: none;
        border: none;
        font-size: 16px;
        color: #d1d5db;
        cursor: pointer;
        line-height: 1;
        padding: 4px;
    }

    .history-del-btn:hover {
        color: #ef4444;
    }

    .history-empty {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: #9ca3af;
        gap: 12px;
        margin-top: 40px;
    }

    .empty-icon {
        font-size: 40px;
        opacity: 0.5;
    }

    .empty-hint {
        font-size: 0.8rem;
        color: #d1d5db;
    }

    /* Mobile Drawer Full Width */
    @media (max-width: 600px) {
        .history-drawer {
            width: 100vw;
        }
    }

    /* Status Text */
    #status-text {
        font-size: 0.85rem;
        color: #666;
        margin-bottom: 8px;
        text-align: center;
        min-height: 20px;
        transition: color 0.3s;
    }

    #status-text.error-notice {
        color: #ef4444;
        font-weight: 600;
    }

    /* --- Task Badge & Popover (NEW) --- */
    .task-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: #ef4444;
        color: #fff;
        font-size: 10px;
        font-weight: 800;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #fff;
        line-height: 1;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .task-badge.hidden {
        display: none !important;
    }

    .task-popover {
        position: absolute;
        top: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%);
        background: #000;
        color: #fff;
        padding: 10px 16px;
        border-radius: 12px;
        white-space: nowrap;
        z-index: 3100;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        animation: popover-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    @keyframes popover-in {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }

    .task-popover.hidden {
        display: none;
    }

    .popover-content {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }

    .popover-arrow {
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-bottom: 6px solid #000;
    }

    /* --- Canvas Toolbar (Moved from Header) --- */
    .canvas-toolbar {
        position: absolute;
        top: 24px;
        left: 24px;
        z-index: 100;
        pointer-events: none;
        /* Allow clicking through empty space */
        width: auto;
        /* Override previous 100% just in case */
        display: block;
        padding-bottom: 0;
    }

    /* PC History Button in Header */
    .pc-history-btn {
        background: transparent;
        padding: 8px 12px;
        border-radius: 8px;
        border: 1px solid transparent;
        font-weight: 500;
        color: #374151;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: all 0.2s;
        height: 36px;
        /* Match avatar height */
    }

    .pc-history-btn:hover {
        background: #f3f4f6;
        color: #111;
    }

    .pc-history-btn .icon {
        font-size: 16px;
    }

    .toolbar-right {
        display: flex;
        align-items: center;
        gap: 12px;
        pointer-events: auto;
        /* Restore events for buttons */
    }

    .toolbar-right .btn-text-icon {
        background: #ffffff;
        /* 纯白背景，更显眼 */
        padding: 10px 18px;
        /* 稍微加大尺寸 */
        border-radius: 24px;
        border: 1px solid rgba(0, 0, 0, 0.12);
        /* 增加边框可见度 */
        box-shadow:
            0 4px 12px -1px rgba(0, 0, 0, 0.1),
            0 2px 4px -1px rgba(0, 0, 0, 0.06);
        font-weight: 600;
        /* 加粗字体 */
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        color: #374151;
    }

    .toolbar-right .btn-text-icon:hover {
        background: #fff;
        color: #111;
        transform: translateY(-2px);
        box-shadow:
            0 10px 15px -3px rgba(0, 0, 0, 0.12),
            0 4px 6px -2px rgba(0, 0, 0, 0.08);
        border-color: rgba(0, 0, 0, 0.2);
    }

    /* Mobile optimization for toolbar */
    @media (max-width: 800px) {
        .canvas-toolbar {
            top: 16px;
            left: 16px;
        }

        /* Hide PC History Button on Mobile */
        .pc-history-btn {
            display: none !important;
        }

        /* Show FAB on Mobile */
        .history-fab.hidden-pc {
            display: flex !important;
        }
    }

    /* --- History FAB (Mobile Only) --- */
    .history-fab {
        position: fixed;
        bottom: 30px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #000;
        color: #fff;
        display: none;
        /* Hidden by default (PC) */
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        z-index: 2900;
        /* Below Drawer (3000) */
        border: 2px solid rgba(255, 255, 255, 0.2);
        cursor: pointer;
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .history-fab:active {
        transform: scale(0.9);
    }

    .fab-icon {
        font-size: 24px;
        line-height: 1;
    }

    .history-fab .loading-spinner-icon {
        animation: spin 1s linear infinite;
    }


    /* --- History Pending State --- */
    .history-item.pending-item {
        border: 1px dashed #2563eb;
        background: #eff6ff;
        pointer-events: none;
        /* Prevent clicking while pending */
    }

    .history-thumb-box.pending-box {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.5);
    }

    .spinner-sm {
        width: 24px;
        height: 24px;
        border: 3px solid #e5e7eb;
        border-top-color: #2563eb;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* --- History Button Loading State (Shared) --- */
    .loading-active {
        color: #2563eb !important;
        background: #eff6ff !important;
        border-color: rgba(37, 99, 235, 0.3) !important;
    }

    .loading-active .icon,
    .loading-active .fab-icon {
        animation: spin 2s linear infinite;
        display: inline-block;
    }

    /* --- New Download Button --- */
    .btn-download-primary {
        background: #000;
        color: #fff;
        border: none;
        padding: 12px 24px;
        border-radius: 99px;
        /* Pill shape */
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        min-width: 140px;
        justify-content: center;
    }

    .btn-download-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        background: #1a1a1a;
    }

    .btn-download-primary:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* --- New Download Button (Floating) --- */
    .btn-floating-download {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        backdrop-filter: blur(4px);
        z-index: 100;
        /* Fix: Ensure button is above image overlay if any */
        pointer-events: auto;
        /* Fix: Ensure clickable */

        -webkit-backdrop-filter: blur(4px);
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 20;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        padding: 0;
        /* Reset padding */
    }

    .btn-floating-download:hover {
        background: rgba(0, 0, 0, 0.7);
        transform: scale(1.1);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    }

    .btn-floating-download:active {
        transform: scale(0.95);
    }

    .btn-floating-download .btn-icon {
        font-size: 18px;
        line-height: 1;
        display: block;
        /* Fix alignment */
    }

    .btn-floating-download.downloading {
        cursor: wait;
        opacity: 0.7;
    }

    .btn-floating-download.downloading .btn-icon {
        animation: spin 1s linear infinite;
        content: "⏳";
        /* Visual feedback via CSS content replacement if possible, or just animate logic in JS */
    }

    /* Remove old footer button styles if needed, or keep for compability */
    .result-actions-footer {
        display: none;
        /* Hide the footer container entirely as we moved the button */
    }

    .result-actions-footer {
        margin-top: 24px;
        padding-bottom: 40px;
        /* Safe space to prevent cutoff */
        width: 100%;
        display: flex;
        justify-content: center;
        flex-shrink: 0;
    }

    /* --- Infinite Canvas System --- */
    .infinite-viewport {
        width: 100%;
        height: 100%;
        overflow: hidden;
        position: relative;
        cursor: grab;
        /* background-color: #f9fafb; Inherited from main-stage */
        touch-action: none;
        /* Important for custom touch handling */
    }

    .infinite-viewport:active {
        cursor: grabbing;
    }

    .infinite-world {
        position: absolute;
        top: 50%;
        left: 50%;
        transform-origin: center center;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-content: center;
        align-items: center;
        width: 0;
        /* Acts as a point source that expands visually via overflow: visible */
        height: 0;
        overflow: visible;
        will-change: transform;
    }

    .canvas-item {
        position: absolute;
        /* Managed by JS Layout or simplified flex? 
                               Let's use absolute for Masonry-like control or keep it simple.
                               If using standard flex centered in a zero-size container, it might behave weirdly.
                               Better: The world is a flexible container. */
        /* Re-thinking World: Let World be a div that we just transform. 
           Inside, let's use a standard grid for simplicity. */
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 12px;
        padding: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        transition: transform 0.2s, box-shadow 0.2s;
        user-select: none;
        -webkit-user-select: none;
        width: auto;
    }

    /* We'll override .infinite-world to be robust */
    .infinite-world {
        /* Reset keys */
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        /* The actual transform (translate/scale) applies here */
        pointer-events: none;
        /* Let click pass through empty space */
        z-index: 10;
    }

    .infinite-world-content {
        /* CSS Columns 瀑布流布局 */
        position: absolute;
        left: 0;
        top: 0;
        transform: none;

        width: 100%;
        padding: 16px;
        box-sizing: border-box;
        max-width: none;

        column-width: 280px;
        column-gap: 16px;

        pointer-events: auto;
    }

    /* Mobile: 固定画布，铺满无边距 */
    @media (max-width: 768px) {
        .infinite-world-content {
            column-width: 48%;
            column-gap: 4px;
            padding: 0;
            /* 无边距 */
        }

        /* 移动端禁用画布缩放拖动 */
        .infinite-world {
            transform: none !important;
            position: relative;
            height: auto;
        }

        .infinite-viewport {
            overflow-y: auto;
            overflow-x: hidden;
        }

        .canvas-item {
            margin-bottom: 4px;
            padding: 0;
            /* 无边距 */
            border-radius: 6px;
        }
    }

    /* Single Item: Centered & Full view */
    .infinite-world-content:has(.canvas-item:only-child) {
        column-width: auto;
        column-count: 1;
        display: flex;
        justify-content: center;
    }

    .infinite-world-content:has(.canvas-item:only-child) .canvas-item {
        max-width: 600px;
        width: 100%;
    }

    .canvas-item {
        position: relative;
        width: 100%;
        display: inline-block;
        break-inside: avoid;
        margin-bottom: 16px;
        background: #fff;
        border-radius: 12px;
        padding: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        transition: box-shadow 0.2s;
    }

    .canvas-item:hover {
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
        /* 移除 z-index 避免 Safari columns 重绘 bug */
    }

    .canvas-item img {
        width: 100%;
        height: auto;
        border-radius: 8px;
        display: block;
        pointer-events: auto;
        cursor: zoom-in;
    }

    .canvas-item .item-meta {
        font-size: 12px;
        color: #6b7280;
        margin-top: 8px;
        padding: 0 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 卡片操作按钮容器 */
    .card-actions {
        position: absolute;
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 10px;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .canvas-item:hover .card-actions {
        opacity: 1;
    }

    /* 统一卡片按钮样式 */
    .btn-card-action {
        padding: 8px 16px;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.95);
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 5px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
        transition: all 0.15s;
        font-size: 13px;
        font-weight: 500;
        color: #333;
        white-space: nowrap;
    }

    .btn-card-action:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
        background: #fff;
    }

    /* 编辑按钮高亮样式 */
    .btn-card-action.btn-card-edit {
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
        color: #92400e;
    }

    .btn-card-action.btn-card-edit:hover {
        background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    }

    .btn-card-action .btn-icon {
        font-size: 14px;
    }

    .btn-card-action .btn-text {
        font-size: 13px;
    }

    /* 浮动编辑面板 */
    .edit-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10000;
        animation: fadeIn 0.2s ease-out;
    }

    .edit-panel.closing {
        animation: fadeOut 0.2s ease-out forwards;
    }

    .edit-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 16px 16px 0 0;
    }

    .edit-panel-title {
        font-size: 16px;
        font-weight: 600;
        color: #111;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .edit-panel-close {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: none;
        background: #f3f4f6;
        font-size: 20px;
        color: #6b7280;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.15s;
    }

    .edit-panel-close:hover {
        background: #e5e7eb;
        color: #111;
    }

    .edit-panel-preview {
        padding: 16px 20px;
        background: #fff;
        display: flex;
        justify-content: center;
    }

    .edit-panel-preview img {
        max-width: 100%;
        max-height: 200px;
        border-radius: 8px;
        object-fit: contain;
    }

    .edit-panel-body {
        padding: 16px 20px 20px;
        background: #fff;
        border-radius: 0 0 16px 16px;
    }

    .edit-instruction {
        width: 100%;
        min-height: 100px;
        padding: 14px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        font-size: 14px;
        line-height: 1.6;
        resize: vertical;
        font-family: inherit;
        transition: border-color 0.15s;
    }

    .edit-instruction:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    .edit-instruction::placeholder {
        color: #9ca3af;
    }

    .edit-panel-actions {
        display: flex;
        gap: 12px;
        margin-top: 16px;
        justify-content: flex-end;
    }

    .edit-cancel-btn {
        padding: 10px 20px;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
        background: #fff;
        color: #6b7280;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.15s;
    }

    .edit-cancel-btn:hover {
        background: #f3f4f6;
    }

    .edit-submit-btn {
        padding: 10px 24px;
        border-radius: 8px;
        border: none;
        background: linear-gradient(135deg, #111 0%, #333 100%);
        color: #fff;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.15s;
    }

    .edit-submit-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .edit-submit-btn:disabled {
        background: #9ca3af;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    /* 编辑面板内容卡片 */
    .edit-panel-card {
        max-width: 420px;
        width: 90%;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        overflow: hidden;
    }

    /* 包裹卡片 */
    .edit-panel::before {
        content: none;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    @keyframes fadeOut {
        from {
            opacity: 1;
        }

        to {
            opacity: 0;
        }
    }

    /* Adjust grid for mobile */
    @media (max-width: 1000px) {
        .infinite-world-content {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media (max-width: 600px) {
        .infinite-world-content {
            grid-template-columns: 1fr;
        }
    }

    /* --- Animations --- */
    @keyframes scatter-out {
        0% {
            opacity: 1;
            transform: scale(1) translateY(0);
            filter: blur(0);
        }

        100% {
            opacity: 0;
            transform: scale(1.1) translateY(-20px);
            filter: blur(10px);
        }
    }

    .canvas-item.scatter-out {
        animation: scatter-out 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        pointer-events: none;
        /* Prevent clicks during exit */
    }

    /* Stagger delays for a cooler effect if we can via JS, or just random/index based in CSS if items are limited */
    /* .canvas-item.scatter-out:nth-child(even) { animation-duration: 0.7s; } */

    /* Focus Mode - Single Image View */
    .focus-stage {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
        padding: 20px;
        box-sizing: border-box;
        animation: fadeIn 0.5s ease;
        position: relative;
        z-index: 10;
    }

    .focus-stage.hidden {
        display: none !important;
    }

    .focus-stage .canvas-item {
        /* 响应式适应画布 */
        max-width: 90%;
        max-height: 80vh;
        width: auto;
        height: auto;
        margin: 0;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .focus-stage .canvas-item img {
        max-width: 100%;
        max-height: 70vh;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 12px;
    }

    @media (max-width: 768px) {
        .focus-stage .canvas-item {
            max-width: 95vw;
            max-height: 70vh;
        }

        .focus-stage .canvas-item img {
            max-height: 60vh;
        }
    }

    /* Floating Toggle Button */
    .btn-floating-toggle {
        position: absolute;
        top: 20px;
        left: 20px;
        z-index: 200;

        background: rgba(43, 45, 49, 0.85);
        /* Dark semi-transparent */
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #fff;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        transition: all 0.2s ease;

        display: flex;
        align-items: center;
        gap: 6px;
    }

    .btn-floating-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    }

    .btn-floating-toggle:active {
        transform: translateY(0);
    }

    .btn-floating-toggle.hidden {
        display: none;
        opacity: 0;
        pointer-events: none;
    }

    /* --- Image Upload UI --- */
    .input-actions-bar {
        display: flex;
        justify-content: flex-end;
        /* Align to right */
        align-items: center;
        margin-top: 8px;
        padding-top: 4px;
    }

    .btn-text-action {
        background: transparent;
        border: none;
        color: #6b7280;
        font-size: 0.8rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 4px;
        cursor: pointer;
        padding: 6px 10px;
        border-radius: 6px;
        transition: all 0.2s;
    }

    .btn-text-action:hover {
        background: #f3f4f6;
        color: #111;
    }

    /* 多图预览网格 */
    .ref-images-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
        padding: 8px;
        background: #f9fafb;
        border-radius: 8px;
        border: 1px dashed #e5e7eb;
    }

    .ref-image-item {
        position: relative;
        width: 56px;
        height: 56px;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid #e5e7eb;
        background: #fff;
        flex-shrink: 0;
    }

    .ref-image-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: zoom-in;
        transition: transform 0.15s;
    }

    .ref-image-item img:hover {
        transform: scale(1.05);
    }

    .ref-image-item .remove-btn {
        position: absolute;
        top: 2px;
        right: 2px;
        width: 18px;
        height: 18px;
        background: rgba(0, 0, 0, 0.6);
        color: #fff;
        border: none;
        border-radius: 50%;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.15s;
    }

    .ref-image-item:hover .remove-btn {
        opacity: 1;
    }

    .ref-image-item .remove-btn:hover {
        background: rgba(239, 68, 68, 0.9);
    }

    /* 参考图数量徽章 */
    .ref-count-badge {
        background: #3b82f6;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        padding: 2px 6px;
        border-radius: 10px;
        margin-left: 4px;
    }

    .ref-count-badge.hidden {
        display: none;
    }

    /* 添加更多图片占位按钮 */
    .ref-add-more {
        width: 56px;
        height: 56px;
        border: 2px dashed #d1d5db;
        border-radius: 8px;
        background: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #9ca3af;
        font-size: 24px;
        transition: all 0.15s;
    }

    .ref-add-more:hover {
        border-color: #3b82f6;
        color: #3b82f6;
        background: #eff6ff;
    }