* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #eef2f6;
    color: #1e293b;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background-color: transparent;
    overflow: hidden;
}

/* 头部 - 固定在顶部 */
.header {
    padding: 16px 32px;
    background-color: #ffffff;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    margin-bottom: 0;
    flex-shrink: 0;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #0f172a;
    margin-bottom: 4px;
}

.header-sub {
    font-size: 14px;
    color: #64748b;
    font-weight: 400;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 0 20px 20px 20px;
    overflow: hidden;
    min-height: 0;
    flex-wrap: wrap;
}

/* 左侧面板 - 允许内部滚动 */
.left-panel {
    width: 440px;
    background-color: #ffffff;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 8px 8px 20px rgba(0,0,0,0.03), -4px -4px 12px rgba(255,255,255,0.8);
    overflow-y: auto;
    height: 100%;
}

/* 右侧面板 - 靠上对齐 */
.right-panel {
    flex: 1;
    background-color: #ffffff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: -8px 8px 20px rgba(0,0,0,0.03), 4px -4px 12px rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* max-width: 620px; */
    margin: 0 auto;
    /* height: 100%; */
    /* overflow: hidden; */
}

/* 右侧内容区域 - 内部靠上 */
.video-examples,
.loading-state,
.result-state {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.02), inset 0 -1px 2px rgba(255,255,255,0.8);
    height: auto;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

/* 选项卡 */
.tab-nav {
    display: flex;
    margin-bottom: 28px;
    border-bottom: 1px solid #e9eef2;
    gap: 16px;
}

.tab-nav button {
    padding: 8px 0;
    background: none;
    border: none;
    font-size: 15px;
    cursor: pointer;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
    margin-bottom: -1px;
}

.tab-nav button.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #d0d9e8;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 28px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background-color: #f8fafc;
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.02), inset 0 -1px 2px rgba(255,255,255,0.8);
}

.upload-area:hover {
    border-color: #2563eb;
    background-color: #f0f7ff;
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0.6;
}

.upload-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #8b9eb0;
    position: absolute;
    border-radius: 4px;
}

.upload-icon::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-left: 2px solid #8b9eb0;
    border-top: 2px solid #8b9eb0;
    transform: rotate(45deg);
    margin-top: -4px;
    margin-left: 8px;
}

.upload-text {
    font-size: 16px;
    color: #334155;
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-info {
    font-size: 12px;
    color: #7e92a5;
    line-height: 1.6;
}

.uploaded-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 14px;
    display: none;
    background-color: white;
    padding: 8px;
}

/* 示例区域 */
.example-section {
    margin-bottom: 24px;
    background-color: #f8fafc;
    border-radius: 14px;
    padding: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01), inset 0 -1px 2px rgba(255,255,255,0.8);
}

.example-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.example-title {
    font-size: 13px;
    font-weight: 600;
    color: #4b5f73;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.refresh-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: #4b5f73;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.refresh-btn:hover {
    background: #d0d9e8;
    color: #2563eb;
    transform: rotate(180deg);
}

/* 示例图片 - 确保4个都显示 */
.example-images {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    min-height: 80px;
}

.example-image {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    display: block;
}

.example-image:hover {
    border-color: #2563eb;
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(37,99,235,0.15);
}

.example-prompts {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: wrap;
}

.example-prompt {
    padding: 6px 16px;
    background-color: #ffffff;
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    color: #4b5f73;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.example-prompt:hover {
    background-color: #f0f7ff;
    border-color: #2563eb;
    color: #2563eb;
    box-shadow: 0 4px 8px rgba(37,99,235,0.1);
    transform: translateY(-1px);
}

/* 提示词输入 */
.prompt-section {
    margin-bottom: 20px;
}

.prompt-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #2d3f53;
}

.prompt-input {
    width: 100%;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: all 0.2s;
    background-color: #ffffff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01), 0 1px 2px rgba(255,255,255,0.8);
}

.prompt-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: inset 0 2px 4px rgba(37,99,235,0.05), 0 0 0 3px rgba(37,99,235,0.1);
}

/* 分辨率区域 */
.resolution-section {
    margin-bottom: 16px;
    background-color: #f8fafc;
    border-radius: 14px;
    padding: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
}

.resolution-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #4b5f73;
    text-transform: uppercase;
}

