:root {
    --proof-indent: 20px;
    --proof-inset: 12px;
    --strategy-content-indent: 20px;
    --strategy-content-inset: 12px;
    --text-color: #334155;
    --text-muted: #94a3b8;
    --border-color: #cbd5e1;
    --border-color-light: #e7e7e7;
    --current-step-color: #3b82f6;
    --current-step-color-background: #eff6ff;
    --proof-mark-pass-color-light: #007acc;
    --proof-mark-pass-color-dark: #3794ff;
    --proof-mark-warning-color-light: #bf8803;
    --proof-mark-warning-color-dark: #cca700;
    --proof-mark-error-color-light: #e51400;
    --proof-mark-error-color-dark: #f14c4c;
    --tag-color: #475569;
    --tag-color-background: #e2e8f0;
    --cases-color: #6b7280;
    --cases-color-light: #d1d5db;
    --decompose-color: #6366f1;
    --decompose-color-light: #c7d2fe;
    --remark-color: #64748b;
    --remark-color-background: #f8fafc;
    --cause-color: #cca700;
    --cause-color-background: #fffbeb;
    --ref-color: #2563eb;
}

html {
    overflow-y: scroll;
}

body {
    font-family: serif, "Microsoft YaHei";
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    margin: 0;
}

a {
    color: var(--ref-color);
}

.page-layout {
    --sidebar-width: min(clamp(280px, 25vw, 360px), calc(100vw - 492px));
    display: grid;
    grid-template-columns: minmax(0, var(--sidebar-width)) 12px minmax(0, 1fr);
    align-items: start;
    min-height: 100vh;
}

.page-splitter {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: 12px;
    height: 100vh;
    height: 100dvh;
    cursor: col-resize;
    touch-action: none;
    background: linear-gradient(to right, transparent 5px, var(--border-color-light) 5px,
        var(--border-color-light) 6px, transparent 6px);
}

.page-splitter:hover,
.page-splitter:focus-visible,
.page-layout.is-resizing .page-splitter {
    background: linear-gradient(to right, transparent 5px, var(--current-step-color) 5px,
        var(--current-step-color) 7px, transparent 7px);
}

.page-splitter:focus-visible {
    outline: 2px solid var(--current-step-color);
    outline-offset: -2px;
}

.page-layout.is-resizing,
.page-layout.is-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.module-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
}

.module-sidebar-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    padding: 20px clamp(20px, 2vw, 32px) 56px clamp(40px, 4vw, 72px);
}

.module-sidebar-inner::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: 0;
    left: 0;
    height: 72px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 78%);
}

.module-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 18px 8px;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 750;
    letter-spacing: 0.02em;
    overflow-wrap: anywhere;
}

.module-directory-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.module-directory-scroll::-webkit-scrollbar,
.theorem-dependency-navigation::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.module-context-tree,
.module-context-tree ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.module-context-tree ul {
    position: relative;
    margin-left: 10px;
    padding-left: 18px;
}

.module-context-tree ul::before {
    content: "";
    position: absolute;
    top: -7px;
    bottom: 16px;
    left: 0;
    border-left: 1px solid #cbd5e1;
}

.module-context-tree li {
    position: relative;
    padding: 3px 0;
}

.module-context-tree ul > li::before {
    content: "";
    position: absolute;
    top: 19px;
    left: -18px;
    width: 18px;
    border-top: 1px solid #cbd5e1;
}

