:root {
	--bg: #e9eef3;
	--panel: rgba(255, 255, 255, 0.74);
	--panel-strong: rgba(255, 255, 255, 0.88);
	--panel-subtle: rgba(248, 251, 252, 0.62);
	--glass-line: rgba(255, 255, 255, 0.72);
	--text: #1f2a34;
	--muted: #64717f;
	--line: rgba(143, 159, 174, 0.34);
	--line-strong: rgba(118, 138, 158, 0.48);
	--accent: #6e3a21;
	--accent-strong: #591804;
	--accent-soft: rgba(246, 232, 213, 0.75);
	--danger: #9b3e31;
	--danger-soft: #f7e9e7;
	--warning: #95620a;
	--code-bg: #f7f2e8;
	--shadow: 0 20px 48px rgba(32, 45, 58, 0.12);
	--shadow-soft: 0 8px 22px rgba(32, 45, 58, 0.08);
	--glass-blur: blur(18px) saturate(1.18);
	--radius: 12px;
	--editor-radius: 10px;
	--scrollbar-thumb: rgba(119, 133, 145, 0.46);
	--scrollbar-thumb-hover: rgba(89, 24, 4, 0.42);
	--scrollbar-track: rgba(255, 255, 255, 0.34);
}

* {
	box-sizing: border-box;
	scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
	scrollbar-width: thin;
}

*::-webkit-scrollbar {
	height: 10px;
	width: 10px;
}

*::-webkit-scrollbar-track {
	background: var(--scrollbar-track);
	border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
	background: var(--scrollbar-thumb);
	border: 2px solid transparent;
	border-radius: 999px;
	background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
	background: var(--scrollbar-thumb-hover);
	background-clip: padding-box;
}

body {
	margin: 0;
	background:
		linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(225, 233, 240, 0.52) 38%, rgba(242, 231, 218, 0.42)),
		linear-gradient(180deg, #f5f8fa 0%, var(--bg) 44%, #e6edf2 100%);
	color: var(--text);
	font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Microsoft YaHei", sans-serif;
	min-width: 320px;
	min-height: 100vh;
}

button,
select,
textarea {
	font: inherit;
}

button {
	align-items: center;
	background: var(--accent);
	border: 1px solid var(--accent);
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	justify-content: center;
	min-height: 34px;
	padding: 0 12px;
	transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
		color 0.15s ease;
	white-space: nowrap;
}

button:hover {
	background: var(--accent-strong);
	border-color: var(--accent-strong);
}

button:focus-visible,
textarea:focus-visible {
	outline: 2px solid rgba(43, 113, 128, 0.24);
	outline-offset: 2px;
}

button.primary-action {
	box-shadow: 0 7px 16px rgba(89, 24, 4, 0.16);
	font-weight: 600;
	min-width: 118px;
}

button.secondary {
	background: rgba(255, 255, 255, 0.68);
	color: var(--accent);
	border-color: var(--line-strong);
}

button.secondary:hover {
	background: var(--accent-soft);
	border-color: var(--accent);
}

button.ghost {
	background: transparent;
	border-color: transparent;
	color: var(--muted);
}

button.ghost:hover {
	background: var(--panel-subtle);
	border-color: var(--line);
	color: var(--text);
}

button.danger {
	color: var(--danger);
}

button.danger:hover {
	background: var(--danger-soft);
	border-color: #e3b9b2;
	color: var(--danger);
}

button.text-button {
	background: transparent;
	border: 0;
	color: var(--accent);
	font-size: 12px;
	min-height: 26px;
	padding: 0 4px;
}

button.text-button:hover {
	background: transparent;
	color: var(--accent-strong);
	text-decoration: underline;
}

button.section-action {
	background: rgba(255, 255, 255, 0.54);
	border-color: var(--line-strong);
	border-radius: 9px;
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.72);
	color: var(--accent);
	gap: 5px;
	font-size: 12px;
	font-weight: 700;
	min-height: 30px;
	padding: 0 9px;
}

button.section-action:hover {
	background: var(--accent-soft);
	border-color: rgba(89, 24, 4, 0.38);
	box-shadow: 0 6px 14px rgba(89, 24, 4, 0.10);
	color: var(--accent-strong);
}

button.section-action svg {
	display: block;
	fill: currentColor;
	flex: 0 0 14px;
	height: 14px;
	width: 14px;
}

.app-shell {
	width: min(1680px, calc(100vw - 32px));
	margin: 0 auto;
	padding: 16px 0 28px;
}

