:root {
  --chat-bg: #f0f2f5;
  --message-out: #0084ff;
  --message-out-text: #fff;
  --message-in: #e4e6eb;
  --message-in-text: #050505;
}

body {
  background-color: var(--chat-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Chat Bubbles */
.message-bubble {
  padding: 0.5rem 1rem;
  border-radius: 1.25rem;
  position: relative;
  max-width: 100%;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-bubble.incoming {
  background-color: var(--message-in);
  color: var(--message-in-text);
  border-top-left-radius: 0.25rem;
}

.message-bubble.outgoing {
  background-color: var(--message-out);
  color: var(--message-out-text);
  border-top-right-radius: 0.25rem;
  margin-left: auto;
}

.message-bubble.outgoing.monochrome {
  background-color: var(--message-in);
  color: var(--message-in-text);
}

.chat-link {
  color: inherit !important;
  text-decoration: underline;
}
.chat-link:hover {
  text-decoration: none;
  opacity: 0.8;
}

.message-meta {
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.7;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
}

.message-author {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  margin-left: 0.5rem;
  color: #65676b;
}

/* No Bubble Mode */
.message-bubble.no-bubble {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border: none !important;
}
.message-bubble.no-bubble.outgoing {
  color: var(--message-in-text) !important;
}

/* Reactions */
.reaction-bar {
  position: absolute;
  bottom: -12px;
  right: 0;
  background: white;
  border-radius: 10px;
  padding: 2px 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 3px;
  font-size: 0.8rem;
  z-index: 10;
}

.incoming .reaction-bar {
  left: 0;
  right: auto;
}

.outgoing .reaction-bar {
  right: 0;
  left: auto;
}

.reaction-pill {
  background: #f0f2f5;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 0 4px;
  cursor: pointer;
  font-size: 0.75rem;
  user-select: none;
}

.reaction-pill.active {
  background: #e7f3ff;
  border-color: #0084ff;
  color: #0084ff;
}

/* Room List */
.list-group-item {
  border: none;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
}

.list-group-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.list-group-item.active {
  background-color: #e7f3ff;
  color: #0084ff;
  font-weight: 600;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #bcc0c4;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a0a4a8;
}

/* Media */
.message-media:first-child img {
  margin-top: 0; /* Align perfectly if image is the first content */
}
.message-media img {
  max-width: 100%;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s;
  margin-top: 0.5rem;
  object-fit: contain;
}
.message-media img:hover {
  transform: scale(1.02);
}

/* Message Grouping */
.message-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}
.message-group.outgoing {
  align-items: flex-end;
}
.message-group.incoming {
  align-items: flex-start;
}

/* Message Actions (Reply, React) */
.message-actions {
  opacity: 0;
  transition: opacity 0.2s;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.5rem;
}

.outgoing .message-actions {
  right: 100%;
  margin-right: 0.5rem;
}

.incoming .message-actions {
  left: 100%;
  margin-left: 0.5rem;
}

.message-bubble:hover .message-actions {
  opacity: 1;
}

.action-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  padding: 0;
}

.action-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --chat-bg: #18191a;
    --message-in: #3e4042;
    --message-in-text: #e4e6eb;
  }
  body {
    background-color: #18191a;
    color: #e4e6eb;
  }
  .bg-white {
    background-color: #242526 !important;
  }
  .bg-light {
    background-color: #18191a !important;
  }
  .card,
  .list-group-item {
    background-color: #242526;
    color: #e4e6eb;
  }
  .list-group-item:hover {
    background-color: #3a3b3c;
  }
  .list-group-item.active {
    background-color: #2d88ff;
    color: #fff;
  }
  .border,
  .border-top,
  .border-bottom,
  .border-end {
    border-color: #3e4042 !important;
  }
  .form-control {
    background-color: #3a3b3c;
    border-color: #3e4042;
    color: #e4e6eb;
  }
  .form-control:focus {
    background-color: #3a3b3c;
    color: #e4e6eb;
    border-color: #2d88ff;
  }
  .btn-light {
    background-color: #3a3b3c;
    border-color: #3e4042;
    color: #e4e6eb;
  }
  .modal-content {
    background-color: #242526;
    border-color: #3e4042;
    color: #e4e6eb;
  }
  .dropdown-menu {
    background-color: #242526;
    border-color: #3e4042;
  }
  .dropdown-item {
    color: #e4e6eb;
  }
  .dropdown-item:hover {
    background-color: #3a3b3c;
  }
  .reaction-bar {
    background-color: #3e4042;
  }
  .reaction-pill {
    background-color: #3a3b3c;
    border-color: #4e4f50;
  }
  .message-author {
    color: #b0b3b8;
  }
  .text-muted {
    color: #b0b3b8 !important;
  }
}

/* Emoji Picker */
.emoji-picker-panel {
  max-height: min(520px, calc(100vh - 140px));
  overflow: visible;
}

.emoji-grid {
  max-height: min(420px, calc(100vh - 220px));
  overflow-y: auto;
}

.emoji-categories {
  display: flex;
  gap: 0.35rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.5rem;
  border-bottom: 1px solid #e9ecef;
}

.emoji-category-btn {
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 0.2rem 0.6rem;
}

.emoji-category-btn.active {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

.emoji-item, .fluent-emoji-item {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.emoji-item:hover, .fluent-emoji-item:hover {
  background: #f1f3f5;
  border-color: #e9ecef;
}

img.emoji {
  width: 1.1em;
  height: 1.1em;
  margin: 0 0.05em;
  vertical-align: -0.15em;
}

/* GIF Picker */
.gif-picker-panel {
  max-height: min(520px, calc(100vh - 140px));
  overflow: visible;
}

.gif-grid {
  max-height: min(420px, calc(100vh - 220px));
  overflow-y: auto;
}

#message-content {
  border-radius: 1.5rem;
  line-height: 1.35;
}

.gif-item {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0.5rem;
  overflow: hidden;
}

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

.dice-winner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.dice-winner-content {
  background: transparent;
  padding: 2rem;
  animation: diceWinnerPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dice-winner-content h2 {
  font-size: 4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px #ff00de, 0 0 40px #ff00de, 0 0 50px #ff00de, 0 0 60px #ff00de, 0 0 70px #ff00de;
  margin-bottom: 1rem;
}

.dice-winner-content p {
  font-size: 2rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 0 5px rgba(0,0,0,0.8), 0 0 10px rgba(0,0,0,0.8);
}

.dice-fireworks {
  font-size: 3rem;
  animation: diceFireworksBlink 0.8s ease-in-out infinite alternate;
  display: none; /* Hide old text fireworks since we use real confetti now */
}

@keyframes diceWinnerPop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes diceFireworksBlink {
  from {
    transform: translateY(0);
    opacity: 0.7;
  }
  to {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.lightbox-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  border-radius: 5px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2001;
  transition: color 0.2s;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* --- New Dark Theme & Layout Overrides --- */
:root {
  --dt-header: #0f172a;
  --dt-sidebar: #0f172a;
  --dt-body: #000000;
  --dt-text: #e2e8f0;
  --dt-border: #1e293b;
  --dt-input-bg: #1e293b;
  --dt-active: #0d6efd;
}

.dark-theme {
  background-color: var(--dt-body);
  color: var(--dt-text);
}

.bg-dark-header {
  background-color: var(--dt-header) !important;
}
.bg-dark-sidebar {
  background-color: var(--dt-sidebar) !important;
}
.bg-black {
  background-color: #000 !important;
}
.bg-input {
  background-color: var(--dt-input-bg) !important;
}

.border-secondary {
  border-color: var(--dt-border) !important;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: #2196f3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196f3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(14px);
  -ms-transform: translateX(14px);
  transform: translateX(14px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.bg-success {
  background-color: #10b981 !important;
}
.bg-danger {
  background-color: #ef4444 !important;
}

/* Custom Scrollbar for Dark Theme */
.dark-theme ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.dark-theme ::-webkit-scrollbar-track {
  background: #0f172a;
}
.dark-theme ::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Transitions */
.transition-width {
  transition:
    width 0.3s ease,
    min-width 0.3s ease;
}

.transition-height {
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease,
    border-width 0.3s ease;
}

/* Message List Tweaks for Dark Overlay */
.dark-theme .message-bubble.incoming {
  background-color: rgba(62, 64, 66, 0.8);
  color: #e4e6eb;
  backdrop-filter: blur(4px);
}
.dark-theme .message-bubble.outgoing {
  background-color: rgba(0, 132, 255, 0.8);
  backdrop-filter: blur(4px);
}
.dark-theme .message-bubble.outgoing.monochrome {
  background-color: rgba(62, 64, 66, 0.8);
  color: #e4e6eb;
}
.dark-theme .message-bubble.no-bubble.incoming,
.dark-theme .message-bubble.no-bubble.outgoing,
.dark-theme .message-bubble.no-bubble.outgoing.monochrome {
  background: transparent !important;
  backdrop-filter: none !important;
  color: #e4e6eb !important;
}

/* Active Tab Indicator */
.active-tab {
  color: #fff !important;
}
.active-tab .active-indicator {
  background-color: #10b981 !important;
}

/* Utilities */
.text-shadow {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.hover-opacity-100:hover {
  opacity: 1 !important;
}

/* Video Grid */
.video-container {
  transition: all 0.3s ease;
  background: #000;
}
#local-video {
  transform: scaleX(-1);
}

/* Input Placeholder */
.bg-input::placeholder {
  color: rgba(255, 255, 255, 0.7) !important;
  opacity: 1;
}

[contenteditable="true"]:empty:before {
  content: attr(data-placeholder);
  color: rgba(255, 255, 255, 0.7) !important;
  pointer-events: none;
  display: block;
}

/* Toolbar Separator */
.toolbar-separator {
  width: 1px;
  background-color: rgba(255, 255, 255, 0.2);
  height: 20px;
  margin: 0 4px;
}

#composer-shell.composer-focus-active {
  position: fixed !important;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 40px));
  max-height: min(72vh, 680px);
  z-index: 1040 !important;
  background-color: #1f2937;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.5rem;
}

#composer-shell.composer-focus-active .hide-in-composer-focus {
  display: none !important;
}

/* emoji and gif always on top at fullscreen */
#composer-shell.composer-focus-active #gif-picker,
#composer-shell.composer-focus-active #emoji-picker {
  left: 0 !important;
  right: auto !important;
  bottom: calc(100% + 8px) !important;
  top: auto !important;
}

#composer-shell.composer-focus-active #message-content {
  min-height: clamp(140px, 24vh, 240px) !important;
  max-height: min(40vh, 420px) !important;
  resize: vertical;
}

