body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    padding: 20px;
    background-color: #f7f9fc;
    color: #333;
    line-height: 1.6;
    margin: 0;
    display: flex;
    justify-content: center;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10 and IE 11 */
    user-select: none;         /* Standard syntax */
}
.container {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    background-color: #ffffff;
    padding: 30px 35px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
    animation: fadeIn 0.5s ease-out;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
.container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}
h1 {
    font-size: 26px;
    color: #1a2533;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
}
#controls {
    margin-bottom: 20px;
    padding: 25px 25px 15px;
    border: 1px solid #e9edf1;
    border-radius: 12px;
    background-color: #fdfdff;
}
#modeSpecificControls {
    margin-bottom: 10px;
}
.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.control-group label:not(.radio-label):not(.segmented-control label):not(.fragment-option label):not(.switch) {
    margin-right: 15px;
    font-weight: 500;
    color: #4a5568;
    flex-shrink: 0;
    min-width: 100px;
}
select, input[type="number"], input[type="text"] {
    padding: 10px 15px;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    font-size: 14px;
    background-color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-grow: 1;
    max-width: 350px;
    box-sizing: border-box;

    -webkit-user-select: text; /* Safari */
    -ms-user-select: text;     /* IE 10 and IE 11 */
    user-select: text;         /* Standard syntax */
}
input[type="text"]#douyinUrlInput {
    max-width: none;
}
select:focus, input[type="number"]:focus, input[type="text"]:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
    transform: translateY(-1px);
}
input[type="checkbox"] {
    margin-right: 5px;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    accent-color: #007bff;
    flex-shrink: 0;
    cursor: pointer;
}
.segmented-control {
    display: flex;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    overflow: hidden;
    flex-grow: 1;
    position: relative;
    transition: all 0.3s ease;
}
.segmented-control input[type="radio"] {
    display: none;
}
.segmented-control label {
    flex: 1;
    min-width: 80px;
    padding: 9px 15px;
    text-align: center;
    cursor: pointer;
    background-color: transparent;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    white-space: nowrap;
}
.segmented-control label:first-of-type {
    border-left: none;
}
.segmented-control input[type="radio"]:checked + label {
    /* background-color: #007bff; */ /* Removed to let slider show through */
    color: white;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.segmented-control label:hover:not(input[type="radio"]:checked + label) {
    background-color: #f0f4f8;
}
label.radio-label {
    min-width: auto;
    margin-right: 5px;
    font-weight: normal !important;
    color: #333 !important;
}
#dropZone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    background-color: #f8f9fc;
    transition: border-color 0.25s ease-in-out, background-color 0.25s ease-in-out, transform 0.2s ease;
    flex-grow: 1;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
#dropZone:hover {
    border-color: #007bff;
    background-color: #eef5ff;
}
#dropZone.drag-over {
    border-color: #0056b3;
    background-color: #e9f5ff;
    transform: scale(1.01);
}
.drop-zone-text { font-size: 16px; color: #5a6268; margin: 0 0 8px 0; }
.drop-zone-browse { color: #007bff; text-decoration: none; font-weight: 500; font-size: 15px; border-bottom: 1px dashed #007bff;}
.drop-zone-browse:hover { text-decoration: underline; }
button {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    margin: 5px 10px 5px 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}
button:hover:not(:disabled) {
    opacity: 0.95;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}
button:active:not(:disabled) {
    transform: scale(0.98) translateY(0);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}
button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}
@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(40, 40);
        opacity: 0;
    }
}
button:disabled {
    background-color: #e9ecef !important;
    color: #adb5bd !important;
    cursor: not-allowed;
    opacity: 0.7;
}
button#processBtn {
    background-color: #007bff; color: white; border-color: #007bff;
    display: block; margin: 25px auto 0 auto;
    padding: 12px 28px;
    font-size: 16px;
}
button#processBtn:hover:not(:disabled) { background-color: #0056b3; border-color: #0056b3; }

.btn-icon {
    padding: 8px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}
.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

button.btn-primary {
    background-color: #28a745; color: white; border-color: #28a745;
}
button.btn-primary:hover:not(:disabled) {
    background-color: #218838; border-color: #1e7e34;
}
button.btn-danger {
    background-color: #dc3545; color: white; border-color: #dc3545;
}
button.btn-danger:hover:not(:disabled) {
    background-color: #c82333; border-color: #bd2130;
}
button.btn-secondary {
    background-color: #6c757d; color: white; border-color: #6c757d;
}
button.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268; border-color: #545b62;
}
button.btn-secondary.active-selection {
    background-color: #5a6268;
    border-color: #545b62;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}


.file-management-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    margin-top: 10px;
}
.file-management-controls #selectAllToggleBtn,
.file-management-controls #downloadSelectedDouyinBtn {
    margin-top: 0;
    margin-bottom: 0;
}
.file-management-controls #selectAllToggleBtn {
    margin-right: 10px;
}
.file-management-controls #downloadSelectedDouyinBtn {
    margin-left: 10px;
}
.file-management-controls #fileCountInfoContainer {
    flex-grow: 1;
    text-align: center;
}
#fileCountInfo {
    background-color: #e6f0ff;
    color: #0056b3;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 91, 179, 0.1);
    text-align: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: inline-block;
    min-width: 40px;
}

