* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: #f5f6f2;
    color: #272b26;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: #35601f;
    text-decoration: none;
}

a:hover {
    color: #1f3d10;
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 3px solid #9cc764;
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 12px;
    z-index: 1100;
    padding: 7px 14px;
    border-radius: 5px;
    background: #fff;
    color: #222;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    width: 0;
    height: 3px;
    background: #b4df67;
}

.site-header {
    border-bottom: 1px solid #343831;
    background: #20231f;
    color: #fff;
}

.header-inner {
    display: flex;
    align-items: center;
    max-width: 1280px;
    min-height: 64px;
    margin: 0 auto;
    padding: 0 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: .02em;
}

.brand:hover {
    color: #fff;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    border-radius: 8px;
    background: #b4df67;
    color: #20231f;
    font-size: 20px;
    line-height: 1;
    place-items: center;
}

.brand small {
    margin-left: 8px;
    color: #aeb4aa;
    font-size: 12px;
    font-weight: 400;
}

.nav-toggle,
.sidebar-toggle {
    display: none;
    border: 1px solid #555b51;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.nav-toggle {
    margin-left: auto;
    padding: 7px 11px;
}

.top-nav {
    margin-left: auto;
}

.top-nav ul {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.top-nav a {
    display: block;
    padding: 20px 13px;
    color: #d8ddd3;
    font-size: 14px;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
    background: #2d322b;
    color: #c7ed8c;
    text-decoration: none;
}

.page-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.breadcrumbs {
    padding: 18px 0 12px;
    color: #757b72;
    font-size: 13px;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.breadcrumbs li + li::before {
    margin: 0 8px;
    color: #a2a79f;
    content: "/";
}

.tutorial-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 190px;
    gap: 24px;
    align-items: start;
    padding: 8px 0 48px;
}

.chapter-sidebar,
.page-toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.chapter-sidebar {
    padding: 18px 15px;
    border: 1px solid #e0e3dc;
    border-radius: 10px;
    background: #fff;
}

.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 12px;
    color: #20231f;
    font-size: 17px;
}

.sidebar-heading a {
    color: #62695e;
    font-size: 12px;
    font-weight: 400;
}

.chapter-search {
    width: 100%;
    height: 36px;
    margin-bottom: 14px;
    padding: 6px 10px;
    border: 1px solid #d9ddd4;
    border-radius: 6px;
    background: #fafbf8;
    color: #333;
    font-size: 13px;
}

.chapter-group {
    margin: 17px 0 0;
    color: #8a9085;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
}

.chapter-list {
    margin: 5px 0 0;
    padding: 0;
    list-style: none;
}

.chapter-list a {
    display: block;
    margin: 2px -7px;
    padding: 6px 9px;
    border-left: 3px solid transparent;
    border-radius: 0 5px 5px 0;
    color: #555c51;
    font-size: 13px;
    line-height: 1.5;
}

.chapter-list a:hover {
    background: #f3f6ee;
    color: #2c471d;
    text-decoration: none;
}

.chapter-list a[aria-current="page"] {
    border-left-color: #75a640;
    background: #edf4e4;
    color: #294517;
    font-weight: 600;
}

.no-chapter-result {
    display: none;
    margin: 12px 0;
    color: #888;
    font-size: 13px;
}

.article-card {
    min-width: 0;
    padding: 36px 42px 30px;
    border: 1px solid #e2e5de;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(35, 43, 30, .035);
}

.article-kicker {
    margin: 0 0 8px;
    color: #6b8e4b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 16px;
    color: #20231f;
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.35;
    letter-spacing: -.02em;
}

.article-lead {
    margin: 0 0 16px;
    color: #596053;
    font-size: 17px;
    line-height: 1.9;
}

.article-meta {
    margin: 0 0 26px;
    padding-bottom: 22px;
    border-bottom: 1px solid #eceee8;
    color: #92988e;
    font-size: 12px;
}

.article-body h2 {
    margin: 38px 0 14px;
    color: #252922;
    font-size: 24px;
    line-height: 1.45;
}

