.toast-stack {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: min(92vw, 560px);
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 12px;
    padding: 16px 14px 16px 16px;
    min-height: 72px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(18, 18, 24, 0.92);
    color: #f5f5f7;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(8px);
    transform: translateY(-6px);
    opacity: 0;
    transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-6px);
}

.toast .toast-body {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.toast .toast-close {
    border: 0;
    background: transparent;
    color: #d0d4dc;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
}

.toast .toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.88), rgba(69, 10, 10, 0.92));
    border-color: rgba(248, 113, 113, 0.4);
}

.toast.toast-success {
    border-left: 4px solid #22c55e;
    background: linear-gradient(135deg, rgba(20, 83, 45, 0.88), rgba(5, 46, 22, 0.92));
    border-color: rgba(74, 222, 128, 0.4);
}

.toast.toast-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.88), rgba(69, 26, 3, 0.92));
    border-color: rgba(251, 191, 36, 0.45);
}

.toast.toast-info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.88), rgba(23, 37, 84, 0.92));
    border-color: rgba(96, 165, 250, 0.42);
}

.error-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    color: #ff4d4d;
    font-size: 0.9rem;
    line-height: 1.5;
}

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    cursor: pointer;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-download-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(12, 12, 12, 0.55);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
    z-index: 2;
}

.lightbox-download-btn:hover {
    background: rgba(22, 22, 22, 0.82);
    border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-download-btn:active {
    transform: scale(0.96);
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox-overlay.active .lightbox-image {
    transform: scale(1);
}

/* Cropper Modal */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    z-index: 20000;
    padding: 20px;
    color: white;
}

.crop-modal.active {
    display: flex;
}

.crop-header {
    display: flex;
    justify-content: center;
    /* Centered buttons */
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.crop-header h3 {
    position: absolute;
    left: 0;
    margin: 0;
    font-size: 1rem;
}

.crop-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-bottom: 80px;
}

.crop-item {
    background: #18181b;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.crop-item-title {
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #a0a0b0;
    display: flex;
    justify-content: space-between;
}

.crop-container {
    max-height: 400px;
    overflow: hidden;
    border-radius: 8px;
}

.crop-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: #09090b;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ratio-selector {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 8px;
}

.ratio-btn {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    color: #a0a0b0;
}

.ratio-btn.active {
    background: var(--primary-color);
    color: white;
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
}

.adjust-images-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    height: fit-content;
    align-self: center;
}

.sidebar-close-btn {
    display: none;
}

.sidebar.open .sidebar-close-btn {
    display: flex;
}

.adjust-images-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Larger cropper handles */
.cropper-point {
    width: 20px !important;
    height: 20px !important;
    background-color: var(--primary-color) !important;
    opacity: 0.8 !important;
}

.cropper-point.point-ne {
    top: -10px !important;
    right: -10px !important;
}

.cropper-point.point-nw {
    top: -10px !important;
    left: -10px !important;
}

.cropper-point.point-se {
    bottom: -10px !important;
    right: -10px !important;
}

.cropper-point.point-sw {
    bottom: -10px !important;
    left: -10px !important;
}

.crop-btn-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: white;
    transition: all 0.2s;
}

.crop-btn-overlay:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.clear-btn {
    background: none;
    border: none;
    color: #707080;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s;
    font-weight: 500;
    opacity: 0.7;
}

.clear-btn:hover {
    color: var(--primary-color);
    opacity: 1;
}

.task-settings-info {
    font-size: 0.75rem;
    color: #707080;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.task-settings-info span {
    display: flex;
    align-items: center;
}

.task-card.failed-collapsible {
    position: relative;
}

.generator-page .task-card.failed-collapsible,
.generator-page .task-card.failed-collapsible.error-card-collapsed {
    background: rgba(24, 18, 20, 0.92) !important;
    border: 1px solid rgba(160, 70, 70, 0.18) !important;
    box-shadow: inset 0 0 0 1px rgba(120, 48, 48, 0.10);
}

.failed-collapse-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
}

.failed-collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.task-card.error-card-collapsed {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    min-height: 44px;
}

.task-card.error-card-collapsed .task-settings-info {
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 34px;
}

.task-card.error-card-collapsed .task-prompt-wrapper,
.task-card.error-card-collapsed .task-attachments,
.task-card.error-card-collapsed .video-player-container,
.task-card.error-card-collapsed .task-meta {
    display: none !important;
}

.advanced-settings-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    color: #d4d4d8;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.86rem;
}

.advanced-settings-toggle:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.04);
}

.advanced-settings-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s;
}

.advanced-settings-modal.open {
    display: flex;
    opacity: 1;
}

.advanced-settings-dialog {
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: #1a1a20;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.advanced-settings-modal.open .advanced-settings-dialog {
    transform: translateY(0);
}