.douyin-controls button {
    background-color: #6c757d; color: white; border-color: #6c757d;
}
.douyin-controls button:hover:not(:disabled) {
    background-color: #5a6268; border-color: #545b62;
}
#blendModeControlGroup {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    margin-bottom: 10px;
}

#blendModeControlGroup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(49, 130, 206, 0) 0%, 
        rgba(49, 130, 206, 0.2) 50%, 
        rgba(49, 130, 206, 0) 100%
    );
}

#blendModeControlGroup:hover {
    background: linear-gradient(135deg, #f1f5f9, #e8edf3);
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

#blendModeControlGroup label {
    color: #334155;
    font-weight: 600;
    font-size: 0.95em;
    margin: 0;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

#blendModeToggleBtn {
    position: relative;
    padding: 8px 16px 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.92em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

#blendModeToggleBtn:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#blendModeToggleBtn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.blend-mode-text {
    font-weight: 500;
    transition: color 0.3s ease;
    flex-grow: 1;
}

.blend-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: white;
    transform: rotate(0deg);
    opacity: 0.9;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    margin-left: auto;
    padding: 3px;
}

#blendModeToggleBtn:hover .blend-mode-icon {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.blend-mode-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    transition: transform 0.3s ease;
    opacity: 0.95;
}

#blendModeToggleBtn:hover .blend-mode-icon svg {
    transform: rotate(180deg);
    opacity: 1;
}

.blend-mode-icon svg path {
    transition: transform 0.3s ease;
}

#currentBlendModeInfo {
    font-size: 0.9em;
    color: #475569;
    background-color: rgba(241, 245, 249, 0.85);
    padding: 8px 14px;
    border-radius: 8px;
    margin: 0;
    flex-grow: 1;
    flex-basis: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

#currentBlendModeInfo.success {
    background-color: rgba(220, 252, 231, 0.85);
    border-color: #86efac;
    color: #166534;
}

#currentBlendModeInfo.info {
    background-color: rgba(239, 246, 255, 0.85);
    border-color: #93c5fd;
    color: #1e40af;
}

#currentBlendModeInfo.error {
    background-color: rgba(254, 242, 242, 0.85);
    border-color: #fca5a5;
    color: #991b1b;
}

#currentBlendModeInfo.active {
    transform: translateY(0);
    opacity: 1;
    animation: fadeInInfo 0.3s ease-out;
}