.resolution-options {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.resolution-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    color: #4b5f73;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.resolution-btn.active {
    border-color: #2563eb;
    color: #2563eb;
    background-color: #eff6ff;
    box-shadow: 0 4px 8px rgba(37,99,235,0.1);
}

.resolution-sizes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.resolution-size {
    flex: 1;
    min-width: 80px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    background-color: #ffffff;
    color: #4b5f73;
    text-align: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.resolution-size.active {
    border-color: #2563eb;
    color: #2563eb;
    background-color: #eff6ff;
}

/* 分辨率选项禁用样式 */
.resolution-size.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #f0f0f0;
    border-color: #ddd;
}

/* 时长区域 */
.duration-section {
    margin-bottom: 24px;
    background-color: #f8fafc;
    border-radius: 14px;
    padding: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
}

.duration-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #4b5f73;
    text-transform: uppercase;
}

.duration-options {
    display: flex;
    gap: 10px;
}

.duration-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    color: #4b5f73;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.duration-btn.active {
    border-color: #2563eb;
    color: #2563eb;
    background-color: #eff6ff;
    box-shadow: 0 4px 8px rgba(37,99,235,0.1);
}

/* 生成按钮 */
.generate-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(to bottom, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 10px rgba(37,99,235,0.2), 0 2px 4px rgba(0,0,0,0.05);
}

.generate-btn:hover {
    background: linear-gradient(to bottom, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37,99,235,0.25);
}

.generate-btn:disabled {
    background: #cbd5e1;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.note {
    font-size: 12px;
    color: #8b9eb0;
    line-height: 1.6;
    text-align: center;
}

/* 视频墙 - 调整位置和布局 */
.video-examples {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    height: auto;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    margin-top: 0;
}

/* 第一排：左边大视频，右边小视频 */
.video-example:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.video-example:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

/* 第二排：左边小视频，右边大视频 - 与第一排相反 */
.video-example:nth-child(3) {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.video-example:nth-child(4) {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

/* 所有视频卡片统一比例 */
.video-example {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e9eef2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    aspect-ratio: 16/9;
    width: 100%;
    height: 100%;
    display: block;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* 加载状态 */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e9eef2;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
}

.result-state {
    height: 100%;
    min-height: 360px;
    width: 100%;
}

.result-video {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background-color: #0f172a;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    object-fit: contain;
}

/* 确保各个状态显示正确 */
#videoExamples {
    display: grid;
}

#loadingState {
    display: none;
    min-height: 300px;
    width: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#resultState {
    display: none;
    width: 100%;
    min-height: 300px;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* ========== 手机端强制修复 ========== */
@media screen and (max-width: 768px) {
    .container {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    
    .main-content {
        flex-direction: column !important;
        overflow-y: visible !important;
        height: auto !important;
        padding: 0 12px 20px 12px !important;
        gap: 16px !important;
    }
    
    .left-panel {
        width: 100% !important;
        height: auto !important;
        padding: 20px !important;
        margin-bottom: 0 !important;
    }
    
    .right-panel {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        padding: 20px !important;
        margin-top: 0 !important;
        display: block !important;
        scroll-margin-top: 20px;
    }
    
    .video-examples {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .video-example {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16/9 !important;
        display: block !important;
    }
    
    .video-example:nth-child(1),
    .video-example:nth-child(2),
    .video-example:nth-child(3),
    .video-example:nth-child(4) {
        grid-column: auto !important;
        grid-row: auto !important;
    }
    
    .generate-btn {
        width: 100% !important;
        padding: 14px 16px !important;
        font-size: 16px !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
        margin: 16px 0 !important;
    }
    
    .tab-nav {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
    
    .tab-nav button {
        flex-shrink: 0;
    }
    
    .result-state {
        scroll-margin-top: 20px;
    }
}

/* 超小屏修复 */
@media screen and (max-width: 480px) {
    .video-examples {
        grid-template-columns: 1fr !important;
    }
    
    .generate-btn {
        font-size: 15px !important;
        padding: 12px 16px !important;
    }
    
    .resolution-options,
    .resolution-sizes,
    .duration-options {
        flex-direction: column !important;
    }
    
    .resolution-btn,
    .resolution-size,
    .duration-btn {
        width: 100% !important;
    }
}