.app-header {
	align-items: center;
	background: var(--panel);
	-webkit-backdrop-filter: var(--glass-blur);
	backdrop-filter: var(--glass-blur);
	border: 1px solid var(--glass-line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
	display: flex;
	gap: 18px;
	justify-content: space-between;
	margin-bottom: 14px;
	padding: 12px 16px;
}

.app-header h1,
.panel-header h2,
.side-panel h2 {
	margin: 0;
}

.app-header h1 {
	font-size: 19px;
	line-height: 1.2;
}

.app-header p,
.panel-header span {
	color: var(--muted);
	margin: 4px 0 0;
}

.header-actions,
.output-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.brand-block {
	align-items: center;
	display: flex;
	gap: 14px;
	min-width: 0;
}

.brand-logo {
	align-items: center;
	background: rgba(255, 255, 255, 0.44);
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 10px;
	display: flex;
	height: 58px;
	justify-content: center;
	padding: 4px 10px;
}

.brand-logo svg {
	display: block;
	height: 50px;
	max-width: min(300px, 44vw);
}

.brand-copy {
	min-width: 0;
}

.workspace {
	display: grid;
	gap: 14px;
	grid-template-columns: minmax(0, 1fr) 400px;
	align-items: stretch;
}

.editor-panel,
.tool-section,
.preview-panel {
	background: var(--panel);
	-webkit-backdrop-filter: var(--glass-blur);
	backdrop-filter: var(--glass-blur);
	border: 1px solid var(--glass-line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.editor-panel {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	overflow: hidden;
}

.panel-header {
	align-items: center;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), var(--panel-subtle));
	border-bottom: 1px solid var(--line);
	display: flex;
	gap: 12px;
	justify-content: space-between;
	min-height: 54px;
	padding: 10px 14px;
}

.panel-title {
	min-width: 0;
}

.panel-header h2,
.side-panel h2 {
	font-size: 14px;
	line-height: 1.2;
}

#nga-editor {
	height: 620px;
	width: 100%;
}

.sceditor-container {
	background: #fff0cd !important;
	border: 1px solid rgba(107, 139, 176, 0.55) !important;
	border-radius: var(--editor-radius) !important;
	box-sizing: border-box !important;
	box-shadow: 0 12px 26px rgba(40, 57, 76, 0.10) !important;
	flex: 1 1 auto !important;
	height: auto !important;
	margin: 12px !important;
	min-height: 620px !important;
	overflow: visible !important;
	width: 100% !important;
	width: calc(100% - 24px) !important;
}

.sceditor-toolbar {
	background: linear-gradient(180deg, rgba(222, 232, 245, 0.96), rgba(192, 216, 239, 0.96)) !important;
	border-left: 0 !important;
	border-right: 0 !important;
	border-top: 0 !important;
	border-radius: var(--editor-radius) var(--editor-radius) 0 0 !important;
	overflow-x: auto !important;
	overflow-y: hidden !important;
	padding: 7px 8px !important;
	white-space: nowrap !important;
}

.sceditor-toolbar div.sceditor-group {
	background: linear-gradient(180deg, #cadcf0 18%, #bcd0e9 44%, #d0e1f7 100%) !important;
	border: 1px solid #7596bf !important;
	border-radius: 5px !important;
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.48) !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	margin: 0 7px 4px 0 !important;
	overflow: hidden !important;
	padding: 0 !important;
	vertical-align: top !important;
}

.sceditor-toolbar .sceditor-button {
	align-items: center !important;
	background: transparent !important;
	background-clip: border-box !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow:
		inset 0 1px #d5e3f1,
		inset 0 -1px #e3edfb,
		inset 1px 0 #cddcef,
		inset -1px 0 #b8ceea !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	float: none !important;
	height: 24px !important;
	justify-content: center !important;
	margin: 0 !important;
	min-width: 26px !important;
	overflow: hidden !important;
	padding: 4px 5px !important;
	position: relative !important;
	transition: background 0.08s ease, box-shadow 0.08s ease, transform 0.08s ease !important;
	width: auto !important;
}

.sceditor-toolbar .sceditor-button:first-child {
	border-radius: 4px 0 0 4px !important;
}

.sceditor-toolbar .sceditor-button:last-child {
	border-radius: 0 4px 4px 0 !important;
}

.sceditor-toolbar .sceditor-button:only-child {
	border-radius: 4px !important;
}

