/* JTS Chat — public (light + dark themes) */

.jts-chat-wrap {
	--jts-red: #e11d2e;
	--jts-ink: #1a1a1a;
	--jts-muted: #5c5c5c;
	--jts-border: #e2e2e2;
	--jts-bg: #f7f7f8;
	--jts-msg-bg: #ffffff;
	--jts-panel: #ffffff;
	--jts-input-bg: #ffffff;
	--jts-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
	--jts-error: #7f1d1d;
	--jts-source-web-bg: #e8f0fe;
	--jts-source-web-fg: #1e40af;
	--jts-source-discord-bg: #ece9fe;
	--jts-source-discord-fg: #5b21b6;
	--jts-source-zoom-bg: #e0f2fe;
	--jts-source-zoom-fg: #075985;
	--jts-source-system-bg: #fef3c7;
	--jts-source-system-fg: #92400e;
	--jts-source-default-bg: #eee;
	--jts-tool-bg: rgba(255, 255, 255, 0.08);
	--jts-tool-border: rgba(255, 255, 255, 0.18);
	--jts-tool-hover: rgba(255, 255, 255, 0.16);
	--jts-radius: 12px;
	--jts-chat-height: 480px;
	max-width: 1100px;
	width: 100%;
	margin: 1.5rem auto 2rem;
	color: var(--jts-ink);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1rem;
	line-height: 1.45;
	border: 1px solid var(--jts-border);
	border-radius: var(--jts-radius);
	background: var(--jts-panel);
	box-shadow: var(--jts-shadow);
	overflow: hidden;
	box-sizing: border-box;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Dark theme */
.jts-chat-wrap.jts-chat-theme-dark {
	--jts-ink: #e8eaed;
	--jts-muted: #9aa0a6;
	--jts-border: #2a2f3a;
	--jts-bg: #12151c;
	--jts-msg-bg: #1a1f2a;
	--jts-panel: #0f1115;
	--jts-input-bg: #1a1f2a;
	--jts-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
	--jts-error: #fca5a5;
	--jts-source-web-bg: #1e3a5f;
	--jts-source-web-fg: #93c5fd;
	--jts-source-discord-bg: #2e1065;
	--jts-source-discord-fg: #c4b5fd;
	--jts-source-zoom-bg: #0c4a6e;
	--jts-source-zoom-fg: #7dd3fc;
	--jts-source-system-bg: #422006;
	--jts-source-system-fg: #fcd34d;
	--jts-source-default-bg: #2a2f3a;
	color-scheme: dark;
}

/* Light theme: force light native form controls too */
.jts-chat-wrap.jts-chat-theme-light {
	color-scheme: light;
}

.jts-chat-wrap *,
.jts-chat-wrap *::before,
.jts-chat-wrap *::after {
	box-sizing: border-box;
}

.jts-chat-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1rem;
	padding: 0.9rem 1.1rem;
	background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 55%, #1a1a1a 100%);
	color: #fff;
	border-bottom: 3px solid var(--jts-red);
}

.jts-chat-header-brand {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-width: 0;
	flex: 1 1 auto;
}

.jts-chat-logo {
	display: block;
	width: auto;
	height: 2.45rem; /* matches title + subtitle block */
	max-height: 2.45rem;
	flex-shrink: 0;
	object-fit: contain;
	border-radius: 50%;
}

.jts-chat-header-text {
	min-width: 0;
}

.jts-chat-title {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.2;
	color: #fff;
}

.jts-chat-version {
	font-size: 0.72rem;
	font-weight: 500;
	opacity: 0.65;
	margin-left: 0.25rem;
	letter-spacing: 0.02em;
}

.jts-chat-sub {
	margin: 0.2rem 0 0;
	font-size: 0.8rem;
	opacity: 0.75;
	color: #eee;
}

.jts-chat-header-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	margin-left: auto;
}

