:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --code-bg: #e9edf2;
    --bg-hover: #dee2e6;
    --bg-accent: #212529;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border: rgba(0, 0, 0, .08);
    --border-hover: rgba(0, 0, 0, .15);
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-ui: Inter, "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
}

:root[data-theme="dark"] {
    --bg-primary: #2c3036;
    --bg-secondary: #333840;
    --bg-tertiary: #3b414a;
    --code-bg: #282d34;
    --bg-hover: #454c56;
    --bg-accent: rgba(255, 255, 255, .72);
    --text-primary: rgba(255, 255, 255, .87);
    --text-secondary: rgba(255, 255, 255, .62);
    --text-muted: rgba(255, 255, 255, .42);
    --border: rgba(255, 255, 255, .06);
    --border-hover: rgba(255, 255, 255, .13);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    overflow-x: hidden;
}

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

button,
input {
    font: inherit;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

::selection {
    background: rgba(59, 130, 246, .3);
    color: var(--text-primary);
}

.ms-app {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.ms-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0 36px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}

.ms-logo {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    color: #22d3ee;
    border-radius: var(--radius-sm);
    font-weight: 800;
}

.ms-logo span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-primary);
}

.ms-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ms-sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.ms-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s, color .15s, transform .15s;
}

.ms-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

.ms-icon-btn.is-active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ms-icon-btn.is-active::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 50%;
    width: 2px;
    height: 16px;
    border-radius: 0 1px 1px 0;
    background: var(--bg-accent);
    transform: translateY(-50%);
}

.ms-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
}

