/* PrismJS 1.19.0 语言包保留 — 主题配色由 星算AI社区 定制（明暗双态自适应）
   亮色：浅灰白底；暗色：苹果风深色底（类似 macOS 终端/Xcode Dark） */

/* ---------- 基础 ---------- */
code[class*="language-"],
pre[class*="language-"] {
	color: var(--mn-code-text, #24292e);
	background: none;
	text-shadow: none;
	font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', SFMono-Regular, Menlo, monospace;
	font-size: .92em;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	line-height: 1.55;

	-moz-tab-size: 4;
	-o-tab-size: 4;
	tab-size: 4;

	-webkit-hyphens: none;
	-moz-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
}

pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
	text-shadow: none;
	background: rgba(76, 141, 255, .25);
}

pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
	text-shadow: none;
	background: rgba(76, 141, 255, .25);
}

@media print {
	code[class*="language-"],
	pre[class*="language-"] {
		text-shadow: none;
	}
}

/* ---------- 代码块容器（明态） ---------- */
pre[class*="language-"] {
	padding: 1em 1.1em;
	margin: .6em 0;
	overflow: auto;
	max-height: 640px;
	background: #f6f8fa;
	border: 1px solid var(--mn-border, #e7e9ee);
	border-radius: 10px;
	color: var(--mn-code-text, #24292e);
}

/* 保险：不显示语言名标签（部分环境会给 pre.language-* 加 ::before 标签） */
pre[class*="language-"]::before,
pre[class*="language-"]::after,
div.message pre[class*="language-"]::before,
div.message pre[class*="language-"]::after {
	content: none !important;
	display: none !important;
}

:not(pre) > code[class*="language-"] {
	padding: .12em .4em;
	border-radius: .35em;
	white-space: normal;
	background: rgba(120, 130, 145, .12);
	color: var(--mn-code-text, #24292e);
}

/* ---------- 代码块容器（暗态：苹果风深底） ---------- */
html[data-theme="dark"] pre[class*="language-"] {
	background: #161b22;
	border-color: #303642;
	color: #e6edf3;
	box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
	--mn-code-text: #e6edf3;
}
html[data-theme="dark"] code[class*="language-"] {
	color: #e6edf3;
}
html[data-theme="dark"]:not(pre) > code[class*="language-"] {
	background: rgba(148, 163, 184, .16);
	color: #e6edf3;
}

/* ---------- 语法着色（明态） ---------- */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
	color: #6a737d;
	font-style: italic;
}

.token.punctuation {
	color: #57606a;
}

.token.namespace {
	opacity: .75;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
	color: #cf222e;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
	color: #0a7d32;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
	color: #953800;
	background: transparent;
}

.token.atrule,
.token.attr-value,
.token.keyword {
	color: #0969da;
	font-weight: 600;
}

.token.function,
.token.class-name {
	color: #8250df;
}

.token.regex,
.token.important,
.token.variable {
	color: #b35900;
}

.token.important,
.token.bold {
	font-weight: bold;
}
.token.italic {
	font-style: italic;
}

.token.entity {
	cursor: help;
}

/* ---------- 语法着色（暗态，全部按深底 #161b22 提亮到 AA 对比度） ---------- */
html[data-theme="dark"] .token.comment,
html[data-theme="dark"] .token.prolog,
html[data-theme="dark"] .token.doctype,
html[data-theme="dark"] .token.cdata {
	color: #9aa4b2;
	font-style: italic;
}

html[data-theme="dark"] .token.punctuation {
	color: #c9d1d9;
}

html[data-theme="dark"] .token.property,
html[data-theme="dark"] .token.tag,
html[data-theme="dark"] .token.boolean,
html[data-theme="dark"] .token.number,
html[data-theme="dark"] .token.constant,
html[data-theme="dark"] .token.symbol,
html[data-theme="dark"] .token.deleted {
	color: #ff8f88;
}

html[data-theme="dark"] .token.selector,
html[data-theme="dark"] .token.attr-name,
html[data-theme="dark"] .token.string,
html[data-theme="dark"] .token.char,
html[data-theme="dark"] .token.builtin,
html[data-theme="dark"] .token.inserted {
	color: #96f0a0;
}

html[data-theme="dark"] .token.operator,
html[data-theme="dark"] .token.entity,
html[data-theme="dark"] .token.url,
html[data-theme="dark"] .language-css .token.string,
html[data-theme="dark"] .style .token.string {
	color: #ffb77e;
	background: transparent;
}

html[data-theme="dark"] .token.atrule,
html[data-theme="dark"] .token.attr-value,
html[data-theme="dark"] .token.keyword {
	color: #8ec9ff;
	font-weight: 600;
}

html[data-theme="dark"] .token.function,
html[data-theme="dark"] .token.class-name {
	color: #dcb8ff;
}

html[data-theme="dark"] .token.regex,
html[data-theme="dark"] .token.important,
html[data-theme="dark"] .token.variable {
	color: #ffb77e;
}

/* ---------- 工具条：复制 / 折叠按钮 ---------- */
.mn-code-wrap { position: relative; }
/* macOS 风格顶栏：实心背景遮住滚动内容，三色点不透底 */
.mn-code-top {
	position: absolute; top: 1px; left: 1px; right: 1px; height: 34px; z-index: 6;
	display: flex; align-items: center; justify-content: space-between;
	padding: 0 8px 0 14px;
	background: var(--mn-code-topbg, #f6f8fa);
	border-radius: 9px 9px 0 0;
	pointer-events: none;          /* 顶栏本体不拦截，按钮单独放开 */
	user-select: none;
}
html[data-theme="dark"] .mn-code-top { background: #161b22; }
/* macOS 窗口三色点（左上角） */
.mn-dots {
	display: flex; gap: 6px;
	pointer-events: none;
}
.mn-dots span {
	display: block; width: 11px; height: 11px; border-radius: 50%;
	box-shadow: inset 0 0 1px rgba(0,0,0,.28);
}
.mn-dots span:nth-child(1) { background: #ff5f57; }
.mn-dots span:nth-child(2) { background: #febc2e; }
.mn-dots span:nth-child(3) { background: #28c840; }
/* 顶部留出三色点区域，首行不被遮挡 */
.mn-code-wrap > pre[class*="language-"],
.mn-code-wrap > pre {
	padding-top: 2.6em;
}
.mn-code-top .mn-code-btn { pointer-events: auto; }
.mn-code-bar {
	display: flex; gap: 6px; opacity: 1;
	position: static;
}
.mn-code-btn {
	display: inline-flex; align-items: center; gap: .3em;
	padding: .18rem .6rem;
	font-size: .74rem; line-height: 1.4; font-weight: 600;
	color: var(--mn-text-2, #4b5563);
	background: var(--mn-card, #fff);
	border: 1px solid var(--mn-border-strong, #d0d7de);
	border-radius: 6px;
	cursor: pointer;
	user-select: none;
	box-shadow: 0 1px 3px rgba(16,24,40,.10);
	white-space: nowrap;
}
.mn-code-btn:hover { color: var(--mn-primary, #2563eb); border-color: var(--mn-primary, #2563eb); }
.mn-code-btn.mn-done { color: #16a34a; border-color: #16a34a; }
html[data-theme="dark"] .mn-code-btn {
	color: #b8bec8;
	background: #21262d;
	border-color: #3d444d;
	box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
html[data-theme="dark"] .mn-code-btn:hover { color: #79c0ff; border-color: #79c0ff; }
html[data-theme="dark"] .mn-code-btn.mn-done { color: #4ade80; border-color: #4ade80; }

/* ---------- 折叠态（代码仍可上下滚动查看，仅限高） ---------- */
.mn-code-wrap.mn-collapsed pre[class*="language-"] {
	max-height: 320px;
	overflow-y: auto !important;
	overflow-x: auto;
	/* 底部留出渐隐区域，滚动到底也能看清最后一行 */
	scrollbar-width: thin;
}
.mn-code-wrap.mn-collapsed pre[class*="language-"]::-webkit-scrollbar { width: 8px; }
.mn-code-wrap.mn-collapsed pre[class*="language-"]::-webkit-scrollbar-thumb { background: rgba(120,130,145,.35); border-radius: 4px; }
.mn-code-fold-mask {
	position: absolute; left: 1px; right: 1px; bottom: 1px; height: 90px;
	background: linear-gradient(to bottom, transparent, var(--mn-card, #fff));
	pointer-events: none !important;   /* 不拦截滚动与选择 */
	user-select: none;
	border-radius: 0 0 10px 10px;
}
html[data-theme="dark"] .mn-code-fold-mask {
	background: linear-gradient(to bottom, transparent, #161b22);
}
.mn-code-expand {
	position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
	z-index: 6;
	display: inline-flex; align-items: center; gap: .35em;
	padding: .3rem 1.1rem;
	font-size: .78rem; font-weight: 600;
	color: #fff;
	background: var(--mn-primary, #2563eb);
	border: none; border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(37,99,235,.35);
	white-space: nowrap;
	pointer-events: auto !important;
}
.mn-code-expand:hover { filter: brightness(1.08); }
/* 展开态隐藏 mask 与按钮 */
.mn-code-wrap:not(.mn-collapsed) .mn-code-fold-mask { display: none; }