@keyframes fadeInInfo {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端适配优化 */
@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 20px 15px; margin: 10px auto; border-radius: 12px; }
    h1 { font-size: 22px; margin-bottom: 20px; }
    .control-group {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 18px;
    }
    .control-group label:not(.radio-label):not(.segmented-control label):not(.fragment-option label):not(.switch) {
        margin-bottom: 8px;
        margin-right: 0;
        min-width: auto;
        width: auto;
        text-align: left;
    }
    #localUploadSection > .control-group:first-child > label,
    #douyinFetchSection > .control-group:first-child > label {
        width: auto;
        min-width: auto;
    }
    /* Ensure full width for specific control groups and their direct interactive children */
    #localUploadSection .control-group,
    #douyinFetchSection .control-group {
        width: 100%;
        box-sizing: border-box;
    }

    #dropZone,
    .douyin-input-group {
        width: 100% !important; /* Ensure full width */
        max-width: 100% !important; /* Ensure full width */
        box-sizing: border-box !important; /* Consistent box model */
    }

    .segmented-control {
        width: 100%;
    }
    .segmented-control label {
        font-size: 13px;
        padding: 8px 10px;
    }
    .control-group > div:not(#dropZone):not(.douyin-input-group):not(.segmented-control):not(.fragment-options-grid):not(.douyin-input-container-wrapper) {
        width: 100%;
    }
    select, input[type="text"]:not(#douyinUrlInput), #dropZone, .douyin-input-container-wrapper {
        width: 100%;
        max-width: 100%;
    }
    #dropZone { padding: 20px 10px; min-height: 80px;}
    .drop-zone-text { font-size: 14px; }
    .drop-zone-browse { font-size: 14px; }
    select, input[type="text"] {
        font-size: 16px !important;
    }
    #douyinUrlInput {
        font-size: 16px !important;
    }

    /* Ensure douyinFetchSection itself allows its children to be full width */
    #douyinFetchSection {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Retain specific styling for douyin-input-group but ensure it can be full width */
    .douyin-input-group {
        /* width: 100%; /* Already set above with !important */
        flex-direction: row; 
        align-items: stretch; 
        gap: 8px;
        flex-wrap: nowrap;
    }
    /* Adjust wrapper within douyin-input-group for responsiveness */
    .douyin-input-container-wrapper {
        /* width: auto; /* Let flex-grow handle it */
        flex-grow: 1; /* Allow it to take available space */
        max-width: calc(100% - 46px); /* Account for button */
        min-width: 0; /* Allow shrinking */
    }
    #fetchDouyinImagesBtn {
        width: 38px;
        height: 38px;
        padding: 8px;
        flex-shrink: 0;
        min-width: 38px;
        max-width: 38px;
    }
    #fileList {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    #fileList li {
        padding: 6px;
    }
    #fileList img {
        width: 45px; height: 45px;
        margin-bottom: 5px;
    }
    .invert-toggle-btn {
        font-size: 9px;
        padding: 2px 5px;
    }
    .outputItem {
        flex-basis: 100%;
        padding: 15px;
    }

    .outputItem-fragment {
        flex-basis: calc(50% - 7.5px);
        padding: 5px;
    }
    .outputItem-fragment .output-image-display {
        max-width: 100%;
        max-height: 160px;
    }


    .outputItem .output-image-display {
        margin: 10px auto;
    }
    #blendModeControlGroup label { margin-bottom: 8px; flex-basis: 100%;} /* Added flex-basis */
    #blendModeToggleBtn {
        flex-shrink: 0;
        min-width: 110px;
    }
    #currentBlendModeInfo {
        flex-grow: 1;
        min-width: 0;
        max-width: none;
        text-align: left;
        padding: 10px;
        white-space: normal;
        flex-basis: auto; /* Changed from 100% to auto */
    }
    .fragment-options-grid {
        flex-direction: column;
        align-items: stretch;  
        gap: 15px;
    }
    .fragment-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .fragment-option > label:first-child {
        width: auto;
    }

    .fragment-option-num-outputs .num-outputs-controls-wrapper {
        width: 100%;
        justify-content: space-between;
    }
    .number-input-presets {
        flex-grow: 1;
        justify-content: flex-start;
    }

    .fragment-option-size-preset .segmented-control {
        width: 100%;
        min-width: 0;
    }

    .fragment-option.fragment-option-toggle {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
    .fragment-option.fragment-option-toggle label:first-child {
        margin-right: 10px;
        margin-bottom: 0;
    }

    #blendModeControlGroup {
        padding: 14px 16px;
        gap: 12px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap; /* Added for consistent wrapping */
    }
    
    #currentBlendModeInfo {
        flex-grow: 1;
        min-width: 0;
        max-width: none;
        text-align: left;
        padding: 10px;
        white-space: normal;
        flex-basis: auto; /* Changed from 100% to auto */
    }
}
@media (max-width: 480px) {
    body { padding: 8px; }
    .container { padding: 15px 10px; margin: 8px auto; }
    h1 { font-size: 20px; }
    #controls { padding: 15px 15px 0; }

    /* Ensure full width for dropZone and douyin-input-group on smaller screens too */
    #dropZone,
    .douyin-input-group {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .douyin-input-container-wrapper {
        max-width: calc(100% - 42px); /* Adjusted for potentially smaller button */
    }
    
    #fileCountInfo {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .segmented-control label { font-size: 12px; padding: 7px 8px; }
    #fileList {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
        padding: 10px;
    }
    #fileList li {
        padding: 6px;
    }
    #fileList img {
        width: 38px; height: 38px;
        margin-bottom: 4px;
    }
    .invert-toggle-btn {
        font-size: 8px;
        padding: 2px 4px;
    }
    button { padding: 8px 12px; font-size: 13px; }
    .btn-icon {
        width: 36px; 
        height: 36px; 
        padding: 7px;
        min-width: 36px;
        max-width: 36px;
    }
    .btn-icon svg { width: 16px; height: 16px; }

    button#processBtn { padding: 10px 16px; font-size: 14px; }
    .drop-zone-text, .drop-zone-browse { font-size: 13px; }

    .input-prefix-btn {
        padding: 0 8px;
    }
    .input-prefix-btn .paste-icon { width: 16px; height: 16px; }

    .control-group label:not(.radio-label):not(.segmented-control label):not(.fragment-option label):not(.switch) { font-size: 13px; }
    .outputItem { padding: 10px; }


    .outputItem-fragment {
        flex-basis: calc(33.333% - 10px);
        padding: 4px;
    }
    .outputItem-fragment .output-image-display {
        max-width: 100%;
        max-height: 140px;
    }


    .outputItem h4 { font-size: 14px; }
    .download-output-btn { font-size: 13px; padding: 8px 12px;}

    .fragment-option-num-outputs .num-outputs-controls-wrapper {
        gap: 8px;
    }
    .custom-number-input {
        width: auto;
    }
    .btn-preset-num {
        padding: 5px 8px;
        font-size: 11px;
    }
    .btn-num-stepper {
        padding: 0 8px;
        font-size: 14px;
        line-height: 30px;
        height: 32px;
    }
    .num-display {
        line-height: 32px;
        padding: 0 10px;
        font-size: 13px;
    }


    #douyinUrlInput {
        height: 34px;
        line-height: 34px;
        padding-right: 32px !important;
    }
    .switch { width: 44px; height: 24px; }
    .slider:before { height: 18px; width: 18px; left: 3px; bottom: 3px;}
    input:checked + .slider:before { transform: translateX(20px); }
    .slider.round { border-radius: 24px; }
}

