.ch-gif-picker-button {
	border: 1px solid currentColor;
	border-radius: 8px;
	background: transparent;
	font-weight: 700;
	line-height: 1;
	padding: 8px 10px;
	cursor: pointer;
}

.ch-gif-selected-preview {
	position: relative;
	display: inline-block;
	max-width: min(100%, 520px);
	margin-top: 10px;
}

.ch-gif-selected-preview img {
	display: block;
	max-width: 100%;
	max-height: 420px;
	border-radius: 12px;
	object-fit: contain;
}

.ch-gif-remove-selection {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, .72);
	color: #fff;
	cursor: pointer;
}

.ch-gif-modal[hidden] {
	display: none !important;
}

.ch-gif-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	place-items: center;
	padding: 18px;
}

.ch-gif-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .66);
}

.ch-gif-panel {
	position: relative;
	z-index: 1;
	width: min(720px, 100%);
	max-height: min(780px, 88vh);
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(127, 127, 127, .25);
	border-radius: 16px;
	background: var(--ch-surface, #fff);
	color: var(--ch-text, #171717);
	box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
	overflow: hidden;
}

.ch-gif-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(127, 127, 127, .18);
}

.ch-gif-close {
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 20px;
	cursor: pointer;
}

.ch-gif-search-row {
	padding: 12px 14px 6px;
}

.ch-gif-search {
	width: 100%;
	min-height: 42px;
	border: 1px solid rgba(127, 127, 127, .28);
	border-radius: 10px;
	padding: 8px 12px;
	background: transparent;
	color: inherit;
}

.ch-gif-status {
	padding: 6px 14px 10px;
	font-size: 12px;
	font-weight: 700;
	opacity: .68;
	text-transform: uppercase;
	letter-spacing: .06em;
}

.ch-gif-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
	padding: 0 10px 12px;
	overflow-y: auto;
	min-height: 220px;
}

.ch-gif-result {
	display: block;
	aspect-ratio: 1 / .82;
	padding: 0;
	border: 0;
	border-radius: 8px;
	overflow: hidden;
	background: rgba(127, 127, 127, .12);
	cursor: pointer;
}

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

.ch-gif-attribution {
	padding: 9px 14px 11px;
	border-top: 1px solid rgba(127, 127, 127, .18);
	font-size: 12px;
	font-weight: 800;
	text-align: right;
	letter-spacing: .02em;
}

.ch-gif-loading-grid,
.ch-gif-empty,
.ch-gif-unavailable {
	grid-column: 1 / -1;
	padding: 24px;
	text-align: center;
	opacity: .7;
}

.ch-activity-gif,
.ch-comment-gif {
	position: relative;
	margin-top: 10px;
	max-width: 620px;
}

.ch-gif-embed-image {
	display: block;
	max-width: 100%;
	max-height: 560px;
	width: auto;
	height: auto;
	border-radius: 12px;
	object-fit: contain;
}

.ch-gif-embed-attribution {
	display: inline-block;
	margin-top: 4px;
	font-size: 10px;
	font-weight: 800;
	opacity: .55;
}

body.ch-gif-picker-open {
	overflow: hidden;
}

@media (max-width: 640px) {
	.ch-gif-modal {
		padding: 0;
		align-items: end;
	}

	.ch-gif-panel {
		width: 100%;
		max-height: 84vh;
		border-radius: 18px 18px 0 0;
	}

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

	.ch-gif-result {
		aspect-ratio: 1 / .8;
	}
}


/* v1.0.19 — readable GIF library tiles. Preserve each GIF's real aspect ratio. */
.ch-gif-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	align-items: start;
	grid-auto-flow: row;
	gap: 10px;
	padding: 2px 12px 14px;
}

.ch-gif-result {
	aspect-ratio: auto !important;
	height: auto !important;
	min-height: 0;
	overflow: hidden;
	border-radius: 10px;
	background: rgba(127, 127, 127, .10);
	box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.ch-gif-result img {
	display: block;
	width: 100% !important;
	height: auto !important;
	max-height: none !important;
	object-fit: contain !important;
	object-position: center;
}

@media (max-width: 640px) {
	.ch-gif-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		padding-inline: 8px;
	}

	.ch-gif-result {
		aspect-ratio: auto !important;
	}
}


/* =========================================================
   v1.0.20 — GIF picker visual reset + masonry gallery
   Prevent global theme/button CSS from distorting GIF tiles.
   ========================================================= */

.ch-composer-actions > .ch-gif-picker-button {
	order: 30 !important;
	flex: 0 0 auto !important;
}

