/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== 头部 ===== */
header {
    text-align: center;
    padding: 60px 20px 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

header h1 a {
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #8892b0;
    font-size: 1.1rem;
}

/* ===== 面包屑导航 ===== */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #8892b0;
}

.breadcrumb a {
    color: #8892b0;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #00d4ff;
}

.breadcrumb .separator {
    opacity: 0.5;
}

.breadcrumb .current {
    color: #ccd6f6;
}

/* ===== 主内容区 ===== */
main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* ===== 首页卡片网格 ===== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
}

.card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #fff;
}

.card p {
    color: #8892b0;
    line-height: 1.6;
}

.card .tags {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card .tags span {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #ccd6f6;
}

/* 卡片教程数量统计 */
.card .tutorial-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 15px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    color: #ccd6f6;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 各卡片主题色 */
.card:nth-child(1) {
    --accent-color: #00d4ff;
}

.card:nth-child(2) {
    --accent-color: #ff6b6b;
}

.card:nth-child(3) {
    --accent-color: #4ecdc4;
}

/* ===== 子页面：页面介绍区 ===== */
.page-intro {
    text-align: center;
    margin-bottom: 40px;
}

.page-intro .page-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.page-intro h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.page-intro p {
    color: #8892b0;
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 主题色变量 */
.theme-cyan {
    --theme-color: #00d4ff;
    --theme-glow: rgba(0, 212, 255, 0.15);
}

.theme-red {
    --theme-color: #ff6b6b;
    --theme-glow: rgba(255, 107, 107, 0.15);
}

.theme-green {
    --theme-color: #4ecdc4;
    --theme-glow: rgba(78, 205, 196, 0.15);
}

.page-intro h2 {
    color: var(--theme-color);
}

/* ===== 子页面：教程卡片列表 ===== */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.tutorial-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 28px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tutorial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--theme-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.tutorial-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25), 0 0 60px var(--theme-glow);
    border-color: rgba(255, 255, 255, 0.15);
}

.tutorial-card:hover::before {
    opacity: 1;
}

.tutorial-card .card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tutorial-card .card-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--theme-glow);
    color: var(--theme-color);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.tutorial-card .difficulty {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.difficulty.beginner {
    background: rgba(78, 205, 196, 0.15);
    color: #4ecdc4;
}

.difficulty.intermediate {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.difficulty.advanced {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.tutorial-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e6f1ff;
    margin-bottom: 8px;
}

.tutorial-card .description {
    color: #8892b0;
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.tutorial-card .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tutorial-card .card-tags span {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #a8b2d1;
}

/* 教程卡片状态标签 */
.tutorial-card .status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    font-size: 0.8rem;
    color: #64748b;
}

.tutorial-card .status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
}

.tutorial-card .status.coming-soon::before {
    background: #ffc107;
}

.tutorial-card .status.available::before {
    background: #4ecdc4;
}

/* ===== 页脚 ===== */
footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.beian {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    color: #64748b;
    font-size: 0.85rem;
}

.beian a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.3s;
}

.beian a:hover {
    color: #8892b0;
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.tutorial-card {
    animation: fadeInUp 0.5s ease backwards;
}

.card:nth-child(1),
.tutorial-card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2),
.tutorial-card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3),
.tutorial-card:nth-child(3) {
    animation-delay: 0.3s;
}

.tutorial-card:nth-child(4) {
    animation-delay: 0.4s;
}

.tutorial-card:nth-child(5) {
    animation-delay: 0.5s;
}

.tutorial-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* ===== 侧边目录导航 ===== */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(22, 33, 62, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ccd6f6;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle:hover {
    background: rgba(22, 33, 62, 0.95);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.sidebar-toggle .icon-menu,
.sidebar-toggle .icon-close {
    transition: opacity 0.2s, transform 0.2s;
}

.sidebar-toggle .icon-close {
    display: none;
}

.sidebar-toggle.active .icon-menu {
    display: none;
}

.sidebar-toggle.active .icon-close {
    display: block;
}

/* 遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    background: rgba(16, 24, 48, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 80px 0 30px;
    overflow-y: auto;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
    left: 0;
}

.sidebar-title {
    padding: 0 24px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin: 2px 12px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    color: #8892b0;
    font-size: 0.92rem;
    transition: all 0.25s ease;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ccd6f6;
}

.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #e6f1ff;
    font-weight: 500;
}

.sidebar-nav li a .nav-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

/* 侧边栏分隔线 */
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 12px 24px;
}

/* 侧边栏内教程子目录 */
.sidebar-section {
    margin-top: 4px;
}

.sidebar-section .section-title {
    padding: 8px 24px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav .sub-item a {
    padding-left: 28px;
    font-size: 0.85rem;
    color: #64748b;
}

.sidebar-nav .sub-item a:hover {
    color: #a8b2d1;
}

.sidebar-nav .sub-item a .nav-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
}

/* ===== 教程文章页 ===== */
.article {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px 20px 40px;
}

/* 文章元信息 */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.article-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #64748b;
}

