:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --paper: #ffffff;
    --surface-soft: #f1f3f5;
    --surface-strong: #111111;
    --text: #151515;
    --muted: #686f78;
    --line: #e5e7eb;
    --accent: #111111;
    --accent-dark: #000000;
    --green: #16794c;
    --red: #b42318;
    --shadow: 0 18px 50px rgba(15, 23, 42, .08);
    --shadow-strong: 0 26px 80px rgba(15, 23, 42, .14);
}

:root[data-theme="dark"] {
    --bg: #090909;
    --surface: #141414;
    --paper: #111111;
    --surface-soft: #1f1f1f;
    --surface-strong: #f7f7f7;
    --text: #f5f5f5;
    --muted: #a1a1aa;
    --line: #2a2a2a;
    --accent: #ffffff;
    --accent-dark: #ffffff;
    --green: #4ade80;
    --red: #f87171;
    --shadow: 0 18px 50px rgba(0, 0, 0, .32);
    --shadow-strong: 0 26px 80px rgba(0, 0, 0, .45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(0, 0, 0, .05), transparent 26%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 255, 255, .08), transparent 26%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

input,
textarea,
select,
button {
    font: inherit;
}

label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: auto;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent);
}

textarea {
    resize: vertical;
}

small {
    color: var(--muted);
    font-weight: 400;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: var(--surface-soft);
}

th:first-child {
    border-top-left-radius: 14px;
}

th:last-child {
    border-top-right-radius: 14px;
}

tbody tr:hover td {
    background: color-mix(in srgb, var(--surface-soft) 68%, transparent);
}

td small {
    display: block;
    margin-top: 5px;
}

code {
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--surface-soft);
}

pre {
    position: relative;
    overflow: auto;
    margin: 24px 0;
    padding: 22px;
    border-radius: 18px;
    color: #f7f7f7;
    background: #0d0d0d;
    line-height: 1.7;
    scrollbar-color: rgba(255, 250, 241, .35) transparent;
}

pre code {
    padding: 0;
    background: transparent;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 18px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.btn.primary,
button.primary {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
}

.site-header,
.site-footer {
    width: min(1540px, calc(100% - 40px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 0;
}

.site-logo,
.brand {
    font-weight: 900;
    letter-spacing: .04em;
}

.site-logo:empty {
    width: 1px;
    height: 1px;
}

.brand {
    font-size: 20px;
}

.theme-toggle {
    min-height: 38px;
    padding: 8px 13px;
    color: var(--text);
    background: var(--surface);
}

.theme-toggle.compact {
    width: 100%;
    justify-content: flex-start;
    color: inherit;
    background: transparent;
}

.site-header nav {
    display: flex;
    gap: 18px;
    color: var(--muted);
    font-weight: 800;
}

.site-main {
    width: min(1540px, calc(100% - 40px));
    margin: 0 auto;
}

.site-footer {
    padding: 40px 0;
    color: var(--muted);
}

.hero {
    padding: 70px 0 42px;
}

.hero h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(44px, 6vw, 76px);
    line-height: 1.02;
    letter-spacing: -.05em;
}

.hero p {
    max-width: 690px;
    color: var(--muted);
    font-size: 20px;
    line-height: 1.8;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .14em;
}

.branch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    padding-bottom: 70px;
}

.branch-card {
    display: grid;
    gap: 18px;
    min-height: 270px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: card-bounce 4.2s ease-in-out infinite;
    animation-delay: calc(var(--card-index, 0) * .18s);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.branch-card:hover {
    transform: translateY(-8px) scale(1.015);
    border-color: var(--text);
    box-shadow: var(--shadow-strong);
    animation-play-state: paused;
}

.branch-card span {
    color: var(--muted);
    font-weight: 800;
}

.branch-card h2 {
    margin: 0;
    font-size: 36px;
    letter-spacing: -.03em;
}

.branch-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.75;
}

.branch-card strong {
    align-self: end;
    color: var(--text);
}

@keyframes card-bounce {
    0%,
    100% {
        transform: translateY(0);
    }

    45% {
        transform: translateY(-7px);
    }

    55% {
        transform: translateY(-7px);
    }
}

.guide-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    padding: 18px 0 72px;
}