.article-body h3 {
    margin: 28px 0 10px;
    color: #343a30;
    font-size: 19px;
    line-height: 1.5;
}

.article-body p {
    margin: 0 0 16px;
}

.article-body ul,
.article-body ol {
    margin: 0 0 18px;
    padding-left: 25px;
}

.article-body li {
    margin: 6px 0;
    padding-left: 3px;
}

.article-body strong {
    color: #252a22;
}

.article-body a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #eef1e9;
    color: #355022;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: .9em;
    overflow-wrap: anywhere;
}

pre {
    position: relative;
    margin: 16px 0 22px;
    padding: 20px;
    overflow: auto;
    border: 1px solid #343a32;
    border-radius: 8px;
    background: #222720;
    color: #e7eee0;
    font-size: 13px;
    line-height: 1.75;
    tab-size: 4;
}

pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
    overflow-wrap: normal;
}

.code-block {
    position: relative;
    margin: 16px 0 22px;
}

.code-block pre {
    margin: 0;
    padding-top: 46px;
}

.copy-code {
    position: absolute;
    top: 8px;
    right: 9px;
    z-index: 2;
    padding: 4px 9px;
    border: 1px solid #4c5547;
    border-radius: 5px;
    background: #30372d;
    color: #dbe5d2;
    font-size: 12px;
    cursor: pointer;
}

.copy-code:hover {
    background: #414a3b;
    color: #fff;
}

.note,
.tip,
.warning {
    margin: 20px 0;
    padding: 14px 17px;
    border: 1px solid #dce5d1;
    border-left: 4px solid #82a958;
    border-radius: 6px;
    background: #f6f9f1;
    color: #48543d;
    font-size: 14px;
}

.warning {
    border-color: #eadbb9;
    border-left-color: #cc963a;
    background: #fffaf0;
    color: #6d542b;
}

.note p:last-child,
.tip p:last-child,
.warning p:last-child {
    margin-bottom: 0;
}

.table-wrap {
    max-width: 100%;
    margin: 16px 0 22px;
    overflow-x: auto;
    border: 1px solid #e0e4dc;
    border-radius: 7px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.65;
}

th,
td {
    min-width: 110px;
    padding: 11px 13px;
    border-bottom: 1px solid #e5e8e1;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f4f6f0;
    color: #3c4436;
    font-weight: 600;
}

tr:last-child td {
    border-bottom: 0;
}

.hero-terminal {
    margin: 26px 0;
    overflow: hidden;
    border-radius: 10px;
    background: #20231f;
    box-shadow: 0 10px 30px rgba(28, 34, 24, .12);
}

.terminal-bar {
    display: flex;
    gap: 6px;
    padding: 11px 15px;
    border-bottom: 1px solid #363b33;
}

.terminal-bar i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #5d6458;
}

.terminal-screen {
    margin: 0;
    padding: 22px;
    border: 0;
    border-radius: 0;
    color: #d8e5cb;
}

.terminal-screen .prompt {
    color: #b4df67;
}

.learning-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 24px;
}

.learning-card {
    display: block;
    padding: 16px 17px;
    border: 1px solid #e0e5da;
    border-radius: 8px;
    background: #fbfcf9;
    color: #333;
}

.learning-card:hover {
    border-color: #a8bf8d;
    background: #f4f8ed;
    text-decoration: none;
    transform: translateY(-1px);
}

.learning-card strong,
.learning-card span {
    display: block;
}

.learning-card strong {
    margin-bottom: 4px;
    color: #35472a;
}

.learning-card span {
    color: #777f72;
    font-size: 13px;
    line-height: 1.6;
}

.checklist {
    padding: 0;
    list-style: none;
}

.checklist li {
    position: relative;
    padding-left: 28px;
}

.checklist li::before {
    position: absolute;
    left: 2px;
    color: #6b963d;
    content: "✓";
    font-weight: 700;
}

.page-toc {
    padding: 5px 0 10px 17px;
    border-left: 1px solid #dfe3da;
}