.article-meta .meta-icon {
    font-size: 1rem;
}

/* 文章页内目录 */
.article-toc {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 32px;
}

.article-toc .toc-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #8892b0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.article-toc ol {
    list-style: none;
    counter-reset: toc-counter;
    padding: 0;
}

.article-toc ol li {
    counter-increment: toc-counter;
}

.article-toc ol li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    color: #8892b0;
    font-size: 0.92rem;
    transition: color 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.article-toc ol li:last-child a {
    border-bottom: none;
}

.article-toc ol li a::before {
    content: counter(toc-counter, decimal-leading-zero);
    font-size: 0.75rem;
    font-weight: 700;
    color: #4a5568;
    width: 22px;
    flex-shrink: 0;
}

.article-toc ol li a:hover {
    color: var(--theme-color, #00d4ff);
}

/* 文章标题层级 */
.article h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e6f1ff;
    margin: 40px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.article h2:first-of-type {
    margin-top: 0;
}

.article h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ccd6f6;
    margin: 28px 0 12px;
}

.article h4 {
    font-size: 1.05rem;
    font-weight: 500;
    color: #a8b2d1;
    margin: 20px 0 10px;
}

/* 文章段落 */
.article p {
    color: #8892b0;
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.article strong {
    color: #ccd6f6;
    font-weight: 600;
}

/* 文章列表 */
.article ul,
.article ol {
    color: #8892b0;
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 24px;
    font-size: 0.95rem;
}

.article li {
    margin-bottom: 6px;
}

/* 代码块 */
.article pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 20px;
    margin: 16px 0 20px;
    overflow-x: auto;
    position: relative;
}

.article pre code {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #e6f1ff;
    line-height: 1.7;
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

/* 代码语言标签 */
.article pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.7rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: -apple-system, sans-serif;
}

/* 行内代码 */
.article code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #ff79c6;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 提示框 */
.tip-box {
    padding: 16px 20px;
    border-radius: 10px;
    margin: 16px 0 20px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #ccd6f6;
}

.tip-box .tip-title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tip-box p {
    margin-bottom: 0;
    color: inherit;
    opacity: 0.85;
}

.tip-box.tip {
    background: rgba(78, 205, 196, 0.08);
    border-left: 4px solid #4ecdc4;
}

.tip-box.tip .tip-title {
    color: #4ecdc4;
}

.tip-box.warning {
    background: rgba(255, 193, 7, 0.08);
    border-left: 4px solid #ffc107;
}

.tip-box.warning .tip-title {
    color: #ffc107;
}

.tip-box.note {
    background: rgba(0, 212, 255, 0.08);
    border-left: 4px solid #00d4ff;
}

.tip-box.note .tip-title {
    color: #00d4ff;
}

.tip-box.danger {
    background: rgba(255, 107, 107, 0.08);
    border-left: 4px solid #ff6b6b;
}

.tip-box.danger .tip-title {
    color: #ff6b6b;
}

/* 步骤列表 */
.steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.steps li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 48px;
    margin-bottom: 24px;
    color: #8892b0;
    line-height: 1.7;
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--theme-color, #00d4ff);
}

.steps li strong {
    display: block;
    color: #e6f1ff;
    font-size: 1rem;
    margin-bottom: 4px;
}

/* 文章上/下篇导航 */
.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.article-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #8892b0;
    font-size: 0.88rem;
    transition: all 0.3s;
}

.article-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #ccd6f6;
}

.article-nav a .nav-label {
    font-size: 0.75rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.article-nav a .nav-title {
    color: #ccd6f6;
    font-weight: 500;
}

.article-nav a.next {
    text-align: right;
}

/* 文章内图片 */
.article img {
    max-width: 100%;
    border-radius: 10px;
    margin: 16px 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 文章内表格 */
.article table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 20px;
    font-size: 0.9rem;
}

.article th,
.article td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #8892b0;
}

.article th {
    color: #ccd6f6;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
}

.article tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* 文章内引用 */
.article blockquote {
    border-left: 3px solid rgba(255, 255, 255, 0.15);
    padding: 12px 20px;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 8px 8px 0;
    color: #8892b0;
    font-style: italic;
}

/* 文章 summary 总结区 */
.article-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 24px;
    margin: 32px 0;
}

.article-summary h3 {
    margin-top: 0;
    color: var(--theme-color, #00d4ff);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    header {
        padding: 40px 16px 30px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tutorial-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .page-intro h2 {
        font-size: 1.5rem;
    }

    .tutorial-card {
        padding: 22px;
    }

    .article {
        padding: 10px 16px 30px;
    }

    .article h2 {
        font-size: 1.3rem;
    }

    .article pre {
        padding: 14px;
        font-size: 0.8rem;
    }

    .article-nav {
        flex-direction: column;
    }

    .article-meta {
        gap: 8px;
    }
}