.yht-tiptap-shell {
	--yht-tiptap-border: hsla(var(--xf-borderColor--h, 0), var(--xf-borderColor--s, 0%), var(--xf-borderColor--l, 88%), var(--xf-borderColor--a, 1));
	--yht-tiptap-muted: hsla(var(--xf-textColorMuted--h, 0), var(--xf-textColorMuted--s, 0%), var(--xf-textColorMuted--l, 52%), var(--xf-textColorMuted--a, 1));
	--yht-tiptap-text: var(--yht-tiptap-color, hsla(var(--xf-editorColor--h, 0), var(--xf-editorColor--s, 0%), var(--xf-editorColor--l, 18%), var(--xf-editorColor--a, 1)));
	--yht-tiptap-accent: #7a52ff;
	--yht-tiptap-accent-hover: #6842e8;
	--yht-tiptap-surface: hsla(var(--xf-editorBg--h, 0), var(--xf-editorBg--s, 0%), var(--xf-editorBg--l, 100%), var(--xf-editorBg--a, 1));
	--yht-tiptap-hover: rgba(127, 127, 127, 0.12);
	--yht-tiptap-active: rgba(122, 82, 255, 0.16);
	--yht-tiptap-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 8px 24px rgba(24, 24, 27, 0.04);
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 12px;
	background: var(--yht-tiptap-surface);
	box-shadow: var(--yht-tiptap-shadow);
	color: var(--yht-tiptap-text);
	font-family: var(--yht-tiptap-font-family, inherit);
	font-size: var(--yht-tiptap-font-size, 16px);
	line-height: var(--yht-tiptap-line-height, 1.6);
	overflow: hidden;
	isolation: isolate;
}

.yht-tiptap-shell[data-yht-color-scheme="light"] {
	--yht-tiptap-border: rgba(24, 24, 27, 0.14);
	--yht-tiptap-muted: #6e6e78;
	--yht-tiptap-text: #202027;
	--yht-tiptap-accent: #6842e8;
	--yht-tiptap-accent-hover: #5635ca;
	--yht-tiptap-surface: #ffffff;
	--yht-tiptap-hover: rgba(15, 15, 20, 0.06);
	--yht-tiptap-active: rgba(122, 82, 255, 0.14);
	--yht-tiptap-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 8px 24px rgba(24, 24, 27, 0.04);
	color-scheme: light;
}

.yht-tiptap-shell[data-yht-color-scheme="dark"] {
	--yht-tiptap-border: rgba(255, 255, 255, 0.12);
	--yht-tiptap-muted: rgba(245, 245, 245, 0.62);
	--yht-tiptap-text: #f5f5f5;
	--yht-tiptap-accent: #a78bfa;
	--yht-tiptap-accent-hover: #c4b5fd;
	--yht-tiptap-surface: #0e0e11;
	--yht-tiptap-hover: rgba(255, 255, 255, 0.08);
	--yht-tiptap-active: rgba(122, 82, 255, 0.22);
	--yht-tiptap-shadow: 0 1px 2px rgba(0, 0, 0, 0.36), 0 10px 30px rgba(0, 0, 0, 0.24);
	color-scheme: dark;
}

.yht-tiptap-theme-icon__sun,
.yht-tiptap-theme-icon__moon {
	display: none;
}

.yht-tiptap-shell[data-yht-color-scheme="light"] .yht-tiptap-theme-icon__moon,
.yht-tiptap-shell[data-yht-color-scheme="dark"] .yht-tiptap-theme-icon__sun {
	display: inline;
}

.yht-tiptap-toolbar {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	box-sizing: border-box;
	min-height: 48px;
	padding: 7px 8px;
	border-top: 1px solid var(--yht-tiptap-border);
	background: var(--yht-tiptap-surface);
	box-shadow: 0 -1px 0 rgba(24, 24, 27, 0.02);
	font: inherit;
}

.yht-tiptap-toolbar-group {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 2px;
}

.yht-tiptap-toolbar-group + .yht-tiptap-toolbar-group {
	margin-inline-start: 4px;
	padding-inline-start: 4px;
	border-inline-start: 1px solid var(--yht-tiptap-border);
}

.yht-tiptap-button {
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 32px;
	height: 32px;
	padding: 6px 8px;
	border: 0;
	border-radius: 10px;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--yht-tiptap-text) !important;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.yht-tiptap-button:hover,
.yht-tiptap-button:focus-visible {
	border: 0;
	background: var(--yht-tiptap-hover) !important;
	box-shadow: none !important;
	color: var(--yht-tiptap-text) !important;
	outline: none;
}

.yht-tiptap-button:focus-visible {
	box-shadow: 0 0 0 2px rgba(122, 82, 255, 0.32) !important;
}

.yht-tiptap-button:active {
	transform: translateY(1px);
}

.yht-tiptap-button.is-active {
	border: 0;
	background: var(--yht-tiptap-active) !important;
	color: var(--yht-tiptap-accent) !important;
}

.yht-tiptap-button--highlight::before {
	width: 14px;
	height: 14px;
	border: 1px solid rgba(24, 24, 27, 0.12);
	border-radius: 4px;
	background: var(--yht-highlight-color);
	box-shadow: 0 1px 2px rgba(24, 24, 27, 0.12);
	content: "";
}