/* 添加滑块样式 */
.segmented-slider, .preset-slider {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    border-radius: 8px;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.number-input-presets {
    position: relative;
}

.btn-preset-num {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 30px;
    background-color: transparent;
    color: #4a5568;
    border: 1px solid #d8dde3;
    margin: 0;
    position: relative;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-preset-num.active {
    background-color: transparent;
    color: white;
    border-color: transparent;
    font-weight: bold;
    z-index: 2;
}
.btn-preset-num:hover:not(.active):not(:disabled) {
    background-color: #e6eaf0;
    border-color: #c1c9d1;
    opacity: 1;
}

#blendModeControlGroup {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    margin-bottom: 10px;
}

#blendModeControlGroup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(49, 130, 206, 0) 0%, 
        rgba(49, 130, 206, 0.2) 50%, 
        rgba(49, 130, 206, 0) 100%
    );
}

#blendModeControlGroup:hover {
    background: linear-gradient(135deg, #f1f5f9, #e8edf3);
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

#blendModeControlGroup label {
    color: #334155;
    font-weight: 600;
    font-size: 0.95em;
    margin: 0;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

#blendModeToggleBtn {
    position: relative;
    padding: 8px 16px 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.92em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

#blendModeToggleBtn:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#blendModeToggleBtn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.blend-mode-text {
    font-weight: 500;
    transition: color 0.3s ease;
    flex-grow: 1;
}

.blend-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: white;
    transform: rotate(0deg);
    opacity: 0.9;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    margin-left: auto;
    padding: 3px;
}

#blendModeToggleBtn:hover .blend-mode-icon {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.blend-mode-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    transition: transform 0.3s ease;
    opacity: 0.95;
}

#blendModeToggleBtn:hover .blend-mode-icon svg {
    transform: rotate(180deg);
    opacity: 1;
}

.blend-mode-icon svg path {
    transition: transform 0.3s ease;
}

#currentBlendModeInfo {
    font-size: 0.9em;
    color: #475569;
    background-color: rgba(241, 245, 249, 0.85);
    padding: 8px 14px;
    border-radius: 8px;
    margin: 0;
    flex-grow: 1;
    flex-basis: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

#currentBlendModeInfo.success {
    background-color: rgba(220, 252, 231, 0.85);
    border-color: #86efac;
    color: #166534;
}

#currentBlendModeInfo.info {
    background-color: rgba(239, 246, 255, 0.85);
    border-color: #93c5fd;
    color: #1e40af;
}

#currentBlendModeInfo.error {
    background-color: rgba(254, 242, 242, 0.85);
    border-color: #fca5a5;
    color: #991b1b;
}

#currentBlendModeInfo.active {
    transform: translateY(0);
    opacity: 1;
    animation: fadeInInfo 0.3s ease-out;
}

@keyframes fadeInInfo {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 针对极小屏幕的额外优化 */
@media (max-width: 360px) {
    /* Ensure full width for dropZone and douyin-input-group on very small screens */
    #dropZone,
    .douyin-input-group {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .douyin-input-container-wrapper {
        max-width: calc(100% - 40px); /* Adjusted for even smaller button */
    }
    #douyinUrlInput {
        font-size: 14px !important;
        padding-right: 30px !important;
    }
    .btn-icon, #fetchDouyinImagesBtn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        max-width: 34px;
        padding: 6px;
    }
    .input-clear-btn {
        padding: 0 8px;
    }
}

/* 针对安卓Edge浏览器的hack */
@supports (-webkit-touch-callout: none) and (not (translate: none)) {
    /* 只在支持-webkit-touch-callout但不支持translate的浏览器上应用
       这通常是安卓上较老版本的Edge和一些其他Webkit浏览器 */
    #dropZone, /* Added #dropZone */
    .douyin-input-group {
        width: 99% !important; /* Keep important if still needed for this specific hack */
        max-width: 99% !important; /* Added max-width */
    }
    .douyin-input-container-wrapper {
        /* Ensuring the input wrapper respects its parent's potential 99% width 
           by calculating based on 100% of its direct parent, which is .douyin-input-group */
        max-width: calc(100% - 48px); /* Adjusted to be consistent with JS for Edge */
    }
}

