.note {
    max-width: 900px;
}

.note h1 {
    margin: 0 0 10px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.05;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    margin-bottom: 34px;
}

.note-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: -16px 0 32px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.reaction-form {
    margin: 0;
}

.note-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--panel-soft) 86%, transparent),
        var(--panel)
    );
    color: var(--ink);
    box-shadow: 0 10px 22px rgba(54, 42, 29, 0.055);
    padding: 8px 13px;
    cursor: pointer;
    font-weight: 800;
    transition:
        border-color 0.16s ease,
        background 0.16s ease,
        transform 0.16s ease;
}

.note-action-button:hover {
    transform: translateY(-1px);
}

.note-action-icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--line) 56%, transparent);
    color: var(--accent-dark);
    font-size: 14px;
    line-height: 1;
}

.note-action-text {
    line-height: 1;
}

.note-action-button strong {
    min-width: 28px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 13%, var(--panel));
    color: var(--accent-dark);
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
}

.note-action-button:hover,
.note-action-button.active,
.note-action-button.copied {
    border-color: var(--accent);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--accent) 13%, var(--panel)),
        var(--panel)
    );
}

.note-action-button.active .note-action-icon,
.note-action-button.copied .note-action-icon {
    background: var(--accent);
    color: #fff;
}

.note-action-button:disabled {
    cursor: default;
    opacity: 0.82;
}

.note-action-button.loading {
    pointer-events: none;
}

.markdown {
    font-size: 17px;
    line-height: 1.75;
}

.markdown h1,
.markdown h2,
.markdown h3 {
    margin: 1.8em 0 0.5em;
    line-height: 1.18;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre {
    margin: 0 0 1.1em;
}

.markdown a {
    color: var(--accent-dark);
    border-bottom: 1px solid rgba(189, 75, 58, 0.35);
}

.markdown code {
    border-radius: 6px;
    background: transparent;
    padding: 2px 5px;
}

.markdown pre {
    overflow: auto;
    background: #1f2933;
    color: #f6efe3;
    padding: 16px;
}

.markdown hr {
    margin: 28px 0;
    border: 0;
}

.markdown blockquote {
    border-left: 4px solid var(--accent);
    background: color-mix(in srgb, var(--panel) 86%, var(--accent) 14%);
    padding: 12px 16px;
    color: var(--muted);
}

.markdown table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

.markdown th,
.markdown td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.markdown th {
    background: color-mix(in srgb, var(--line) 62%, var(--panel) 38%);
    font-weight: 800;
}

.markdown tr:last-child td {
    border-bottom: 0;
}

.html-document img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.html-document table {
    width: 100%;
    border-collapse: collapse;
}

.html-document th,
.html-document td {
    border: 1px solid var(--line);
    padding: 9px 10px;
    text-align: left;
}

.ad-slot {
    margin: 34px 0 10px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 70%, transparent);
    padding: 18px 0;
    overflow: hidden;
}

.in-article-ad {
    min-height: 120px;
}

.backlinks {
    max-width: 900px;
    margin-top: 52px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.backlinks h2 {
    font-size: 18px;
}

.backlinks a {
    display: inline-flex;
    margin: 0 8px 8px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 9px 11px;
}

/* =========================
   Docs Content Page
========================= */

.doc-layout-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 34px;
    width: min(1180px, 100%);
    margin: 0 auto;
}

.doc-content-page {
    min-width: 0;
    max-width: 860px;
}

.doc-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin: 6px 0 22px;
    color: var(--muted);
    font-size: 12px;
}

.doc-breadcrumb a {
    color: var(--muted);
}

.doc-breadcrumb a:hover {
    color: var(--accent-dark);
}

.doc-breadcrumb strong {
    color: var(--ink);
    font-weight: 800;
}

.doc-content-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.doc-kicker {
    display: inline-flex;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.doc-content-head h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(34px, 5vw, 52px);
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.doc-content-head p {
    max-width: 720px;
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.doc-head-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
}

.doc-info-box {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 22px 0 22px;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--accent) 8%, var(--panel)),
        var(--panel)
    );
    padding: 14px 16px;
}

.doc-info-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.doc-info-box strong {
    display: block;
    margin-bottom: 3px;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 900;
}

.doc-info-box p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.doc-info-box button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
}

.doc-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.doc-meta-row span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.doc-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 30px;
}

.doc-tag-row a {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 6%, var(--panel));
    color: var(--accent-dark);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
}

.doc-body {
    color: var(--ink);
}

.doc-body > *:first-child {
    margin-top: 0;
}

.doc-body h2 {
    margin-top: 42px;
    padding-top: 14px;
    font-size: 24px;
    letter-spacing: -0.035em;
}

.doc-body h3 {
    margin-top: 30px;
    font-size: 18px;
}

.doc-body p {
    color: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

.doc-body ul,
.doc-body ol {
    padding-left: 22px;
}

.doc-body li + li {
    margin-top: 5px;
}

.doc-body pre {
    border-radius: 8px;
    background: #171b22;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.doc-body code {
    font-size: 0.92em;
}

.doc-body table {
    font-size: 14px;
}

.doc-related-section {
    margin-top: 54px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.doc-related-section h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.doc-related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.doc-related-grid a {
    display: grid;
    gap: 7px;
    min-height: 100px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    padding: 14px;
}

.doc-related-grid a:hover {
    border-color: var(--accent);
}

.doc-related-grid strong {
    color: var(--ink);
    font-size: 14px;
}

.doc-related-grid span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

/* Right TOC */

.doc-right-toc {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 14px;
    align-self: start;
    min-width: 0;
}

.doc-toc-card {
    border-left: 1px solid var(--line);
    padding-left: 16px;
}

.doc-toc-title {
    margin-bottom: 10px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 900;
}

.doc-toc-list {
    display: grid;
    gap: 2px;
}

.doc-toc-list a,
.doc-toc-list span {
    display: block;
    border-radius: 8px;
    color: var(--muted);
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.35;
}

.doc-toc-list a:hover,
.doc-toc-list a.active {
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
    color: var(--accent-dark);
}

.doc-toc-list a[data-level='3'] {
    padding-left: 18px;
}

.doc-feedback-buttons {
    display: flex;
    gap: 8px;
}

.doc-feedback-buttons button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
}

.doc-feedback-buttons button:hover {
    border-color: var(--accent);
}

.doc-side-links {
    display: grid;
    gap: 4px;
}

.doc-side-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: 8px;
    color: var(--muted);
    padding: 7px 8px;
    font-size: 12px;
}

.doc-side-links a:hover {
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
    color: var(--accent-dark);
}

@media (max-width: 1080px) {
    .doc-layout-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-right-toc {
        display: none;
    }

    .doc-content-page {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .doc-content-head {
        display: grid;
    }

    .doc-head-actions {
        justify-content: flex-start;
    }

    .doc-info-box {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .doc-info-box button {
        display: none;
    }

    .doc-related-grid {
        grid-template-columns: 1fr;
    }
}