.jts-chat-room-select {
	font: inherit;
	font-size: 0.9rem;
	padding: 0.4rem 0.55rem;
	border-radius: 8px;
	border: 1px solid #444;
	background: #111;
	color: #fff;
	max-width: 100%;
}

.jts-chat-tool-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	padding: 0.38rem 0.6rem;
	border-radius: 8px;
	border: 1px solid var(--jts-tool-border);
	background: var(--jts-tool-bg);
	color: #fff;
	cursor: pointer;
	line-height: 1.2;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.15s ease;
}

/* Icon-only header controls */
.jts-chat-tool-btn.jts-chat-tool-icon {
	width: 2.15rem;
	height: 2.15rem;
	padding: 0;
	gap: 0;
}

.jts-chat-tool-btn:hover,
.jts-chat-tool-btn:focus {
	background: var(--jts-tool-hover);
	outline: none;
}

.jts-chat-tool-btn:focus-visible {
	outline: 2px solid rgba(225, 29, 46, 0.55);
	outline-offset: 2px;
}

.jts-chat-theme-icon,
.jts-chat-popout-icon,
.jts-chat-settings-icon,
.jts-chat-logout-icon {
	font-size: 1.1rem;
	line-height: 1;
}

.jts-chat-settings-icon {
	font-size: 1.15rem;
}

/* Show moon in light mode (click to go dark), sun in dark mode */
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-theme-icon-moon {
	display: none;
}
.jts-chat-wrap:not(.jts-chat-theme-dark) .jts-chat-theme-icon-sun {
	display: none;
}

.jts-chat-status {
	min-height: 0;
	padding: 0 1rem;
	font-size: 0.85rem;
	color: var(--jts-muted);
	background: var(--jts-panel);
}

.jts-chat-status:not(:empty) {
	padding: 0.5rem 1rem 0;
}

.jts-chat-status.is-error {
	color: var(--jts-error);
}

/* Main + people side panel */
.jts-chat-body-row {
	display: flex;
	align-items: stretch;
	min-height: 0;
	flex: 1 1 auto;
	border-top: 1px solid var(--jts-border);
}

.jts-chat-main-col {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.jts-chat-messages {
	height: var(--jts-chat-height);
	overflow-y: auto;
	padding: 0.75rem 1rem;
	background: var(--jts-bg);
	border-bottom: 1px solid var(--jts-border);
	scroll-behavior: smooth;
	flex: 1 1 auto;
}

/* Online people panel (right) */
.jts-chat-people-panel {
	flex: 0 0 168px;
	width: 168px;
	max-width: 40%;
	border-left: 1px solid var(--jts-border);
	background: var(--jts-panel);
	display: flex;
	flex-direction: row;
	align-items: stretch;
	transition: flex-basis 0.18s ease, width 0.18s ease;
	position: relative;
}

.jts-chat-people-panel.is-collapsed {
	flex-basis: 28px;
	width: 28px;
	max-width: 28px;
}

.jts-chat-people-toggle {
	flex: 0 0 28px;
	width: 28px;
	border: none;
	border-right: 1px solid var(--jts-border);
	background: var(--jts-bg);
	color: var(--jts-muted);
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.jts-chat-people-toggle:hover,
.jts-chat-people-toggle:focus {
	color: var(--jts-red);
	background: var(--jts-input-bg);
	outline: none;
}

.jts-chat-people-inner {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	padding: 0.55rem 0.55rem 0.65rem 0.4rem;
}

.jts-chat-people-panel.is-collapsed .jts-chat-people-inner {
	display: none;
}

.jts-chat-people-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.35rem;
	margin-bottom: 0.45rem;
	padding-bottom: 0.35rem;
	border-bottom: 1px solid var(--jts-border);
}

.jts-chat-people-title {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--jts-muted);
}

.jts-chat-people-count {
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--jts-ink);
	background: var(--jts-bg);
	border-radius: 999px;
	padding: 0.05rem 0.4rem;
	border: 1px solid var(--jts-border);
}

.jts-chat-people-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	flex: 1 1 auto;
	max-height: var(--jts-chat-height);
}