#fileList {
    margin: 20px 0;
    padding: clamp(12px, 2vw, 18px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: clamp(10px, 1.5vw, 18px);
    background-color: #f0f3f7;
    border-radius: 10px;
    min-height: 70px;
    border: 1px solid #e0e6ed;
}
#fileList li {
    list-style: none;
    border: 2px solid #cbd5e0;
    padding: clamp(8px, 1vw, 10px);
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    animation: fadeIn 0.3s ease-out;
    aspect-ratio: 1;
}
#fileList li:hover {
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}
#fileList img {
    width: 100%;
    max-height: 75%;
    object-fit: contain;
    margin-bottom: 4px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    padding: 2px;
    flex-grow: 1;
}
.invert-toggle-btn {
    font-size: 10px;
    padding: 3px 7px;
    margin: 0;
    cursor: pointer;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    background-color: #f1f5f9;
    color: #4a5568;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    display: inline-block;
    line-height: 1.2;
    font-weight: 500;
    width: 100%;
    text-align: center;
    height: 20px;
    box-sizing: border-box;
}
.invert-toggle-btn.inverted {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}
.invert-toggle-btn:hover:not(.inverted) {
    border-color: #007bff;
    background-color: #e6f0ff;
}
.file-source-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #000000;
    color: #FFFFFF;
    border: 1px solid #333333;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: bold;
}
#downloadAllBtn {
    background-color: #28a745; color: white; border-color: #28a745;
    padding: 10px 20px;
    font-size: 14px;
}
#downloadAllBtn:hover:not(:disabled) { background-color: #218838; border-color: #1e7e34; }

