/* ========== 变量定义 ========== */
:root {
    --primary-blue: #1a3a6c;
    --primary-dark: #0f2444;
    --secondary-blue: #4a90e2;
    --accent-gold: #c9a84c;
    --accent-orange: #f39c12;
    --success-green: #2ecc71;
    --warning-red: #e74c3c;
    --light-bg: #f5f7fb;
    --card-bg: #ffffff;
    --text-dark: #1a2332;
    --text-medium: #4a5568;
    --text-light: #8896a8;
    --border-color: #e8ecf1;
    --shadow-sm: 0 2px 8px rgba(26, 58, 108, 0.06);
    --shadow-md: 0 4px 20px rgba(26, 58, 108, 0.10);
    --shadow-lg: 0 8px 40px rgba(26, 58, 108, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--light-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ========== 容器 ========== */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ========== 导航栏 ========== */
.top-nav {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.brand-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: 1px;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-light);
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--light-bg);
    color: var(--primary-blue);
}

.nav-link.active {
    background: var(--primary-blue);
    color: white;
}

.nav-link.active:hover {
    background: var(--primary-dark);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-blue);
    padding: 4px 8px;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--card-bg);
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    gap: 4px;
}

.mobile-nav-link {
    padding: 12px 0;
    text-decoration: none;
    color: var(--text-medium);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-link:last-child {
    border-bottom: none;
}
.mobile-nav-link.active {
    color: var(--primary-blue);
}

/* ========== 头部 ========== */
header {
    text-align: center;
    padding: 30px 0 10px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: 1px;
    line-height: 1.3;
}

header .subtitle {
    color: var(--text-medium);
    font-size: 1rem;
    margin-top: 6px;
}

/* ========== 按钮 ========== */
.btn-submit {
    background: linear-gradient(135deg, var(--accent-gold), #b8943a);
    color: white;
    border: none;
    padding: 16px 48px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: block;
    margin: 20px auto 0;
    width: 100%;
    max-width: 400px;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.35);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(201, 168, 76, 0.45);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ========== 加载动画 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    color: var(--text-medium);
    font-size: 0.95rem;
}

/* ========== 页脚 ========== */
.main-footer {
    background: var(--primary-blue);
    color: white;
    padding: 40px 20px 24px;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--accent-gold);
}

.footer-section p,
.footer-section a {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    text-decoration: none;
    display: block;
    margin-bottom: 6px;
    line-height: 1.6;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 32px auto 0;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

/* ========== 错误页 ========== */
.error-container {
    max-width: 500px;
    margin: 80px auto;
    text-align: center;
    padding: 40px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.error-container h1 {
    font-size: 5rem;
    color: var(--primary-blue);
    font-weight: 300;
}

.error-container h2 {
    color: var(--text-dark);
    margin: 10px 0;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.error-actions a {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--text-medium);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .mobile-menu-btn {
        display: block;
    }
    .container {
        padding: 12px 12px;
    }
    header h1 {
        font-size: 1.4rem;
    }
    header .subtitle {
        font-size: 0.9rem;
    }
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 10px 14px;
    }
    .brand-text {
        font-size: 1.1rem;
    }
    .brand-sub {
        font-size: 0.6rem;
    }
    .btn-submit {
        font-size: 0.95rem;
        padding: 14px 24px;
    }
    .footer-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .error-container h1 {
        font-size: 3.5rem;
    }
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }

/* ========== 消息提示 ========== */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-md);
    max-width: 90%;
}

.message.success {
    background: var(--success-green);
}
.message.error {
    background: var(--warning-red);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ========== 夜间模式 ========== */
[data-theme="dark"] {
    --primary-blue: #3b82f6;
    --primary-dark: #1e3a5f;
    --light-bg: #1a1a2e;
    --card-bg: #16213e;
    --text-dark: #e8edf5;
    --text-medium: #b0bcd5;
    --text-light: #7a8aa3;
    --border-color: #2a3a5e;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    background: #0f0f1a;
}

[data-theme="dark"] .top-nav {
    background: var(--card-bg);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .nav-link {
    color: var(--text-medium);
}

[data-theme="dark"] .nav-link.active {
    background: var(--primary-blue);
    color: white;
}

[data-theme="dark"] .form-section,
[data-theme="dark"] .result-section,
[data-theme="dark"] .module,
[data-theme="dark"] .report-card {
    background: var(--card-bg);
}

[data-theme="dark"] .score-options label {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-medium);
}

[data-theme="dark"] .score-options input:checked + label {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

[data-theme="dark"] .contact-module {
    background: linear-gradient(135deg, #1a2a4a, #0f1f3a);
}

[data-theme="dark"] .contact-module input {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-dark);
}

[data-theme="dark"] .scoring-rule {
    background: #1a2a4a;
    color: var(--text-medium);
}

[data-theme="dark"] .novel-content {
    background: var(--card-bg);
}

[data-theme="dark"] .chapter-sidebar {
    background: var(--card-bg);
}

[data-theme="dark"] .chapter-item {
    background: var(--light-bg);
    color: var(--text-medium);
}

[data-theme="dark"] .chapter-item:hover,
[data-theme="dark"] .chapter-item.active {
    background: var(--primary-blue);
    color: white;
}