:root {
    --primary: #6db300;
    --primary-dark: #5a9500;
    --primary-light: #f0fdf4;
    --text: #1e293b;
    --text-secondary: #64748b;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --sidebar-w: 280px;
    --toc-w: 220px;
    --content-max: 820px;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.75;
    font-size: 16px;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary); }

/* ── Reading progress bar ── */
#reading-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #a3e635);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s;
}

/* ── Layout ── */
.page-wrapper { display: flex; min-height: 100vh; }

/* ── Left Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-logo img { width: 32px; height: 32px; border-radius: 6px; }
.sidebar-logo-text { font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.sidebar-logo-text span { color: var(--primary); }

/* Sidebar search */
.sidebar-search {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-search-input {
    width: 100%;
    padding: 7px 32px 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748b' viewBox='0 0 24 24'%3E%3Cpath d='M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z' stroke='%2364748b' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center;
    outline: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.sidebar-search-input:focus { border-color: var(--primary); background-color: var(--white); }
.sidebar-search-input::placeholder { color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 8px 0 20px; }

.nav-section { margin-bottom: 2px; }

/* Collapsible nav sections */
.nav-section-title {
    display: flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
    padding: 10px 20px 4px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.nav-section-title::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--text-secondary);
    border-bottom: 1.5px solid var(--text-secondary);
    transform: rotate(45deg);
    margin-left: auto;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.nav-section.collapsed .nav-section-title::after {
    transform: rotate(-45deg);
}
.nav-section-items {
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.nav-section.collapsed .nav-section-items {
    max-height: 0 !important;
}

.nav-item {
    display: block;
    padding: 5px 20px;
    font-size: 0.855rem;
    color: var(--text);
    border-left: 3px solid transparent;
    transition: all 0.12s;
    line-height: 1.5;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary);
    text-decoration: none;
    border-left-color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
}

.nav-sub { padding-left: 12px; }
.nav-sub .nav-item { font-size: 0.82rem; padding: 4px 20px 4px 32px; }

/* ── Main content ── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ── */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 10px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.breadcrumb {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb .sep { color: #cbd5e1; }

/* Topbar search */
.topbar-search {
    flex: 1;
    max-width: 360px;
    position: relative;
}

.topbar-search-input {
    width: 100%;
    padding: 7px 14px 7px 36px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    background: var(--bg);
    outline: none;
    color: var(--text);
    transition: all 0.15s;
}

.topbar-search-input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(109,179,0,.15);
}

.topbar-search-input::placeholder { color: var(--text-secondary); }

.topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.btn-back, .btn-next {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-back:hover, .btn-next:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    text-decoration: none;
}

/* ── Content layout with TOC ── */
.content-wrapper {
    display: flex;
    flex: 1;
    align-items: flex-start;
}

/* ── Article ── */
.article {
    padding: 44px 56px 80px;
    max-width: var(--content-max);
    flex: 1;
    min-width: 0;
}

/* Article typography */
.article h1 {
    font-size: 1.85rem;
    font-weight: 750;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.article h2 {
    font-size: 1.2rem;
    font-weight: 650;
    color: var(--text);
    margin: 36px 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--primary);
    line-height: 1.4;
}

.article h3 {
    font-size: 1.03rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 24px 0 10px;
}

.article p {
    margin-bottom: 14px;
    font-size: 0.94rem;
    line-height: 1.8;
    color: #334155;
}

.article ul, .article ol {
    margin: 8px 0 16px 22px;
    font-size: 0.94rem;
    line-height: 1.8;
    color: #334155;
}

.article li { margin-bottom: 5px; }

.article li > ul, .article li > ol { margin-top: 4px; margin-bottom: 4px; }

.article img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 14px 0;
    display: block;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.article img:hover { box-shadow: var(--shadow-md); }

/* Image lightbox */
.article img { cursor: zoom-in; }

.article table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 0.88rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.article th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    color: var(--text);
}

.article td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.6;
}

.article tr:last-child td { border-bottom: none; }
.article tr:nth-child(even) td { background: #fafbfc; }
.article tr:hover td { background: #f0fdf4; }

/* Code and pre */
.article code {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875em;
    color: #c7254e;
}

.article pre {
    background: #1e293b;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 16px 0;
    overflow-x: auto;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.article pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Note and warning boxes */
.note-box {
    background: var(--primary-light);
    border: 1px solid #86efac;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 18px 0;
    font-size: 0.9rem;
    line-height: 1.7;
}

.warn-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 18px 0;
    font-size: 0.9rem;
    line-height: 1.7;
}

/* kbd */
kbd, .article kbd {
    display: inline-block;
    background: var(--white);
    border: 1px solid #94a3b8;
    border-bottom: 2px solid #64748b;
    border-radius: 5px;
    padding: 1px 7px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.82em;
    color: var(--text);
    white-space: nowrap;
    box-shadow: 0 1px 0 rgba(0,0,0,.1);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}

/* manual-table (for structured content) */
.manual-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.88rem;
}

.manual-table td, .manual-table th {
    padding: 8px 12px;
    border: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.6;
}

.manual-table th {
    background: #f1f5f9;
    font-weight: 600;
}

.manual-table tr:nth-child(even) td { background: #fafbfc; }

/* ── Right TOC ── */
.toc-panel {
    width: var(--toc-w);
    min-width: var(--toc-w);
    padding: 44px 0 80px 0;
    position: sticky;
    top: 49px;
    max-height: calc(100vh - 49px);
    overflow-y: auto;
    flex-shrink: 0;
}

.toc-panel::-webkit-scrollbar { width: 3px; }
.toc-panel::-webkit-scrollbar-thumb { background: var(--border); }

.toc-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
    padding: 0 20px 8px;
}

.toc-list { list-style: none; }

.toc-list a {
    display: block;
    padding: 4px 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 2px solid transparent;
    transition: all 0.12s;
    line-height: 1.5;
}

.toc-list a:hover {
    color: var(--primary);
    text-decoration: none;
    border-left-color: var(--primary);
}

.toc-list a.active {
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    background: var(--primary-light);
}

/* ── Page nav footer ── */
.page-nav {
    display: flex;
    justify-content: space-between;
    padding: 24px 56px 40px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    gap: 12px;
}

.page-nav a {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text);
    background: var(--white);
    transition: all 0.15s;
    max-width: 260px;
    box-shadow: var(--shadow-sm);
}

.page-nav a:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.page-nav .nav-label { font-size: 0.68rem; color: var(--text-secondary); }
.page-nav .nav-title { font-weight: 600; font-size: 0.875rem; }
/* Single button: prev stays left, next pushed right */
.page-nav a:only-child.nav-prev { margin-right: auto; }
.page-nav a:only-child.nav-next { margin-left: auto; }

/* ── Search results overlay ── */
.search-overlay {
    display: none;
    position: fixed;
    top: 50px;
    left: calc(var(--sidebar-w) + 40px);
    right: 40px;
    max-width: 680px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-height: 70vh;
    overflow-y: auto;
}

.search-overlay.visible { display: block; }

.search-result-item {
    display: block;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); text-decoration: none; }

