/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Bahnschrift", "Rajdhani", "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(1200px 600px at 10% 10%, rgba(64, 201, 255, 0.18), transparent 60%),
        radial-gradient(800px 400px at 90% 20%, rgba(255, 204, 102, 0.18), transparent 60%),
        linear-gradient(135deg, #1b1f3b 0%, #252b5c 55%, #2a2f66 100%);
    color: #e8edf6;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.login-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 22, 0.85);
    backdrop-filter: blur(6px);
    z-index: 1000;
}

body.login-locked .login-mask {
    display: block;
}

body.login-locked .requires-login,
body.login-locked .usage-note {
    display: none;
}

body.login-locked .login-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw);
    z-index: 1100;
    margin-top: 0;
}

body.login-locked .container {
    padding-top: 40px;
}

.usage-note {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 280px;
    max-width: calc(100vw - 32px);
    background: rgba(18, 22, 46, 0.88);
    border: 1px solid rgba(112, 189, 255, 0.35);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    backdrop-filter: blur(6px);
}

.usage-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: #e8edf6;
    letter-spacing: 0.5px;
}

.usage-text {
    font-size: 12px;
    color: #c6d2ea;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(12, 16, 38, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(112, 189, 255, 0.2);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    padding: 30px;
}

.top-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 14px;
    margin-bottom: 30px;
}

.top-card {
    margin-top: 0;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(112, 189, 255, 0.2);
}

header h1 {
    color: #7bd3ff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

header p {
    color: #c0c9dc;
    font-size: 1.1rem;
}

/* 通用部分样式 */
section {
    margin-bottom: 30px;
}

section h2 {
    color: #e8edf6;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* API 配置部分 */
.api-config {
    background: rgba(16, 20, 44, 0.7);
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #7bd3ff;
    border: 1px solid rgba(112, 189, 255, 0.15);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #cbd6ea;
    letter-spacing: 0.3px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(112, 189, 255, 0.25);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: rgba(9, 12, 28, 0.9);
    color: #e8edf6;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #7bd3ff;
    box-shadow: 0 0 0 3px rgba(123, 211, 255, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #4aa3ff, #6e7bff);
    color: #fff;
    box-shadow: 0 8px 18px rgba(74, 163, 255, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6bb6ff, #7f8bff);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(74, 163, 255, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #d8e6ff;
    border: 1px solid rgba(112, 189, 255, 0.2);
    margin-left: 10px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

/* 选项卡样式 */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(112, 189, 255, 0.2);
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #b6c3da;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-right: 20px;
}

.tab-btn:hover {
    color: #7bd3ff;
}

.tab-btn.active {
    color: #7bd3ff;
    border-bottom-color: #7bd3ff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 生成表单样式 */
.generation-form {
    background: rgba(12, 16, 38, 0.8);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid rgba(112, 189, 255, 0.15);
}

/* 状态提示样式 */
.status {
    margin-left: 10px;
    font-size: 14px;
    font-weight: 600;
}

.status.success {
    color: #6fe1a2;
}

.status.error {
    color: #ff8b8b;
}

/* 结果显示样式 */
.result-section {
    background: rgba(12, 16, 38, 0.8);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid rgba(112, 189, 255, 0.15);
}

.result {
    background: rgba(9, 12, 28, 0.9);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid rgba(112, 189, 255, 0.15);
    min-height: 100px;
}

.result.success {
    border-color: rgba(111, 225, 162, 0.4);
    background: rgba(18, 64, 50, 0.4);
    color: #c6f0d8;
}

.result.error {
    border-color: rgba(255, 139, 139, 0.4);
    background: rgba(78, 26, 26, 0.5);
    color: #ffd4d4;
}

.result .video-info {
    margin-bottom: 15px;
}

.result .video-info p {
    margin: 5px 0;
}

.task-progress {
    margin: 10px 0 15px;
}

.task-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.task-progress-inner {
    height: 100%;
    background: linear-gradient(90deg, #4aa3ff, #7bd3ff);
    transition: width 0.3s ease;
}

.task-progress-inner.indeterminate {
    width: 35%;
    animation: progress-slide 1.6s ease-in-out infinite;
}

@keyframes progress-slide {
    0% { transform: translateX(-120%); }
    50% { transform: translateX(60%); }
    100% { transform: translateX(120%); }
}

.result .video-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4aa3ff, #6e7bff);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.result .video-link:hover {
    background: linear-gradient(135deg, #6bb6ff, #7f8bff);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(74, 163, 255, 0.35);
}

.character-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid rgba(112, 189, 255, 0.2);
    border-radius: 8px;
    background: rgba(9, 12, 28, 0.9);
    margin-bottom: 10px;
    gap: 16px;
}

.character-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.character-name {
    font-weight: 600;
    color: #e8edf6;
}

.character-link {
    font-size: 12px;
    color: #7bd3ff;
    text-decoration: none;
}

.character-link:hover {
    text-decoration: underline;
}

.character-actions .btn {
    margin-left: 0;
}

.character-note-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
}

.character-note-input {
    width: 100%;
    max-width: 260px;
    padding: 8px 10px;
    border: 1px solid rgba(112, 189, 255, 0.2);
    border-radius: 6px;
    font-size: 12px;
    background: rgba(9, 12, 28, 0.9);
    color: #e8edf6;
}

.character-note-input:focus {
    outline: none;
    border-color: #7bd3ff;
    box-shadow: 0 0 0 2px rgba(123, 211, 255, 0.15);
}

.muted {
    color: #9aa7bf;
    font-size: 12px;
}

/* 加载动画样式 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 8, 20, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 12px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.12);
    border-top: 6px solid #7bd3ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 18px;
    color: #cbd6ea;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .top-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        margin-bottom: 20px;
    }

    .tabs {
        flex-direction: column;
        gap: 10px;
        border-bottom: none;
    }

    .tab-btn {
        margin-right: 0;
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
    }

    .tab-btn.active {
        border-bottom: none;
        border-left-color: #7bd3ff;
        background: rgba(123, 211, 255, 0.1);
    }

    .usage-note {
        position: static;
        width: auto;
        max-width: none;
        margin-bottom: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .api-config,
    .generation-form,
    .result-section {
        padding: 15px;
    }
}
