.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: hsla(var(--xf-editorButtonActiveColor, 122, 82, 255, 1));
	--yht-tiptap-accent-hover: hsla(var(--xf-linkHoverColor, 86, 53, 202, 1));
	--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: hsla(var(--xf-editorButtonHoverBg, 127, 127, 127, 0.12));
	--yht-tiptap-active: hsla(var(--xf-editorButtonSelectedBg, 122, 82, 255, 0.16));
	--yht-tiptap-button-hover-color: hsla(var(--xf-editorButtonHoverColor, 32, 32, 32, 1));
	--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);
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: visible;
	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-surface: #ffffff;
	--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-surface: #0e0e11;
	--yht-tiptap-accent: #a78bfa;
	--yht-tiptap-accent-hover: #c4b5fd;
	--yht-tiptap-hover: rgba(255, 255, 255, 0.08);
	--yht-tiptap-active: rgba(167, 139, 250, 0.18);
	--yht-tiptap-button-hover-color: #f5f5f5;
	--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="dark"] .yht-tiptap-theme-icon__moon,
.yht-tiptap-shell[data-yht-color-scheme="light"] .yht-tiptap-theme-icon__sun {
	display: inline;
}

textarea.yht-tiptap-bbcode {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 250px;
	padding: 24px 28px;
	border: 0;
	border-bottom: 1px solid var(--yht-tiptap-border);
	border-radius: 11px 11px 0 0;
	outline: none;
	resize: vertical;
	background: var(--yht-tiptap-surface) !important;
	box-shadow: none;
	color: var(--yht-tiptap-text) !important;
	-webkit-text-fill-color: var(--yht-tiptap-text);
	caret-color: var(--yht-tiptap-text);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 14px;
	line-height: 1.6;
}

textarea.yht-tiptap-bbcode:focus {
	box-shadow: inset 0 0 0 2px rgba(122, 82, 255, 0.24);
}

.yht-tiptap-shell[data-yht-mode="bbcode"] .yht-tiptap-content,
.yht-tiptap-shell[data-yht-mode="bbcode"] .yht-tiptap-toolbar-group:not(.yht-tiptap-toolbar-group--mode),
.yht-tiptap-shell[data-yht-mode="bbcode"] .yht-tiptap-grammar-status {
	display: none;
}

.yht-tiptap-shell[data-yht-mode="bbcode"] .yht-tiptap-speech-status {
	display: none;
}

.yht-tiptap-shell[data-yht-mode="bbcode"] .yht-tiptap-toolbar {
	justify-content: flex-end;
}

.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);
	border-radius: 0 0 11px 11px;
	background: var(--yht-tiptap-surface);
	box-shadow: 0 -1px 0 rgba(24, 24, 27, 0.02);
	font: inherit;
}

.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-toolbar {
	top: 0;
	bottom: auto;
	order: 0;
	border-top: 0;
	border-bottom: 1px solid var(--yht-tiptap-border);
	border-radius: 11px 11px 0 0;
	box-shadow: 0 1px 0 rgba(24, 24, 27, 0.02);
}

.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-content,
.yht-tiptap-shell[data-yht-toolbar-position="top"] textarea.yht-tiptap-bbcode {
	order: 1;
	border-radius: 0 0 11px 11px;
}

.yht-tiptap-emoji-picker {
	position: absolute;
	inset-inline-start: 12px;
	bottom: 62px;
	z-index: 20;
	box-sizing: border-box;
	width: min(420px, calc(100% - 24px));
	max-height: min(430px, 65vh);
	padding: 10px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 14px;
	background: var(--yht-tiptap-surface);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
	color: var(--yht-tiptap-text);
}

.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-emoji-picker {
	top: 62px;
	bottom: auto;
}

.yht-tiptap-emoji-picker[hidden] {
	display: none;
}

.yht-tiptap-emoji-search {
	box-sizing: border-box;
	width: 100%;
	height: 36px;
	padding: 7px 10px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 9px;
	outline: none;
	background: var(--yht-tiptap-hover);
	box-shadow: none;
	color: var(--yht-tiptap-text) !important;
	font: inherit;
	font-size: 13px;
}

.yht-tiptap-emoji-search:focus {
	border-color: var(--yht-tiptap-accent);
	box-shadow: 0 0 0 2px rgba(122, 82, 255, 0.2);
}

.yht-tiptap-emoji-tabs {
	display: flex;
	gap: 4px;
	margin-top: 8px;
	padding-bottom: 7px;
	overflow-x: auto;
	border-bottom: 1px solid var(--yht-tiptap-border);
	scrollbar-width: thin;
}