.composer-focus-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.72);
  z-index: 1030;
}

#composer-fullscreen-btn.is-active {
  color: #f87171 !important;
}

/* Specific Toggle Colors */
#sound-toggle:checked + .slider {
  background-color: #10b981; /* Success Green */
}
#sound-toggle:not(:checked) + .slider {
  background-color: #ef4444; /* Danger Red */
}

#camera-toggle:checked + .slider {
  background-color: #10b981; /* Success Green */
}
#camera-toggle:not(:checked) + .slider {
  background-color: #ef4444; /* Danger Red */
}

/* Header Radio Player */
#radio-player-container {
  display: flex;
}
#radio-player-container #radio-cover {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

#radio-player-container .radio-controls {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 4px 12px;
  height: 36px;
}

#radio-player-container .radio-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.8) !important;
  padding: 0;
}

#radio-player-container .radio-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff !important;
}

#radio-player-container .radio-btn svg {
  width: 16px;
  height: 16px;
}

#radio-player-container .custom-range {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
  transition: background 0.2s;
}

#radio-player-container .custom-range:hover {
  background: rgba(255, 255, 255, 0.3);
}

#radio-player-container .custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

#radio-player-container .custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

#radio-player-container .custom-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

#radio-player-container .custom-range::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

#radio-player-container .volume-icon {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-right: -2px;
}

/* Radio Marquee */
.radio-marquee-active {
  display: inline-block !important;
  text-overflow: clip !important;
  overflow: visible !important;
  width: max-content !important;
  padding-right: 15px; /* So it doesn't touch the edge instantly on reverse */
  animation: radio-marquee-anim var(--scroll-duration, 8s) linear infinite alternate;
}

@keyframes radio-marquee-anim {
  0%, 15% { transform: translateX(0); }
  85%, 100% { transform: translateX(var(--scroll-amount)); }
}

/* User Context Menu */
#user-context-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  padding: 0.5rem 0;
  display: none;
}

#user-context-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  color: #333;
  text-align: left;
  background: none;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

#user-context-menu .menu-item:hover {
  background-color: #f0f2f5;
}

/* Dark Mode Override */
.dark-theme #user-context-menu {
  background: #242526;
  border-color: #3e4042;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dark-theme #user-context-menu .menu-item {
  color: #e4e6eb;
}

.dark-theme #user-context-menu .menu-item:hover {
  background-color: #3a3b3c;
}

.menu-divider {
  height: 1px;
  background-color: #e4e6eb;
  margin: 0.25rem 0;
}
.dark-theme .menu-divider {
  background-color: #3e4042;
}

/* Upload Drop Zone */
.upload-drop-zone {
  border-style: dashed !important;
  transition: all 0.2s ease;
  background-color: rgba(255,255,255,0.02);
}

.upload-drop-zone:hover,
.upload-drop-zone.active {
  background-color: rgba(255,255,255,0.05);
  border-color: #0d6efd !important;
  color: #fff !important;
}

.upload-drop-zone.active svg {
  color: #0d6efd !important;
}

/* Layout Overrides */
.force-left-align.message-group.outgoing {
    align-items: flex-start !important;
}
.force-left-align .message-bubble.outgoing {
    margin-left: 0 !important;
    margin-right: auto !important;
    border-top-right-radius: 1.25rem !important;
    border-top-left-radius: 0.25rem !important;
}
.force-left-align .d-flex.flex-column.align-items-end {
    align-items: flex-start !important;
}

.force-right-align.message-group.incoming {
    align-items: flex-end !important;
    flex-direction: row-reverse !important;
}
.force-right-align .message-bubble.incoming {
    margin-right: 0 !important;
    margin-left: auto !important;
    border-top-left-radius: 1.25rem !important;
    border-top-right-radius: 0.25rem !important;
}
/* Revert incoming styles for flex-direction: row-reverse */
.force-right-align.message-group.incoming .flex-shrink-0.mt-1 {
    margin-left: 0.5rem;
}
.force-right-align .d-flex.flex-column.flex-grow-1 {
    align-items: flex-end !important;
}
.force-right-align .message-author {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* Quoted Replies */
.chat-quote {
  border-left: 4px solid #0d6efd;
  background-color: rgba(13, 110, 253, 0.1);
  margin: 0.25rem 0 0.5rem 0;
  padding: 0.4rem 0.75rem;
  border-radius: 0 0.25rem 0.25rem 0;
  font-size: 0.85em;
  color: inherit;
  opacity: 0.95;
  transition: all 0.2s ease;
}

.chat-quote:hover {
  background-color: rgba(13, 110, 253, 0.15);
}

.dark-theme .chat-quote {
  border-left-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.15);
}

.dark-theme .chat-quote:hover {
  background-color: rgba(59, 130, 246, 0.25);
}

.chat-quote strong {
  font-weight: 700;
  color: inherit;
}

/* Accessibility overrides */
.a11y-high-contrast {
  --dt-body: #000000;
  --dt-header: #000000;
  --dt-sidebar: #000000;
  --dt-text: #ffffff;
  --dt-border: #ffffff;
  --dt-input-bg: #111111;
  --dt-active: #ffff00;
}

.a11y-high-contrast .text-muted,
.a11y-high-contrast .text-secondary {
  color: #dddddd !important;
}

.a11y-high-contrast .border-secondary {
  border-color: #ffffff !important;
}

.a11y-high-contrast .bg-dark {
  background-color: #0d0d0d !important;
}

.a11y-high-contrast .message-bubble {
  border: 1px solid #ffffff;
  background-color: #000000 !important;
  color: #ffffff !important;
}

.a11y-high-contrast .message-bubble.outgoing {
  border: 2px solid #ffff00;
}