.jts-chat-people-list li {
	font-size: 0.88rem;
	line-height: 1.3;
	padding: 0.28rem 0.2rem;
	color: var(--jts-ink);
	border-bottom: 1px solid transparent;
	word-break: break-word;
}

.jts-chat-people-list li:hover {
	background: var(--jts-bg);
	border-radius: 6px;
}

.jts-chat-people-empty {
	font-size: 0.82rem;
	color: var(--jts-muted);
	padding: 0.35rem 0.15rem;
	font-style: italic;
}

.jts-chat-wrap.is-popout .jts-chat-body-row {
	flex: 1 1 auto;
	min-height: 0;
}

.jts-chat-wrap.is-popout .jts-chat-main-col {
	min-height: 0;
}

.jts-chat-wrap.is-popout .jts-chat-messages {
	height: auto !important;
	min-height: 0;
}

.jts-chat-wrap.is-popout .jts-chat-people-list {
	max-height: none;
}

@media (max-width: 560px) {
	.jts-chat-people-panel:not(.is-collapsed) {
		flex-basis: 120px;
		width: 120px;
	}
}

.jts-chat-empty {
	margin: 2rem 0;
	text-align: center;
	color: var(--jts-muted);
	font-size: 0.95rem;
}

.jts-chat-msg {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.15rem 0.75rem;
	margin-bottom: 0.65rem;
	padding: 0.55rem 0.7rem;
	background: var(--jts-msg-bg);
	border: 1px solid var(--jts-border);
	border-radius: 10px;
	animation: jts-chat-in 0.2s ease;
}

@keyframes jts-chat-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.jts-chat-msg-meta {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem 0.6rem;
	font-size: 0.8rem;
}

.jts-chat-msg-name {
	font-weight: 700;
	color: var(--jts-ink);
}

.jts-chat-msg-source {
	display: inline-block;
	padding: 0.08rem 0.4rem;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	background: var(--jts-source-default-bg);
	color: var(--jts-muted);
}

.jts-chat-msg-source[data-source="web"] {
	background: var(--jts-source-web-bg);
	color: var(--jts-source-web-fg);
}

.jts-chat-msg-source[data-source="discord"] {
	background: var(--jts-source-discord-bg);
	color: var(--jts-source-discord-fg);
}

.jts-chat-msg-source[data-source="zoom"] {
	background: var(--jts-source-zoom-bg);
	color: var(--jts-source-zoom-fg);
}

.jts-chat-msg-source[data-source="system"] {
	background: var(--jts-source-system-bg);
	color: var(--jts-source-system-fg);
}

.jts-chat-msg-time {
	margin-left: auto;
	color: var(--jts-muted);
	font-variant-numeric: tabular-nums;
}

.jts-chat-msg-delete {
	font: inherit;
	font-size: 0.72rem;
	font-weight: 600;
	padding: 0.12rem 0.4rem;
	border-radius: 6px;
	border: 1px solid var(--jts-border);
	background: transparent;
	color: var(--jts-muted);
	cursor: pointer;
	line-height: 1.2;
}

.jts-chat-msg-delete:hover,
.jts-chat-msg-delete:focus {
	color: var(--jts-red);
	border-color: var(--jts-red);
	outline: none;
}

.jts-chat-msg.is-deleted {
	background: transparent;
	border-style: dashed;
	opacity: 0.85;
	padding: 0.4rem 0.7rem;
}

.jts-chat-msg-deleted {
	font-size: 0.78rem;
	font-style: italic;
	color: var(--jts-muted);
	opacity: 0.75;
	letter-spacing: 0.01em;
}

.jts-chat-msg-body {
	grid-column: 1 / -1;
	/* newlines handled as <br> when embeds/links present */
	white-space: normal;
	word-break: break-word;
	font-size: 0.98rem;
}

.jts-chat-ext-link {
	color: var(--jts-red);
	word-break: break-all;
}

.jts-chat-wrap.jts-chat-theme-dark .jts-chat-ext-link {
	color: #f87171;
}