.yht-tiptap-button.is-loading svg {
	animation: yht-tiptap-spin 800ms linear infinite;
}

.yht-tiptap-grammar-status {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	margin-inline-start: auto;
	padding: 4px 9px;
	border-radius: 999px;
	background: var(--yht-tiptap-hover);
	color: var(--yht-tiptap-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
}

.yht-tiptap-grammar-status[data-status="error"] {
	color: #ef4444;
}

.yht-tiptap-grammar-status[hidden] {
	display: none;
}

.yht-tiptap-button svg {
	display: block;
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.yht-tiptap-button[data-command="preview"] {
	color: var(--yht-tiptap-accent) !important;
}

.yht-tiptap-content {
	box-sizing: border-box;
	min-height: var(--yht-tiptap-min-height, 250px);
	max-height: 65vh;
	padding: 32px 36px 40px;
	overflow-x: auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: transparent;
	color: var(--yht-tiptap-text);
	font-family: var(--yht-tiptap-font-family, inherit);
	font-size: var(--yht-tiptap-font-size, 16px);
	line-height: var(--yht-tiptap-line-height, 1.6);
	text-align: start;
	-webkit-user-select: text;
	user-select: text;
	-webkit-tap-highlight-color: transparent;
}

.yht-tiptap-content .tiptap {
	min-height: inherit;
	outline: none;
}

.yht-tiptap-content ::selection {
	background: rgba(122, 82, 255, 0.22);
	color: inherit;
}

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

.yht-tiptap-content p:last-child {
	margin-bottom: 0;
}

.yht-tiptap-content h1,
.yht-tiptap-content h2,
.yht-tiptap-content h3,
.yht-tiptap-content h4,
.yht-tiptap-content h5,
.yht-tiptap-content h6 {
	margin: 1.2em 0 0.55em;
	font-family: inherit;
	font-weight: 700;
	line-height: 1.25;
}

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

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

.yht-tiptap-content h3 {
	font-size: 1.15em;
}

.yht-tiptap-content > :first-child {
	margin-top: 0;
}

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

.yht-tiptap-content li {
	margin: 0.2em 0;
}

.yht-tiptap-content blockquote {
	margin: 1.15em 0;
	padding: 0.2em 0 0.2em 1em;
	border-inline-start: 3px solid var(--yht-tiptap-accent);
	color: var(--yht-tiptap-muted);
}

.yht-tiptap-content pre {
	box-sizing: border-box;
	margin: 1.15em 0;
	padding: 14px 16px;
	overflow-x: auto;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 10px;
	background: var(--yht-tiptap-hover);
	font-size: 0.9em;
	line-height: 1.5;
}

.yht-tiptap-content code {
	border-radius: 4px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.yht-tiptap-content :not(pre) > code {
	padding: 0.15em 0.35em;
	background: var(--yht-tiptap-hover);
}

.yht-tiptap-content mark {
	padding: 0.08em 0.16em;
	border-radius: 4px;
	background: #ffe58f;
	box-decoration-break: clone;
	color: inherit;
	-webkit-box-decoration-break: clone;
}

.yht-tiptap-content mark[data-color="yellow"] {
	background: #ffe58f;
}

.yht-tiptap-content mark[data-color="green"] {
	background: #a7f3c2;
}

.yht-tiptap-content mark[data-color="blue"] {
	background: #b9ddff;
}

.yht-tiptap-content mark[data-color="pink"] {
	background: #ffc6df;
}

.yht-tiptap-content .yht-grammar-error {
	border-radius: 3px;
	background: rgba(239, 68, 68, 0.12);
	color: inherit;
	cursor: pointer;
	text-decoration: underline wavy #ef4444;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.yht-tiptap-content img {
	display: inline-block;
	max-width: 100%;
	height: auto;
	margin: 0.75em 0;
	border-radius: 10px;
	vertical-align: middle;
}

.yht-tiptap-content img.ProseMirror-selectednode {
	outline: 3px solid rgba(122, 82, 255, 0.35);
	outline-offset: 2px;
}

.yht-tiptap-content a {
	color: var(--yht-tiptap-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.yht-tiptap-content a:hover {
	color: var(--yht-tiptap-accent-hover);
}

.yht-tiptap-content hr {
	height: 1px;
	margin: 1.5em 0;
	border: 0;
	background: var(--yht-tiptap-border);
}

.yht-tiptap-content .is-empty::before,
.yht-tiptap-content p.is-editor-empty:first-child::before {
	color: var(--yht-tiptap-muted);
	content: attr(data-placeholder);
	float: left;
	height: 0;
	font-style: italic;
	pointer-events: none;
}

@keyframes yht-tiptap-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (max-width: 600px) {
	.yht-tiptap-shell {
		border-radius: 10px;
	}

	.yht-tiptap-toolbar {
		gap: 2px;
		min-height: 46px;
		padding: 6px;
		padding-bottom: calc(6px + env(safe-area-inset-bottom));
	}

	.yht-tiptap-toolbar-group + .yht-tiptap-toolbar-group {
		margin-inline-start: 2px;
		padding-inline-start: 2px;
	}

	.yht-tiptap-button {
		min-width: 30px;
		height: 30px;
		padding: 5px 6px;
		border-radius: 9px;
	}

	.yht-tiptap-content {
		max-height: 70vh;
		padding: 22px 18px 30px;
	}
}