.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 4px;
}

.search-result-snippet {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.search-result-snippet mark {
    background: #fef08a;
    color: var(--text);
    border-radius: 2px;
    padding: 0 2px;
}

.search-no-result {
    padding: 24px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.search-overlay-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 1rem;
}

.search-close-btn:hover { background: var(--bg); }

/* ── Image lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    cursor: zoom-out;
    border: none;
}

/* ── Mobile toggle ── */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--text);
}

.menu-toggle:hover { background: var(--bg); }

/* ── Image size helpers ── */
.img-xs { max-width: 120px; }
.img-sm { max-width: 280px; }
.img-md { max-width: 440px; }
.img-lg { max-width: 640px; }
.img-full { max-width: 100%; }

/* ── Anchor offset for fixed topbar ── */
.article h2, .article h3 {
    scroll-margin-top: 70px;
}

/* ── Responsive ── */
@media (max-width: 1280px) {
    .toc-panel { display: none; }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s;
        z-index: 300;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }

    /* Topbar */
    .topbar { padding: 9px 12px; gap: 8px; }
    .topbar-search { display: none; }
    .breadcrumb { font-size: 0.75rem; }
    .breadcrumb a:first-child { display: none; } /* hide domain on mobile */
    .topbar-actions { display: none; } /* hide prev/next on mobile topbar */

    /* Copy link button: show icon only on mobile */
    .copy-link-btn { padding: 5px 8px; }
    .copy-link-text { display: none; }

    /* Article */
    .article { padding: 24px 16px 60px; }
    .article h1 { font-size: 1.35rem; }
    .article h2 { font-size: 1.05rem; }

    /* Page nav */
    .page-nav {
        padding: 14px 16px 24px;
        flex-direction: row;
        gap: 10px;
    }
    .page-nav a {
        flex: 1;
        max-width: none;
        padding: 10px 14px;
        min-width: 0;
    }
    .page-nav a.nav-prev { align-items: flex-start; }
    .page-nav a.nav-next { align-items: flex-end; }
    .page-nav .nav-title {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .page-nav .nav-label { font-size: 0.62rem; }

    /* Search overlay */
    .search-overlay { left: 12px; right: 12px; top: 52px; }

    /* Sidebar CTA buttons */
    .sidebar-cta { padding: 10px 12px 14px; }
    .sidebar-cta-btn { font-size: 0.76rem; padding: 7px 10px; }
}