/* Media embeds (YouTube / Instagram / TikTok) */
.jts-chat-embed {
	margin: 0.5rem 0 0.25rem;
	max-width: 100%;
}

.jts-chat-embed-frame {
	position: relative;
	width: 100%;
	border-radius: 10px;
	overflow: hidden;
	background: #000;
	border: 1px solid var(--jts-border);
}

.jts-chat-embed-frame--wide {
	max-width: 560px;
	aspect-ratio: 16 / 9;
}

.jts-chat-embed-frame--vertical {
	max-width: 320px;
	aspect-ratio: 9 / 16;
	max-height: min(70vh, 640px);
	margin-left: auto;
	margin-right: auto;
}

.jts-chat-embed-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.jts-chat-embed-link,
.jts-chat-yt-link {
	display: inline-block;
	margin-top: 0.3rem;
	font-size: 0.8rem;
	color: var(--jts-muted);
	text-decoration: underline;
}

.jts-chat-embed-link:hover,
.jts-chat-yt-link:hover {
	color: var(--jts-red);
}

/* Legacy class names kept harmless if old cached HTML somehow present */
.jts-chat-yt {
	margin: 0.5rem 0 0.25rem;
}
.jts-chat-yt-frame {
	position: relative;
	width: 100%;
	max-width: 560px;
	aspect-ratio: 16 / 9;
	border-radius: 10px;
	overflow: hidden;
	background: #000;
}
.jts-chat-yt-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.jts-chat-form {
	padding: 0.85rem 1rem 1rem;
	background: var(--jts-panel);
}

.jts-chat-hp {
	position: absolute !important;
	left: -9999px !important;
	height: 0 !important;
	width: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.jts-chat-label {
	display: block;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--jts-muted);
	margin-bottom: 0.35rem;
}

.jts-chat-label span {
	display: block;
	margin-bottom: 0.25rem;
}

.jts-chat-label-grow {
	flex: 1;
	min-width: 0;
	margin-bottom: 0;
}

.jts-chat-name,
.jts-chat-body,
.jts-chat-wrap input.jts-chat-name,
.jts-chat-wrap textarea.jts-chat-body {
	width: 100%;
	font: inherit;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--jts-border);
	border-radius: 8px;
	background: var(--jts-input-bg);
	background-color: var(--jts-input-bg);
	color: var(--jts-ink);
	caret-color: var(--jts-ink);
	/* Avoid UA “light field” look that ignores parent theme */
	color-scheme: inherit;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.jts-chat-name::placeholder,
.jts-chat-body::placeholder {
	color: var(--jts-muted);
	opacity: 0.85;
}

/* Dark: hard-set colors so browser / autofill cannot leave a white box with light text */
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-name,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-body,
.jts-chat-wrap.jts-chat-theme-dark input.jts-chat-name,
.jts-chat-wrap.jts-chat-theme-dark textarea.jts-chat-body {
	background: #1a1f2a;
	background-color: #1a1f2a;
	color: #e8eaed;
	-webkit-text-fill-color: #e8eaed;
	caret-color: #e8eaed;
	border-color: #2a2f3a;
}

.jts-chat-wrap.jts-chat-theme-dark .jts-chat-name::placeholder,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-body::placeholder {
	color: #9aa0a6;
	-webkit-text-fill-color: #9aa0a6;
	opacity: 1;
}

.jts-chat-wrap.jts-chat-theme-dark .jts-chat-name:-webkit-autofill,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-name:-webkit-autofill:hover,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-name:-webkit-autofill:focus,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-body:-webkit-autofill,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-body:-webkit-autofill:hover,
.jts-chat-wrap.jts-chat-theme-dark .jts-chat-body:-webkit-autofill:focus {
	-webkit-text-fill-color: #e8eaed;
	caret-color: #e8eaed;
	box-shadow: 0 0 0 1000px #1a1f2a inset;
	transition: background-color 99999s ease-in-out 0s;
}