.advanced-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 20px 28px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 1.1rem;
    color: #fff;
    font-weight: 600;
}

.advanced-settings-close {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #a0a0b0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    transition: all 0.2s;
}

.advanced-settings-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.advanced-settings-panel {
    display: flex;
    padding: 16px 28px 24px;
    gap: 12px;
    flex-direction: column;
}

.advanced-setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d4d4d8;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 12px;
}

.advanced-setting-item:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
}

.advanced-setting-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* UUID Button & Tooltip */
.uuid-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.uuid-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #707080;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 700;
    transition: all 0.2s;
    margin-left: 4px;
}

.uuid-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.query-badge {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

.query-badge:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.55);
    color: #dbeafe;
}

.uuid-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #1a1a20;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #fff;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.duration-control {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1a1c;
    border: 1px solid var(--primary-border);
    border-radius: 10px;
    min-height: 42px;
    padding: 5px 8px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.duration-control:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.16);
}

.duration-number-input {
    flex: 1;
    min-width: 0;
    background: transparent !important;
    border: none !important;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    height: 30px;
    padding: 0 4px;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
    background-image: none !important;
}

.duration-number-input::-webkit-outer-spin-button,
.duration-number-input::-webkit-inner-spin-button,
.duration-number-input::-webkit-calendar-picker-indicator {
    -webkit-appearance: none;
    display: none;
    margin: 0;
}

.duration-stepper {
    display: inline-flex;
    gap: 6px;
    margin-left: auto;
}

.duration-step-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
    cursor: pointer;
    line-height: 1;
    font-size: 16px;
    user-select: none;
}

.duration-step-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
}

.duration-step-btn:active {
    transform: scale(0.96);
}

.uuid-container:hover .uuid-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #1a1a1c;
    border: 1px solid var(--primary-border);
    border-radius: 10px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
}

.custom-select-value {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-arrow {
    color: #808090;
    font-size: 0.9rem;
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #1a1a1c;
    border: 1px solid var(--primary-border);
    border-radius: 10px;
    padding: 6px;
    display: none;
    z-index: 50;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.custom-select.open .custom-select-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-select-option {
    background: transparent;
    border: none;
    color: #ffffff;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.custom-select-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.custom-select-option.selected {
    background: rgba(255, 107, 53, 0.2);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 107, 53, 0.5);
}

.ratio-option-content {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.ratio-preview {
    height: 16px;
    width: 18px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.ratio-preview[data-ratio="16:9"] {
    width: 28px;
}

.ratio-preview[data-ratio="9:16"] {
    width: 9px;
}

.ratio-preview[data-ratio="1:1"] {
    width: 16px;
}

.ratio-preview[data-ratio="4:3"] {
    width: 22px;
}

.ratio-preview[data-ratio="3:4"] {
    width: 12px;
}

.custom-select-option.selected .ratio-preview,
.custom-select-trigger .ratio-preview {
    border-color: rgba(255, 107, 53, 0.95);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 53, 0.35);
    background: rgba(255, 107, 53, 0.08);
}

.prompt-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Fix vertical spacing and prompt UI */
.generator-page .prompt-container {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.generator-page .prompt-input-wrapper {
    position: relative;
    padding: 16px 16px 16px;
    /* Spacing for the header at top */
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.generator-page .prompt-input {
    flex: 1 1 auto;
    min-width: 0;
}

.generator-page .prompt-side-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.generator-page .omni-media-btn-wrapper {
    display: none;
}

/* seedance-specific prompt actions layout moved to /create/providers/seedance_fyshark_ui.css */

.generator-page .prompt-header {
    position: absolute !important;
    top: 4px !important;
    right: 14px !important;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
}

.generator-page .image-attachments-container {
    padding: 12px 16px;
    margin: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-viewer {
    position: relative;
    overflow-y: hidden !important;
    /* Hide scrollbar while loading */
}

#historyLoader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #070403;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.history-viewer.loaded #historyLoader {
    display: none;
}

.history-viewer .task-list {
    opacity: 0;
}

.history-viewer.loaded .task-list {
    opacity: 1;
}

.history-viewer.loaded {
    overflow-y: auto !important;
    /* Show scrollbar only when ready */
}

.empty-state {
    display: none;
}

/* Projects Sidebar Styles */
.sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 0 24px 24px !important;
    padding-right: 0 !important;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding-right: 24px;
}

.projects-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #a0a0b0;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-project-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.add-project-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    padding-right: 26px;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #808090;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.05);
    /* Slightly darker for better feedback */
    color: #fff;
}

.project-item.active {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary-color);
    border-color: rgba(255, 107, 53, 0.2);
    font-weight: 500;
}

.project-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.project-actions {
    visibility: hidden;
    /* Use visibility to keep layout stable */
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.project-item:hover .project-actions,
.project-item.active .project-actions {
    visibility: visible;
}

.project-action-btn {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.4;
    cursor: pointer;
    padding: 2px;
    transition: all 0.2s;
}

.project-action-btn:hover {
    opacity: 1;
    color: #fff;
}

.project-action-btn.delete:hover {
    color: #ff4d4d;
}

/* Custom Modal Styles */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.custom-modal.active {
    display: flex;
    opacity: 1;
}

.modal-body {
    background: #1a1a20;
    padding: 28px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.custom-modal.active .modal-body {
    transform: translateY(0);
}

.modal-body h3 {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.modal-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 24px;
    transition: all 0.2s;
}

.modal-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.query-modal-body {
    width: min(960px, 96vw);
    max-width: 960px;
    padding: 20px;
}

.query-pre {
    margin: 0;
    max-height: 62vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px;
    color: #dbeafe;
    font-size: 12px;
    line-height: 1.45;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer button {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-modal-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a0a0b0;
}

.btn-modal-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-modal-confirm {
    background: var(--primary-color);
    border: none;
    color: #fff;
}

.btn-modal-confirm:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.attach-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    padding-right: 4px;
}

.attach-picker-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 14px;
    align-items: start;
}

.attach-picker-col {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px;
}

.attach-picker-col-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #9ca3af;
    margin-bottom: 10px;
    font-weight: 700;
}

.attach-picker-upload-btn {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.22);
}