#outputContainer {
    display: flex; flex-wrap: wrap; gap: 15px;
    padding: 15px; background-color: #f0f3f7;
    border-radius: 10px;
    border: 1px solid #e0e6ed;
    text-align: left;
    min-height: 100px;
}
.outputItem {
    text-align: center;
    background-color: #fff;
    padding: 20px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    flex-basis: calc(50% - 7.5px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.4s ease-out;
}
.outputItem:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.outputItem.selected {
    border-color: #007bff;
    box-shadow: 0 3px 8px rgba(0, 123, 255, 0.25);
}
.outputItem.error-fragment {
    border-color: #dc3545 !important;
    background-color: #fbeeed;
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.outputItem.error-fragment .output-image-display {
    opacity: 0.5;
}
.outputItem .output-image-display {
    display: block;
    max-width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 15px auto;
    object-fit: contain;
    -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
.outputItem a:not(.download-output-btn) {
    display: inline-block; margin-top: 12px; font-size: 14px;
    text-decoration: none; color: #007bff; transition: color 0.2s ease;
}
.outputItem a:not(.download-output-btn):hover { color: #0056b3; text-decoration: underline; }
.download-output-btn {
    background-color: #17a2b8; color: white; border-color: #17a2b8;
    margin-top: 12px;
}
.download-output-btn:hover:not(:disabled) { background-color: #138496; border-color: #117a8b; }
.outputItem h4 {
    margin-top: 5px; margin-bottom: 12px; font-size: 15px;
    color: #2c3e50;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.outputItem-fragment {
    flex-basis: calc(25% - 11.25px);
    padding: 5px;
    cursor: pointer;
}
.outputItem-fragment .output-image-display {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    margin-top: 5px;
    margin-bottom: 5px;
}
.outputItem-fragment h4 {
    display: none;
}


.status-message {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9em;
    margin-top: 12px;
    border-left-width: 4px;
    border-left-style: solid;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.status-message.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.error { 
    background-color: #fff0f1; 
    border-left-color: #f44336; 
    color: #c62828; 
}

.success { 
    background-color: #edf9f0; 
    border-left-color: #4CAF50; 
    color: #2e7d32; 
}

.info { 
    background-color: #eef6ff; 
    border-left-color: #2196F3; 
    color: #1565c0; 
}

.loader {
    border: 5px solid #f0f0f0;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 18px auto;
    display: none;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 
    0% { transform: scale(1); } 
    50% { transform: scale(1.05); } 
    100% { transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.douyin-input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 8px;
    max-width: 100%;
    box-sizing: border-box;
}
.douyin-input-container-wrapper {
    display: flex;
    flex-grow: 1;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    position: relative;
    align-items: center;
    background-color: #fff;
    overflow: visible;
    min-width: 0;
    max-width: calc(100% - 46px);
}
.douyin-input-container-wrapper:focus-within {
    border-color: #007bff;
    box-shadow: none;
}

.input-prefix-btn,
.input-clear-btn {
    padding: 0 9px;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    transition: color 0.2s ease-in-out, transform 0.15s ease, fill 0.2s ease-in-out, opacity 0.2s ease-in-out, background-color 0.1s ease-out;
    margin: 0;
    height: 100%;
}

.input-prefix-btn {
    position: relative;
    border-top-left-radius: 7px;
    border-bottom-left-radius: 7px;
}
.input-prefix-btn .paste-icon {
    fill: #28a745;
    width: 18px;
    height: 18px;
    transition: fill 0.2s ease-in-out;
}
.input-prefix-btn:hover:not(:disabled) {
    opacity: 1;
    background-color: rgba(40, 167, 69, 0.1) !important;
    transform: none;
}
.input-prefix-btn:active:not(:disabled) {
    transform: scale(0.96);
    background-color: #eaf7ec !important;
}


.input-clear-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    line-height: 1;
    color: #dc3545;
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background: transparent;
    border: none;
    outline: none;
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out, transform 0.1s ease-out, opacity 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    z-index: 2;
}

.input-clear-btn:hover:not(:disabled) {
    color: #c82333;
    background-color: rgba(220, 53, 69, 0.1) !important;
    transform: translateY(-50%);
    opacity: 1;
    box-shadow: none;
}

.input-clear-btn:active:not(:disabled) {
    color: #bd2130;
    background-color: rgba(220, 53, 69, 0.2) !important;
    transform: translateY(-50%) scale(1);
    box-shadow: none;
}

#douyinUrlInput {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 5px !important;
    padding-right: 36px !important;
    flex-grow: 1;
    border: none !important;
    border-radius: 0;
    outline: none !important;
    font-size: 14px;
    background-color: transparent !important;
    min-width: 0;
    box-sizing: border-box;
    box-shadow: none !important;
    height: 36px;
    line-height: 36px;
    z-index: 1;
}
#douyinUrlInput:focus {
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

#fetchDouyinImagesBtn {
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 0;
    min-width: 38px;
    max-width: 38px;
}

#douyinFetchSection .control-group > .douyin-input-group {
    flex-grow: 1; max-width: none;
}
#localUploadSection > .control-group:first-child > label,
#douyinFetchSection > .control-group:first-child > label {
    width: 110px;
    min-width: 0;
    flex-shrink: 0;
    margin-right: 10px;
}
.fragment-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    width: 100%;
}
.fragment-option {
    display: flex;
    align-items: center;
    gap: 8px; /* Gap between label and its control group */
}
.fragment-option label {
    margin-right: 0; /* Already set to 0 by default for fragment-option labels */
    font-weight: 500;
    color: #4a5568;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Styles for Number of Outputs control */
.fragment-option-num-outputs .num-outputs-controls-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Allow presets and custom input to wrap on smaller screens */
    gap: 10px; /* Gap between presets and custom input */
    flex-grow: 1;
    justify-content: flex-start; /* Align items to the start of the wrapper */
}
.number-input-presets {
    display: flex;
    gap: 5px; /* Gap between preset buttons */
}
.btn-preset-num {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 30px; /* Ensure buttons have some width */
    background-color: transparent;
    color: #4a5568;
    border: 1px solid #d8dde3;
    margin: 0; /* Override default button margin */
    position: relative;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-preset-num.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}
.btn-preset-num:hover:not(.active):not(:disabled) {
    background-color: #e6eaf0;
    border-color: #c1c9d1;
    opacity: 1; /* Override general button hover opacity if needed */
}

.custom-number-input {
    display: flex;
    align-items: center;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}
.btn-num-stepper {
    padding: 0 10px;
    font-size: 16px;
    font-weight: bold;
    line-height: 34px; /* Match height of display/input */
    height: 36px;
    background-color: #f8f9fa;
    color: #495057;
    border: none;
    border-radius: 0;
    margin: 0; /* Override default button margin */
    box-shadow: none;
}
.btn-num-stepper:hover:not(:disabled) {
    background-color: #e9ecef;
    opacity: 1;
}
.btn-num-stepper:active:not(:disabled) {
    background-color: #d8dde3;
    transform: none; /* Disable default button active scale */
}
.btn-num-stepper-minus {
    border-right: 1px solid #d8dde3;
}
.btn-num-stepper-plus {
    border-left: 1px solid #d8dde3;
}
.num-display {
    padding: 0 12px;
    font-size: 14px;
    line-height: 36px; /* Match height of steppers */
    min-width: 20px; /* Ensure space for 2 digits */
    text-align: center;
    font-weight: 500;
    color: #333;
    -webkit-user-select: text; -ms-user-select: text; user-select: text; /* Allow selecting number */
}


/* Styles for Fragment Size (segmented control) */
.fragment-option-size-preset .segmented-control {
    flex-grow: 1; /* Allow it to take available space in the fragment-option */
    min-width: 180px; /* Ensure it has enough base width for 3 options */
}
.fragment-option-size-preset .segmented-control label {
    padding: 8px 10px; /* Slightly less padding for compactness if needed */
}


.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    vertical-align: middle;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
    background-color: #007bff;
}
input:focus + .slider {
    box-shadow: 0 0 1px #007bff;
}
input:checked + .slider:before {
    transform: translateX(22px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.slider.round {
    border-radius: 28px;
}
.slider.round:before {
    border-radius: 50%;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .outputItem-fragment {
        flex-basis: calc(33.333% - 10px);
    }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 20px 15px; margin: 10px auto; border-radius: 12px; }
    h1 { font-size: 22px; margin-bottom: 20px; }
    .control-group {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 18px;
    }
    .control-group label:not(.radio-label):not(.segmented-control label):not(.fragment-option label):not(.switch) {
        margin-bottom: 8px;
        margin-right: 0;
        min-width: auto;
        width: auto;
        text-align: left;
    }
    #localUploadSection > .control-group:first-child > label,
    #douyinFetchSection > .control-group:first-child > label {
        width: auto;
        min-width: auto;
    }
    .segmented-control {
        width: 100%;
    }
    .segmented-control label {
        font-size: 13px;
        padding: 8px 10px;
    }
    .control-group > div:not(#dropZone):not(.douyin-input-group):not(.segmented-control):not(.fragment-options-grid):not(.douyin-input-container-wrapper) {
        width: 100%;
    }
    select, input[type="text"]:not(#douyinUrlInput), #dropZone, .douyin-input-container-wrapper {
        width: 100%;
        max-width: 100%;
    }
    #dropZone { padding: 20px 10px; min-height: 80px;}
    .drop-zone-text { font-size: 14px; }
    .drop-zone-browse { font-size: 14px; }
    select, input[type="text"] {
        font-size: 16px !important;
    }
    #douyinUrlInput {
        font-size: 16px !important;
    }

    #douyinFetchSection .control-group > label[for="douyinUrlInput"] {
        width: 100%;
    }
    .douyin-input-group {
        width: 100%; 
        flex-direction: row; 
        align-items: stretch; 
        gap: 8px;
        flex-wrap: nowrap;
    }
    .douyin-input-container-wrapper {
        width: auto;
        max-width: calc(100% - 46px);
    }
    #fetchDouyinImagesBtn {
        width: 38px;
        height: 38px;
        padding: 8px;
        flex-shrink: 0;
        min-width: 38px;
        max-width: 38px;
    }
    #fileList {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    #fileList li {
        padding: 6px;
    }
    #fileList img {
        width: 45px; height: 45px;
        margin-bottom: 5px;
    }
    .invert-toggle-btn {
        font-size: 9px;
        padding: 2px 5px;
    }
    .outputItem {
        flex-basis: 100%;
        padding: 15px;
    }

    .outputItem-fragment {
        flex-basis: calc(50% - 7.5px);
        padding: 5px;
    }
    .outputItem-fragment .output-image-display {
        max-width: 100%;
        max-height: 160px;
    }


    .outputItem .output-image-display {
        margin: 10px auto;
    }
    #blendModeControlGroup label { margin-bottom: 8px; flex-basis: 100%;} /* Added flex-basis */
    #blendModeToggleBtn {
        flex-shrink: 0;
        min-width: 110px;
    }
    #currentBlendModeInfo {
        flex-grow: 1;
        min-width: 0;
        max-width: none;
        text-align: left;
        padding: 10px;
        white-space: normal;
        flex-basis: auto; /* Changed from 100% to auto */
    }
    .fragment-options-grid {
        flex-direction: column;
        align-items: stretch;  
        gap: 15px;
    }
    .fragment-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .fragment-option > label:first-child {
        width: auto;
    }

    .fragment-option-num-outputs .num-outputs-controls-wrapper {
        width: 100%;
        justify-content: space-between;
    }
    .number-input-presets {
        flex-grow: 1;
        justify-content: flex-start;
    }

    .fragment-option-size-preset .segmented-control {
        width: 100%;
        min-width: 0;
    }

    .fragment-option.fragment-option-toggle {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
    .fragment-option.fragment-option-toggle label:first-child {
        margin-right: 10px;
        margin-bottom: 0;
    }

    #blendModeControlGroup {
        padding: 14px 16px;
        gap: 12px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap; /* Added for consistent wrapping */
    }
    
    #currentBlendModeInfo {
        flex-grow: 1;
        min-width: 0;
        max-width: none;
        text-align: left;
        padding: 10px;
        white-space: normal;
        flex-basis: auto; /* Changed from 100% to auto */
    }
}
@media (max-width: 480px) {
    body { padding: 8px; }
    .container { padding: 15px 10px; margin: 8px auto; }
    h1 { font-size: 20px; }
    #controls { padding: 15px 15px 0; }

    #fileCountInfo {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .segmented-control label { font-size: 12px; padding: 7px 8px; }
    #fileList {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
        padding: 10px;
    }
    #fileList li {
        padding: 6px;
    }
    #fileList img {
        width: 38px; height: 38px;
        margin-bottom: 4px;
    }
    .invert-toggle-btn {
        font-size: 8px;
        padding: 2px 4px;
    }
    button { padding: 8px 12px; font-size: 13px; }
    .btn-icon {
        width: 36px; 
        height: 36px; 
        padding: 7px;
        min-width: 36px;
        max-width: 36px;
    }
    .btn-icon svg { width: 16px; height: 16px; }

    button#processBtn { padding: 10px 16px; font-size: 14px; }
    .drop-zone-text, .drop-zone-browse { font-size: 13px; }

    .input-prefix-btn {
        padding: 0 8px;
    }
    .input-prefix-btn .paste-icon { width: 16px; height: 16px; }

    .control-group label:not(.radio-label):not(.segmented-control label):not(.fragment-option label):not(.switch) { font-size: 13px; }
    .outputItem { padding: 10px; }


    .outputItem-fragment {
        flex-basis: calc(33.333% - 10px);
        padding: 4px;
    }
    .outputItem-fragment .output-image-display {
        max-width: 100%;
        max-height: 140px;
    }


    .outputItem h4 { font-size: 14px; }
    .download-output-btn { font-size: 13px; padding: 8px 12px;}

    .fragment-option-num-outputs .num-outputs-controls-wrapper {
        gap: 8px;
    }
    .custom-number-input {
        width: auto;
    }
    .btn-preset-num {
        padding: 5px 8px;
        font-size: 11px;
    }
    .btn-num-stepper {
        padding: 0 8px;
        font-size: 14px;
        line-height: 30px;
        height: 32px;
    }
    .num-display {
        line-height: 32px;
        padding: 0 10px;
        font-size: 13px;
    }


    #douyinUrlInput {
        height: 34px;
        line-height: 34px;
        padding-right: 32px !important;
    }
    .switch { width: 44px; height: 24px; }
    .slider:before { height: 18px; width: 18px; left: 3px; bottom: 3px;}
    input:checked + .slider:before { transform: translateX(20px); }
    .slider.round { border-radius: 24px; }
}