.jts-chat-name:focus,
.jts-chat-body:focus,
.jts-chat-room-select:focus {
	outline: 2px solid rgba(225, 29, 46, 0.35);
	border-color: var(--jts-red);
}

.jts-chat-compose {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start; /* top-align + / Send with text box */
	margin-top: 0.5rem;
}

.jts-chat-attach-btn {
	flex-shrink: 0;
	width: 2.5rem;
	height: 2.5rem;
	/* Match textarea top padding + border so + lines up with first line area */
	margin-top: 0;
	border-radius: 8px;
	border: 1px solid var(--jts-border);
	background: var(--jts-input-bg);
	color: var(--jts-ink);
	font-size: 1.4rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.jts-chat-attach-btn:hover,
.jts-chat-attach-btn:focus {
	border-color: var(--jts-red);
	color: var(--jts-red);
	outline: none;
}

.jts-chat-attach-status {
	margin: 0.4rem 0 0;
	font-size: 0.82rem;
	color: var(--jts-muted);
}

.jts-chat-attach-status.is-error {
	color: var(--jts-error);
}

.jts-chat-img-link {
	display: inline-block;
	max-width: 100%;
	margin: 0.35rem 0 0.15rem;
	line-height: 0;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid var(--jts-border);
	background: #000;
}

.jts-chat-img {
	display: block;
	max-width: min(100%, 420px);
	max-height: 320px;
	width: auto;
	height: auto;
	object-fit: contain;
	vertical-align: middle;
}

.jts-chat-img-link:hover {
	border-color: var(--jts-red);
}

.jts-chat-body {
	resize: vertical;
	min-height: 2.75rem;
	max-height: 8rem;
}

.jts-chat-send {
	flex-shrink: 0;
	font: inherit;
	font-weight: 700;
	/* Match attach button height and top-align with text box */
	height: 2.5rem;
	min-height: 2.5rem;
	padding: 0 1.15rem;
	border: none;
	border-radius: 8px;
	background: var(--jts-red);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, transform 0.1s ease;
}

.jts-chat-send:hover {
	background: #c41524;
}

.jts-chat-send:active {
	transform: scale(0.98);
}

.jts-chat-send:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.jts-chat-hint {
	margin: 0.65rem 0 0;
	font-size: 0.8rem;
	color: var(--jts-muted);
	line-height: 1.35;
}

.jts-chat-wrap.is-closed .jts-chat-compose {
	opacity: 0.45;
	pointer-events: none;
}

/* Login required to send — chat-only auth */
.jts-chat-login-gate {
	padding: 1rem 1.1rem 1.15rem;
	background: var(--jts-panel);
	border-top: 1px solid var(--jts-border);
	text-align: center;
}

.jts-chat-login-prompt {
	margin: 0 0 0.75rem;
	font-size: 0.92rem;
	color: var(--jts-muted);
	line-height: 1.4;
}

.jts-chat-login-actions {
	margin: 0;
}

.jts-chat-login-btn,
.jts-chat-magic-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.6rem 1.15rem;
	border-radius: 8px;
	border: none;
	background: var(--jts-red);
	color: #fff !important;
	font: inherit;
	font-weight: 700;
	text-decoration: none !important;
	cursor: pointer;
	transition: background 0.15s ease;
	width: 100%;
	max-width: 320px;
	box-sizing: border-box;
}

.jts-chat-login-btn:hover,
.jts-chat-login-btn:focus,
.jts-chat-magic-submit:hover,
.jts-chat-magic-submit:focus {
	background: #c41524;
	color: #fff !important;
}

.jts-chat-oauth-row {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	align-items: center;
	margin: 0.75rem 0;
}

.jts-chat-oauth-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 320px;
	padding: 0.6rem 1rem;
	border-radius: 8px;
	font-weight: 700;
	text-decoration: none !important;
	border: 1px solid var(--jts-border);
	box-sizing: border-box;
	cursor: pointer;
	font: inherit;
	line-height: 1.25;
}