.sceditor-toolbar .sceditor-button:hover {
	background: linear-gradient(180deg, #fff8d8 0%, #fae6aa 44%, #ffd04b 44%, #ffe6a4 100%) !important;
	box-shadow:
		inset 0 1px rgba(255, 255, 255, 0.95),
		inset 0 -1px rgba(255, 250, 209, 0.95),
		inset 1px 0 rgba(255, 241, 190, 0.92),
		inset -1px 0 rgba(218, 148, 43, 0.28) !important;
}

.sceditor-toolbar .sceditor-button.active,
.sceditor-toolbar .sceditor-button.active:hover {
	background: linear-gradient(180deg, #fbdbb5 0%, #feb456 42%, #fdeb9f 100%) !important;
	box-shadow:
		inset 0 1px #ebd1b4,
		inset 0 -1px #ffe47f,
		inset 1px 0 rgba(139, 83, 19, 0.22),
		inset -1px 0 rgba(139, 83, 19, 0.26) !important;
}

.sceditor-toolbar .sceditor-button:active,
.sceditor-toolbar .sceditor-button.active:active {
	background: linear-gradient(180deg, #e9a76c 0%, #fcb16d 6%, #ff920f 46%, #ffc450 100%) !important;
	box-shadow:
		inset 0 1px 2px rgba(95, 60, 28, 0.48),
		inset 0 -1px rgba(209, 156, 51, 0.82) !important;
	transform: translateY(1px) !important;
}

.sceditor-toolbar .sceditor-button.disabled,
.sceditor-toolbar .sceditor-button.disabled:hover,
.sceditor-toolbar .sceditor-button.disabled:active {
	background: transparent !important;
	box-shadow:
		inset 0 1px #d5e3f1,
		inset 0 -1px #e3edfb,
		inset 1px 0 #cddcef,
		inset -1px 0 #b8ceea !important;
	cursor: default !important;
	transform: none !important;
}

.sceditor-toolbar .sceditor-button svg {
	display: block !important;
	flex: 0 0 auto !important;
	height: 16px !important;
	margin: 0 !important;
	width: 16px !important;
}

.sceditor-toolbar .sceditor-button-color .sce-color {
	display: none !important;
}

.sceditor-container iframe,
.sceditor-container textarea {
	background: #fff0cd !important;
	border-radius: 0 0 var(--editor-radius) var(--editor-radius) !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	width: 100% !important;
	width: calc(100%) !important;
}

.sceditor-container iframe {
	min-height: 0 !important;
}

.sceditor-container textarea {
	padding: 8px !important;
}

	.sceditor-container.sceditor-maximize {
		border-radius: 0 !important;
		box-sizing: border-box !important;
		display: flex !important;
		flex-direction: column !important;
		height: 100vh !important;
		height: 100dvh !important;
		inset: 0 !important;
		margin: 0 !important;
		max-height: none !important;
		max-width: none !important;
		min-height: 0 !important;
		overflow: hidden !important;
		position: fixed !important;
		width: 100vw !important;
		width: 100dvw !important;
		z-index: 3000 !important;
	}

	.sceditor-container.sceditor-maximize .sceditor-toolbar,
	.sceditor-container.sceditor-maximize iframe,
	.sceditor-container.sceditor-maximize textarea {
		border-radius: 0 !important;
	}

	.sceditor-container.sceditor-maximize .sceditor-toolbar {
		flex: 0 0 auto !important;
	}

	.sceditor-container.sceditor-maximize iframe,
	.sceditor-container.sceditor-maximize textarea {
		flex: 1 1 auto !important;
		height: auto !important;
		min-height: 0 !important;
		max-width: 100% !important;
		width: 100% !important;
	}

html.sceditor-maximize,
	body.sceditor-maximize {
		height: 100% !important;
		overflow: hidden !important;
		width: 100% !important;
	}

	body.nga-editor-maximized .sceditor-container.sceditor-maximize {
		flex: none !important;
	}

	body.nga-editor-maximized .editor-panel {
		-webkit-backdrop-filter: none !important;
		backdrop-filter: none !important;
		overflow: visible !important;
	}

.sceditor-button div {
	overflow: hidden;
	text-overflow: clip;
	white-space: nowrap;
}

.sceditor-button-nga-h div,
.sceditor-button-nga-collapse div,
.sceditor-button-nga-tid div,
.sceditor-button-nga-pid div,
.sceditor-button-nga-at div,
.sceditor-button-nga-spoiler div,
.sceditor-button-at div {
	font-size: 11px;
	line-height: 18px;
	min-width: 26px;
	padding: 0 4px;
	text-indent: 0;
}

.sceditor-button-at svg,
.sceditor-button-nga-at svg {
	display: block;
}

.nga-toolbar-tooltip {
	background: rgba(31, 42, 52, 0.94);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 7px;
	box-shadow: 0 10px 24px rgba(20, 30, 40, 0.18);
	color: #fff;
	font-size: 12px;
	left: 0;
	line-height: 1.35;
	max-width: min(280px, calc(100vw - 20px));
	opacity: 0;
	padding: 6px 8px;
	pointer-events: none;
	position: fixed;
	top: 0;
	transform: translateY(-2px);
	transition: opacity 0.08s ease, transform 0.08s ease;
	white-space: nowrap;
	z-index: 5000;
}

.nga-toolbar-tooltip.is-visible {
	opacity: 1;
	transform: translateY(0);
}

div.sceditor-dropdown {
	background: rgba(255, 255, 255, 0.9) !important;
	-webkit-backdrop-filter: blur(18px) saturate(1.14);
	backdrop-filter: blur(18px) saturate(1.14);
	border: 1px solid rgba(255, 255, 255, 0.75) !important;
	border-radius: 14px !important;
	box-shadow: 0 20px 44px rgba(31, 42, 52, 0.20) !important;
	box-sizing: border-box !important;
	color: var(--text) !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
	"Microsoft YaHei", sans-serif !important;
	font-size: 13px !important;
	padding: 13px !important;
}

div.sceditor-dropdown label {
	color: var(--text) !important;
	display: block !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	letter-spacing: 0;
	line-height: 1.25 !important;
	padding: 0 0 6px !important;
}

div.sceditor-dropdown input,
div.sceditor-dropdown textarea {
	background: rgba(255, 255, 255, 0.8) !important;
	border: 1px solid var(--line-strong) !important;
	border-radius: 10px !important;
	box-shadow: inset 0 1px 2px rgba(31, 42, 52, 0.05) !important;
	box-sizing: border-box !important;
	color: var(--text) !important;
	font: inherit !important;
	height: 38px !important;
	line-height: 20px !important;
	margin: 0 !important;
	min-height: 36px;
	padding: 7px 10px !important;
	width: 100% !important;
}

div.sceditor-dropdown textarea {
	height: auto !important;
	min-height: 96px;
}

div.sceditor-dropdown input:focus,
div.sceditor-dropdown textarea:focus {
	border-color: rgba(89, 24, 4, 0.48) !important;
	box-shadow: 0 0 0 3px rgba(89, 24, 4, 0.10) !important;
	outline: 0 !important;
}

div.sceditor-dropdown .button,
div.sceditor-dropdown button {
	align-items: center;
	background: var(--accent) !important;
	border: 1px solid var(--accent) !important;
	border-radius: 10px !important;
	box-shadow: 0 7px 16px rgba(89, 24, 4, 0.13) !important;
	color: #fff !important;
	cursor: pointer;
	display: inline-flex;
	font-weight: 600 !important;
	justify-content: center;
	line-height: 1.2;
	margin: 0 !important;
	min-height: 36px;
	padding: 0 14px !important;
	text-decoration: none !important;
	width: auto !important;
}

div.sceditor-dropdown .button:hover,
div.sceditor-dropdown button:hover {
	background: var(--accent-strong) !important;
	border-color: var(--accent-strong) !important;
}

.sceditor-insertlink,
.sceditor-insertimage,
.sceditor-inserttable {
	min-width: 0 !important;
	width: min(320px, calc(100vw - 32px)) !important;
}

.sceditor-inserttable {
	width: min(280px, calc(100vw - 32px)) !important;
}

.sceditor-insertlink::before,
.sceditor-insertimage::before,
.sceditor-inserttable::before {
	color: var(--text);
	display: block;
	font-size: 15px;
	font-weight: 800;
	line-height: 1.25;
	margin: 0 0 11px;
}

.sceditor-insertlink::before {
	content: "插入链接";
}

.sceditor-insertimage::before {
	content: "插入图片";
}

.sceditor-inserttable::before {
	content: "插入表格";
}

.sceditor-insertlink > div,
.sceditor-insertimage > div,
.sceditor-inserttable > div {
	display: grid !important;
	gap: 10px !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.sceditor-insertlink > div {
	grid-template-columns: minmax(0, 1fr) !important;
}

.sceditor-insertlink > div > div,
.sceditor-insertimage > div > div,
.sceditor-inserttable > div > div {
	box-sizing: border-box !important;
	min-width: 0 !important;
}

.sceditor-insertlink > div > div,
.sceditor-insertimage > div > div:first-child,
.sceditor-insertimage > div > div:last-child,
.sceditor-inserttable > div > div:last-child {
	grid-column: 1 / -1 !important;
}

.sceditor-insertlink > div > div:last-child,
.sceditor-insertimage > div > div:last-child,
.sceditor-inserttable > div > div:last-child {
	display: flex !important;
	justify-content: flex-end !important;
	margin-top: 2px !important;
}

.sceditor-insertlink input.button,
.sceditor-insertimage input.button,
.sceditor-inserttable input.button {
	appearance: none;
	min-width: 82px !important;
}

.sceditor-insertimage input#width,
.sceditor-insertimage input#height,
.sceditor-inserttable input#rows,
.sceditor-inserttable input#cols {
	text-align: center;
}

.sceditor-nga-reference-tid,
.sceditor-nga-reference-pid,
.sceditor-nga-mention-picker,
.sceditor-nga-dice-picker,
.sceditor-nga-template-picker {
	left: 50% !important;
	margin-top: 0 !important;
	min-width: 0 !important;
	width: min(760px, calc(100vw - 32px)) !important;
	max-height: min(620px, calc(100vh - 40px)) !important;
	overflow: auto !important;
	position: fixed !important;
	top: 50% !important;
	transform: translate(-50%, -50%) !important;
	z-index: 7000 !important;
}

.sceditor-nga-reference-tid::before,
.sceditor-nga-reference-pid::before,
.sceditor-nga-mention-picker::before,
.sceditor-nga-dice-picker::before,
.sceditor-nga-template-picker::before {
	color: var(--text);
	display: block;
	font-size: 15px;
	font-weight: 800;
	line-height: 1.25;
	margin: 0 0 11px;
}

.sceditor-nga-reference-tid::before {
	content: "插入主题链接";
}

.sceditor-nga-reference-pid::before {
	content: "插入回复链接";
}

.sceditor-nga-mention-picker::before {
	content: "@用户";
}

.sceditor-nga-dice-picker::before {
	content: "插入骰子";
}

.sceditor-nga-template-picker::before {
	content: "预置排版";
}

.nga-reference-form,
.nga-mention-form,
.nga-dice-form,
.nga-template-form {
	display: grid;
	gap: 9px;
}

.nga-reference-form label,
.nga-mention-form label,
.nga-dice-form label {
	padding-bottom: 0 !important;
}

.nga-reference-hint,
.nga-mention-hint,
.nga-dice-hint,
.nga-template-hint {
	color: var(--muted);
	font-size: 12px;
	line-height: 1.45;
	margin: 0;
}

.nga-template-list {
	display: grid;
	gap: 7px;
	max-height: 358px;
	min-width: 0;
	overflow: auto;
	padding-right: 2px;
}

.nga-template-layout {
	display: grid;
	gap: 12px;
	grid-template-columns: minmax(220px, 260px) minmax(300px, 1fr);
	min-width: 0;
}

div.sceditor-dropdown .nga-template-list button {
	align-items: center !important;
	background: rgba(255, 255, 255, 0.72) !important;
	border: 1px solid var(--line-strong) !important;
	border-radius: 10px !important;
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.72) !important;
	color: var(--text) !important;
	cursor: pointer !important;
	display: grid !important;
	gap: 9px !important;
	grid-template-columns: 28px minmax(0, 1fr) !important;
	justify-items: stretch !important;
	min-height: 58px !important;
	padding: 8px 10px !important;
	text-align: left !important;
	width: 100% !important;
}

div.sceditor-dropdown .nga-template-list button:hover,
div.sceditor-dropdown .nga-template-list button:focus-visible {
	background: var(--accent-soft) !important;
	border-color: rgba(89, 24, 4, 0.36) !important;
	color: var(--accent-strong) !important;
	outline: none !important;
}

div.sceditor-dropdown .nga-template-list button.is-selected {
	background: rgba(255, 240, 205, 0.92) !important;
	border-color: rgba(89, 24, 4, 0.48) !important;
	box-shadow: inset 3px 0 0 var(--accent), inset 0 1px rgba(255, 255, 255, 0.8) !important;
	color: var(--accent-strong) !important;
}

.template-index {
	align-items: center;
	background: rgba(89, 24, 4, 0.08);
	border: 1px solid rgba(89, 24, 4, 0.14);
	border-radius: 8px;
	display: flex;
	font-size: 12px;
	font-weight: 800;
	height: 28px;
	justify-content: center;
	width: 28px;
}

.template-copy {
	display: grid;
	gap: 3px;
	min-width: 0;
}

.template-title {
	font-size: 14px;
	font-weight: 800;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.template-desc {
	color: var(--muted);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nga-template-preview {
	background: rgba(255, 255, 255, 0.56);
	border: 1px solid var(--line-strong);
	border-radius: 12px;
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.7);
	display: grid;
	gap: 9px;
	min-height: 0;
	min-width: 0;
	padding: 10px;
}

.nga-template-preview-head {
	border-bottom: 1px solid rgba(120, 143, 165, 0.22);
	display: grid;
	gap: 3px;
	padding-bottom: 8px;
}

.nga-template-preview-head strong {
	color: var(--text);
	font-size: 15px;
	font-weight: 900;
	line-height: 1.25;
}

.nga-template-preview-head span {
	color: var(--muted);
	font-size: 12px;
	font-weight: 650;
	line-height: 1.35;
}

div.sceditor-dropdown textarea.nga-template-code {
	background: rgba(255, 240, 205, 0.62) !important;
	border: 1px solid rgba(120, 143, 165, 0.30) !important;
	border-radius: 10px !important;
	box-shadow: inset 0 1px 3px rgba(31, 42, 52, 0.08) !important;
	color: var(--text) !important;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace !important;
	font-size: 12px !important;
	line-height: 1.55 !important;
	margin: 0 !important;
	min-height: 252px !important;
	resize: none !important;
	width: 100% !important;
}

.nga-template-footer {
	align-items: center;
	border-top: 1px solid rgba(120, 143, 165, 0.20);
	display: flex;
	gap: 12px;
	justify-content: space-between;
	padding-top: 11px;
}

.nga-template-actions {
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
	justify-content: flex-end;
}

.nga-template-actions button {
	min-width: 86px;
}

div.sceditor-dropdown .nga-template-actions button.secondary {
	background: rgba(255, 255, 255, 0.68) !important;
	border-color: var(--line-strong) !important;
	box-shadow: none !important;
	color: var(--text) !important;
}

.nga-dice-presets {
	display: grid;
	gap: 7px;
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

div.sceditor-dropdown .nga-dice-presets button.secondary {
	background: rgba(255, 255, 255, 0.72) !important;
	border-color: var(--line-strong) !important;
	box-shadow: none !important;
	color: var(--text) !important;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace !important;
	font-size: 12px !important;
	min-height: 30px !important;
	padding: 0 8px !important;
}

div.sceditor-dropdown .nga-dice-presets button.secondary:hover {
	background: var(--accent-soft) !important;
	border-color: rgba(89, 24, 4, 0.38) !important;
	color: var(--accent-strong) !important;
}

.nga-reference-actions,
.nga-mention-actions,
.nga-dice-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 2px;
}

.nga-reference-actions button,
.nga-mention-actions button,
.nga-dice-actions button {
	min-width: 82px;
}

.side-panel {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
	position: sticky;
	top: 12px;
}

.tool-section {
	background: rgba(255, 255, 255, 0.66);
	padding: 12px;
}

.side-panel h2 {
	margin-bottom: 9px;
}

.section-title-row {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 9px;
}

.section-title-row h2 {
	margin: 0;
}

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

.quick-grid button {
	align-items: center;
	background: rgba(255, 255, 255, 0.62);
	border-color: var(--line-strong);
	color: var(--text);
	display: grid;
	font-size: 14px;
	font-weight: 700;
	gap: 8px;
	grid-template-columns: 30px minmax(0, 1fr) 30px;
	letter-spacing: 0;
	line-height: 1;
	min-height: 42px;
	overflow: hidden;
	padding: 0 10px;
	position: static;
	text-align: center;
}

.quick-grid button:hover {
	background: var(--accent-soft);
	border-color: var(--accent);
}

.quick-grid button:active {
	background: rgba(89, 24, 4, 0.10);
	transform: translateY(1px);
}

.quick-button-icon,
.quick-button-spacer {
	align-items: center;
	display: flex;
	height: 30px;
	justify-content: center;
	min-width: 0;
	width: 30px;
}

.quick-button-icon {
	background: rgba(255, 255, 255, 0.68);
	border: 1px solid rgba(120, 143, 165, 0.30);
	border-radius: 8px;
	box-shadow: inset 0 1px rgba(255, 255, 255, 0.74);
	color: rgba(31, 42, 52, 0.86);
}

.quick-grid button:hover .quick-button-icon {
	background: rgba(255, 255, 255, 0.9);
	border-color: rgba(89, 24, 4, 0.24);
	color: var(--accent-strong);
}

.quick-icon {
	display: block;
	fill: currentColor;
	height: 15px;
	opacity: 0.86;
	width: 15px;
}

.quick-label {
	align-items: center;
	display: flex;
	justify-content: center;
	line-height: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
	white-space: nowrap;
	width: 100%;
}

#import-source,
#bbcode-output {
	border: 1px solid var(--line-strong);
	border-radius: 10px;
	color: var(--text);
	display: block;
	line-height: 1.5;
	padding: 10px;
	resize: vertical;
	width: 100%;
}

#import-source {
	background: rgba(255, 255, 255, 0.76);
	min-height: 116px;
}

#bbcode-output {
	background: rgba(248, 250, 251, 0.76);
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 12px;
	min-height: 280px;
}