@media (min-width: 901px) and (max-width: 1100px) {
    .article { padding: 36px 40px 80px; }
    .page-nav { padding: 20px 40px 40px; }
}

/* ── Share bar (article bottom) ── */
.share-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    margin: 40px 0 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 12px;
}
.share-bar-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.share-bar-label svg { color: var(--primary); flex-shrink: 0; }
.share-bar-url {
    flex: 1;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
    font-family: 'SFMono-Regular', Consolas, monospace;
    cursor: default;
    -webkit-user-select: all;
    user-select: all;
}
.copy-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--primary-light);
    border: 1px solid rgba(109,179,0,.3);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.copy-link-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(109,179,0,.3);
}
.copy-link-btn.copied {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.copy-link-btn svg { flex-shrink: 0; }
.copy-link-btn .icon-check { display: none; }
.copy-link-btn.copied .icon-link { display: none; }
.copy-link-btn.copied .icon-check { display: inline; }

@media (max-width: 900px) {
    .share-bar {
        padding: 12px 16px;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    .share-bar-url { display: none; }
    .share-bar-label {
        font-size: 0.78rem;
        justify-content: center;
        order: 1;
    }
    .copy-link-btn {
        order: 2;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* ── Sidebar CTA buttons ── */
.sidebar-cta {
    padding: 12px 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: auto;
    background: var(--white);
    flex-shrink: 0;
}
.sidebar-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.sidebar-cta-dl {
    background: var(--primary);
    color: #fff;
}
.sidebar-cta-dl:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(109,179,0,.35);
}
.sidebar-cta-buy {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.sidebar-cta-buy:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
    text-decoration: none;
}

/* ── Manual Home Page (index.html) ── */

/* Hero */
.home-hero {
    position: relative;
    min-height: 280px;
    background: url('../images/mainbg.jpg') center center / cover no-repeat;
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

/* Left content area with semi-transparent overlay */
.home-hero-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 52px 60px 48px;
    /* Gradient overlay: opaque left → transparent right, so mascot shows through */
    background: linear-gradient(
        to right,
        rgba(15, 23, 42, 0.92) 0%,
        rgba(15, 23, 42, 0.82) 42%,
        rgba(15, 23, 42, 0.30) 68%,
        transparent 100%
    );
}

.home-hero-text {
    max-width: 520px;
    flex-shrink: 0;
}

.home-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
    line-height: 1.3;
    border: none;
    padding: 0;
    text-shadow: 0 2px 12px rgba(0,0,0,.3);
    letter-spacing: -0.02em;
}

.home-hero p {
    font-size: 0.95rem;
    color: rgba(255,255,255,.75);
    max-width: 460px;
    margin: 0 0 28px;
    line-height: 1.75;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(109,179,0,.2);
    border: 1px solid rgba(109,179,0,.5);
    color: #a3e635;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.home-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
}

.hero-btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(109,179,0,.4);
}
.hero-btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(109,179,0,.5);
}

.hero-btn-secondary {
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.25);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.hero-btn-secondary:hover {
    background: rgba(255,255,255,.16);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Hero stats — shown as row below text on wide screens */
.home-hero-stats {
    display: flex;
    flex-direction: row;
    gap: 32px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,.12);
}
.stat-item { text-align: left; }
.stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: #a3e635;
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-label {
    font-size: 0.68rem;
    color: rgba(255,255,255,.45);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Quick links bar */
.home-quicklinks {
    display: flex;
    gap: 6px;
    padding: 14px 60px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}
.quicklink {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.quicklink:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    text-decoration: none;
}

/* Section header */
.home-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 28px 60px 0;
}
.home-section-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.home-section-header span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* TOC Grid */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
    padding: 20px 60px 40px;
}
.toc-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.18s;
    box-shadow: var(--shadow-sm);
}
.toc-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 24px rgba(109,179,0,.14);
    transform: translateY(-2px);
}
.toc-card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 13px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toc-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.toc-icon-green,
.toc-icon-blue,
.toc-icon-amber,
.toc-icon-violet,
.toc-icon-pink,
.toc-icon-cyan,
.toc-icon-emerald,
.toc-icon-slate,
.toc-icon-orange,
.toc-icon-purple,
.toc-icon-gray   { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.toc-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}
.toc-card-body { padding: 10px 18px 14px; }
.toc-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 0;
    font-size: 0.845rem;
    color: #475569;
    border-bottom: 1px dashed #f1f5f9;
    transition: color 0.12s;
    text-decoration: none;
}
.toc-link:last-child { border-bottom: none; }
.toc-link:hover { color: var(--primary); text-decoration: none; }
.toc-link::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background 0.12s;
}
.toc-link:hover::before { background: var(--primary); }