.yht-tiptap-emoji-tabs[hidden] {
	display: none;
}

.yht-tiptap-emoji-tabs button {
	flex: 0 0 auto;
	padding: 5px 8px;
	border: 0;
	border-radius: 8px;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--yht-tiptap-muted) !important;
	font: inherit;
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
}

.yht-tiptap-emoji-tabs button:hover,
.yht-tiptap-emoji-tabs button.is-active {
	background: var(--yht-tiptap-active) !important;
	color: var(--yht-tiptap-accent) !important;
}

.yht-tiptap-emoji-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
	gap: 3px;
	max-height: 270px;
	margin-top: 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.yht-tiptap-emoji {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	min-width: 40px;
	padding: 0;
	border: 0;
	border-radius: 9px;
	background: transparent !important;
	box-shadow: none !important;
	color: inherit !important;
	font-size: 23px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 100ms ease, transform 100ms ease;
}

.yht-tiptap-emoji:hover,
.yht-tiptap-emoji:focus-visible {
	border: 0;
	background: var(--yht-tiptap-hover) !important;
	box-shadow: none !important;
	outline: none;
	transform: scale(1.06);
}

.yht-tiptap-emoji-empty {
	grid-column: 1 / -1;
	padding: 24px 8px;
	color: var(--yht-tiptap-muted);
	font-size: 13px;
	text-align: center;
}

.yht-tiptap-link-dialog {
	position: absolute;
	inset-inline-start: 12px;
	bottom: 62px;
	z-index: 20;
	box-sizing: border-box;
	width: min(440px, calc(100% - 24px));
	padding: 14px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 14px;
	background: var(--yht-tiptap-surface);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
	color: var(--yht-tiptap-text);
}

.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-link-dialog {
	top: 62px;
	bottom: auto;
}

.yht-tiptap-link-dialog[hidden] {
	display: none;
}

.yht-tiptap-link-row {
	display: flex;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 8px;
}

.yht-tiptap-link-field {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	margin-bottom: 10px;
}

.yht-tiptap-link-label {
	display: block;
	margin-bottom: 4px;
	color: var(--yht-tiptap-muted);
	font-size: 12px;
	font-weight: 600;
}

.yht-tiptap-link-input {
	box-sizing: border-box;
	width: 100%;
	height: 36px;
	padding: 7px 10px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 9px;
	outline: none;
	background: var(--yht-tiptap-hover);
	box-shadow: none;
	color: var(--yht-tiptap-text) !important;
	font: inherit;
	font-size: 13px;
}

.yht-tiptap-link-input:focus {
	border-color: var(--yht-tiptap-accent);
}