.guide-sidebar,
.guide-content,
.panel,
.auth-card,
.metric-card,
.empty {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.guide-sidebar {
    position: sticky;
    top: 18px;
    padding: 20px;
}

.guide-sidebar h1 {
    margin: 14px 0 8px;
    font-size: 24px;
    letter-spacing: -.03em;
}

.guide-sidebar p {
    color: var(--muted);
    line-height: 1.65;
}

.back-link {
    width: 100%;
    margin-bottom: 10px;
    font-weight: 800;
}

.step-list {
    display: grid;
    gap: 8px;
    padding: 16px 0 0;
    margin: 18px 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.step-list a {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 13px;
    border-radius: 15px;
    color: var(--muted);
    background: transparent;
    line-height: 1.45;
}

.step-list a.active {
    color: var(--bg);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.step-list a:not(.active):hover {
    background: var(--surface-soft);
}

.step-list span {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    font-weight: 900;
}

.guide-content {
    padding: clamp(28px, 4vw, 56px);
    background: var(--paper);
    min-height: 620px;
}

.guide-content h1 {
    margin-top: 0;
    margin-bottom: 28px;
    max-width: 1120px;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.08;
    letter-spacing: -.05em;
}

.step-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.step-topbar h1 {
    margin-bottom: 0;
}

.markdown-body {
    color: var(--text);
    max-width: 1120px;
    line-height: 1.92;
    font-size: 18px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin: 38px 0 16px;
    line-height: 1.2;
    letter-spacing: -.03em;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
    margin-top: 0;
}

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

.markdown-body ul {
    display: grid;
    gap: 10px;
    margin: 18px 0;
    padding-left: 1.35em;
}

.markdown-body li::marker {
    color: var(--accent);
}

.markdown-body a {
    color: var(--text);
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.markdown-body blockquote {
    margin: 26px 0;
    padding: 18px 20px;
    border-left: 5px solid var(--accent);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 700;
}

.markdown-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 28px 0;
    border-radius: 22px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.is-previewable {
    cursor: zoom-in;
    transition: transform .18s ease, filter .18s ease;
}

.is-previewable:hover {
    filter: brightness(.96);
    transform: translateY(-1px);
}

.step-content-single {
    max-width: 1280px;
}

.step-content-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
    gap: clamp(24px, 4vw, 54px);
    align-items: start;
}

.step-content-split .markdown-body {
    max-width: none;
}

.step-image-panel {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 18px;
}

.step-image-panel figure {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface-soft);
    box-shadow: var(--shadow);
}

.step-image-panel img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72vh;
    object-fit: contain;
}

.copy-code-button {
    position: sticky;
    left: 100%;
    top: 10px;
    float: right;
    min-height: 32px;
    margin: -8px -8px 8px 10px;
    padding: 6px 10px;
    border-radius: 10px;
    color: #111;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .24);
    font-size: 13px;
    font-weight: 900;
}

.copy-code-button:hover {
    transform: translateY(-1px);
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(0, 0, 0, .78);
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: min(1200px, 94vw);
    max-height: 86vh;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
}

.image-lightbox button {
    position: fixed;
    top: 22px;
    right: 22px;
    color: #111;
    background: #fff;
    border-color: rgba(255, 255, 255, .3);
}

.step-image-panel figcaption {
    padding: 12px 14px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.step-nav {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.step-nav .btn {
    min-width: 92px;
    max-width: none;
    text-align: center;
    line-height: 1.45;
}

.auth-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 34px;
}

.auth-card h1 {
    margin: 0 0 8px;
}

.auth-card p {
    color: var(--muted);
}

.auth-card form,
.form-panel form {
    display: grid;
    gap: 18px;
}

.install-info {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--surface-soft);
}

.install-info p {
    margin: 8px 0;
}

.admin-body {
    background: var(--bg);
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px;
    color: var(--text);
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.admin-brand-row {
    display: grid;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.admin-sidebar nav {
    display: grid;
    gap: 8px;
}

.admin-sidebar nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    font-weight: 800;
}

.admin-sidebar nav a:hover {
    color: var(--text);
    background: var(--surface-soft);
}

.admin-user {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.admin-user a {
    font-weight: 800;
    color: var(--text);
}

.admin-main {
    padding: 34px;
    max-width: 1600px;
    width: 100%;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

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

.page-head h1 {
    margin: 0;
    font-size: 40px;
    letter-spacing: -.04em;
}

.page-head p:not(.eyebrow) {
    margin: 8px 0 0;
    color: var(--muted);
}

.panel {
    padding: 24px;
}

.form-panel {
    padding: 28px;
}

.table-wrap {
    overflow-x: auto;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.actions a,
.actions button {
    min-height: auto;
    padding: 7px 11px;
    font-size: 14px;
}

.actions form {
    display: inline;
}

.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 10px;
    color: #fff;
    background: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.status.published {
    background: var(--green);
}

.status.draft {
    background: var(--accent);
}

.status.hidden {
    background: var(--muted);
}

.flash {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 700;
}

.flash.success {
    color: var(--green);
    background: color-mix(in srgb, var(--green) 12%, transparent);
}

.flash.error {
    color: var(--red);
    background: color-mix(in srgb, var(--red) 12%, transparent);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.metric-card {
    padding: 26px;
    background:
        linear-gradient(135deg, var(--surface), var(--surface-soft));
}

.metric-card span {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 52px;
    letter-spacing: -.05em;
}

.empty {
    padding: 38px;
    text-align: center;
}

.empty h2,
.empty h1 {
    margin-top: 0;
}

.public-empty {
    margin: 50px auto;
    max-width: 720px;
}

.form-panel {
    max-width: 980px;
}

.step-editor-panel {
    padding: 22px;
}

.step-editor-panel form {
    display: grid;
    gap: 18px;
}

.step-meta-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.4fr) minmax(220px, 1fr) 160px 120px;
    gap: 14px;
    align-items: start;
}

.editor-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: start;
}

.editor-main,
.editor-side {
    min-width: 0;
}

.editor-main {
    display: grid;
    gap: 12px;
}

.editor-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.editor-section-head h2,
.editor-help-card h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.02em;
}

.editor-section-head p,
.editor-help-card p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.editor-section-head span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.editor-side {
    position: sticky;
    top: 22px;
    display: grid;
    gap: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.form-actions .btn,
.form-actions button {
    min-width: 110px;
}

.content-editor {
    min-height: 68vh;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.65;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-soft);
}

.editor-toolbar span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.preview-box {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: var(--surface-soft);
}

.preview-box summary {
    cursor: pointer;
    font-weight: 900;
}

.preview-box .markdown-body {
    max-height: 58vh;
    overflow: auto;
    padding-right: 8px;
    font-size: 15px;
    line-height: 1.75;
}

.editor-help-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: var(--surface);
}

.muted {
    color: var(--muted);
}

@media (max-width: 800px) {
    .site-header,
    .page-head,
    .step-nav,
    .step-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .guide-layout,
    .admin-shell,
    .form-grid,
    .step-meta-grid,
    .editor-workspace {
        grid-template-columns: 1fr;
    }

    .guide-sidebar {
        position: static;
        padding: 20px;
    }

    .guide-layout {
        gap: 18px;
        padding-top: 12px;
    }

    .guide-content {
        padding: 26px 20px;
        min-height: auto;
    }

    .step-content-split {
        grid-template-columns: 1fr;
    }

    .step-image-panel {
        position: static;
        order: -1;
    }

    .markdown-body {
        font-size: 16.5px;
        line-height: 1.85;
    }

    .branch-card {
        min-height: auto;
    }

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

    .step-nav .btn {
        width: 100%;
        max-width: none;
    }

    .step-nav {
        width: 100%;
    }

    .admin-sidebar {
        border-radius: 0 0 26px 26px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .admin-main {
        padding: 22px 16px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn,
    .page-actions button {
        width: 100%;
    }

    .step-editor-panel {
        padding: 16px;
    }

    .editor-side {
        position: static;
    }

    .content-editor {
        min-height: 55vh;
    }

    .admin-brand-row {
        grid-template-columns: 1fr;
    }

    .page-head h1 {
        font-size: 32px;
    }
}

@media (min-width: 801px) and (max-width: 1200px) {
    .step-meta-grid,
    .editor-workspace {
        grid-template-columns: 1fr;
    }

    .editor-side {
        position: static;
    }
}

@media (min-width: 801px) and (max-width: 1080px) {
    .branch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1600px) {
    .site-header,
    .site-footer,
    .site-main {
        width: min(1720px, calc(100% - 32px));
    }

    .guide-layout {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .guide-content h1,
    .markdown-body,
    .step-nav {
        max-width: 1280px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .branch-card {
        animation: none;
    }
}