.jts-chat-oauth-btn:disabled {
	opacity: 0.65;
	cursor: wait;
}

.jts-chat-google-status {
	margin: 0.35rem 0 0;
	font-size: 0.85rem;
	color: var(--jts-muted);
	text-align: center;
	max-width: 320px;
}

.jts-chat-google-status.is-error {
	color: #b42318;
}

.jts-chat-wrap.jts-chat-theme-dark .jts-chat-google-status.is-error {
	color: #f97066;
}

.jts-chat-oauth-google {
	background: #fff;
	color: #1a1a1a !important;
}

.jts-chat-wrap.jts-chat-theme-dark .jts-chat-oauth-google {
	background: #1a1f2a;
	color: #e8eaed !important;
	border-color: #2a2f3a;
}

.jts-chat-oauth-discord {
	background: #5865f2;
	color: #fff !important;
	border-color: #4752c4;
}

.jts-chat-or {
	margin: 0.85rem 0 0.5rem;
	font-size: 0.8rem;
	color: var(--jts-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.jts-chat-magic-form {
	max-width: 320px;
	margin: 0 auto;
	text-align: left;
}

.jts-chat-magic-form .jts-chat-label {
	margin-bottom: 0.65rem;
}

.jts-chat-magic-form input[type='email'],
.jts-chat-magic-form input[type='text'] {
	width: 100%;
	font: inherit;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--jts-border);
	border-radius: 8px;
	background: var(--jts-input-bg);
	color: var(--jts-ink);
	box-sizing: border-box;
}

.jts-chat-optional {
	font-weight: 500;
	color: var(--jts-muted);
}

.jts-chat-magic-msg {
	margin: 0.65rem 0 0;
	font-size: 0.88rem;
	color: var(--jts-muted);
	text-align: center;
	min-height: 1.2em;
}

.jts-chat-signed-in {
	margin: 0 0 0.5rem;
	font-size: 0.88rem;
	color: var(--jts-muted);
}

.jts-chat-signed-name {
	color: var(--jts-ink);
}

.jts-chat-staff-badge {
	display: inline-block;
	margin-left: 0.35rem;
	padding: 0.1rem 0.4rem;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	background: #fef3c7;
	color: #92400e;
}

.jts-chat-wrap.jts-chat-theme-dark .jts-chat-staff-badge {
	background: #422006;
	color: #fcd34d;
}

.jts-chat-status .is-error {
	color: var(--jts-error);
	font-weight: 600;
}

/* User settings panel */
.jts-chat-settings-panel {
	border-bottom: 1px solid var(--jts-border);
	background: var(--jts-bg);
	padding: 0.85rem 1rem 1rem;
}

.jts-chat-settings-panel[hidden] {
	display: none !important;
}

.jts-chat-settings-inner {
	max-width: 420px;
}

.jts-chat-settings-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.5rem;
	color: var(--jts-ink);
}

.jts-chat-settings-close {
	font: inherit;
	border: none;
	background: transparent;
	color: var(--jts-muted);
	cursor: pointer;
	font-size: 1.1rem;
	line-height: 1;
	padding: 0.2rem 0.4rem;
}

.jts-chat-settings-help,
.jts-chat-settings-hint {
	font-size: 0.82rem;
	color: var(--jts-muted);
	margin: 0 0 0.75rem;
	line-height: 1.35;
}

.jts-chat-boss-key-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.jts-chat-checkbox-label {
	display: flex !important;
	flex-direction: row !important;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0.75rem 0 0.25rem;
	cursor: pointer;
	font-weight: 600;
	color: var(--jts-ink);
}

.jts-chat-checkbox-label input {
	margin-top: 0.2rem;
	flex-shrink: 0;
}

.jts-chat-checkbox-label span {
	display: inline !important;
	margin: 0 !important;
	font-weight: 600;
}

