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

html {
    scroll-padding-top: 80px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f9fafb;
    color: #111827;
    line-height: 1.6;
}

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

/* Header */
.header {
    background: #1e293b;
    color: white;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    margin-left: 8px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
}

.logo-icon {
    height: 28px;
    width: auto;
    border-radius: 4px;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: #e2e8f0;
    text-decoration: none;
    font-size: 16px;
}

.nav-link.active, .nav-link:hover {
    color: white;
}

.lang-btn {
    background: #475569;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

/* Hero */
.hero {
    background: #0f172a;
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    margin-bottom: 16px;
}

.hero-desc {
    font-size: 18px;
    max-width: 800px;
    margin: 0 auto 32px;
    color: #cbd5e1;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
}

.btn.primary {
    background: #2563eb;
    color: white;
}

.btn.secondary {
    background: #334155;
    color: white;
}

/* Section */
.section-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 32px;
}

.features {
    padding: 60px 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.code-example {
    padding: 60px 0;
    background: #f1f5f9;
}

.code-block {
    background: #1e293b;
    color: #e6e6e6;
    padding: 24px;
    border-radius: 10px;
    overflow-x: auto;
    max-width: 100%;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.catbase {
    color: #e6e6e6;
}

.catbase .keyword { color: #c4a5ff; }
.catbase .type { color: #5cc4ff; }
.catbase .string { color: #9acd32; }
.catbase .number { color: #ff9166; }
.catbase .func { color: #ffd766; }

.mission {
    padding: 60px 0;
    background: white;
}

/* Footer */
.footer {
    background: #1e293b;
    color: #cbd5e1;
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
}

.footer .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-logo {
    height: 32px;
    width: auto;
    border-radius: 4px;
}

.hero-logo {
    height: 240px;
    width: auto;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
}

/* Download */
.page {
    padding: 60px 0;
}

.page-title {
    font-size: 32px;
    margin-bottom: 12px;
}

.download-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.install-notice {
    margin-top: 30px;
    background: #eff6ff;
    padding: 20px;
    border-radius: 8px;
}

/* Manual */
.manual-container {
    display: flex;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    gap: 30px;
}

.sidebar {
    width: 280px;
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
}

.index-title {
    margin-top: 24px;
}

.toc {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toc a {
    color: #1e293b;
    text-decoration: none;
}

.index-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.index-list a {
    background: #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: #1e293b;
    text-decoration: none;
}

.manual-content {
    flex: 1;
    min-width: 0;
}

.content-block {
    background: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow-x: hidden;
    scroll-margin-top: 80px;
}

.code {
    background: #f1f5f9;
    padding: 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-family: monospace;
}

.func-item {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.content-block h2 {
    font-size: 28px;
    color: #0f172a;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 12px;
    margin-top: 10px;
    margin-bottom: 28px;
}

.content-block h3 {
    font-size: 22px;
    color: #1e293b;
    margin-top: 36px;
    margin-bottom: 20px;
    padding-left: 12px;
    border-left: 4px solid #2563eb;
}

.content-block h4 {
    font-size: 18px;
    color: #334155;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-left: 10px;
    border-left: 3px solid #94a3b8;
}

.content-block p {
    margin-bottom: 20px;
    line-height: 2.2;
}

.content-block blockquote {
    margin: 20px 0;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    border-left: 4px solid #4a90d9;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.1);
}

.content-block blockquote p {
    margin-bottom: 0;
    line-height: 2.2;
    color: #2c5282;
}

.content-block blockquote p strong {
    color: #1a365d;
}

.content-block ul, .content-block ol {
    margin-bottom: 20px;
    margin-left: 32px;
    padding-left: 24px;
    line-height: 2.2;
}

.content-block li {
    margin-bottom: 12px;
}

.content-block table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
}

.content-block th {
    background: #334155;
    color: white;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
}

.content-block td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.content-block tr:hover td {
    background: #f1f5f9;
}

.content-block code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.code-block code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.content-block a {
    color: #2563eb;
    text-decoration: none;
}

.content-block a:hover {
    text-decoration: underline;
}

.code-block {
    margin: 20px 0;
}

/* ============================================================
   Hamburger button (mobile only, hidden on desktop)
   ============================================================ */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

/* ============================================================
   Responsive Layout — breakpoints
   ============================================================ */

/* Tablet only (769px – 1024px): keep sidebar but narrower */
@media (min-width: 769px) and (max-width: 1024px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-title {
        font-size: 36px;
    }

    .manual-container {
        gap: 20px;
    }

    .sidebar {
        width: 220px;
    }
}

/* Mobile (≤ 768px) — all iPhones portrait + SE landscape:
   sidebar hidden, hamburger toggle */
@media (max-width: 768px) {
    /* Hide sidebar by default — use left instead of transform (iOS Safari bug) */
    .sidebar {
        position: fixed;
        top: 64px;
        left: -100%;
        width: 80vw;
        max-width: 320px;
        height: calc(100vh - 64px);
        background: white;
        z-index: 99;
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        transition: left 0.3s ease;
        padding: 20px;
        border-right: 1px solid #e2e8f0;
        -webkit-transform: translateZ(0); /* iOS GPU acceleration hint */
    }

    .sidebar.open {
        left: 0;
    }

    /* Overlay backdrop when sidebar is open */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 98;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    /* Hamburger button shows on mobile */
    .hamburger {
        display: inline-block;
    }

    /* Nav links (首页/下载/手册) — hide on mobile, hamburger replaces */
    .nav {
        display: none;
    }

    /* Manual container: content takes full width */
    .manual-container {
        flex-direction: column;
        padding: 0 12px;
        margin: 20px auto;
    }

    .manual-content {
        width: 100%;
    }

    /* Hero section */
    .hero {
        padding: 48px 0;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-desc {
        font-size: 16px;
        padding: 0 16px;
    }

    .hero-logo {
        height: 140px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    /* Feature grid single column */
    .feature-grid {
        grid-template-columns: 1fr;
    }

    /* Content blocks */
    .content-block {
        padding: 20px 16px;
    }

    .content-block h2 {
        font-size: 22px;
    }

    .content-block h3 {
        font-size: 18px;
    }

    .content-block table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
    }

    .content-block th,
    .content-block td {
        padding: 8px 10px;
    }

    /* Header */
    .container {
        padding: 0 12px;
    }

    /* Code blocks */
    .code-block {
        padding: 16px;
        font-size: 13px;
    }

    /* Download table */
    .download-table table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
    }

    th, td {
        padding: 10px 12px;
    }
}