html {
    scroll-behavior: smooth;
}

body {
    background-color: #0a0a0f;
    min-height: 100vh;
}

/* 导航链接下划线动画 */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: white;
}

/* 玻璃拟态 */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    transition: all 0.5s;
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-8px);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

/* FAQ和内部数据卡禁用hover上浮 */
#faq .glass-card:hover,
.glass-card .glass-card:hover {
    transform: none;
    box-shadow: none;
}

/* 文字发光 */
.text-glow {
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
}

/* 渐变文字 */
.gradient-text {
    background: linear-gradient(to right, #6366f1, #22d3ee, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 渐变边框 */
.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* 发光按钮 */
.btn-glow {
    position: relative;
    overflow: hidden;
    background: linear-gradient(to right, #6366f1, #6366f1);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
}

.btn-glow:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

/* Mesh背景 */
.mesh-bg {
    background: 
        radial-gradient(at 40% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(34, 211, 238, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(34, 211, 238, 0.08) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(99, 102, 241, 0.1) 0px, transparent 50%);
}

/* 噪点背景 */
.noise-bg {
    position: relative;
}

.noise-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
}

/* FAQ折叠 */
.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease;
}

.faq-content.open {
    max-height: 500px;
}

.faq-btn {
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
}

.faq-btn:hover {
    color: #6366f1;
}

/* 功能模块标签切换 */
.feature-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feature-tab:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: #d1d5db;
}

.feature-tab.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(34, 211, 238, 0.2));
    border-color: rgba(99, 102, 241, 0.5);
    color: #fff;
}

/* 功能面板切换 */
.feature-panel {
    display: none;
}

.feature-panel.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 在线手册页面 ========== */
#loginOverlay {
    z-index: 100;
    background-color: #0a0a0f;
    transition: opacity 0.4s ease;
}

#loginOverlay .manual-login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 28rem;
    margin: 0 auto;
}

#loginOverlay .manual-login-card input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    box-sizing: border-box;
    font-size: 0.875rem;
}

#loginOverlay .manual-login-card input::placeholder {
    color: #6b7280;
}

#loginOverlay .manual-login-card input:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

#loginOverlay .manual-login-card .login-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: linear-gradient(to right, #6366f1, #6366f1);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

#loginOverlay .manual-login-card .login-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

#loginOverlay .manual-login-card .login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#loginOverlay .login-error {
    color: #f87171;
    font-size: 0.875rem;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

#loginOverlay .login-error[style*="display: none"],
#loginOverlay .login-error.is-hidden {
    display: none;
}

#manualContent {
    display: none;
}

#manualContent.is-visible {
    display: block;
}

#manualContent table th,
#manualContent table td {
    white-space: nowrap;
}

#manualContent code {
    font-family: 'Courier New', Courier, monospace;
}

/* ========== 侧边目录导航(TOC) ========== */
.toc-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
    padding: 1.5rem;
    padding-top: 5rem;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(99, 102, 241, 0.3);
    transition: transform 0.3s ease;
}

.toc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6366f1, #22d3ee);
    border-radius: 3px;
}

.toc-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    padding-left: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toc-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #6366f1, #22d3ee);
    border-radius: 2px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 0.5rem;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid transparent;
}

.toc-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #fff;
}

.toc-link.active {
    background: rgba(59, 130, 246, 0.2);
    color: #fff;
    font-weight: 500;
    border-left: 3px solid #3b82f6;
}

.toc-link .toc-icon {
    width: 1.5rem;
    text-align: center;
    font-size: 1rem;
    color: #6366f1;
}

.toc-link.active .toc-icon {
    color: #22d3ee;
}

/* 移动端TOC */
.toc-toggle {
    display: none;
    position: fixed;
    left: 1rem;
    top: 1rem;
    z-index: 60;
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    border: none;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.toc-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.toc-toggle i {
    font-size: 1.25rem;
}

.toc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 35;
    backdrop-filter: blur(4px);
}

/* 平板断点 */
@media (max-width: 1024px) {
    .toc-sidebar {
        transform: translateX(-100%);
    }

    .toc-sidebar.open {
        transform: translateX(0);
    }

    .toc-toggle {
        display: flex;
    }

    .toc-overlay.open {
        display: block;
    }

    /* 平板下移除所有margin-left */
    [style*="margin-left: 300px"] {
        margin-left: 0 !important;
    }
}

/* 手机断点 */
@media (max-width: 640px) {
    .toc-sidebar {
        width: 280px;
    }
    
    .toc-list {
        padding: 0.5rem;
    }
    
    .toc-item {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .toc-link {
        font-size: 0.9rem;
    }
}

/* ========== 阅读进度条 ========== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
    z-index: 200;
    transition: width 0.1s ease;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.5));
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

/* ========== 搜索功能 ========== */
.search-container {
    position: relative;
}

.search-input {
    width: 280px;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: #6b7280;
}

.search-input:focus {
    width: 360px;
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
    transition: color 0.3s;
}

.search-input:focus + .search-icon,
.search-container:focus-within .search-icon {
    color: #6366f1;
}

.search-results {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 0;
    width: 100%;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.75rem;
    display: none;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.search-results.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.25rem;
}

.search-result-preview {
    font-size: 0.75rem;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-highlight {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

/* ========== 代码复制按钮 ========== */
.code-block {
    position: relative;
    margin: 1rem 0;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    padding-right: 3rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.code-block code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e5e7eb;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    color: #9ca3af;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.copy-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #fff;
    border-color: rgba(99, 102, 241, 0.3);
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* ========== 提示框组件 ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* 成功提示 */
.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.alert-success .alert-title {
    color: #22c55e;
}

/* 警告提示 */
.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.alert-warning .alert-title {
    color: #fbbf24;
}

/* 错误提示 */
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.alert-error .alert-title {
    color: #f87171;
}

/* 信息提示 */
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.alert-info .alert-title {
    color: #60a5fa;
}

/* ========== 新章节通用样式 ========== */
.chapter-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* FAQ 折叠样式 */
.faq-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    cursor: pointer;
    color: #e5e7eb;
    font-weight: 500;
    transition: color 0.2s;
}

.faq-question:hover {
    color: #fff;
}

.faq-question .faq-icon {
    transition: transform 0.3s ease;
    color: #6b7280;
}

.faq-item.open .faq-question .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
}

.faq-answer-content {
    padding-bottom: 1rem;
    color: #9ca3af;
    line-height: 1.7;
}

/* 更新日志时间线 */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #6366f1, #22d3ee);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #6366f1;
    border: 2px solid #0a0a0f;
    z-index: 1;
}

.timeline-date {
    font-size: 0.75rem;
    color: #6366f1;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.timeline-content {
    color: #9ca3af;
    font-size: 0.875rem;
    line-height: 1.7;
}

.timeline-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 0.5rem;
}

.timeline-tag.new {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.timeline-tag.fix {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.timeline-tag.improve {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}