.a11y-no-animations, .a11y-no-animations * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Format Buttons Visual Feedback */
.format-btn-active {
  color: #10b981 !important;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.combiner-slot-active {
  border-color: #10b981 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5) !important;
}

.combiner-slot-active span {
  color: #10b981 !important;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.6) !important;
}

.format-btn-shimmer {
  animation: formatShimmer 0.5s ease-out;
}

@keyframes formatShimmer {
  0% { text-shadow: 0 0 0 rgba(255, 255, 255, 0); transform: scale(1); }
  50% { text-shadow: 0 0 15px rgba(255, 255, 255, 1); transform: scale(1.2); }
  100% { text-shadow: 0 0 0 rgba(255, 255, 255, 0); transform: scale(1); }
}

/* Picture in Picture Mode */
.pip-mode {
  position: fixed !important;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  cursor: grab;
  border-radius: 8px;
  resize: both;
  overflow: hidden;
  transition: width 0.3s ease, height 0.3s ease;
}

.pip-mode:active {
  cursor: grabbing;
}
.pip-mode video {
  pointer-events: none;
}
.pip-btn {
  transition: all 0.2s;
  color: rgba(255,255,255,0.7);
}
.pip-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

.emoji-normal { font-size: inherit; }
.emoji-big { font-size: 2em; line-height: 1; display: inline-block; }
.emoji-extra-big { font-size: 3.5em; line-height: 1; display: inline-block; }

.fluent-emoji-normal { height: 1.5em; width: 1.5em; vertical-align: middle; border: 0; background: transparent; }
.fluent-emoji-big { height: 2.5em; width: 2.5em; vertical-align: middle; border: 0; background: transparent; }
.fluent-emoji-extra-big { height: 4em; width: 4em; vertical-align: middle; border: 0; background: transparent; }

/* -------------------------------------------------------------------------- */
/*                        50 CHAT TEXT ANIMATIONS                             */
/* -------------------------------------------------------------------------- */

/* Basics & Color */
@keyframes text-fade { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.anim-fade { display: inline-block; animation: text-fade 2s infinite; }

@keyframes text-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.anim-blink { display: inline-block; animation: text-blink 1s step-end infinite; }

@keyframes text-flash { 0%, 50%, 100% { opacity: 1; } 25%, 75% { opacity: 0; } }
.anim-flash { display: inline-block; animation: text-flash 1.5s infinite; }

@keyframes text-flicker { 0% { opacity: 1; } 10% { opacity: 0.8; } 20% { opacity: 1; } 40% { opacity: 0.3; } 50% { opacity: 1; } 80% { opacity: 0.5; } 100% { opacity: 1; } }
.anim-flicker { display: inline-block; animation: text-flicker 2s linear infinite; }

@keyframes text-blur { 0%, 100% { filter: blur(0px); opacity: 1; } 50% { filter: blur(2px); opacity: 0.8; } }
.anim-blur { display: inline-block; animation: text-blur 2s ease-in-out infinite; }

@keyframes text-rainbow { 0% { color: #ff0000; filter: hue-rotate(0deg); } 50% { filter: hue-rotate(180deg); } 100% { color: #ff0000; filter: hue-rotate(360deg); } }
.anim-rainbow { display: inline-block; animation: text-rainbow 3s linear infinite; }

@keyframes text-colorpulse { 0%, 100% { color: inherit; } 50% { color: #0d6efd; } }
.anim-colorpulse { display: inline-block; animation: text-colorpulse 2s infinite; }

@keyframes text-glow { 0%, 100% { text-shadow: 0 0 5px currentColor, 0 0 10px currentColor; } 50% { text-shadow: 0 0 2px currentColor, 0 0 5px currentColor; } }
.anim-glow { display: inline-block; animation: text-glow 2s ease-in-out infinite; }

@keyframes text-neon { 0%, 100% { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #0ff, 0 0 40px #0ff, 0 0 80px #0ff; } 50% { text-shadow: 0 0 2px #fff, 0 0 5px #fff, 0 0 10px #0ff, 0 0 20px #0ff, 0 0 40px #0ff; } }
.anim-neon { display: inline-block; animation: text-neon 1.5s ease-in-out infinite; }

/* Movements */
@keyframes text-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.anim-bounce { display: inline-block; animation: text-bounce 1s infinite alternate; }

@keyframes text-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.anim-bob { display: inline-block; animation: text-bob 1s ease-in-out infinite; }

@keyframes text-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.anim-float { display: inline-block; animation: text-float 2s ease-in-out infinite; }

@keyframes text-jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
.anim-jump { display: inline-block; animation: text-jump 1s cubic-bezier(0.28, 0.84, 0.42, 1) infinite; }

@keyframes text-drop { 0%, 100% { transform: translateY(-20px); opacity: 0; } 20%, 80% { transform: translateY(0); opacity: 1; } }
.anim-drop { display: inline-block; animation: text-drop 3s ease-in-out infinite; }

@keyframes text-sink { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.anim-sink { display: inline-block; animation: text-sink 2s ease-in-out infinite; }

@keyframes text-orbit { 0% { transform: rotate(0deg) translateX(5px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(5px) rotate(-360deg); } }
.anim-orbit { display: inline-block; animation: text-orbit 2s linear infinite; }

@keyframes text-spin { 100% { transform: rotate(360deg); } }
.anim-spin { display: inline-block; animation: text-spin 2s linear infinite; }

@keyframes text-slideup { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.anim-slideup { display: inline-block; animation: text-slideup 2s ease-in-out infinite; }

@keyframes text-slidedown { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
.anim-slidedown { display: inline-block; animation: text-slidedown 2s ease-in-out infinite; }

@keyframes text-slideright { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(10px); } }
.anim-slideright { display: inline-block; animation: text-slideright 2s ease-in-out infinite; }

@keyframes text-slideleft { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-10px); } }
.anim-slideleft { display: inline-block; animation: text-slideleft 2s ease-in-out infinite; }

@keyframes text-roll { 0% { transform: translateX(-20px) rotate(-120deg); opacity: 0; } 20%, 80% { transform: translateX(0) rotate(0deg); opacity: 1; } 100% { transform: translateX(20px) rotate(120deg); opacity: 0; } }
.anim-roll { display: inline-block; animation: text-roll 3s ease-in-out infinite; }

/* Vibrations & Wobbly */
@keyframes text-shake { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-2px) rotate(-1deg); } 20%, 40%, 60%, 80% { transform: translateX(2px) rotate(1deg); } }
.anim-shake { display: inline-block; animation: text-shake 0.8s ease-in-out infinite; }

@keyframes text-shakex { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); } 20%, 40%, 60%, 80% { transform: translateX(5px); } }
.anim-shakex { display: inline-block; animation: text-shakex 1s infinite; }

@keyframes text-shakey { 0%, 100% { transform: translateY(0); } 10%, 30%, 50%, 70%, 90% { transform: translateY(-5px); } 20%, 40%, 60%, 80% { transform: translateY(5px); } }
.anim-shakey { display: inline-block; animation: text-shakey 1s infinite; }

@keyframes text-wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.anim-wiggle { display: inline-block; animation: text-wiggle 0.3s ease-in-out infinite; }

@keyframes text-wobble { 0%, 100% { transform: translateX(0%) rotate(0deg); } 15% { transform: translateX(-15%) rotate(-5deg); } 30% { transform: translateX(12%) rotate(3deg); } 45% { transform: translateX(-9%) rotate(-3deg); } 60% { transform: translateX(6%) rotate(2deg); } 75% { transform: translateX(-3%) rotate(-1deg); } }
.anim-wobble { display: inline-block; animation: text-wobble 2s infinite; }

@keyframes text-tremble { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-1px, 1px); } 40% { transform: translate(1px, -1px); } 60% { transform: translate(-1px, -1px); } 80% { transform: translate(1px, 1px); } }
.anim-tremble { display: inline-block; animation: text-tremble 0.2s linear infinite; }

@keyframes text-glitch { 0% { transform: translate(0); } 20% { transform: translate(-2px, 2px); } 40% { transform: translate(-2px, -2px); } 60% { transform: translate(2px, 2px); } 80% { transform: translate(2px, -2px); } 100% { transform: translate(0); } }
.anim-glitch { display: inline-block; animation: text-glitch 0.4s linear infinite; }

/* Transforms & Distortion */
@keyframes text-pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
.anim-pulse { display: inline-block; animation: text-pulse 1.5s infinite; }

@keyframes text-heartbeat { 0% { transform: scale(1); } 14% { transform: scale(1.3); } 28% { transform: scale(1); } 42% { transform: scale(1.3); } 70% { transform: scale(1); } }
.anim-heartbeat { display: inline-block; animation: text-heartbeat 1.5s infinite; }

@keyframes text-jelly { 0%, 100% { transform: scale(1, 1); } 25% { transform: scale(1.1, 0.9); } 50% { transform: scale(0.9, 1.1); } 75% { transform: scale(1.05, 0.95); } }
.anim-jelly { display: inline-block; animation: text-jelly 1s ease-in-out infinite; }

@keyframes text-rubberband { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(1.25, 0.75); } 40% { transform: scale(0.75, 1.25); } 50% { transform: scale(1.15, 0.85); } 65% { transform: scale(0.95, 1.05); } 75% { transform: scale(1.05, 0.95); } }
.anim-rubberband { display: inline-block; animation: text-rubberband 2s infinite; }

@keyframes text-squish { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.2, 0.8); } }
.anim-squish { display: inline-block; animation: text-squish 1s ease-in-out infinite; }

