* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f3ef;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.panel h2 {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.panel h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

/* 表单 */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.hint {
    font-weight: normal;
    color: #999;
    font-size: 12px;
}

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 150px;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background: #f0f0f0;
    color: #666;
}

.btn-sm:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #ff4757;
    color: white;
    padding: 4px 10px;
    font-size: 12px;
}

.btn-danger:hover {
    background: #ff6b81;
}

/* 结果框 */
.result-box {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.result-box.success {
    background: #f0f9eb;
    color: #67c23a;
    border: 1px solid #c2e7b0;
}

.result-box.error {
    background: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fbc4c4;
}

.result-box.info {
    background: #ecf5ff;
    color: #409eff;
    border: 1px solid #b3d8ff;
}

/* 任务列表 */
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.task-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.task-list {
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.task-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}
.task-item-id {
    font-size: 11px;
    color: #999;
    font-family: monospace;
    margin-bottom: 4px;
}

.task-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.status-pending { background: #f0f0f0; color: #999; }
.status-planning { background: #e3f2fd; color: #2196f3; }
.status-generating_images { background: #fff3e0; color: #ff9800; }
.status-generating_audio { background: #fce4ec; color: #e91e63; }
.status-rendering { background: #f3e5f5; color: #9c27b0; }
.status-muxing { background: #e8eaf6; color: #3f51b5; }
.status-completed { background: #e8f5e9; color: #4caf50; }
.status-failed { background: #ffebee; color: #f44336; }

.empty {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

/* 任务详情 */
.task-detail {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s;
}

.scene-list {
    margin-top: 16px;
}

.scene-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
}

.scene-num {
    width: 28px;
    height: 28px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.scene-text {
    flex: 1;
    font-size: 13px;
}

.scene-thumb {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.video-player {
    margin-top: 16px;
}

.video-player video {
    width: 100%;
    border-radius: 8px;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 环境状态 */
.env-panel {
    margin-bottom: 20px;
}

.env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.env-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
}

.env-item .label {
    color: #999;
    font-size: 11px;
}

.env-item .value {
    font-weight: 600;
    margin-top: 2px;
}

.env-ok { color: #4caf50; }
.env-bad { color: #f44336; }

footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 12px;
}

/* 响应式 */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}


/* 高级配置面板 */
.config-panel {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}
.config-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #555;
    font-size: 14px;
    user-select: none;
}
.config-header:hover {
    background: linear-gradient(135deg, #eef1f5 0%, #dde3eb 100%);
}
.config-body {
    padding: 20px;
    display: none;
}
.config-body.show {
    display: block;
}
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.config-grid .form-group {
    margin-bottom: 0;
}


/* 密码框：隐藏浏览器原生的显示/隐藏按钮，其他样式和普通输入框一致 */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
}

/* ========== 风格卡片网格 ========== */
.style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.style-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.style-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.style-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.style-preview {
    width: 100%;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.style-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.style-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.style-info {
    padding: 8px 10px;
}

.style-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.style-desc {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.style-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(102, 126, 234, 0.9);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.style-group-title {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    padding: 8px 0 4px 0;
    border-bottom: 1px solid #eee;
    margin-top: 8px;
}

/* 响应式：小屏幕减少列数 */
@media (max-width: 768px) {
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