/* 添加滑块样式 */
.segmented-slider, .preset-slider {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    border-radius: 8px;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.number-input-presets {
    position: relative;
}

.btn-preset-num {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 30px;
    background-color: transparent;
    color: #4a5568;
    border: 1px solid #d8dde3;
    margin: 0;
    position: relative;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-preset-num.active {
    background-color: transparent;
    color: white;
    border-color: transparent;
    font-weight: bold;
    z-index: 2;
}
.btn-preset-num:hover:not(.active):not(:disabled) {
    background-color: #e6eaf0;
    border-color: #c1c9d1;
    opacity: 1;
}

#blendModeControlGroup {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    margin-bottom: 10px;
}

#blendModeControlGroup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(49, 130, 206, 0) 0%, 
        rgba(49, 130, 206, 0.2) 50%, 
        rgba(49, 130, 206, 0) 100%
    );
}

#blendModeControlGroup:hover {
    background: linear-gradient(135deg, #f1f5f9, #e8edf3);
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

#blendModeControlGroup label {
    color: #334155;
    font-weight: 600;
    font-size: 0.95em;
    margin: 0;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

#blendModeToggleBtn {
    position: relative;
    padding: 8px 16px 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.92em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

#blendModeToggleBtn:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#blendModeToggleBtn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.blend-mode-text {
    font-weight: 500;
    transition: color 0.3s ease;
    flex-grow: 1;
}