.output-actions {
	justify-content: flex-end;
	margin-top: 8px;
}

.preview-panel {
	margin-top: 16px;
	overflow: hidden;
}

.nga-preview {
	background: #fff0cd;
	color: #10273f;
	font-family: Verdana, Tahoma, Arial, sans-serif;
	font-size: 13px;
	line-height: 1.9;
	min-height: 220px;
	max-height: min(720px, 72vh);
	overflow: auto;
	padding: 16px;
}

.nga-preview:empty::before {
	color: var(--muted);
	content: "暂无预览";
}

.nga-preview div,
.nga-preview p {
	min-height: 1.9em;
}

.nga-preview div.quote,
.nga-preview blockquote {
	background: #f9efd6;
	border: 1px solid #e6e1d3;
	color: #10273f;
	display: block;
	line-height: 1.9;
	margin: 10px;
	padding: 8px 10px;
}

.nga-preview h4.subtitle,
.nga-preview .nga-heading {
	border-bottom: 1px solid #9c958b;
	color: #10273f;
	font-size: 15.2px;
	font-weight: 700;
	line-height: 24.7px;
	margin: 20px 0 3px;
	padding: 0;
}

.nga-preview ol,
.nga-preview ul {
	line-height: 1.9;
	margin: 13px 0;
	padding: 0 0 0 18px;
}