@keyframes text-stretch { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(0.8, 1.2); } }
.anim-stretch { display: inline-block; animation: text-stretch 1s ease-in-out infinite; }

@keyframes text-zoomin { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.5); } }
.anim-zoomin { display: inline-block; animation: text-zoomin 2s ease-in-out infinite; }

@keyframes text-zoomout { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.6); } }
.anim-zoomout { display: inline-block; animation: text-zoomout 2s ease-in-out infinite; }

@keyframes text-expand { 0%, 100% { letter-spacing: normal; } 50% { letter-spacing: 0.2em; } }
.anim-expand { display: inline-block; animation: text-expand 3s ease-in-out infinite; }

@keyframes text-contract { 0%, 100% { letter-spacing: normal; } 50% { letter-spacing: -0.1em; } }
.anim-contract { display: inline-block; animation: text-contract 3s ease-in-out infinite; }

@keyframes text-tada { 0%, 100% { transform: scale(1); } 10%, 20% { transform: scale(0.9) rotate(-3deg); } 30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); } 40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); } }
.anim-tada { display: inline-block; animation: text-tada 2s infinite; }

@keyframes text-bouncein { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.2); } 50% { transform: scale(0.9); } 80% { transform: scale(1.1); } }
.anim-bouncein { display: inline-block; animation: text-bouncein 2s infinite; }

/* Rotations & Flips */
@keyframes text-swing { 20% { transform: rotate(15deg); } 40% { transform: rotate(-10deg); } 60% { transform: rotate(5deg); } 80% { transform: rotate(-5deg); } 100% { transform: rotate(0deg); } }
.anim-swing { display: inline-block; transform-origin: top center; animation: text-swing 2s infinite; }

@keyframes text-seesaw { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(10deg); } 75% { transform: rotate(-10deg); } }
.anim-seesaw { display: inline-block; animation: text-seesaw 1s linear infinite; }

@keyframes text-twist { 0%, 100% { transform: perspective(200px) rotateY(0deg); } 50% { transform: perspective(200px) rotateY(180deg); } }
.anim-twist { display: inline-block; animation: text-twist 2s ease-in-out infinite; }

@keyframes text-flipx { 0%, 100% { transform: perspective(400px) rotateX(0deg); } 50% { transform: perspective(400px) rotateX(180deg); } }
.anim-flipx { display: inline-block; animation: text-flipx 2s ease-in-out infinite; }

@keyframes text-flipy { 0%, 100% { transform: perspective(400px) rotateY(0deg); } 50% { transform: perspective(400px) rotateY(180deg); } }
.anim-flipy { display: inline-block; animation: text-flipy 2s ease-in-out infinite; }

@keyframes text-rock { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(15deg); } 75% { transform: rotate(-15deg); } }
.anim-rock { display: inline-block; animation: text-rock 1.5s ease-in-out infinite; }

@keyframes text-pendulum { 0%, 100% { transform: rotate(15deg); } 50% { transform: rotate(-15deg); } }
.anim-pendulum { display: inline-block; transform-origin: top; animation: text-pendulum 1.5s ease-in-out infinite; }

@keyframes text-sway { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(5deg); } 75% { transform: rotate(-5deg); } }
.anim-sway { display: inline-block; transform-origin: bottom; animation: text-sway 2s ease-in-out infinite; }
/* Auto Generated Animations Phase 2 */

.anim-fadein-up {
    animation: fadein-up 1s infinite alternate;
}
@keyframes fadein-up {

    0% { opacity: 0; transform: translateY(-50px); }
    100% { opacity: 1; transform: translateY(0); }
}

.anim-fadein-down {
    animation: fadein-down 1s infinite alternate;
}
@keyframes fadein-down {

    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

.anim-fadein-left {
    animation: fadein-left 1s infinite alternate;
}
@keyframes fadein-left {

    0% { opacity: 0; transform: translateX(-50px); }
    100% { opacity: 1; transform: translateX(0); }
}

.anim-fadein-right {
    animation: fadein-right 1s infinite alternate;
}
@keyframes fadein-right {

    0% { opacity: 0; transform: translateX(50px); }
    100% { opacity: 1; transform: translateX(0); }
}

.anim-fadeout-up {
    animation: fadeout-up 1s infinite alternate;
}
@keyframes fadeout-up {

    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-50px); }
}

.anim-fadeout-down {
    animation: fadeout-down 1s infinite alternate;
}
@keyframes fadeout-down {

    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(50px); }
}

.anim-fadeout-left {
    animation: fadeout-left 1s infinite alternate;
}
@keyframes fadeout-left {

    0% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(-50px); }
}

.anim-fadeout-right {
    animation: fadeout-right 1s infinite alternate;
}
@keyframes fadeout-right {

    0% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(50px); }
}

.anim-fadein-up-right {
    animation: fadein-up-right 1s infinite alternate;
}
@keyframes fadein-up-right {

    0% { opacity: 0; transform: translate(50px, -50px); }
    100% { opacity: 1; transform: translate(0, 0); }
}

.anim-fadein-up-left {
    animation: fadein-up-left 1s infinite alternate;
}
@keyframes fadein-up-left {

    0% { opacity: 0; transform: translate(-50px, -50px); }
    100% { opacity: 1; transform: translate(0, 0); }
}

.anim-fadein-down-right {
    animation: fadein-down-right 1s infinite alternate;
}
@keyframes fadein-down-right {

    0% { opacity: 0; transform: translate(50px, 50px); }
    100% { opacity: 1; transform: translate(0, 0); }
}

.anim-fadein-down-left {
    animation: fadein-down-left 1s infinite alternate;
}
@keyframes fadein-down-left {

    0% { opacity: 0; transform: translate(-50px, 50px); }
    100% { opacity: 1; transform: translate(0, 0); }
}

.anim-slidein-up {
    animation: slidein-up 1s infinite alternate;
}
@keyframes slidein-up {

    0% { transform: translateY(-100%); opacity:0; }
    100% { transform: translateY(0); opacity:1; }
}

.anim-slidein-down {
    animation: slidein-down 1s infinite alternate;
}
@keyframes slidein-down {

    0% { transform: translateY(100%); opacity:0; }
    100% { transform: translateY(0); opacity:1; }
}

.anim-slidein-left {
    animation: slidein-left 1s infinite alternate;
}
@keyframes slidein-left {

    0% { transform: translateX(-100%); opacity:0; }
    100% { transform: translateX(0); opacity:1; }
}

.anim-slidein-right {
    animation: slidein-right 1s infinite alternate;
}
@keyframes slidein-right {

    0% { transform: translateX(100%); opacity:0; }
    100% { transform: translateX(0); opacity:1; }
}

