#giphyModal { padding: 16px; overscroll-behavior: contain; }
#giphyModal .giphy-picker { display: flex; flex-direction: column; width: 100%; max-width: 640px; height: min(760px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); border-radius: 8px; box-shadow: 0 16px 48px rgba(0,0,0,0.22); }
#giphyModal .modal-header { flex-shrink: 0; padding: 14px 18px; }
#giphyModal .modal-header h3 { font-size: 18px; line-height: 24px; }
#giphyModal .modal-close { width: 44px; height: 44px; flex-shrink: 0; }
.giphy-toolbar { flex-shrink: 0; padding: 0 18px 12px; border-bottom: 1px solid var(--border-color); }
.giphy-search { display: flex; gap: 8px; }
.giphy-search input { min-width: 0; flex: 1; height: 44px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--input-bg); color: var(--text-primary); font-size: 16px; }
.giphy-search button, #giphyMore, .giphy-footer button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--input-bg); color: var(--text-primary); cursor: pointer; font-weight: 600; }
.giphy-search button { background: #0088ff; border-color: #0088ff; color: #fff; }
#giphyStatus { margin: 10px 0 0; min-height: 18px; color: var(--text-secondary); font-size: 12px; line-height: 18px; }
#giphyModal .modal-body { flex: 1; min-height: 0; max-height: none; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 14px 18px; scrollbar-gutter: stable; }
.giphy-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.giphy-result { display: block; min-width: 0; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--input-bg); cursor: pointer; aspect-ratio: 4 / 3; transition: box-shadow 0.15s ease; }
.giphy-result img { display: block; width: 100%; height: 100%; object-fit: contain; }
.giphy-result:hover { box-shadow: 0 0 0 2px #0088ff; }
.giphy-result:focus-visible, .giphy-search input:focus-visible, .giphy-search button:focus-visible, #giphyMore:focus-visible, .giphy-footer button:focus-visible { outline: 2px solid #0088ff; outline-offset: 2px; }
#giphyMore { width: 100%; margin-top: 12px; }
.giphy-footer { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 18px; border-top: 1px solid var(--border-color); color: var(--text-secondary); font-size: 11px; }
.giphy-footer a { color: var(--text-secondary); text-decoration: none; }
.giphy-footer a:hover { color: var(--text-primary); }
@media (max-width: 480px) {
	#giphyModal { padding: 8px; }
	#giphyModal .giphy-picker { height: min(760px, calc(100dvh - 16px)); max-height: calc(100dvh - 16px); }
	#giphyModal .modal-header { padding: 8px 12px; }
	.giphy-toolbar { padding: 0 12px 10px; }
	#giphyModal .modal-body { padding: 12px; }
	.giphy-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.giphy-footer { padding: 8px 12px; }
}
.chat-embed-footer a[href^="https://giphy.com/gifs/"] { color: var(--text-secondary, #a8adb7); text-decoration: none; transition: color 0.15s ease; }
.chat-embed-footer a[href^="https://giphy.com/gifs/"]:hover,
.chat-embed-footer a[href^="https://giphy.com/gifs/"]:focus-visible { color: var(--text-primary, #e5e7eb); text-decoration: underline; }
.message .message-bubble:has(.giphy-card) { padding: 0; background: transparent; overflow: hidden; }
.chat-embed-card.giphy-card { padding: 0; border: 0; background: transparent; border-radius: 8px; }
.giphy-card .chat-embed-footer { margin: 0; padding: 4px 2px; border: 0; font-size: 10px; }
.giphy-card .chat-embed-desc { margin: 0; padding: 6px 2px 2px; }
.giphy-message { display: block; border: 0; border-radius: 8px; width: 100%; max-width: 360px; height: 240px; }