.guide-hero {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
}

.guide-hero .home-hero-main,
.guide-hero .home-lead,
.guide-article-head {
    min-width: 0;
}

.guide-hero h1,
.guide-article-head h1 {
    overflow-wrap: anywhere;
    word-break: keep-all;
    white-space: normal;
    writing-mode: horizontal-tb;
}

.guide-hero .home-lead,
.guide-article-head .home-lead {
    max-width: none;
}

.guide-search-wrap {
    margin: 0 0 16px;
}

.guide-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
    box-shadow: var(--app-shadow-sm);
}

.guide-search span {
    color: var(--app-muted);
}

.guide-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--app-text);
    font: inherit;
}

.guide-search-hint,
.guide-empty,
.guide-footer {
    color: var(--app-muted);
    font-size: 0.9rem;
}

.guide-empty {
    margin: 8px 0 24px;
}

.guide-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.guide-card-tags em {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--app-surface-soft);
    color: var(--app-muted);
    font-style: normal;
    font-size: 0.75rem;
}

.guide-page {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 180px;
    gap: 20px;
    align-items: start;
}

.guide-side,
.guide-toc {
    position: sticky;
    top: 16px;
}

.guide-back,
.guide-mini-link,
.guide-nav-link,
.guide-toc-link {
    display: block;
    text-decoration: none;
}

.guide-back {
    margin-bottom: 12px;
    color: var(--app-primary);
    font-size: 0.9rem;
    font-weight: 700;
}

.guide-nav {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.guide-nav-link {
    padding: 10px 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: 12px;
}

.guide-nav-link span {
    display: block;
    color: var(--app-muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.guide-nav-link strong {
    color: var(--app-text);
    font-size: 0.95rem;
}

.guide-nav-link.is-active {
    border-color: var(--app-primary);
    box-shadow: inset 3px 0 0 var(--app-primary);
}

.guide-side-tools {
    display: grid;
    gap: 6px;
}

.guide-mini-link {
    color: var(--app-primary);
    font-size: 0.86rem;
}

.guide-article-head h1 {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    line-height: 1.1;
}

.guide-article-head .guide-search {
    margin-top: 16px;
}

.guide-body {
    margin-top: 8px;
    padding: 8px 4px 24px;
    color: var(--app-text);
    font-size: 1rem;
    line-height: 1.75;
}

.guide-body h2,
.guide-body h3,
.guide-body h4 {
    scroll-margin-top: 18px;
}

.guide-body h2 {
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--app-line);
    font-size: 1.35rem;
}

.guide-body h3 {
    margin: 22px 0 8px;
    font-size: 1.12rem;
}

.guide-body h4 {
    margin: 16px 0 6px;
    font-size: 1rem;
}

.guide-body p,
.guide-body li {
    margin: 0 0 10px;
}

.guide-body ul,
.guide-body ol {
    margin: 0 0 14px;
    padding-left: 1.3em;
}

.guide-body blockquote {
    margin: 0 0 14px;
    padding: 8px 12px;
    border-left: 3px solid var(--app-primary);
    background: var(--app-surface-soft);
    color: var(--app-muted);
}

.guide-body hr {
    border: 0;
    border-top: 1px dashed var(--app-line);
    margin: 22px 0;
}

.guide-chip,
.guide-inline {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin: 0 1px;
    padding: 0 6px;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1.5;
    text-decoration: none;
    vertical-align: baseline;
}

.guide-chip-song {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.12);
}

.guide-chip-char {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.12);
}

.guide-chip-cmd {
    color: #0f766e;
    background: rgba(15, 118, 110, 0.12);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-weight: 750;
}

.guide-chip-pack {
    color: #c2410c;
    background: rgba(194, 65, 12, 0.12);
}

.guide-chip-link {
    color: #1d4ed8;
    background: rgba(29, 78, 216, 0.1);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.guide-inline-tip {
    color: #0369a1;
    background: rgba(3, 105, 161, 0.1);
}

.guide-inline-warn {
    color: #b45309;
    background: rgba(180, 83, 9, 0.12);
}

.guide-inline-note {
    color: #334155;
    background: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .guide-inline-note {
    color: #e2e8f0;
}

.guide-gone {
    color: var(--app-muted);
    text-decoration: line-through;
}

.guide-em {
    color: #be185d;
    font-style: italic;
}

.guide-spoiler {
    display: inline-block;
    margin: 2px 0;
    vertical-align: baseline;
}

.guide-spoiler summary {
    display: inline-flex;
    cursor: pointer;
    color: #1d4ed8;
    font-weight: 700;
    list-style: none;
}

.guide-spoiler summary::-webkit-details-marker {
    display: none;
}

.guide-spoiler-body {
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--app-surface-soft);
    border: 1px dashed var(--app-line);
    border-radius: 10px;
    color: var(--app-text);
}

.guide-body .is-hidden-by-search {
    display: none;
}

.guide-body mark.guide-hit {
    background: #fde68a;
    color: inherit;
    padding: 0 2px;
    border-radius: 4px;
}

.guide-toc {
    display: grid;
    gap: 6px;
    font-size: 0.86rem;
}

.guide-toc strong {
    margin-bottom: 4px;
    color: var(--app-muted);
}

.guide-toc-link {
    color: var(--app-text);
}

.guide-toc-link.level-3 {
    padding-left: 10px;
    color: var(--app-muted);
}

.guide-footer {
    margin-top: 28px;
    padding-top: 12px;
    border-top: 1px solid var(--app-line);
}

@media (max-width: 980px) {
    .guide-hero,
    .guide-page {
        grid-template-columns: 1fr;
    }

    .guide-hero {
        align-items: start;
        padding: 18px 16px;
    }

    .guide-hero h1,
    .guide-article-head h1 {
        font-size: clamp(1.7rem, 9vw, 2.4rem);
        line-height: 1.15;
    }

    .guide-hero .home-lead {
        margin-top: 10px;
        font-size: 0.95rem;
        line-height: 1.55;
    }

    .guide-side,
    .guide-toc {
        position: static;
    }

    .guide-nav {
        grid-template-columns: 1fr;
    }

    .guide-toc {
        order: -1;
        grid-template-columns: 1fr;
        padding: 12px;
        background: var(--app-surface);
        border: 1px solid var(--app-line);
        border-radius: 12px;
    }

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

@media (max-width: 640px) {
    .guide-hero {
        gap: 12px;
        margin-bottom: 12px;
    }

    .guide-search {
        padding: 12px 14px;
    }

    .guide-body {
        font-size: 0.98rem;
        line-height: 1.7;
    }

    .guide-chip,
    .guide-inline {
        max-width: 100%;
        white-space: normal;
    }
}