.jts-chat-boss-key-display {
	display: inline-block;
	min-width: 5rem;
	padding: 0.35rem 0.55rem;
	border-radius: 6px;
	background: var(--jts-input-bg);
	border: 1px solid var(--jts-border);
	color: var(--jts-ink);
	font-size: 0.9rem;
}

.jts-chat-boss-preview-wrap {
	margin: 0.5rem 0 0.75rem;
	min-height: 80px;
}

.jts-chat-boss-preview {
	display: block;
	max-width: 100%;
	max-height: 160px;
	border-radius: 8px;
	border: 1px solid var(--jts-border);
	object-fit: contain;
	background: #111;
}

.jts-chat-boss-preview-empty {
	margin: 0;
	font-size: 0.82rem;
	color: var(--jts-muted);
}

.jts-chat-settings-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.jts-chat-settings-actions .jts-chat-login-btn {
	width: auto;
	max-width: none;
}

.jts-chat-settings-msg {
	margin: 0.6rem 0 0;
	font-size: 0.85rem;
	color: var(--jts-muted);
	min-height: 1.2em;
}

.jts-chat-boss-image-input {
	width: 100%;
	font: inherit;
	font-size: 0.85rem;
	color: var(--jts-ink);
}

/* Boss key overlay (pop-out) */
.jts-chat-boss-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: #1a1a1a;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.jts-chat-boss-overlay[hidden] {
	display: none !important;
}