.anim-slideout-up {
    animation: slideout-up 1s infinite alternate;
}
@keyframes slideout-up {

    0% { transform: translateY(0); opacity:1; }
    100% { transform: translateY(-100%); opacity:0; }
}

.anim-slideout-down {
    animation: slideout-down 1s infinite alternate;
}
@keyframes slideout-down {

    0% { transform: translateY(0); opacity:1; }
    100% { transform: translateY(100%); opacity:0; }
}

.anim-slideout-left {
    animation: slideout-left 1s infinite alternate;
}
@keyframes slideout-left {

    0% { transform: translateX(0); opacity:1; }
    100% { transform: translateX(-100%); opacity:0; }
}

.anim-slideout-right {
    animation: slideout-right 1s infinite alternate;
}
@keyframes slideout-right {

    0% { transform: translateX(0); opacity:1; }
    100% { transform: translateX(100%); opacity:0; }
}

.anim-zoomin-up {
    animation: zoomin-up 1s infinite alternate;
}
@keyframes zoomin-up {

    0% { opacity: 0; transform: scale(0.1) translateY(-100px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.anim-zoomin-down {
    animation: zoomin-down 1s infinite alternate;
}
@keyframes zoomin-down {

    0% { opacity: 0; transform: scale(0.1) translateY(100px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.anim-zoomin-left {
    animation: zoomin-left 1s infinite alternate;
}
@keyframes zoomin-left {

    0% { opacity: 0; transform: scale(0.1) translateX(-100px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

.anim-zoomin-right {
    animation: zoomin-right 1s infinite alternate;
}
@keyframes zoomin-right {

    0% { opacity: 0; transform: scale(0.1) translateX(100px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

.anim-backin-up {
    animation: backin-up 1s infinite alternate;
}
@keyframes backin-up {

    0% { transform: translateY(-1200px) scale(0.7); opacity: 0.7; }
    80% { transform: translateY(0px) scale(0.7); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.anim-backin-down {
    animation: backin-down 1s infinite alternate;
}
@keyframes backin-down {

    0% { transform: translateY(1200px) scale(0.7); opacity: 0.7; }
    80% { transform: translateY(0px) scale(0.7); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.anim-backin-left {
    animation: backin-left 1s infinite alternate;
}
@keyframes backin-left {

    0% { transform: translateX(-1200px) scale(0.7); opacity: 0.7; }
    80% { transform: translateX(0px) scale(0.7); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.anim-backin-right {
    animation: backin-right 1s infinite alternate;
}
@keyframes backin-right {

    0% { transform: translateX(1200px) scale(0.7); opacity: 0.7; }
    80% { transform: translateX(0px) scale(0.7); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.anim-bouncein-up {
    animation: bouncein-up 1s infinite alternate;
}
@keyframes bouncein-up {

    0%, 60%, 75%, 90%, 100% { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    0% { opacity: 0; transform: translateY(-300px); }
    60% { opacity: 1; transform: translateY(25px); }
    75% { transform: translateY(-10px); }
    90% { transform: translateY(5px); }
    100% { transform: none; }
}

.anim-bouncein-down {
    animation: bouncein-down 1s infinite alternate;
}
@keyframes bouncein-down {

    0%, 60%, 75%, 90%, 100% { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    0% { opacity: 0; transform: translateY(300px); }
    60% { opacity: 1; transform: translateY(-25px); }
    75% { transform: translateY(10px); }
    90% { transform: translateY(-5px); }
    100% { transform: none; }
}

.anim-bouncein-left {
    animation: bouncein-left 1s infinite alternate;
}
@keyframes bouncein-left {

    0%, 60%, 75%, 90%, 100% { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    0% { opacity: 0; transform: translateX(-300px); }
    60% { opacity: 1; transform: translateX(25px); }
    75% { transform: translateX(-10px); }
    90% { transform: translateX(5px); }
    100% { transform: none; }
}

.anim-bouncein-right {
    animation: bouncein-right 1s infinite alternate;
}
@keyframes bouncein-right {

    0%, 60%, 75%, 90%, 100% { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    0% { opacity: 0; transform: translateX(300px); }
    60% { opacity: 1; transform: translateX(-25px); }
    75% { transform: translateX(10px); }
    90% { transform: translateX(-5px); }
    100% { transform: none; }
}

.anim-flipinx {
    animation: flipinx 1s infinite alternate;
}
@keyframes flipinx {

    0% { transform: perspective(400px) rotate3d(1, 0, 0, 90deg); opacity: 0; }
    40% { transform: perspective(400px) rotate3d(1, 0, 0, -20deg); }
    60% { transform: perspective(400px) rotate3d(1, 0, 0, 10deg); opacity: 1; }
    80% { transform: perspective(400px) rotate3d(1, 0, 0, -5deg); }
    100% { transform: perspective(400px); opacity: 1; }
}

.anim-flipoutx {
    animation: flipoutx 1s infinite alternate;
}
@keyframes flipoutx {

    0% { transform: perspective(400px); opacity: 1; }
    30% { transform: perspective(400px) rotate3d(1, 0, 0, -20deg); opacity: 1; }
    100% { transform: perspective(400px) rotate3d(1, 0, 0, 90deg); opacity: 0; }
}

.anim-flipiny {
    animation: flipiny 1s infinite alternate;
}
@keyframes flipiny {

    0% { transform: perspective(400px) rotate3d(0, 1, 0, 90deg); opacity: 0; }
    40% { transform: perspective(400px) rotate3d(0, 1, 0, -20deg); }
    60% { transform: perspective(400px) rotate3d(0, 1, 0, 10deg); opacity: 1; }
    80% { transform: perspective(400px) rotate3d(0, 1, 0, -5deg); }
    100% { transform: perspective(400px); opacity: 1; }
}

.anim-flipouty {
    animation: flipouty 1s infinite alternate;
}
@keyframes flipouty {

    0% { transform: perspective(400px); opacity: 1; }
    30% { transform: perspective(400px) rotate3d(0, 1, 0, -20deg); opacity: 1; }
    100% { transform: perspective(400px) rotate3d(0, 1, 0, 90deg); opacity: 0; }
}

.anim-perspective-up {
    animation: perspective-up 1s infinite alternate;
}
@keyframes perspective-up {

    0% { transform: perspective(400px) rotateX(0deg); }
    100% { transform: perspective(400px) rotateX(20deg); }
}

.anim-perspective-down {
    animation: perspective-down 1s infinite alternate;
}
@keyframes perspective-down {

    0% { transform: perspective(400px) rotateX(0deg); }
    100% { transform: perspective(400px) rotateX(-20deg); }
}

.anim-perspective-left {
    animation: perspective-left 1s infinite alternate;
}
@keyframes perspective-left {

    0% { transform: perspective(400px) rotateY(0deg); }
    100% { transform: perspective(400px) rotateY(-20deg); }
}

.anim-perspective-right {
    animation: perspective-right 1s infinite alternate;
}
@keyframes perspective-right {

    0% { transform: perspective(400px) rotateY(0deg); }
    100% { transform: perspective(400px) rotateY(20deg); }
}

.anim-lightspeedinright {
    animation: lightspeedinright 1s infinite alternate;
}
@keyframes lightspeedinright {

    0% { transform: translate3d(100%, 0, 0) skewX(-30deg); opacity: 0; }
    60% { transform: skewX(20deg); opacity: 1; }
    80% { transform: skewX(-5deg); }
    100% { transform: translate3d(0, 0, 0); }
}

.anim-lightspeedinleft {
    animation: lightspeedinleft 1s infinite alternate;
}
@keyframes lightspeedinleft {

    0% { transform: translate3d(-100%, 0, 0) skewX(30deg); opacity: 0; }
    60% { transform: skewX(-20deg); opacity: 1; }
    80% { transform: skewX(5deg); }
    100% { transform: translate3d(0, 0, 0); }
}

.anim-lightspeedoutright {
    animation: lightspeedoutright 1s infinite alternate;
}
@keyframes lightspeedoutright {

    0% { opacity: 1; }
    100% { transform: translate3d(100%, 0, 0) skewX(30deg); opacity: 0; }
}

.anim-lightspeedoutleft {
    animation: lightspeedoutleft 1s infinite alternate;
}
@keyframes lightspeedoutleft {

    0% { opacity: 1; }
    100% { transform: translate3d(-100%, 0, 0) skewX(-30deg); opacity: 0; }
}

.anim-rotatein-up-right {
    animation: rotatein-up-right 1s infinite alternate;
}
@keyframes rotatein-up-right {

    0% { transform-origin: up right; transform: rotate3d(0, 0, 1, -45deg); opacity: 0; }
    100% { transform-origin: up right; transform: translate3d(0, 0, 0); opacity: 1; }
}

.anim-rotatein-up-left {
    animation: rotatein-up-left 1s infinite alternate;
}
@keyframes rotatein-up-left {

    0% { transform-origin: up left; transform: rotate3d(0, 0, 1, -45deg); opacity: 0; }
    100% { transform-origin: up left; transform: translate3d(0, 0, 0); opacity: 1; }
}

.anim-rotatein-down-right {
    animation: rotatein-down-right 1s infinite alternate;
}
@keyframes rotatein-down-right {

    0% { transform-origin: down right; transform: rotate3d(0, 0, 1, -45deg); opacity: 0; }
    100% { transform-origin: down right; transform: translate3d(0, 0, 0); opacity: 1; }
}

.anim-rotatein-down-left {
    animation: rotatein-down-left 1s infinite alternate;
}
@keyframes rotatein-down-left {

    0% { transform-origin: down left; transform: rotate3d(0, 0, 1, -45deg); opacity: 0; }
    100% { transform-origin: down left; transform: translate3d(0, 0, 0); opacity: 1; }
}

.anim-hinge {
    animation: hinge 1s infinite alternate;
}
@keyframes hinge {

    0% { transform-origin: top left; animation-timing-function: ease-in-out; }
    20%, 60% { transform: rotate3d(0, 0, 1, 80deg); transform-origin: top left; animation-timing-function: ease-in-out; }
    40%, 80% { transform: rotate3d(0, 0, 1, 60deg); transform-origin: top left; animation-timing-function: ease-in-out; opacity: 1; }
    100% { transform: translate3d(0, 700px, 0); opacity: 0; }
}

.anim-jackinthebox {
    animation: jackinthebox 1s infinite alternate;
}
@keyframes jackinthebox {

    0% { opacity: 0; transform: scale(0.1) rotate(30deg); transform-origin: center bottom; }
    50% { transform: rotate(-10deg); }
    70% { transform: rotate(3deg); }
    100% { opacity: 1; transform: scale(1); }
}

.anim-rollin {
    animation: rollin 1s infinite alternate;
}
@keyframes rollin {

    0% { opacity: 0; transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); }
    100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

.anim-rollout {
    animation: rollout 1s infinite alternate;
}
@keyframes rollout {

    0% { opacity: 1; }
    100% { opacity: 0; transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); }
}

.anim-focusin {
    animation: focusin 1s infinite alternate;
}
@keyframes focusin {

    0% { filter: blur(12px); opacity: 0; }
    100% { filter: blur(0px); opacity: 1; }
}

.anim-focusout {
    animation: focusout 1s infinite alternate;
}
@keyframes focusout {

    0% { filter: blur(0px); opacity: 1; }
    100% { filter: blur(12px); opacity: 0; }
}

.anim-pop {
    animation: pop 1s infinite alternate;
}
@keyframes pop {

    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.anim-shimmer {
    animation: shimmer 1s infinite alternate;
}
@keyframes shimmer {

    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}

.anim-hover-up {
    animation: hover-up 1s infinite alternate;
}
@keyframes hover-up {

    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

.anim-hover-down {
    animation: hover-down 1s infinite alternate;
}
@keyframes hover-down {

    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

.anim-buzz {
    animation: buzz 1s infinite alternate;
}
@keyframes buzz {

    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.anim-wobble-top {
    animation: wobble-top 1s infinite alternate;
}
@keyframes wobble-top {

    0% { transform: perspective(200px) rotateX(0deg); }
    20% { transform: perspective(200px) rotateX(-10deg); }
    40% { transform: perspective(200px) rotateX(10deg); }
    60% { transform: perspective(200px) rotateX(-5deg); }
    80% { transform: perspective(200px) rotateX(5deg); }
    100% { transform: perspective(200px) rotateX(0deg); }
}

.anim-jello-horizontal {
    animation: jello-horizontal 1s infinite alternate;
}
@keyframes jello-horizontal {

    0% { transform: scale3d(1, 1, 1); }
    30% { transform: scale3d(1.25, 0.75, 1); }
    40% { transform: scale3d(0.75, 1.25, 1); }
    50% { transform: scale3d(1.15, 0.85, 1); }
    65% { transform: scale3d(0.95, 1.05, 1); }
    75% { transform: scale3d(1.05, 0.95, 1); }
    100% { transform: scale3d(1, 1, 1); }
}

.anim-shake-fast-x {
    animation: shake-fast-x 1s infinite alternate;
}
@keyframes shake-fast-x {

    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.anim-shake-fast-y {
    animation: shake-fast-y 1s infinite alternate;
}
@keyframes shake-fast-y {

    0%, 100% { transform: translateY(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-5px); }
    20%, 40%, 60%, 80% { transform: translateY(5px); }
}

.anim-shake-fast-z {
    animation: shake-fast-z 1s infinite alternate;
}
@keyframes shake-fast-z {

    0%, 100% { transform: translateZ(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateZ(-5px); }
    20%, 40%, 60%, 80% { transform: translateZ(5px); }
}

.anim-glow-red {
    animation: glow-red 1s infinite alternate;
}
@keyframes glow-red {

    0% { text-shadow: 0 0 5px rgba(255,0,0,0.5); }
    100% { text-shadow: 0 0 20px rgba(255,0,0,1), 0 0 30px rgba(255,0,0,1); }
}

.anim-glow-green {
    animation: glow-green 1s infinite alternate;
}
@keyframes glow-green {

    0% { text-shadow: 0 0 5px rgba(0,255,0,0.5); }
    100% { text-shadow: 0 0 20px rgba(0,255,0,1), 0 0 30px rgba(0,255,0,1); }
}

.anim-glow-blue {
    animation: glow-blue 1s infinite alternate;
}
@keyframes glow-blue {

    0% { text-shadow: 0 0 5px rgba(0,0,255,0.5); }
    100% { text-shadow: 0 0 20px rgba(0,0,255,1), 0 0 30px rgba(0,0,255,1); }
}

.anim-glow-orange {
    animation: glow-orange 1s infinite alternate;
}
@keyframes glow-orange {

    0% { text-shadow: 0 0 5px rgba(255,165,0,0.5); }
    100% { text-shadow: 0 0 20px rgba(255,165,0,1), 0 0 30px rgba(255,165,0,1); }
}

.anim-glow-purple {
    animation: glow-purple 1s infinite alternate;
}
@keyframes glow-purple {

    0% { text-shadow: 0 0 5px rgba(128,0,128,0.5); }
    100% { text-shadow: 0 0 20px rgba(128,0,128,1), 0 0 30px rgba(128,0,128,1); }
}

.anim-glow-yellow {
    animation: glow-yellow 1s infinite alternate;
}
@keyframes glow-yellow {

    0% { text-shadow: 0 0 5px rgba(255,255,0,0.5); }
    100% { text-shadow: 0 0 20px rgba(255,255,0,1), 0 0 30px rgba(255,255,0,1); }
}

.anim-glow-cyan {
    animation: glow-cyan 1s infinite alternate;
}
@keyframes glow-cyan {

    0% { text-shadow: 0 0 5px rgba(0,255,255,0.5); }
    100% { text-shadow: 0 0 20px rgba(0,255,255,1), 0 0 30px rgba(0,255,255,1); }
}

.anim-glow-pink {
    animation: glow-pink 1s infinite alternate;
}
@keyframes glow-pink {

    0% { text-shadow: 0 0 5px rgba(255,192,203,0.5); }
    100% { text-shadow: 0 0 20px rgba(255,192,203,1), 0 0 30px rgba(255,192,203,1); }
}

.anim-bouncezoomin-up {
    animation: bouncezoomin-up 1s infinite alternate;
}
@keyframes bouncezoomin-up {

    0% { opacity: 0; transform: scale(0.1) translateY(-150px); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    60% { opacity: 1; transform: scale(1.1) translateY(20px); }
    80% { transform: scale(0.95) translateY(-10px); }
    100% { transform: scale(1) translateY(0); }
}

.anim-bouncezoomin-down {
    animation: bouncezoomin-down 1s infinite alternate;
}
@keyframes bouncezoomin-down {

    0% { opacity: 0; transform: scale(0.1) translateY(150px); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    60% { opacity: 1; transform: scale(1.1) translateY(-20px); }
    80% { transform: scale(0.95) translateY(10px); }
    100% { transform: scale(1) translateY(0); }
}

.anim-bouncezoomin-left {
    animation: bouncezoomin-left 1s infinite alternate;
}
@keyframes bouncezoomin-left {

    0% { opacity: 0; transform: scale(0.1) translateX(-150px); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    60% { opacity: 1; transform: scale(1.1) translateX(20px); }
    80% { transform: scale(0.95) translateX(-10px); }
    100% { transform: scale(1) translateX(0); }
}

.anim-bouncezoomin-right {
    animation: bouncezoomin-right 1s infinite alternate;
}
@keyframes bouncezoomin-right {

    0% { opacity: 0; transform: scale(0.1) translateX(150px); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
    60% { opacity: 1; transform: scale(1.1) translateX(-20px); }
    80% { transform: scale(0.95) translateX(10px); }
    100% { transform: scale(1) translateX(0); }
}

.anim-squish-h {
    animation: squish-h 1s infinite alternate;
}
@keyframes squish-h {

    0% { transform: scaleX(1); }
    50% { transform: scaleX(1.5) scaleY(0.7); }
    100% { transform: scaleX(1); }
}

.anim-squish-v {
    animation: squish-v 1s infinite alternate;
}
@keyframes squish-v {

    0% { transform: scaleY(1); }
    50% { transform: scaleX(0.7) scaleY(1.5); }
    100% { transform: scaleY(1); }
}

.anim-wobble-bottom {
    animation: wobble-bottom 1s infinite alternate;
}
@keyframes wobble-bottom {

    0% { transform: perspective(200px) rotateX(0deg); }
    20% { transform: perspective(200px) rotateX(10deg); }
    40% { transform: perspective(200px) rotateX(-10deg); }
    60% { transform: perspective(200px) rotateX(5deg); }
    80% { transform: perspective(200px) rotateX(-5deg); }
    100% { transform: perspective(200px) rotateX(0deg); }
}

.anim-snappy-up {
    animation: snappy-up 1s infinite alternate;
}
@keyframes snappy-up {

    0% { transform: translateY(0); }
    10% { transform: translateY(-50px) scale(0.9); }
    90% { transform: translateY(-50px) scale(0.9); }
    100% { transform: translateY(0) scale(1); }
}

.anim-snappy-down {
    animation: snappy-down 1s infinite alternate;
}
@keyframes snappy-down {

    0% { transform: translateY(0); }
    10% { transform: translateY(50px) scale(0.9); }
    90% { transform: translateY(50px) scale(0.9); }
    100% { transform: translateY(0) scale(1); }
}

.anim-snappy-left {
    animation: snappy-left 1s infinite alternate;
}
@keyframes snappy-left {

    0% { transform: translateX(0); }
    10% { transform: translateX(-50px) scale(0.9); }
    90% { transform: translateX(-50px) scale(0.9); }
    100% { transform: translateX(0) scale(1); }
}

.anim-snappy-right {
    animation: snappy-right 1s infinite alternate;
}
@keyframes snappy-right {

    0% { transform: translateX(0); }
    10% { transform: translateX(50px) scale(0.9); }
    90% { transform: translateX(50px) scale(0.9); }
    100% { transform: translateX(0) scale(1); }
}

.anim-slugg-up {
    animation: slugg-up 1s infinite alternate;
}
@keyframes slugg-up {

    0% { transform: translateY(0); filter: blur(0px); }
    50% { transform: translateY(-10px); filter: blur(2px); }
    100% { transform: translateY(0); filter: blur(0px); }
}

.anim-slugg-down {
    animation: slugg-down 1s infinite alternate;
}
@keyframes slugg-down {

    0% { transform: translateY(0); filter: blur(0px); }
    50% { transform: translateY(10px); filter: blur(2px); }
    100% { transform: translateY(0); filter: blur(0px); }
}

.anim-slugg-left {
    animation: slugg-left 1s infinite alternate;
}
@keyframes slugg-left {

    0% { transform: translateX(0); filter: blur(0px); }
    50% { transform: translateX(-10px); filter: blur(2px); }
    100% { transform: translateX(0); filter: blur(0px); }
}

.anim-slugg-right {
    animation: slugg-right 1s infinite alternate;
}
@keyframes slugg-right {

    0% { transform: translateX(0); filter: blur(0px); }
    50% { transform: translateX(10px); filter: blur(2px); }
    100% { transform: translateX(0); filter: blur(0px); }
}

.anim-color-cycle-rgb {
    animation: color-cycle-rgb 1s infinite alternate;
}
@keyframes color-cycle-rgb {

    0% { color: #f00; }
    33% { color: #0f0; }
    66% { color: #00f; }
    100% { color: #f00; }
}

.anim-color-cycle-cmy {
    animation: color-cycle-cmy 1s infinite alternate;
}
@keyframes color-cycle-cmy {

    0% { color: #0ff; }
    33% { color: #f0f; }
    66% { color: #ff0; }
    100% { color: #0ff; }
}

.anim-color-glow-pulse {
    animation: color-glow-pulse 1s infinite alternate;
}
@keyframes color-glow-pulse {

    0% { color: #fff; text-shadow: 0 0 10px #fff; }
    50% { color: #000; text-shadow: 0 0 20px #f0f; }
    100% { color: #fff; text-shadow: 0 0 10px #fff; }
}

.anim-float-up-right {
    animation: float-up-right 1s infinite alternate;
}
@keyframes float-up-right {

    0% { transform: translate(0, 0); }
    50% { transform: translate(15px, -15px); }
    100% { transform: translate(0, 0); }
}

.anim-float-up-left {
    animation: float-up-left 1s infinite alternate;
}
@keyframes float-up-left {

    0% { transform: translate(0, 0); }
    50% { transform: translate(-15px, -15px); }
    100% { transform: translate(0, 0); }
}

.anim-float-down-right {
    animation: float-down-right 1s infinite alternate;
}
@keyframes float-down-right {

    0% { transform: translate(0, 0); }
    50% { transform: translate(15px, 15px); }
    100% { transform: translate(0, 0); }
}

.anim-float-down-left {
    animation: float-down-left 1s infinite alternate;
}
@keyframes float-down-left {

    0% { transform: translate(0, 0); }
    50% { transform: translate(-15px, 15px); }
    100% { transform: translate(0, 0); }
}

.anim-flip-zoom-in {
    animation: flip-zoom-in 1s infinite alternate;
}
@keyframes flip-zoom-in {

    0% { transform: perspective(400px) rotateY(90deg) scale(0.5); opacity: 0; }
    100% { transform: perspective(400px) rotateY(0deg) scale(1); opacity: 1; }
}

.anim-flip-zoom-out {
    animation: flip-zoom-out 1s infinite alternate;
}
@keyframes flip-zoom-out {

    0% { transform: perspective(400px) rotateY(0deg) scale(1); opacity: 1; }
    100% { transform: perspective(400px) rotateY(90deg) scale(1.5); opacity: 0; }
}

.anim-swing-hard {
    animation: swing-hard 1s infinite alternate;
}
@keyframes swing-hard {

    0% { transform: rotate3d(0, 0, 1, 30deg); transform-origin: top center; }
    50% { transform: rotate3d(0, 0, 1, -30deg); transform-origin: top center; }
    100% { transform: rotate3d(0, 0, 1, 30deg); transform-origin: top center; }
}

.anim-pulse-shrink {
    animation: pulse-shrink 1s infinite alternate;
}
@keyframes pulse-shrink {

    0% { transform: scale(1); }
    50% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

/* --- Accessibility Enhancements (A11Y) --- */

/* 1. Optische Tastatursteuerung */
*:focus-visible {
    outline: 3px solid #0dcaf0 !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* 3. Skip-to-Content Link */
.skip-to-content {
    position: absolute;
    top: -50px;
    left: 10px;
    background: #0dcaf0;
    color: #000;
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.2s;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 0 4px 4px;
}
.skip-to-content:focus {
    top: 0;
}

/* 6. Light Theme Overrides */
body.a11y-light-theme {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

body.a11y-light-theme .bg-black,
body.a11y-light-theme .bg-dark,
body.a11y-light-theme .bg-dark-header,
body.a11y-light-theme .bg-dark-sidebar,
body.a11y-light-theme .bg-input,
body.a11y-light-theme .modal-content,
body.a11y-light-theme .form-control,
body.a11y-light-theme .form-select,
body.a11y-light-theme .dropdown-menu,
body.a11y-light-theme .anim-picker-panel,
body.a11y-light-theme .emoji-picker-panel,
body.a11y-light-theme .gif-picker-panel,
body.a11y-light-theme #reply-preview {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

body.a11y-light-theme .text-white,
body.a11y-light-theme .text-white-50,
body.a11y-light-theme .text-shadow,
body.a11y-light-theme .text-muted,
body.a11y-light-theme h5.text-white,
body.a11y-light-theme h6.text-white {
    color: #212529 !important;
    text-shadow: none !important;
}

body.a11y-light-theme .btn-link.text-white, 
body.a11y-light-theme .btn-link.text-muted,
body.a11y-light-theme .btn-outline-secondary {
    color: #212529 !important;
}
body.a11y-light-theme .btn-outline-secondary {
    border-color: #ced4da !important;
}

body.a11y-light-theme .btn-dark,
body.a11y-light-theme .btn-close-white {
    background-color: #e9ecef !important;
    color: #212529 !important;
    border-color: #ced4da !important;
    filter: invert(1) grayscale(100%) brightness(200%); /* Make close button dark */
}
body.a11y-light-theme .btn-dark {
    filter: none; /* except for normal dark buttons */
}

body.a11y-light-theme .message-bubble.incoming {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

body.a11y-light-theme .border-secondary,
body.a11y-light-theme .border-bottom,
body.a11y-light-theme .border-top,
body.a11y-light-theme .border-start,
body.a11y-light-theme .border-end {
    border-color: #dee2e6 !important;
}

body.a11y-light-theme #composer-shell textarea,
body.a11y-light-theme #message-content-live {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

body.a11y-light-theme #header-info-content {
    border-bottom: 1px solid #dee2e6 !important;
}

body.a11y-light-theme #message-list {
    background: linear-gradient(180deg, rgba(248, 249, 250, 0) 0%, rgba(248, 249, 250, 0.4) 100%) !important;
}

/* Custom Admin Modals (15% distance from screen edges, respecting 60px header) */
#adminUsersModal.modal.show,
#adminConfigModal.modal.show,
#adminDesignModal.modal.show,
#adminDashboardModal.modal.show,
#adminRoomsModal.modal.show,
#adminAuditLogModal.modal.show,
#adminSessionsModal.modal.show,
#adminWordFilterModal.modal.show,
#adminScheduledMsgModal.modal.show,
#adminMediaModal.modal.show {
    padding: 60px 0 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.custom-admin-modal {
    max-width: calc(100vw - 60px) !important;
    width: calc(100vw - 60px) !important;
    height: calc(100vh - 120px) !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.custom-admin-modal .modal-content {
    width: 100% !important;
    height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.custom-admin-modal .modal-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    min-height: 0 !important;
}

.custom-admin-modal .modal-header,
.custom-admin-modal .modal-footer {
    flex-shrink: 0 !important;
}

/* Docked PM Windows */
#docked-pm-container {
    pointer-events: none; /* Let clicks pass through empty space */
}

#docked-pm-container > * {
    pointer-events: auto; /* Re-enable clicks on actual windows */
}

.pm-window {
    width: 320px;
    height: 400px;
    display: flex;
    flex-direction: column;
    background-color: var(--pm-bg, var(--dt-body));
    color: var(--pm-text, inherit);
    border: 1px solid var(--dt-border);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

.pm-window.minimized {
    height: 48px;
    width: 200px;
    cursor: pointer;
}

.pm-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    background-color: var(--pm-header-bg, var(--dt-header));
    color: var(--pm-text, inherit);
    border-bottom: 1px solid var(--dt-border);
    cursor: pointer;
}

/* Glassmorphism support if user has bg image */
body[style*="background-image"] .pm-window,
body[style*="background-image"] .pm-header {
    background-color: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

.pm-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pm-footer {
    padding: 0.5rem;
    background-color: var(--pm-header-bg, var(--dt-header));
    border-top: 1px solid var(--dt-border);
}

.pm-footer input {
    background-color: var(--pm-input-bg, rgba(0,0,0,0.5)) !important;
    color: var(--pm-text, #fff) !important;
    width: 100%;
    font-size: 0.9rem;
    border-radius: 20px;
}

.pm-minimized-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 10;
}

/* --- Mobile Improvements --- */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important; /* Prevent horizontal scrolling entirely */
        max-width: 100vw !important;
    }
    
    /* Make reactions stack below the message text inside the bubble on mobile */
    .message-bubble {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .reaction-bar {
        position: static !important;
        margin: 0 !important;
        margin-top: 0.5rem !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        background: transparent !important;
        padding: 0 !important;
        box-shadow: none !important;
        gap: 0.25rem !important;
        width: 100% !important;
    }
    
    #left-sidebar,
    #right-sidebar {
        position: absolute !important;
        height: 100% !important;
        z-index: 1060 !important;
        max-width: 100vw !important;
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }
    #left-sidebar {
        left: 0;
    }
    #right-sidebar {
        right: 0;
    }
    
    /* Make the rich text toolbar horizontally scrollable on mobile */
    #composer-shell {
        position: relative !important;
        overflow: visible !important; /* Ensure dropups and modals escape the shell */
        z-index: 1050; /* Keep it above other elements when using dropups */
    }
    #composer-shell .d-flex.flex-wrap.gap-3.mb-2 {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: visible !important; /* Allow dropups to show */
        padding-bottom: 8px !important;
        /* Hide scrollbar for a cleaner look */
        scrollbar-width: none;
    }
    #composer-shell .d-flex.flex-wrap.gap-3.mb-2::-webkit-scrollbar {
        display: none;
    }
    /* Prevent toolbar items from shrinking */
    #composer-shell .btn, 
    #composer-shell .dropdown, 
    #composer-shell .position-relative,
    #composer-shell .d-flex.gap-3 {
        flex-shrink: 0 !important;
        position: static !important; /* Allow dropdowns to position relative to the nearest positioned ancestor (composer-shell) instead of the scrolling container */
    }
    
    #composer-shell .dropdown-menu {
        position: absolute !important;
        bottom: 100% !important; /* Force dropup behavior visually */
        top: auto !important;
        transform: none !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Ensure Panels (Color Picker, Emoji) escape scroll boundaries */
    .color-picker-panel,
    .anim-picker-panel,
    .emoji-picker-panel {
        position: fixed !important;
        bottom: 180px !important; /* Move higher up from the input form */
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90vw !important; /* Max width slightly smaller than screen */
        max-width: 350px !important;
        max-height: 40vh !important; /* Keep it smaller vertically */
        z-index: 1080 !important; /* Guarantee above everything */
        border-radius: 12px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.8) !important;
    }
    
    /* Ensure the send button and input field fit on mobile */
    #message-form {
        flex-direction: column !important; /* Stack input and button vertically */
        align-items: stretch !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    #message-form .btn-danger {
        width: 100% !important; /* Make button full width below input */
        padding: 0.5rem !important;
        font-size: 1rem !important;
    }
    #composer-shell {
        padding: 0.5rem !important;
    }
    
    /* Move toast container below the 60px header */
    #toast-container {
        top: 60px !important;
        z-index: 1070 !important;
    }
}