.yht-tiptap-link-paste {
	flex: 0 0 auto;
	height: 36px;
	margin-bottom: 10px;
	padding: 0 12px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 9px;
	background: var(--yht-tiptap-hover);
	color: var(--yht-tiptap-text);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.yht-tiptap-link-paste:hover {
	background: var(--yht-tiptap-active);
}

.yht-tiptap-link-upload {
	flex: 0 0 auto;
	height: 36px;
	margin-bottom: 10px;
	padding: 0 12px;
	border: 1px solid var(--yht-tiptap-accent);
	border-radius: 9px;
	background: var(--yht-tiptap-accent);
	color: #fff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.yht-tiptap-link-upload:hover:not(:disabled) {
	filter: brightness(1.08);
}

.yht-tiptap-link-upload:disabled {
	opacity: 0.6;
	cursor: progress;
}

.yht-tiptap-link-file {
	display: none;
}

.yht-tiptap-link-filename {
	flex: 1 1 100%;
	margin-bottom: 10px;
	overflow: hidden;
	color: var(--yht-tiptap-muted);
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.yht-tiptap-link-status {
	display: block;
	min-height: 1em;
	margin: -4px 0 8px;
	color: var(--yht-tiptap-muted);
	font-size: 12px;
}

.yht-tiptap-link-error {
	margin: 0 0 10px;
	color: #c0392b;
	font-size: 12px;
}

.yht-tiptap-shell[data-yht-color-scheme="dark"] .yht-tiptap-link-error {
	color: #f1948a;
}

.yht-tiptap-link-error[hidden] {
	display: none;
}

.yht-tiptap-link-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.yht-tiptap-link-button {
	height: 34px;
	padding: 0 14px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 9px;
	background: transparent;
	color: var(--yht-tiptap-text);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.yht-tiptap-link-button:hover {
	background: var(--yht-tiptap-hover);
}

.yht-tiptap-link-button--primary {
	border-color: var(--yht-tiptap-accent);
	background: var(--yht-tiptap-accent);
	color: #fff;
}

.yht-tiptap-link-button--primary:hover {
	background: var(--yht-tiptap-accent-hover);
}

.yht-tiptap-link-button--danger[hidden] {
	display: none;
}

.yht-tiptap-toolbar-group .yht-tiptap-button[aria-expanded="true"] {
	background: var(--yht-tiptap-active);
}

.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-button-hover-color) !important;
	outline: none;
}

.yht-tiptap-button:focus-visible {
	box-shadow: 0 0 0 2px hsla(var(--xf-editorButtonActiveColor, 122, 82, 255, 1)) !important;
}

.yht-tiptap-shell[data-yht-color-scheme="dark"] .yht-tiptap-button:focus-visible {
	box-shadow: 0 0 0 2px #a78bfa !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-speech-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	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-speech-status[data-status="error"] {
	color: #ef4444;
}

.yht-tiptap-speech-status[data-status="listening"] {
	color: var(--yht-tiptap-accent);
}

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

.yht-tiptap-button[data-command="speech"] {
	color: var(--yht-tiptap-muted);
}

.yht-tiptap-button[data-command="speech"].is-listening {
	color: #ef4444;
	background: rgba(239, 68, 68, 0.12);
}

.yht-tiptap-shell[data-yht-speech="listening"] .yht-tiptap-button[data-command="speech"] svg {
	animation: yht-tiptap-pulse 1.2s ease-in-out infinite;
}

@keyframes yht-tiptap-pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.35;
	}
}

@media (prefers-reduced-motion: reduce) {
	.yht-tiptap-shell[data-yht-speech="listening"] .yht-tiptap-button[data-command="speech"] svg {
		animation: none;
	}
}