.jts-chat-boss-overlay-img {
	display: none;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

.jts-chat-boss-overlay.has-image .jts-chat-boss-overlay-img {
	display: block;
}

.jts-chat-boss-overlay.has-image .jts-chat-boss-overlay-fallback {
	display: none;
}

.jts-chat-boss-overlay-fallback {
	text-align: center;
	padding: 1.5rem;
	width: min(100%, 720px);
}

.jts-chat-boss-fake-ui {
	background: #f3f4f6;
	color: #111;
	border-radius: 6px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
	overflow: hidden;
	text-align: left;
}

.jts-chat-boss-fake-title {
	background: #e5e7eb;
	padding: 0.45rem 0.75rem;
	font-size: 0.85rem;
	font-weight: 600;
	border-bottom: 1px solid #d1d5db;
}

.jts-chat-boss-fake-lines {
	padding: 1rem 0.9rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.jts-chat-boss-fake-lines span {
	display: block;
	height: 10px;
	border-radius: 3px;
	background: linear-gradient(90deg, #d1d5db 0%, #e5e7eb 50%, #d1d5db 100%);
}

.jts-chat-boss-fake-lines span:nth-child(1) { width: 92%; }
.jts-chat-boss-fake-lines span:nth-child(2) { width: 78%; }
.jts-chat-boss-fake-lines span:nth-child(3) { width: 85%; }
.jts-chat-boss-fake-lines span:nth-child(4) { width: 60%; }
.jts-chat-boss-fake-lines span:nth-child(5) { width: 88%; }
.jts-chat-boss-fake-lines span:nth-child(6) { width: 70%; }
.jts-chat-boss-fake-lines span:nth-child(7) { width: 95%; }
.jts-chat-boss-fake-lines span:nth-child(8) { width: 55%; }

.jts-chat-boss-overlay-hint {
	margin: 1rem 0 0;
	font-size: 0.75rem;
	color: #9ca3af;
	opacity: 0.7;
}

.jts-chat-name[readonly] {
	opacity: 0.9;
	cursor: default;
}

.jts-chat-disabled {
	padding: 1.25rem;
	text-align: center;
	color: var(--jts-muted);
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

@media (max-width: 560px) {
	.jts-chat-compose {
		flex-direction: column;
		align-items: stretch;
	}

	.jts-chat-send {
		width: 100%;
	}

	.jts-chat-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.jts-chat-header-actions {
		margin-left: 0;
		width: 100%;
	}

	.jts-chat-tool-label {
		/* keep labels on mobile for clarity */
	}
}

/* Prefer dark when shortcode theme=auto and no JS class yet + system prefers dark */
@media (prefers-color-scheme: dark) {
	.jts-chat-wrap:not(.jts-chat-theme-light):not(.jts-chat-theme-dark) {
		--jts-ink: #e8eaed;
		--jts-muted: #9aa0a6;
		--jts-border: #2a2f3a;
		--jts-bg: #12151c;
		--jts-msg-bg: #1a1f2a;
		--jts-panel: #0f1115;
		--jts-input-bg: #1a1f2a;
		--jts-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
		--jts-error: #fca5a5;
		--jts-source-web-bg: #1e3a5f;
		--jts-source-web-fg: #93c5fd;
		--jts-source-discord-bg: #2e1065;
		--jts-source-discord-fg: #c4b5fd;
		--jts-source-zoom-bg: #0c4a6e;
		--jts-source-zoom-fg: #7dd3fc;
		--jts-source-system-bg: #422006;
		--jts-source-system-fg: #fcd34d;
		--jts-source-default-bg: #2a2f3a;
	}
	.jts-chat-wrap:not(.jts-chat-theme-light):not(.jts-chat-theme-dark) .jts-chat-theme-icon-moon {
		display: none;
	}
	.jts-chat-wrap:not(.jts-chat-theme-light):not(.jts-chat-theme-dark) .jts-chat-theme-icon-sun {
		display: inline;
	}
}

/* ——— Status card / widget ——— */

.jts-chat-status-card {
	--jts-red: #e11d2e;
	--jts-ink: #1a1a1a;
	--jts-muted: #5c5c5c;
	--jts-border: #e2e2e2;
	--jts-bg: #f7f7f8;
	max-width: 360px;
	margin: 0 0 1.25rem;
	padding: 1rem 1.1rem 1.1rem;
	border: 1px solid var(--jts-border);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
	color: var(--jts-ink);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 0.95rem;
	line-height: 1.4;
	box-sizing: border-box;
}

.jts-chat-status-card *,
.jts-chat-status-card *::before,
.jts-chat-status-card *::after {
	box-sizing: border-box;
}

.jts-chat-status-heading {
	font-weight: 700;
	font-size: 1.05rem;
	margin: 0 0 0.65rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--jts-red);
}

.jts-chat-status-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.45rem;
}

.jts-chat-status-dot {
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 50%;
	background: #9ca3af;
	flex-shrink: 0;
	box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.25);
}

.jts-chat-status-card.has-chatters .jts-chat-status-dot {
	background: #16a34a;
	box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
	animation: jts-chat-pulse 2s ease infinite;
}

@keyframes jts-chat-pulse {
	0%,
	100% {
		box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
	}
	50% {
		box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
	}
}

.jts-chat-status-chatters-text {
	font-weight: 700;
}

.jts-chat-status-online {
	font-weight: 500;
	color: var(--jts-muted);
	font-size: 0.88em;
}

.jts-chat-status-label {
	color: var(--jts-muted);
	font-size: 0.85rem;
	min-width: 5.5rem;
}

.jts-chat-status-last-text {
	font-weight: 600;
}

.jts-chat-status-preview {
	margin: 0.35rem 0 0.75rem;
	padding: 0.5rem 0.65rem;
	background: var(--jts-bg);
	border-radius: 8px;
	font-size: 0.88rem;
	color: var(--jts-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.jts-chat-status-preview strong {
	color: var(--jts-ink);
	margin-right: 0.25rem;
}

.jts-chat-status-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0.6rem 0.9rem;
	border-radius: 8px;
	background: var(--jts-red);
	color: #fff !important;
	font-weight: 700;
	text-decoration: none !important;
	text-align: center;
	transition: background 0.15s ease;
}

.jts-chat-status-link:hover,
.jts-chat-status-link:focus {
	background: #c41524;
	color: #fff !important;
}

.jts-chat-status-off {
	color: var(--jts-muted);
	text-align: center;
}

/* Classic widget wrapper spacing */
.widget .jts-chat-status-card {
	max-width: none;
	margin-bottom: 0;
}