.module-tree-node,
.module-tree-parent {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 7px;
    color: var(--text-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    text-decoration: none;
    transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.module-tree-parent {
    color: #475569;
    font-weight: 750;
}

.module-tree-node:hover,
.module-tree-parent:hover {
    background: #f1f5f9;
    color: var(--ref-color);
}

.module-tree-node-mark {
    position: relative;
    z-index: 1;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.module-tree-node.is-current {
    background: #edf5ff;
    color: #1d4ed8;
    font-weight: 750;
}

.module-tree-node.is-current .module-tree-node-mark {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: 0 0 0 4px #dbeafe;
}

.module-context-tree .is-current-branch > ul::before {
    border-left-color: #93c5fd;
}

.module-context-tree .is-current-branch > ul > li::before {
    border-top-color: #93c5fd;
}

.module-path-row {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    margin: 0 8px 8px;
}

.module-path-prefix {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px;
    line-height: 1.4;
    white-space: nowrap;
    scrollbar-width: none;
}

.module-path-prefix::-webkit-scrollbar {
    display: none;
}

.module-home-button {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.module-home-button:hover,
.module-home-button:focus-visible {
    background: #f1f5f9;
    color: var(--ref-color);
}

.module-home-button:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

.module-home-button .codicon {
    font-size: 16px;
}

.theorem-dependency-navigation {
    flex: 0 0 30%;
    height: 30%;
    max-height: 30%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    margin: 22px 8px 0;
    padding-top: 18px;
    border-top: 1px solid var(--border-color-light);
}

.theorem-dependency-navigation[hidden] {
    display: none;
}

.theorem-dependency-navigation h3,
.theorem-dependency-current {
    font-family: system-ui, -apple-system, sans-serif;
}

.theorem-dependency-navigation h3 {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.theorem-dependency-level {
    position: relative;
    margin: 0;
    padding: 0 0 0 28px;
    list-style: none;
}

.theorem-dependency-level li {
    position: relative;
    padding: 3px 0;
}

.theorem-dependency-node,
.theorem-dependency-current {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 32px;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 7px;
}

.theorem-dependency-node {
    overflow: hidden;
    color: #475569;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.theorem-dependency-node:hover {
    background: #f1f5f9;
    color: var(--ref-color);
}

.theorem-dependency-node.is-unlinked {
    color: var(--text-muted);
}

.theorem-dependency-current {
    position: relative;
    z-index: 1;
    margin: 8px 0;
    background: #edf5ff;
    color: #1d4ed8;
    font-size: 11.5px;
    font-weight: 750;
}

.theorem-dependency-current strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theorem-dependency-mark {
    position: relative;
    z-index: 2;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
}

.theorem-dependency-current .theorem-dependency-mark {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: 0 0 0 4px #dbeafe;
}

.theorem-dependency-level::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 10px;
    border-left: 1px solid #94a3b8;
}

.theorem-dependency-level li::before {
    content: "";
    position: absolute;
    top: 19px;
    left: -18px;
    width: 18px;
    border-top: 1px solid #94a3b8;
}

.theorem-dependency-level.incoming {
    padding-bottom: 5px;
}

.theorem-dependency-level.incoming::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 7px;
    border-top: 6px solid #2563eb;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

.theorem-dependency-level.outgoing {
    padding-top: 5px;
}

.theorem-dependency-level.outgoing li::after {
    content: "";
    position: absolute;
    top: 16px;
    left: -3px;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid #2563eb;
}

.project-header {
    margin-top: 72px;
}

.project-header h1 {
    margin: 0;
    font-size: 40px;
}

.project-metadata {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-family: system-ui, -apple-system, sans-serif;
}

.project-abstract {
    max-width: 720px;
    margin: 20px 0 0;
    font-size: 16px;
    line-height: 1.75;
}

.module-index {
    margin: 28px 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--border-color-light);
}

.module-index li {
    border-bottom: 1px solid var(--border-color-light);
}

.module-index a {
    display: block;
    padding: 16px 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-decoration: none;
}

.module-index-tree,
.module-index-tree ul {
    margin: 28px 0;
    padding: 0;
    list-style: none;
}

.module-index-tree ul {
    position: relative;
    margin: 0 0 0 10px;
    padding-left: 22px;
}

.module-index-tree ul::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 18px;
    left: 0;
    border-left: 1px solid #cbd5e1;
}

.module-index-tree li {
    position: relative;
    padding: 3px 0;
}

.module-index-tree ul > li::before {
    content: "";
    position: absolute;
    top: 20px;
    left: -22px;
    width: 22px;
    border-top: 1px solid #cbd5e1;
}

.module-index-tree a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    padding: 0 8px;
    border-radius: 7px;
    color: var(--text-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    text-decoration: none;
}

.module-index-tree a:hover {
    background: #f1f5f9;
    color: var(--ref-color);
}

.module-index-tree-mark {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
}

.language-switcher {
    position: relative;
    flex: 0 0 auto;
    margin: -6px 0 18px;
}

.sidebar-display-controls {
    display: flex;
    align-items: flex-start;
    margin: -6px 0 18px;
}

@media (max-width: 740px) {
    .display-options-current {
        display: none;
    }
}

.sidebar-display-controls .language-switcher,
.display-options {
    margin: 0;
}

.sidebar-display-controls .language-button,
.sidebar-display-controls .display-options-button,
.sidebar-display-controls .share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    box-sizing: border-box;
    border: 0;
    border-radius: 7px;
    padding: 0 8px;
    color: #475569;
    background: transparent;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.sidebar-display-controls .codicon[class*='codicon-'] {
    font-size: 20px;
}

.sidebar-display-controls .language-button:hover,
.sidebar-display-controls .language-button:focus-visible,
.sidebar-display-controls .display-options-button:hover,
.sidebar-display-controls .display-options-button:focus-visible,
.sidebar-display-controls .share-button:hover,
.sidebar-display-controls .share-button:focus-visible,
.sidebar-display-controls .language-switcher.is-open .language-button,
.sidebar-display-controls .display-options.is-open .display-options-button {
    color: var(--ref-color);
    background: #f1f5f9;
}

.sidebar-display-controls button:focus-visible,
.share-dialog button:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

.share-dialog {
    width: min(400px, calc(100vw - 48px));
    box-sizing: border-box;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    background: #fff;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
    font-family: system-ui, -apple-system, sans-serif;
}

.share-dialog::backdrop {
    background: rgba(15, 23, 42, 0.4);
}

.share-dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.share-dialog h2 {
    margin: 0;
    font-size: 17px;
}

.share-dialog-close {
    display: inline-flex;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    box-sizing: border-box;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    cursor: pointer;
}

.share-dialog-close:hover {
    background: #f1f5f9;
    color: var(--ref-color);
}

.share-dialog-description {
    margin: 12px 0 20px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.share-dialog-actions {
    display: grid;
    gap: 9px;
}

.share-dialog-actions button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-color);
    background: #fff;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.share-dialog-actions button:hover:not(:disabled) {
    border-color: #93c5fd;
    color: var(--ref-color);
    background: #eff6ff;
}

.share-dialog-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.share-unavailable:not([hidden]) {
    display: block;
    margin: 4px 0 0 13px;
    color: #64748b;
    font-size: 11px;
}

.share-dialog-status {
    min-height: 20px;
    margin: 12px 0 0;
    color: var(--ref-color);
    font-size: 12px;
}

.display-options {
    position: relative;
    flex: 0 0 auto;
}

.display-options-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 6;
    display: none;
    min-width: 164px;
    box-sizing: border-box;
    margin-top: 4px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}