.yht-tiptap-button svg {
	display: block;
	width: 17px;
	height: 17px;
	fill: none;
	stroke: var(--yht-tiptap-text);
	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 .yht-quote-attribution {
	margin: 0 0 0.4em;
	padding: 0;
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.4;
	user-select: none;
}

.yht-tiptap-content .yht-quote-attribution__name {
	color: var(--yht-tiptap-accent);
	text-decoration: none;
	cursor: pointer;
}

.yht-tiptap-content .yht-quote-attribution__name:hover {
	text-decoration: underline;
}

.yht-tiptap-content .yht-quote-attribution__name[href] {
	cursor: pointer;
}

.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,
mark.yht-highlight {
	padding: 0.08em 0.16em;
	border-radius: 4px;
	background: #ffe58f;
	box-decoration-break: clone;
	color: #202027;
	-webkit-box-decoration-break: clone;
}

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

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

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

.yht-tiptap-content mark[data-color="pink"],
mark.yht-highlight[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;
	float: inline-start;
	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-shell[data-yht-toolbar-position="top"] .yht-tiptap-toolbar {
		padding-top: calc(6px + env(safe-area-inset-top));
		padding-bottom: 6px;
	}

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

	.yht-tiptap-button {
		min-width: 44px;
		height: 44px;
		padding: 8px 10px;
		border-radius: 11px;
	}

	.yht-tiptap-emoji-picker {
		inset-inline-start: 8px;
		bottom: 56px;
		width: calc(100% - 16px);
		max-height: 60vh;
		padding: 8px;
	}

	.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-emoji-picker {
		top: 56px;
		bottom: auto;
	}

	.yht-tiptap-emoji-results {
		max-height: 230px;
	}

	textarea.yht-tiptap-bbcode {
		min-height: 180px;
		padding: 18px;
	}

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

@media (max-width: 480px) {
	.yht-tiptap-content {
		padding: 16px 12px 24px;
	}
	.yht-tiptap-toolbar {
		min-height: 50px;
		padding: 8px;
		padding-bottom: calc(8px + env(safe-area-inset-bottom));
	}
	.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-toolbar {
		padding-top: calc(8px + env(safe-area-inset-top));
		padding-bottom: 8px;
	}
	.yht-tiptap-button {
		min-width: 44px;
		height: 44px;
		padding: 8px;
	}
	textarea.yht-tiptap-bbcode {
		min-height: 160px;
		padding: 14px;
	}
	.yht-tiptap-emoji-picker {
		inset-inline-start: 4px;
		width: calc(100% - 8px);
		max-height: 65vh;
		padding: 6px;
	}
	.yht-tiptap-emoji-results {
		max-height: 260px;
	}
	.yht-tiptap-gif-picker {
		inset-inline-start: 4px;
		bottom: 58px;
		width: calc(100% - 8px);
		max-height: 70vh;
		max-height: 70dvh;
		padding: 8px;
	}
	.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-gif-picker {
		top: 58px;
		bottom: auto;
	}
	.yht-tiptap-gif-results {
		grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
		gap: 3px;
		max-height: 240px;
	}
}

.yht-tiptap-gif-picker {
	position: absolute;
	inset-inline-start: 12px;
	bottom: 62px;
	z-index: 20;
	box-sizing: border-box;
	width: min(420px, calc(100% - 24px));
	max-height: min(430px, 65vh);
	max-height: min(430px, 65dvh);
	padding: 10px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 14px;
	background: var(--yht-tiptap-surface);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
	color: var(--yht-tiptap-text);
}

.yht-tiptap-shell[data-yht-toolbar-position="top"] .yht-tiptap-gif-picker {
	top: 62px;
	bottom: auto;
}

.yht-tiptap-gif-picker[hidden] {
	display: none;
}

.yht-tiptap-gif-search {
	box-sizing: border-box;
	width: 100%;
	height: 36px;
	padding: 7px 10px;
	border: 1px solid var(--yht-tiptap-border);
	border-radius: 9px;
	outline: none;
	background: var(--yht-tiptap-hover);
	box-shadow: none;
	color: var(--yht-tiptap-text) !important;
	font: inherit;
	font-size: 13px;
}

.yht-tiptap-gif-search:focus {
	border-color: var(--yht-tiptap-accent);
	box-shadow: 0 0 0 2px rgba(122, 82, 255, 0.2);
}

.yht-tiptap-gif-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
	gap: 4px;
	max-height: 320px;
	margin-top: 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.yht-tiptap-gif {
	display: block;
	aspect-ratio: 1;
	padding: 0;
	overflow: hidden;
	border: 1px solid transparent;
	border-radius: 9px;
	background: var(--yht-tiptap-hover) !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: border-color 100ms ease, transform 100ms ease;
}

.yht-tiptap-gif:hover,
.yht-tiptap-gif:focus-visible {
	border-color: var(--yht-tiptap-accent);
	transform: scale(1.03);
}

.yht-tiptap-gif img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.yht-tiptap-gif-empty {
	grid-column: 1 / -1;
	padding: 18px 6px;
	color: var(--yht-tiptap-muted);
	font-size: 13px;
	text-align: center;
}

.yht-tiptap-gif-empty--error {
	color: #d33;
}

.yht-tiptap-shell[data-yht-color-scheme="dark"] .yht-tiptap-gif-empty--error {
	color: #f1948a;
}

.yht-tiptap-message {
	margin-top: 6px;
	padding: 6px 9px;
	border-radius: 8px;
	background: var(--yht-tiptap-hover);
	color: var(--yht-tiptap-muted);
	font-size: 12px;
}

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

.yht-tiptap-message--error {
	color: #d33;
}

.yht-tiptap-shell[data-yht-color-scheme="dark"] .yht-tiptap-message--error {
	color: #f1948a;
}

/* --------------------------------------------------------------------- *
 * Inline suggestion dropdown.
 *
 * Unlike every other panel in this file, this one is appended to <body>
 * rather than living inside .yht-tiptap-shell, because it is positioned
 * against the viewport rather than the editor box. That means it cannot
 * inherit the --yht-tiptap-* custom properties, so it redefines the few it
 * needs from the same XenForo variables the shell uses. The script mirrors
 * the editor's light/dark choice onto data-yht-color-scheme.
 * --------------------------------------------------------------------- */

.yht-tiptap-suggest {
	--yht-suggest-border: hsla(var(--xf-borderColor--h, 0), var(--xf-borderColor--s, 0%), var(--xf-borderColor--l, 88%), var(--xf-borderColor--a, 1));
	--yht-suggest-text: hsla(var(--xf-editorColor--h, 0), var(--xf-editorColor--s, 0%), var(--xf-editorColor--l, 18%), var(--xf-editorColor--a, 1));
	--yht-suggest-muted: hsla(var(--xf-textColorMuted--h, 0), var(--xf-textColorMuted--s, 0%), var(--xf-textColorMuted--l, 52%), var(--xf-textColorMuted--a, 1));
	--yht-suggest-surface: hsla(var(--xf-editorBg--h, 0), var(--xf-editorBg--s, 0%), var(--xf-editorBg--l, 100%), var(--xf-editorBg--a, 1));
	--yht-suggest-active: hsla(var(--xf-editorButtonSelectedBg, 122, 82, 255, 0.16));
	--yht-suggest-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 8px 24px rgba(24, 24, 27, 0.14);
	box-sizing: border-box;
	position: fixed;
	z-index: 10000;
	min-width: 180px;
	max-width: min(320px, calc(100vw - 16px));
	border: 1px solid var(--yht-suggest-border);
	border-radius: 12px;
	background: var(--yht-suggest-surface);
	box-shadow: var(--yht-suggest-shadow);
	color: var(--yht-suggest-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	overflow: hidden;
}

.yht-tiptap-suggest[data-yht-color-scheme="dark"] {
	--yht-suggest-border: rgba(255, 255, 255, 0.12);
	--yht-suggest-text: #e6e6ec;
	--yht-suggest-muted: #9a9aa6;
	--yht-suggest-surface: #1f1f26;
	--yht-suggest-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
	color-scheme: dark;
}

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

.yht-tiptap-suggest-list {
	margin: 0;
	padding: 4px;
	list-style: none;
	max-height: 248px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.yht-tiptap-suggest-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 8px;
	cursor: pointer;
	white-space: nowrap;
}

.yht-tiptap-suggest-item:hover,
.yht-tiptap-suggest-item.is-active {
	background: var(--yht-suggest-active);
}

.yht-tiptap-suggest-avatar {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--yht-suggest-active);
}

.yht-tiptap-suggest-label {
	overflow: hidden;
	text-overflow: ellipsis;
}

.yht-tiptap-suggest-status {
	padding: 7px 10px;
	color: var(--yht-suggest-muted);
	font-size: 12px;
}

@media (max-width: 480px) {
	.yht-tiptap-suggest {
		max-width: calc(100vw - 16px);
	}

	.yht-tiptap-suggest-list {
		max-height: 200px;
	}
}

/* --------------------------------------------------------------------- *
 * Side-by-side BBCode panel.
 *
 * The rich editor and a BBCode textarea are shown together, and the panel is
 * kept in step with the editor by the dual-view script. The panel is a view
 * only: it carries no field name, so the field router still decides what is
 * submitted. Layout stacks them on narrow screens, where there is no room for
 * two columns.
 * --------------------------------------------------------------------- */

.yht-tiptap-shell.yht-tiptap-dual-active {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 8px;
}

.yht-tiptap-shell.yht-tiptap-dual-active .yht-tiptap-content {
	flex: 1 1 320px;
	min-width: 0;
}

.yht-tiptap-dual[hidden] {
	display: none !important;
}

.yht-tiptap-dual {
	flex: 1 1 320px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	border: 1px solid hsla(var(--xf-borderColor--h, 0), var(--xf-borderColor--s, 0%), var(--xf-borderColor--l, 88%), var(--xf-borderColor--a, 1));
	border-radius: 4px;
	overflow: hidden;
	background: hsla(var(--xf-editorBg--h, 0), var(--xf-editorBg--s, 0%), var(--xf-editorBg--l, 100%), var(--xf-editorBg--a, 1));
}

.yht-tiptap-dual-label {
	padding: 4px 8px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: hsla(var(--xf-textColorMuted--h, 0), var(--xf-textColorMuted--s, 0%), var(--xf-textColorMuted--l, 52%), var(--xf-textColorMuted--a, 1));
	border-bottom: 1px solid hsla(var(--xf-borderColor--h, 0), var(--xf-borderColor--s, 0%), var(--xf-borderColor--l, 88%), var(--xf-borderColor--a, 1));
}

.yht-tiptap-dual-bbcode {
	flex: 1 1 auto;
	width: 100%;
	min-height: 200px;
	resize: vertical;
	border: 0;
	outline: none;
	padding: 8px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	line-height: 1.5;
	color: hsla(var(--xf-editorColor--h, 0), var(--xf-editorColor--s, 0%), var(--xf-editorColor--l, 18%), var(--xf-editorColor--a, 1));
	background: transparent;
}

@media (max-width: 700px) {
	.yht-tiptap-shell.yht-tiptap-dual-active {
		display: block;
	}

	.yht-tiptap-dual {
		margin-top: 8px;
	}
}