.blend-mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: white;
    transform: rotate(0deg);
    opacity: 0.9;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    margin-left: auto;
    padding: 3px;
}

#blendModeToggleBtn:hover .blend-mode-icon {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.blend-mode-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    transition: transform 0.3s ease;
    opacity: 0.95;
}

#blendModeToggleBtn:hover .blend-mode-icon svg {
    transform: rotate(180deg);
    opacity: 1;
}

.blend-mode-icon svg path {
    transition: transform 0.3s ease;
}

#currentBlendModeInfo {
    font-size: 0.9em;
    color: #475569;
    background-color: rgba(241, 245, 249, 0.85);
    padding: 8px 14px;
    border-radius: 8px;
    margin: 0;
    flex-grow: 1;
    flex-basis: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

#currentBlendModeInfo.success {
    background-color: rgba(220, 252, 231, 0.85);
    border-color: #86efac;
    color: #166534;
}

#currentBlendModeInfo.info {
    background-color: rgba(239, 246, 255, 0.85);
    border-color: #93c5fd;
    color: #1e40af;
}

#currentBlendModeInfo.error {
    background-color: rgba(254, 242, 242, 0.85);
    border-color: #fca5a5;
    color: #991b1b;
}

#currentBlendModeInfo.active {
    transform: translateY(0);
    opacity: 1;
    animation: fadeInInfo 0.3s ease-out;
}

@keyframes fadeInInfo {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure localUploadSection and douyinFetchSection themselves allow their children to be full width */
#localUploadSection,
#douyinFetchSection {
    width: 100%;
    box-sizing: border-box;
}