/* Footer note */
.home-footer-note {
    padding: 20px 60px 40px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.home-footer-note a { color: var(--primary-dark); }

/* Responsive - Homepage */
@media (max-width: 900px) {
    /* Hero */
    .home-hero {
        min-height: 0;
        background-position: right center;
    }
    .home-hero-inner {
        padding: 36px 20px 32px;
        /* On mobile: stronger overlay so mascot doesn't compete with text */
        background: linear-gradient(
            to right,
            rgba(15, 23, 42, 0.96) 0%,
            rgba(15, 23, 42, 0.90) 55%,
            rgba(15, 23, 42, 0.60) 80%,
            rgba(15, 23, 42, 0.30) 100%
        );
    }
    .home-hero-text { max-width: 100%; }
    .home-hero h1 {
        font-size: 1.45rem;
        line-height: 1.35;
    }
    .home-hero p { font-size: 0.88rem; margin-bottom: 20px; }
    .version-badge { font-size: 0.65rem; padding: 3px 10px; }

    /* Action buttons: wrap to 2 columns on mobile */
    .home-hero-actions {
        gap: 8px;
    }
    .hero-btn {
        padding: 9px 16px;
        font-size: 0.82rem;
    }

    /* Stats: 2x2 grid on very small screens */
    .home-hero-stats {
        gap: 0;
        margin-top: 28px;
        padding-top: 20px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }
    .stat-item { text-align: center; }
    .stat-num { font-size: 1.1rem; }
    .stat-label { font-size: 0.6rem; }

    /* Quick links: 3 per row on mobile */
    .home-quicklinks {
        padding: 10px 12px;
        gap: 4px;
    }
    .quicklink {
        padding: 7px 10px;
        font-size: 0.78rem;
        gap: 5px;
    }

    /* Section header */
    .home-section-header { padding: 20px 16px 0; }
    .home-section-header h2 { font-size: 1.05rem; }

    /* TOC grid: 1 column on mobile */
    .toc-grid { grid-template-columns: 1fr; padding: 12px 12px 32px; gap: 10px; }
    .toc-card-header { padding: 12px 14px; }
    .toc-card-body { padding: 8px 14px 12px; }

    /* Footer note */
    .home-footer-note { padding: 16px 16px 28px; font-size: 0.78rem; }
}

/* Extra small phones */
@media (max-width: 480px) {
    .home-hero-inner { padding: 28px 16px 24px; }
    .home-hero h1 { font-size: 1.25rem; }
    .home-hero p { font-size: 0.85rem; display: none; } /* hide desc on very small to save space */
    .home-hero-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-num { font-size: 1.2rem; }
    .home-quicklinks { padding: 8px 12px; }
    .quicklink { font-size: 0.74rem; padding: 6px 8px; }
}

/* ── 404 Page ── */
.error-404-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 40px 80px;
    min-height: calc(100vh - 52px);
}
.error-404-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 56px 64px;
    text-align: center;
    max-width: 580px;
    width: 100%;
    box-shadow: var(--shadow-md);
}
.error-404-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 8px;
}
.error-404-num {
    font-size: clamp(72px, 14vw, 120px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -4px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: -8px;
}
.error-404-mascot {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 2px solid rgba(109,179,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 20px;
    animation: pulse404 3s ease-in-out infinite;
}
@keyframes pulse404 {
    0%, 100% { box-shadow: 0 0 0 0 rgba(109,179,0,.15); }
    50% { box-shadow: 0 0 0 10px rgba(109,179,0,0); }
}
.error-404-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}
.error-404-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 32px;
}
.error-404-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
.error-404-links {
    border-top: 1px solid var(--border);
    padding-top: 28px;
}
.error-404-links-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 14px;
}
.error-404-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.error-404-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
}
.error-404-link:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: rgba(109,179,0,.25);
    text-decoration: none;
    transform: translateY(-2px);
}
/* hero-btn reuse on 404 page */
.error-404-actions .hero-btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.error-404-actions .hero-btn-secondary:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
}
@media (max-width: 900px) {
    .error-404-wrap { padding: 32px 16px 60px; }
    .error-404-card { padding: 36px 24px; border-radius: 14px; }
    .error-404-grid { grid-template-columns: repeat(2, 1fr); }
    .error-404-actions { flex-direction: column; align-items: stretch; }
    .error-404-actions .hero-btn { justify-content: center; }
}