.nga-preview li {
	line-height: 1.9;
	margin: 0;
	padding: 0;
}

.nga-preview img {
	max-width: 100%;
	vertical-align: baseline;
}

.nga-preview table,
.nga-preview td {
	border: 1px dotted #9c958b;
	empty-cells: show;
}

.nga-preview .nga-collapse {
	display: block;
	line-height: 1.7;
	margin: 8px 0 13px;
	padding: 0;
}

.nga-preview .collapse_btn,
.nga-preview .collapse_title,
.nga-preview .collapse_title2 {
	align-items: center;
	background: #ead5bc;
	border: 1px solid #d8bd9a;
	border-radius: 4px 4px 0 0;
	color: #10273f;
	cursor: pointer;
	display: flex;
	font-weight: 700;
	gap: 8px;
	line-height: 1.5;
	margin: 0;
	padding: 6px 10px;
	text-shadow: 0 1px rgba(255, 255, 255, 0.82);
	user-select: none;
}

.nga-preview .collapse_content,
.nga-preview .collapse {
	background: #fff7d9;
	border: 1px solid #d8bd9a;
	border-top: 0;
	border-radius: 0 0 4px 4px;
	color: #10273f;
	display: block;
	line-height: 1.75;
	margin: 0;
	min-height: 2.2em;
	padding: 9px 11px;
}