.page-toc h2 {
    margin: 0 0 10px;
    color: #777e73;
    font-size: 12px;
    letter-spacing: .1em;
}

.page-toc a {
    display: block;
    padding: 4px 0;
    color: #777e73;
    font-size: 12px;
    line-height: 1.55;
}

.page-toc a:hover,
.page-toc a.active {
    color: #456d2b;
    text-decoration: none;
}

.pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 38px;
    padding-top: 22px;
    border-top: 1px solid #e5e8e0;
}

.pager a {
    display: block;
    padding: 12px 14px;
    border: 1px solid #e0e4dc;
    border-radius: 7px;
    color: #3f4c35;
    font-size: 13px;
    line-height: 1.6;
}

.pager a:hover {
    border-color: #afc497;
    background: #f7f9f4;
    text-decoration: none;
}

.pager .next {
    text-align: right;
}

.pager small {
    display: block;
    color: #969c91;
}

.site-footer {
    padding: 24px;
    border-top: 1px solid #e0e3dc;
    color: #82887e;
    font-size: 12px;
    text-align: center;
}

.site-footer p {
    margin: 3px 0;
}

.gotop {
    position: fixed;
    right: 22px;
    bottom: 24px;
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid #d7ddd0;
    border-radius: 50%;
    background: #fff;
    color: #536849;
    box-shadow: 0 3px 15px rgba(40, 50, 34, .12);
    cursor: pointer;
}

.sidebar-close {
    display: none;
}

@media (max-width: 1120px) {
    .tutorial-layout {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .page-toc {
        display: none;
    }

    .top-nav a {
        padding-right: 9px;
        padding-left: 9px;
    }
}

@media (max-width: 780px) {
    .header-inner,
    .page-shell {
        padding-right: 16px;
        padding-left: 16px;
    }

    .header-inner {
        flex-wrap: wrap;
        min-height: 58px;
    }

    .brand small {
        display: none;
    }

    .nav-toggle {
        display: block;
    }

    .top-nav {
        display: none;
        width: 100%;
        margin: 0 -16px;
        border-top: 1px solid #383d35;
        background: #252923;
    }

    .top-nav.in {
        display: block;
    }

    .top-nav ul {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        padding: 8px;
    }

    .top-nav a {
        padding: 10px 12px;
        border-radius: 5px;
    }

    .breadcrumbs {
        padding-top: 13px;
    }

    .tutorial-layout {
        display: block;
        padding-top: 2px;
    }

    .sidebar-toggle {
        display: block;
        width: 100%;
        margin: 0 0 12px;
        padding: 9px 14px;
        border-color: #d6dccf;
        background: #fff;
        color: #44513a;
        text-align: left;
    }

    .chapter-sidebar {
        position: static;
        display: none;
        max-height: none;
        margin-bottom: 14px;
    }

    .chapter-sidebar.in {
        display: block;
    }

    .article-card {
        padding: 26px 22px;
        border-radius: 9px;
    }

    .article-body h2 {
        margin-top: 32px;
        font-size: 22px;
    }

    .article-lead {
        font-size: 16px;
    }

    .learning-grid {
        grid-template-columns: 1fr;
    }

    .gotop {
        right: 15px;
        bottom: 16px;
    }
}

@media (max-width: 430px) {
    .article-card {
        padding: 23px 17px;
    }

    h1 {
        font-size: 27px;
    }

    .pager {
        grid-template-columns: 1fr;
    }

    .pager .next {
        text-align: left;
    }

    pre {
        padding: 17px 14px;
        font-size: 12px;
    }

    .code-block pre {
        padding-top: 45px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .learning-card:hover {
        transform: none;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
        font-size: 12px;
    }

    .site-header,
    .breadcrumbs,
    .chapter-sidebar,
    .sidebar-toggle,
    .page-toc,
    .reading-progress,
    .copy-code,
    .gotop,
    .site-footer {
        display: none !important;
    }

    .page-shell,
    .article-card {
        max-width: none;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .tutorial-layout {
        display: block;
    }

    pre {
        overflow: visible;
        white-space: pre-wrap;
    }
}