.attach-picker-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.attach-picker-scroll {
    max-height: 50vh;
    overflow: auto;
}

.attach-picker-modal-footer {
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
    .attach-picker-layout {
        grid-template-columns: 1fr;
    }
}

.attach-picker-item {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
}

.attach-picker-item:hover {
    border-color: rgba(255, 107, 53, .6);
    transform: translateY(-1px);
}

.attach-picker-item img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    display: block;
    background: #0e0e12;
}

.attach-picker-item-meta {
    padding: 6px 7px;
    font-size: 11px;
    color: #a7acb8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fix attach button shape */
.generator-page .attach-btn:hover {
    border-radius: 50% !important;
}

.generator-page .gen-btn:disabled {
    background: #444 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    filter: grayscale(1);
}



.generator-page .prompt-container {
    padding: 16px;
}

.generator-page .prompt-input-wrapper {
    gap: 12px;
}

.mode-hint {
    display: none;
    background: rgba(255, 107, 53, 0.05);
    border-bottom: 1px solid rgba(255, 107, 53, 0.1);
    color: var(--primary-color);
    padding: 10px 16px;
    font-size: 0.8rem;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.mode-hint svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* --- MOBILE OPTIMIZATIONS FOR HORIZONTAL SCROLL --- */
@media screen and (max-width: 600px) {

    html,
    body,
    .generator-page,
    .generator-page .app-container,
    .generator-page .main-content,
    .generator-page .history-viewer {
        overflow-x: clip !important;
        /* Stronger than hidden */
        width: 100% !important;
        max-width: 100% !important;
        position: relative;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .generator-page .history-viewer {
        padding-bottom: 20px !important;
        overflow-y: auto !important;
    }

    .generator-page .task-list {
        padding: 10px !important;
        gap: 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .generator-page .task-card {
        padding: 16px !important;
        border-radius: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .generator-page .task-settings-info {
        flex-wrap: wrap !important;
        gap: 6px !important;
        font-size: 0.7rem !important;
    }

    .generator-page .task-meta {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .generator-page .task-meta>div:last-child {
        border-top: none !important;
        padding-top: 0 !important;
        align-items: flex-end !important;
    }

    .generator-page .video-player-container {
        border-radius: 12px !important;
    }

    .generator-page .status-badge {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
    }

    .generator-page .prompt-area {
        padding: 12px 8px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #222224 !important;
        /* Lighter background */
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .generator-page .prompt-container {
        border-radius: 16px !important;
        padding: 6px !important;
        position: relative !important;
        overflow: visible !important;
    }

    .generator-page .prompt-header {
        top: -4px !important;
        right: 8px !important;
        left: auto !important;
        z-index: 50 !important;
    }

    .generator-page .prompt-input-wrapper {
        padding: 4px 10px !important;
        gap: 8px !important;
    }

    .generator-page .prompt-input {
        padding: 24px 0 6px !important;
        min-height: 90px !important;
        /* Increased height */
        height: 90px !important;
        font-size: 0.95rem !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        overflow-y: auto !important;
    }

    .generator-page .prompt-input::-webkit-scrollbar {
        display: none !important;
    }

    .generator-page .gen-btn {
        width: 44px !important;
        height: 44px !important;
    }
}

/* Extreme narrow screens */
@media screen and (max-width: 380px) {
    .generator-page .task-settings-info span:not(:first-child) {
        display: none;
        /* Hide dots and minor labels if really tight */
    }

    .generator-page .task-settings-info span.uuid-container {
        display: flex !important;
    }
}