.nga-preview .collapse-state {
	align-items: center;
	background: #f2dfc8;
	border: 1px solid rgba(89, 24, 4, 0.16);
	border-radius: 5px;
	color: #10273f;
	display: inline-flex;
	flex: 0 0 auto;
	font-size: 16px;
	font-weight: 700;
	height: 24px;
	justify-content: center;
	line-height: 1;
	margin: 0;
	vertical-align: middle;
	width: 24px;
}

.nga-preview .nga-collapse:not(.is-open) > .collapse_content {
	display: none;
}

.nga-preview .nga-collapse.is-open > .collapse_content {
	display: block;
}

.nga-preview .collapse-title-text {
	flex: 0 1 auto;
	font-weight: 400;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nga-preview .collapse-title-input {
	background: transparent;
	border: 0;
	color: inherit;
	font: inherit;
	font-weight: 400;
	outline: none;
	padding: 0;
}

.nga-preview .collapse-suffix {
	flex: 0 0 auto;
	font-weight: 400;
	user-select: none;
}

.nga-spoiler {
	background: #eceff2;
	border-radius: 4px;
	color: transparent;
	padding: 0 4px;
	text-shadow: 0 0 7px rgba(30, 39, 50, 0.6);
}

.nga-spoiler:hover {
	color: inherit;
	text-shadow: none;
}

.nga-ref,
.nga-post-link {
	display: inline;
	line-height: inherit;
	margin: 0;
	padding: 0;
}

.nga-preview .apd {
	color: #8b6f55;
	padding: 0 0.15em;
	vertical-align: 0.05em;
}

.nga-preview .urlincontent,
.nga-preview .userlink {
	color: #004ad4;
	cursor: pointer;
	text-decoration: underline;
}

.nga-preview .userlink.b {
	font-weight: 700;
}

.nga-preview .block_txt {
	border: 1px solid rgba(108, 84, 58, 0.45);
	border-radius: 3px;
	display: inline-block;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.2em;
	margin: 0 1px;
	min-width: 1.2em;
	padding: 0 0.22em;
	text-align: center;
	text-decoration: none;
	vertical-align: 0.05em;
}

.nga-preview .block_txt_c2 {
	background: #f6ead5;
	color: #7a4b21;
}

.nga-preview .block_txt_c0 {
	background: #e9cabb;
	color: #591804;
}

.nga-preview .nga-dice-table,
.nga-preview table.dice {
	background: transparent;
	border: 1px dotted #9c958b;
	border-collapse: collapse;
	color: #10273f;
	display: table;
	font-family: Verdana, Tahoma, Arial, sans-serif;
	font-size: 13px;
	line-height: 1.9;
	margin: 4px 0;
	padding: 0;
	vertical-align: baseline;
}

.nga-preview .nga-dice-row {
	display: table-row;
}

.nga-preview .nga-dice-cell,
.nga-preview table.dice td {
	border: 1px dotted #9c958b;
	display: table-cell;
	padding: 2px 6px;
}

.nga-preview .nga-dice-table b,
.nga-preview table.dice b {
	font-weight: 700;
}

.nga-preview code {
	background: #f2edde;
	display: block;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 12px;
	line-height: 1.6;
	margin: 10px;
	padding: 8px 10px;
	white-space: pre-wrap;
}

#toast {
	background: rgba(23, 33, 43, 0.88);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 9px;
	bottom: 18px;
	box-shadow: var(--shadow);
	color: #fff;
	left: 50%;
	opacity: 0;
	padding: 9px 13px;
	pointer-events: none;
	position: fixed;
	transform: translate(-50%, 16px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

#toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

@media (max-width: 1080px) {
	.app-header,
	.panel-header {
		align-items: flex-start;
		flex-direction: column;
	}

	.brand-block {
		align-items: flex-start;
		flex-direction: column;
		gap: 8px;
	}

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

	.side-panel {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		position: static;
	}

	.side-panel section:last-child {
		grid-column: 1 / -1;
	}
}

@media (max-width: 720px) {
	.sceditor-nga-template-picker {
		width: min(420px, calc(100vw - 24px)) !important;
	}

	.nga-template-layout {
		grid-template-columns: 1fr;
	}

	.nga-template-list {
		max-height: 230px;
	}

	div.sceditor-dropdown textarea.nga-template-code {
		min-height: 180px !important;
	}

	.nga-template-footer {
		align-items: stretch;
		flex-direction: column;
	}

	.nga-template-actions,
	.nga-template-actions button {
		width: 100%;
	}

	.app-shell {
		width: min(100vw - 18px, 680px);
		padding-top: 10px;
	}

	.app-header {
		padding: 10px;
	}

	.brand-block {
		align-items: center;
		flex-direction: row;
		width: 100%;
	}

	.brand-logo {
		height: auto;
		padding: 4px 8px;
		width: auto;
	}

	.brand-logo svg {
		height: 40px;
		max-width: 130px;
	}

	.app-header h1 {
		font-size: 17px;
	}

	.app-header p {
		font-size: 13px;
		margin-top: 2px;
	}

	.output-actions {
		align-items: stretch;
		flex-direction: column;
		width: 100%;
	}

	.header-actions {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		width: 100%;
	}

	.quick-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.header-actions button,
	.output-actions button {
		width: 100%;
	}

	.side-panel {
		display: flex;
	}

	#nga-editor {
		height: 520px;
	}
}