.display-options:not(.is-dismissed):hover .display-options-menu,
.display-options.is-open .display-options-menu {
    display: grid;
}

.display-option,
.language-menu button {
    display: flex;
    width: 100%;
    min-height: 32px;
    box-sizing: border-box;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 6px;
    padding: 0 8px;
    color: #475569;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 400;
    text-align: left;
    background: transparent;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.display-option:hover,
.display-option.is-enabled,
.language-menu button:hover,
.language-menu button[aria-checked="true"] {
    background: #edf5ff;
    color: #1d4ed8;
}

.display-option.is-enabled,
.language-menu button[aria-checked="true"] {
    font-weight: 750;
}

.display-option-mark,
.language-node-mark {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
}

.display-option.is-enabled .display-option-mark,
.language-menu button[aria-checked="true"] .language-node-mark {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: 0 0 0 3px #dbeafe;
}

.language-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 5;
    display: none;
    min-width: 116px;
    box-sizing: border-box;
    margin-top: 4px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}

.language-switcher:not(.is-dismissed):hover .language-menu,
.language-switcher.is-open .language-menu {
    display: grid;
}

[data-language-panel][hidden] {
    display: none;
}

.page-code {
    overflow-x: auto;
    padding: 16px 18px;
    border-radius: 8px;
    background: #f8fafc;
}

blockquote {
    margin-left: 0;
    padding-left: 18px;
    border-left: 3px solid var(--border-color);
}

dt {
    font-weight: 700;
}

dd {
    margin: 4px 0 16px 24px;
}

.unsupported-component {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 24px 0;
    padding: 18px 20px;
    border: 2px dashed #d97706;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
}

.unsupported-component span,
.unresolved-reference {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 12px;
}

.unresolved-reference {
    padding: 1px 4px;
    border-bottom: 1px dashed #dc2626;
    color: #b91c1c;
}

h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    font-size: 20px;
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 8px;
}

h2 sup {
    position: absolute;
    right: 100%;
    margin-right: 4px;
}
.proposition-box {
    border: 0.5px solid var(--border-color);
    margin: 40px 0;
    border-radius: 10px;
    padding: 28px 32px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    transition: 0.25s;
}
.proposition-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}
.proposition-title {
    font-size: 20px;
    font-weight: 750;
    margin-bottom: 12px;
}

.proof-container {
    grid-column: 3;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin-top: 10px;
    padding: 0 clamp(40px, 5vw, 96px) 48px clamp(28px, 4vw, 72px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Keep oversized math inside its own box; the script reserves the scaled height. */
.ps-fit-viewport {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: clip;
}

.ps-fit-content {
    display: block;
    transform-origin: top left;
}