/* Match the composer Attach control while keeping GIF immediately to its right. */
.ch-composer .ch-gif-picker-button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-width: 0 !important;
	min-height: 0 !important;
	height: auto !important;
	margin: 0 !important;
	padding: 10px 14px !important;
	border: 1px solid #dbe3ec !important;
	border-radius: 999px !important;
	background: #f8fafc !important;
	background-image: none !important;
	box-shadow: none !important;
	color: #334155 !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 800 !important;
	line-height: 1 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	cursor: pointer !important;
}

.ch-composer .ch-gif-picker-button:hover {
	background: #eff6ff !important;
	border-color: #bfdbfe !important;
	color: #1d4ed8 !important;
	transform: none !important;
}

.ch-gif-panel {
	width: min(780px, calc(100vw - 36px)) !important;
	max-height: min(820px, 90vh) !important;
}

.ch-gif-grid {
	display: block !important;
	columns: 3 150px !important;
	column-gap: 10px !important;
	padding: 4px 12px 16px !important;
	overflow-x: hidden !important;
	overflow-y: auto !important;
	min-height: 250px !important;
}

/* Strong reset because WordPress themes/plugins often globally style buttons. */
.ch-gif-panel button.ch-gif-result,
.ch-gif-panel .ch-gif-result {
	display: inline-block !important;
	position: relative !important;
	width: 100% !important;
	height: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	margin: 0 0 10px !important;
	padding: 0 !important;
	break-inside: avoid !important;
	-webkit-column-break-inside: avoid !important;
	page-break-inside: avoid !important;
	vertical-align: top !important;
	border: 0 !important;
	outline: 0 !important;
	border-radius: 10px !important;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: inherit !important;
	font: inherit !important;
	line-height: normal !important;
	text-align: initial !important;
	text-decoration: none !important;
	text-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	overflow: hidden !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	cursor: pointer !important;
	transform: none !important;
}

.ch-gif-panel button.ch-gif-result::before,
.ch-gif-panel button.ch-gif-result::after {
	content: none !important;
	display: none !important;
}

.ch-gif-panel .ch-gif-result img {
	display: block !important;
	position: static !important;
	width: 100% !important;
	height: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: 100% !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 10px !important;
	box-shadow: none !important;
	object-fit: contain !important;
	object-position: center !important;
	transform: none !important;
	vertical-align: top !important;
}

.ch-gif-panel .ch-gif-result:hover,
.ch-gif-panel .ch-gif-result:focus-visible {
	outline: 3px solid color-mix(in srgb, #1473e6 65%, transparent) !important;
	outline-offset: 2px !important;
	transform: none !important;
}

.ch-gif-panel .ch-gif-result:active {
	transform: none !important;
}

.ch-gif-status {
	padding-bottom: 8px !important;
}

.ch-gif-attribution {
	flex: 0 0 auto !important;
	background: var(--ch-surface, #fff) !important;
}

@media (max-width: 640px) {
	.ch-gif-panel {
		width: 100% !important;
		max-height: 88vh !important;
	}

	.ch-gif-grid {
		columns: 2 120px !important;
		column-gap: 8px !important;
		padding: 4px 8px 14px !important;
	}

	.ch-gif-panel button.ch-gif-result,
	.ch-gif-panel .ch-gif-result {
		margin-bottom: 8px !important;
	}
}


/* v1.0.26 — compact close/remove controls resist global button styling. */
.ch-gif-remove-selection,.ch-gif-close{
	display:inline-flex!important;align-items:center!important;justify-content:center!important;padding:0!important;margin:0!important;
	border-radius:999px!important;background-image:none!important;box-shadow:none!important;text-shadow:none!important;
	transform:none!important;appearance:none!important;-webkit-appearance:none!important
}
.ch-gif-remove-selection{
	width:30px!important;height:30px!important;border:1px solid rgba(255,255,255,.22)!important;
	background:rgba(15,23,42,.82)!important;color:#fff!important;font-size:17px!important;line-height:1!important
}
.ch-gif-remove-selection:hover,.ch-gif-remove-selection:focus-visible{background:#0f172a!important;color:#fff!important;transform:none!important}
.ch-gif-close{
	width:34px!important;height:34px!important;border:0!important;background:transparent!important;color:inherit!important;font-size:22px!important;line-height:1!important
}
.ch-gif-close:hover,.ch-gif-close:focus-visible{background:rgba(127,127,127,.12)!important;color:inherit!important}


/* v1.0.29.4 — Legacy BuddyBoss GIF activity compatibility */
.ch-gif-legacy-video{
	display:block;
	max-width:100%;
	max-height:560px;
	width:auto;
	height:auto;
	border-radius:12px;
	object-fit:contain;
	background:#000;
}