.ms-tooltip {
    position: absolute;
    left: 44px;
    top: 6px;
    z-index: 10;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.ms-icon-btn:hover .ms-tooltip {
    opacity: 1;
}

.ms-main {
    min-height: calc(100vh - 24px);
    margin-left: 48px;
    margin-bottom: 24px;
    background: var(--bg-primary);
}

.is-pjax-loading .ms-main {
    cursor: progress;
}

.ms-statusbar {
    position: fixed;
    left: 48px;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.ms-status-crumb,
.ms-mobile-crumb {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.ms-status-crumb a,
.ms-status-crumb span,
.ms-mobile-crumb a,
.ms-mobile-crumb span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-status-crumb a:hover,
.ms-mobile-crumb a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ms-status-crumb svg {
    width: 12px;
    height: 12px;
}

.ms-status-music {
    width: 16px;
    height: 14px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.ms-status-music svg {
    width: 12px;
    height: 12px;
}

.ms-status-music:hover {
    background: var(--bg-tertiary);
}

.ms-mobile-header,
.ms-mobile-menu,
.ms-music-panel {
    display: none;
}

.ms-page,
.ms-article {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

.ms-list-page {
    max-width: 860px;
    padding: 32px 24px 72px;
}

.ms-home {
    min-height: calc(100vh - 24px);
    max-width: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 48px 32px;
    text-align: center;
}

.ms-home-inner {
    width: 100%;
}

.ms-home-avatar {
    width: 80px;
    height: 80px;
    display: grid;
    place-items: center;
    margin: 0 auto 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: #22d3ee;
    font-size: 44px;
    font-weight: 800;
}

.ms-home-subtitle {
    margin: 0 0 32px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.ms-home-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ms-home-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    text-align: left;
    transition: background .15s, border-color .15s, transform .15s;
}

.ms-home-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.ms-home-card-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.ms-home-card-icon svg,
.ms-card-arrow svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
}

.ms-home-card-main {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.ms-home-card-main strong {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.ms-home-card-main span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.ms-card-arrow {
    color: var(--text-muted);
}

.ms-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.ms-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.ms-title-row h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.ms-title-row span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
}

.ms-title-line {
    width: 32px;
    height: 3px;
    border-radius: 2px;
    background: var(--bg-accent);
}

.ms-page-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.ms-small-btn,
.ms-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.ms-small-btn:hover,
.ms-small-btn[aria-expanded="true"],
.ms-pill:hover,
.ms-pill.is-active {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.ms-small-btn svg {
    width: 12px;
    height: 12px;
    stroke-width: 1.5;
}

.ms-search {
    position: relative;
    margin-bottom: 16px;
}

.ms-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transform: translateY(-50%);
}

.ms-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 400;
    transition: background .15s, border-color .15s;
}

.ms-search input:hover,
.ms-search input:focus {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.ms-filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
}

.ms-filter-panel[data-open="true"] {
    max-height: none !important;
    overflow: visible;
    margin-bottom: 16px;
}

.ms-filter-box {
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.ms-filter-box + .ms-filter-box {
    margin-top: 12px;
}

.ms-filter-title {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.ms-filter-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ms-pill span {
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 10px;
}

.ms-muted {
    color: var(--text-muted);
    font-size: 12px;
}

.ms-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ms-article-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    overflow: hidden;
    transition: background .15s, border-color .15s;
}

.ms-article-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.ms-article-card.has-sticky {
    border-color: rgba(245, 158, 11, .28);
}

.ms-card-link,
.ms-article-card a:first-child {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
}

.ms-card-mainline {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.ms-article-card h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
}

.ms-card-link time {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.ms-card-badges,
.ms-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.ms-card-badges span,
.ms-card-meta a,
.ms-card-meta span {
    min-height: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 10px;
}

.ms-sticky-badge {
    min-width: 9px !important;
    min-height: 9px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #b45309 !important;
}

.ms-sticky-badge svg {
    width: 9px;
    height: 9px;
    color: #d97706;
    stroke-width: 2.4;
}

.ms-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.ms-article-header {
    margin-bottom: 32px;
}

.ms-article-header h1 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.ms-article-header .ms-title-line {
    margin-bottom: 18px;
}

.ms-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.ms-article-meta a,
.ms-article-meta span,
.ms-article-meta time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    transition: background .15s, border-color .15s, color .15s;
}

.ms-article-meta svg {
    width: 14px;
    height: 14px;
}

.ms-article-meta a:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.ms-article-summary {
    margin: 18px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}

.ms-cover {
    margin: 0 0 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.ms-cover img {
    display: block;
    width: 100%;
    height: auto;
}

.ms-audio-list {
    display: grid;
    gap: 12px;
    margin: 0 0 24px;
}

.ms-audio-card {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.ms-audio-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.ms-audio-head > span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 11px;
}

.ms-audio-head strong,
.ms-audio-head em {
    display: block;
}

.ms-audio-head strong {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.ms-audio-head em {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-style: normal;
}

.ms-audio-card audio {
    width: 100%;
    height: 34px;
    display: block;
}

.ms-audio-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

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

.ms-gallery figure {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.ms-gallery img {
    display: block;
    width: 100%;
    height: auto;
}

.markdown-content {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    margin: 1.5em 0 .75em;
    color: var(--text-primary);
    font-weight: 700;
}

.markdown-content h1 {
    font-size: 1.5em;
}

.markdown-content h2 {
    font-size: 1.3em;
}

.markdown-content h3 {
    font-size: 1.1em;
}

.markdown-content p {
    margin: 0 0 1em;
}

.markdown-content a {
    color: #2563eb;
    text-decoration: none;
    text-underline-offset: 3px;
    transition: background .15s, border-color .15s, color .15s;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content p a:not(.md-button),
.markdown-content li a:not(.md-button),
.markdown-content blockquote a:not(.md-button),
.markdown-content td a:not(.md-button) {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 1px 6px;
    border: 1px solid rgba(37, 99, 235, .18);
    border-radius: var(--radius-xs);
    background: rgba(37, 99, 235, .07);
    color: #2563eb;
    font-weight: 500;
    vertical-align: baseline;
}

.markdown-content p a:not(.md-button)::after,
.markdown-content li a:not(.md-button)::after,
.markdown-content blockquote a:not(.md-button)::after,
.markdown-content td a:not(.md-button)::after {
    content: "↗";
    margin-left: 4px;
    color: currentColor;
    font-size: .82em;
    line-height: 1;
    opacity: .72;
}

.markdown-content p a:not(.md-button):hover,
.markdown-content li a:not(.md-button):hover,
.markdown-content blockquote a:not(.md-button):hover,
.markdown-content td a:not(.md-button):hover {
    border-color: rgba(37, 99, 235, .35);
    background: rgba(37, 99, 235, .12);
    color: #1d4ed8;
    text-decoration: none;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.markdown-content ul {
    list-style: disc outside;
}

.markdown-content ol {
    list-style: decimal outside;
}

.markdown-content li {
    display: list-item;
    margin: .35em 0;
}

.markdown-content blockquote {
    margin: 1em 0;
    padding-left: 1em;
    border-left: 3px solid #3b82f6;
    color: var(--text-secondary);
}

.markdown-content table,
.md-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.55;
}

.markdown-content table {
    margin: 1.2em 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.md-table-wrap {
    width: 100%;
    margin: 1.2em 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.md-table-wrap .md-table {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.markdown-content th,
.markdown-content td,
.md-table th,
.md-table td {
    padding: 9px 12px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.markdown-content th,
.md-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 700;
}

.markdown-content tr:last-child td,
.md-table tr:last-child td {
    border-bottom: 0;
}

.markdown-content th:last-child,
.markdown-content td:last-child,
.md-table th:last-child,
.md-table td:last-child {
    border-right: 0;
}

.md-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    gap: 7px;
    padding: 0 15px;
    border: 1px solid rgba(37, 99, 235, .28);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(37, 99, 235, .12), rgba(37, 99, 235, .06));
    color: #2563eb !important;
    font-size: 12px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}

.md-button::after {
    content: "→";
    font-size: .95em;
    opacity: .78;
    transition: transform .15s;
}

.md-button:hover {
    border-color: rgba(37, 99, 235, .45);
    background: linear-gradient(180deg, rgba(37, 99, 235, .16), rgba(37, 99, 235, .09));
    text-decoration: none !important;
}

.md-button:hover::after {
    transform: translateX(2px);
}

.md-highlight,
.md-panel,
.md-alert,
.md-collapse,
.md-download {
    margin: 1.2em 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.md-highlight {
    padding: 12px 14px;
    border-left: 3px solid #22d3ee;
}

.md-highlight > :last-child,
.md-panel > div > :last-child,
.md-alert > :last-child,
.md-collapse > div > :last-child {
    margin-bottom: 0;
}

.md-panel {
    overflow: hidden;
}

.md-panel > h3 {
    margin: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    font-size: 14px;
}

.md-panel > div,
.md-collapse > div {
    padding: 12px 14px;
}

.md-panel-blue {
    border-left: 3px solid #3b82f6;
}

.md-panel-yellow {
    border-left: 3px solid #f59e0b;
}

.md-panel-red {
    border-left: 3px solid #ef4444;
}

.md-panel-gray {
    border-left: 3px solid var(--text-muted);
}

.md-alert {
    padding: 12px 14px;
    border-left-width: 3px;
}

.md-alert > strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.md-alert-info {
    border-left-color: #3b82f6;
}

.md-alert-success {
    border-left-color: #22c55e;
}

.md-alert-warning {
    border-left-color: #f59e0b;
}

.md-alert-danger {
    border-left-color: #ef4444;
}

.md-collapse {
    overflow: hidden;
}

.md-collapse summary {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.md-download {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.md-download-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 16px;
}

.md-download-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.md-download-main strong,
.md-download-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-download-main strong {
    color: var(--text-primary);
    font-size: 13px;
}

.md-download-main span {
    color: var(--text-muted);
    font-size: 11px;
}

.md-download > a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}

.md-download > a::after {
    content: none !important;
}

.markdown-content code:not(pre code) {
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    background: rgba(59, 130, 246, .1);
    font-family: var(--font-mono);
    font-size: .9em;
}

.markdown-content pre {
    position: relative;
    margin: 1.5em 0;
    padding: 40px 16px 16px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--code-bg);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.markdown-content pre code {
    background: transparent;
}

.markdown-content pre .code-key {
    color: #b7791f;
}

.markdown-content pre .code-string {
    color: #22863a;
}

.markdown-content pre .code-number,
.markdown-content pre .code-keyword {
    color: #805ad5;
}

:root[data-theme="dark"] .markdown-content pre .code-key {
    color: #f6ad55;
}

:root[data-theme="dark"] .markdown-content pre .code-string {
    color: #68d391;
}

:root[data-theme="dark"] .markdown-content pre .code-number,
:root[data-theme="dark"] .markdown-content pre .code-keyword {
    color: #b794f4;
}

.code-lang-badge {
    position: absolute;
    left: 12px;
    top: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.copy-button {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
    transition: opacity .1s, background .1s, color .1s;
}

.copy-button svg {
    width: 14px;
    height: 14px;
}

.markdown-content pre:hover .copy-button,
.copy-button.copied {
    opacity: 1;
    pointer-events: auto;
}

.copy-button:hover,
.copy-button.copied {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.ms-prev-next {
    display: flex;
    align-items: stretch;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.ms-prev-next a,
.ms-prev-next .is-disabled {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    transition: background .15s, border-color .15s;
}

.ms-prev-next .is-disabled {
    opacity: .55;
}

.ms-prev-next a:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.ms-prev-next a > span,
.ms-prev-next .is-disabled > span {
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: .03em;
}

.ms-prev-next strong {
    display: block;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-auth {
    min-height: calc(100vh - 24px);
    display: grid;
    place-items: center;
    padding: 32px 24px;
}

.ms-auth-card {
    width: min(420px, 100%);
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.ms-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.ms-form label {
    display: grid;
    gap: 6px;
}

.ms-form label span {
    color: var(--text-muted);
    font-size: 12px;
}

.ms-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.ms-form input:focus {
    border-color: var(--border-hover);
    background: var(--bg-tertiary);
}

.ms-form button {
    padding: 10px 12px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    background: var(--bg-accent);
    color: var(--bg-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.ms-auth-switch {
    margin: 16px 0 0;
    color: var(--text-muted);
    text-align: center;
    font-size: 12px;
}

.ms-auth-switch a {
    color: var(--text-primary);
    font-weight: 600;
}

.ms-flash {
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
}

.ms-flash.is-success {
    border-color: rgba(34, 197, 94, .35);
}

.ms-flash.is-error {
    border-color: rgba(239, 68, 68, .35);
}

.ms-message-card {
    text-align: center;
}

.ms-message-card .ms-home-avatar {
    margin-bottom: 20px;
}

.ms-message-card .ms-title-row {
    justify-content: center;
}

.ms-message-card .ms-title-line {
    margin: 0 auto;
}

.ms-message-card p {
    margin: 18px 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 24px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.pagination a,
.pagination span {
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
}

.pagination a.active,
.pagination a:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ms-music-panel {
    position: fixed;
    z-index: 199;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.ms-music-panel[data-open="false"] {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.ms-music-panel[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.ms-music-inner {
    padding: 8px;
}

.ms-music-title strong,
.ms-music-title span {
    display: block;
}

.ms-music-title strong {
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 400;
}

.ms-music-title span {
    color: var(--text-muted);
    font-size: 10px;
}

.ms-range {
    margin-top: 6px;
}

.ms-range input {
    width: 100%;
    height: 3px;
    accent-color: var(--bg-accent);
}

.ms-range div {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 9px;
}

.ms-music-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.ms-music-controls button {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
}

.ms-music-controls button:disabled,
.ms-playlist button:disabled {
    cursor: default;
    opacity: .55;
}

.ms-music-controls button svg {
    width: 15px;
    height: 15px;
}

.ms-music-controls button.is-main {
    width: 36px;
    height: 36px;
    background: var(--bg-accent);
    color: var(--bg-primary);
}

.ms-music-controls button.is-main svg {
    width: 18px;
    height: 18px;
}

.ms-lyric {
    margin-top: 8px;
    padding: 7px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    text-align: center;
    font-size: 10px;
}

.ms-playlist {
    margin-top: 8px;
}

.ms-playlist button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
}

.ms-playlist strong {
    font-size: 12px;
    font-weight: 400;
}

.ms-playlist button.is-active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ms-playlist span {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 9px;
}

@media (max-width: 767px) {
    html,
    body,
    .ms-app {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .ms-sidebar {
        display: none;
    }

    .ms-mobile-header {
        position: fixed;
        inset: 0 0 auto 0;
        z-index: 200;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 8px;
        border-bottom: 1px solid var(--border);
        background: var(--bg-secondary);
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }

    .ms-mobile-crumb {
        min-width: 0;
        max-width: calc(100vw - 98px);
        flex: 1;
        overflow: hidden;
    }

    .ms-mobile-crumb a,
    .ms-mobile-crumb span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
        line-height: 1.2;
    }

    .ms-mobile-crumb .is-current {
        background: var(--bg-tertiary);
        color: var(--text-primary);
        font-weight: 500;
    }

    .ms-mobile-crumb svg {
        width: 12px;
        height: 12px;
        flex: 0 0 auto;
    }

    .ms-mobile-actions {
        display: flex;
        flex: 0 0 auto;
        gap: 2px;
        margin-left: auto;
    }

    .ms-mobile-actions .ms-icon-btn {
        width: 28px;
        height: 28px;
    }

    .ms-mobile-actions .ms-icon-btn svg {
        width: 15px;
        height: 15px;
    }

    .ms-main {
        width: 100%;
        max-width: 100vw;
        min-height: calc(100vh - 72px);
        margin: 40px 0 24px;
        overflow-x: hidden;
    }

    .ms-statusbar {
        left: 0;
        background: var(--bg-secondary);
    }

    .ms-status-crumb,
    .ms-status-music {
        display: none;
    }

    .ms-mobile-menu {
        position: fixed;
        left: 0;
        right: 0;
        top: 40px;
        bottom: 24px;
        z-index: 150;
        display: block;
        padding: 16px 12px;
        background: var(--bg-primary);
        transition: opacity .2s;
    }

    .ms-mobile-menu[data-open="false"] {
        opacity: 0;
        pointer-events: none;
    }

    .ms-mobile-menu[data-open="true"] {
        opacity: 1;
        pointer-events: auto;
    }

    .ms-mobile-menu nav {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .ms-mobile-menu a,
    .ms-mobile-menu button {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        border: 0;
        border-radius: var(--radius-sm);
        background: var(--bg-secondary);
        color: var(--text-secondary);
        font-size: 12px;
        text-align: left;
        cursor: pointer;
    }

    .ms-mobile-menu a.is-active {
        background: var(--bg-tertiary);
        color: var(--text-primary);
        font-weight: 500;
    }

    .ms-mobile-menu svg {
        width: 15px;
        height: 15px;
        stroke-width: 1.5;
    }

    .ms-music-panel {
        display: block;
        left: 0;
        right: 0;
        top: 40px;
        max-height: 70vh;
        overflow-y: auto;
        transition: opacity .2s, transform .2s;
    }

    .ms-page,
    .ms-article {
        width: 100%;
        max-width: none;
        overflow-x: hidden;
        padding: 20px 12px;
    }

    .ms-list-page {
        padding: 22px 12px 72px;
    }

    .ms-home {
        min-height: calc(100vh - 72px);
        justify-content: flex-start;
        padding: 52px 12px 72px;
    }

    .ms-home-avatar {
        width: 64px;
        height: 64px;
        margin-bottom: 18px;
        font-size: 36px;
    }

    .ms-home-subtitle {
        margin-bottom: 24px;
        font-size: 14px;
    }

    .ms-home-card {
        min-height: 56px;
        padding: 10px 12px;
    }

    .ms-home-card-icon {
        width: 32px;
        height: 32px;
    }

    .ms-home-card-main strong {
        font-size: 14px;
    }

    .ms-home-card-main span {
        font-size: 11px;
    }

    .ms-page-header {
        align-items: flex-start;
        flex-direction: row;
        gap: 10px;
        margin-bottom: 16px;
    }

    .ms-page-header > div:first-child {
        min-width: 0;
        flex: 1 1 auto;
    }

    .ms-page-actions {
        flex: 0 0 auto;
        gap: 6px;
        padding-top: 1px;
    }

    .ms-small-btn {
        min-height: 30px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .ms-title-row h1,
    .ms-article-header h1 {
        font-size: 18px;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .ms-title-row span {
        font-size: 11px;
    }

    .ms-article-header .ms-title-line {
        margin-bottom: 14px;
    }

    .ms-article-meta a,
    .ms-article-meta span,
    .ms-article-meta time {
        padding: 4px 8px;
        font-size: 11px;
    }

    .ms-search input {
        padding-top: 13px;
        padding-bottom: 13px;
        font-size: 13px;
    }

    .ms-card-link,
    .ms-article-card a:first-child {
        min-width: 0;
        min-height: 58px;
        align-items: flex-start;
        padding: 12px 14px;
    }

    .ms-article-card h2 {
        font-size: 15px;
    }

    .ms-card-mainline {
        min-width: 0;
        gap: 7px;
    }

    .markdown-content,
    .markdown-content p,
    .markdown-content li,
    .markdown-content blockquote,
    .markdown-content td,
    .markdown-content th {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .markdown-content p a:not(.md-button),
    .markdown-content li a:not(.md-button),
    .markdown-content blockquote a:not(.md-button),
    .markdown-content td a:not(.md-button) {
        display: inline;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    .markdown-content pre,
    .md-table-wrap {
        max-width: 100%;
    }

    .ms-prev-next a,
    .ms-prev-next .is-disabled {
        min-width: 0;
    }

    .ms-card-link time {
        font-size: 11px;
    }

    .ms-article-meta {
        align-items: center;
        flex-direction: row;
        gap: 6px;
        padding-bottom: 14px;
    }

    .ms-prev-next {
        flex-direction: column;
    }

    .ms-gallery {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .ms-music-panel {
        display: block;
        right: 12px;
        bottom: 28px;
        top: auto;
        width: 240px;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
        transition: opacity .2s, transform .2s;
    }
}

/* Compatibility for stale/opcache-rendered Tailwind templates.
   Once PHP opcache is cleared and all templates render the ms-* markup,
   these rules are harmless fallbacks. */
.ms-main > section[class*="min-h"][class*="max-w-4xl"] {
    min-height: calc(100vh - 24px);
    max-width: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 48px 32px;
    text-align: center;
}

.ms-main > section[class*="min-h"][class*="max-w-4xl"] > div {
    width: 100%;
}

.ms-main > section[class*="min-h"][class*="max-w-4xl"] > div:first-child,
.ms-main > section[class*="min-h"][class*="max-w-4xl"] .mx-auto.grid {
    margin-left: auto;
    margin-right: auto;
}

.ms-main > section[class*="min-h"][class*="max-w-4xl"] a.group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.ms-main > section[class*="max-w-5xl"],
.ms-main > section[class*="max-w-4xl"]:not([class*="min-h"]),
.ms-main > article[class*="max-w-4xl"] {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

.ms-main > article[class*="max-w-4xl"] h1,
.ms-main > section[class*="max-w-5xl"] h1,
.ms-main > section[class*="max-w-5xl"] h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.ms-main > article[class*="max-w-4xl"] [class*="mt-7"],
.ms-main > article[class*="max-w-4xl"] time,
.ms-main > article[class*="max-w-4xl"] header a {
    font-size: 11px;
}

.ms-main > article[class*="max-w-4xl"] [class*="ny-prose"],
.ms-main > article[class*="max-w-4xl"] [class*="mt-10"] {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.7;
}

:root[data-theme="dark"] .ms-logo,
:root[data-theme="dark"] .ms-home-avatar {
    color: #36c6d3;
}

:root[data-theme="dark"] .markdown-content a {
    color: #8ab4f8;
}

:root[data-theme="dark"] .markdown-content p a:not(.md-button),
:root[data-theme="dark"] .markdown-content li a:not(.md-button),
:root[data-theme="dark"] .markdown-content blockquote a:not(.md-button),
:root[data-theme="dark"] .markdown-content td a:not(.md-button) {
    border-color: rgba(138, 180, 248, .22);
    background: rgba(138, 180, 248, .1);
    color: #8ab4f8;
}

:root[data-theme="dark"] .markdown-content p a:not(.md-button):hover,
:root[data-theme="dark"] .markdown-content li a:not(.md-button):hover,
:root[data-theme="dark"] .markdown-content blockquote a:not(.md-button):hover,
:root[data-theme="dark"] .markdown-content td a:not(.md-button):hover {
    border-color: rgba(138, 180, 248, .32);
    background: rgba(138, 180, 248, .15);
    color: #a7c7fb;
}

:root[data-theme="dark"] .md-button {
    border-color: rgba(138, 180, 248, .28);
    background: linear-gradient(180deg, rgba(138, 180, 248, .14), rgba(138, 180, 248, .08));
    color: #8ab4f8 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

:root[data-theme="dark"] .md-button:hover {
    border-color: rgba(138, 180, 248, .4);
    background: linear-gradient(180deg, rgba(138, 180, 248, .19), rgba(138, 180, 248, .1));
}

:root[data-theme="dark"] .md-download > a,
:root[data-theme="dark"] .pagination a,
:root[data-theme="dark"] .pagination span {
    background: rgba(255, 255, 255, .06);
}

:root[data-theme="dark"] .ms-music-panel {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
}
