.reaction-effects {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}
.reaction-controls {
  position: absolute;
  right: 18px;
  bottom: 64px;
  z-index: 6;
  width: 44px;
  height: 44px;
}
.reaction-controls::before { content: ''; position: absolute; right: 100%; top: 0; width: 10px; height: 100%; }
.reaction-toggle, .reaction-repeat {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff38;
  border-radius: 50%;
  background: #202026d9;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 3px 14px #0005;
  transition: background .15s, transform .15s, opacity .15s;
}
.reaction-repeat {
  position: absolute;
  right: calc(100% + 8px);
  top: 0;
  background: linear-gradient(145deg, #434454f5, #252530f5);
  border-color: #b9a6ff70;
  box-shadow: 0 4px 18px #0006, 0 0 15px #a68aff18;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(34px) scale(.65);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.9,.3,1.25), visibility .18s;
}
.reaction-repeat[hidden] { display: none; }
.reaction-controls:hover .reaction-repeat, .reaction-controls:has(:focus-visible) .reaction-repeat {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}
.reaction-repeat:hover:not(:disabled) { background: #505064fa; border-color: #d1c3ffaa; }
.reaction-repeat:active:not(:disabled) { transform: scale(.9); }
.reaction-repeat:disabled { cursor: default; }
.reaction-toggle:hover:not(:disabled), .reaction-toggle[aria-expanded="true"] { background: #424252ed; transform: scale(1.05); }
.reaction-toggle:disabled { opacity: .45; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .video-wrapper:not(:hover) .reaction-controls:not(:has(:focus-visible)) {
    opacity: 0;
    pointer-events: none;
  }
}
@media (hover: none), (pointer: coarse) {
  .reaction-repeat { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
}
.reaction-toggle:focus-visible, .reaction-repeat:focus-visible, .reaction-popup button:focus-visible, .reaction-popup input:focus-visible { outline: 2px solid var(--accent, #4a90e2); outline-offset: 3px; }
.reaction-popup {
  position: absolute;
  right: 16px;
  bottom: 116px;
  z-index: 21;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100% - 32px));
  max-height: min(480px, calc(100% - 126px));
  border: 1px solid #ffffff26;
  border-radius: 14px;
  background: #202026;
  color: #eee;
  box-shadow: 0 12px 40px #0008;
  overflow: hidden;
}
.reaction-popup[hidden] { display: none; }
.reaction-popup-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px 6px; font-size: 14px; font-weight: 600; }
.reaction-popup-header button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #c9c9d1; font-size: 23px; cursor: pointer; }
.reaction-popup-header button:hover { background: #ffffff12; }
.reaction-favorites { padding: 5px 12px 8px; border-bottom: 1px solid #ffffff14; flex: none; }
.reaction-favorites-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: #e0d9f4; }
.reaction-favorites-header small { display: block; color: #9b97aa; font-size: 10px; font-weight: 400; }
#reaction-favorite-add { padding: 6px 9px; border: 1px solid #b6a0ff40; border-radius: 8px; background: #a68aff12; color: #d5c9ff; font: inherit; font-size: 12px; cursor: pointer; }
#reaction-favorite-add:hover, #reaction-favorite-add[aria-pressed="true"] { background: #a68aff30; }
#reaction-favorite-add:disabled { opacity: .45; cursor: default; }
.reaction-favorites-list { display: flex; gap: 7px; overflow-x: auto; padding: 6px 2px 2px; scrollbar-width: thin; scrollbar-color: #6c627b transparent; }
.reaction-favorites-list:empty { display: none; }
.reaction-favorite { display: inline-flex; flex: none; align-items: center; padding: 2px; border: 1px solid #ffffff18; border-radius: 10px; background: #ffffff07; }
.reaction-favorite:hover { border-color: #b6a0ff66; background: #a68aff12; }
.reaction-favorite button { border: 0; background: transparent; color: #bbb4ce; cursor: pointer; border-radius: 6px; }
.reaction-favorite-send { display: grid; place-items: center; min-width: 34px; min-height: 34px; padding: 0; font-size: 25px; }
.reaction-favorite-remove { width: 22px; height: 30px; padding: 0; font-size: 17px; }
.reaction-favorite-remove:hover { color: #ff9caa; background: #ff71881a; }
.reaction-favorites-hint { margin: 6px 0 0; font-size: 11px; line-height: 1.4; color: #aaa3bc; }
.reaction-favorites-hint:empty { display: none; }
#reaction-picker { height: 340px; min-height: 120px; flex: 1 1 340px; overflow: hidden; }
#reaction-picker > emoji-picker { width: 100%; height: 100%; min-height: 0; --background: #202026; --border-color: transparent; --button-hover-background: #ffffff18; --button-active-background: #4a90e233; --input-border-color: #ffffff30; --indicator-color: #75b4ff; --num-columns: 8; }
#reaction-picker:not(:has(emoji-picker)) { padding: 14px; font-size: 13px; color: #b9b9c5; }
.reaction-custom-form { display: flex; gap: 8px; padding: 8px 12px 12px; border-top: 1px solid #ffffff14; }
.reaction-custom-form[hidden] { display: none; }
.reaction-custom-form input { min-width: 0; flex: 1; padding: 8px 10px; border: 1px solid #ffffff26; border-radius: 8px; background: #16161c; color: #eee; font: inherit; font-size: 13px; }
.reaction-custom-form button { width: 34px; border: 0; border-radius: 8px; background: var(--accent, #4a90e2); color: #fff; font-size: 20px; cursor: pointer; }
.reaction-status { position: absolute; z-index: 6; right: 16px; bottom: 116px; max-width: calc(100% - 32px); padding: 6px 10px; border-radius: 8px; background: #202026ed; color: #eee; font-size: 12px; pointer-events: none; }
.reaction-status:empty { display: none; }
.floating-reaction {
  position: absolute;
  right: var(--reaction-x);
  bottom: 76px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  filter: drop-shadow(0 2px 4px #0005);
  animation: reaction-float 2.6s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes reaction-float {
  0% { transform: translate(0, 0) scale(.65); opacity: 0; }
  12% { opacity: 1; }
  65% { opacity: .95; }
  100% { transform: translate(var(--reaction-drift), calc(-1 * var(--reaction-rise))) rotate(var(--reaction-rotate)) scale(1.2); opacity: 0; }
}
#toggle-chat { position: relative; }
#toggle-chat.has-unread::after { content: ''; position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: #ff4757; box-shadow: 0 0 0 2px var(--bg-card, #1e1e1e); pointer-events: none; }
@media (max-width: 480px) {
  .reaction-controls { right: 12px; bottom: 60px; }
  .reaction-popup { right: 10px; bottom: 112px; width: min(340px, calc(100% - 20px)); max-height: calc(100% - 122px); }
  #reaction-picker > emoji-picker { --num-columns: 7; }
}
@media (max-height: 520px) {
  .reaction-popup { bottom: 10px; max-height: calc(100% - 20px); right: 66px; width: min(340px, calc(100% - 80px)); overflow-y: auto; }
  .reaction-popup-header { padding: 5px 10px 3px; }
  .reaction-favorites { padding: 3px 10px 5px; }
  .reaction-favorites-header small { display: none; }
  .reaction-favorites-list { padding-top: 4px; }
  .reaction-favorite-send { min-height: 30px; min-width: 30px; font-size: 23px; }
  .reaction-favorite-remove { height: 28px; }
  #reaction-picker { height: 180px; flex-basis: 180px; min-height: 80px; }
  #reaction-picker > emoji-picker { --num-columns: 6; }
}
@media (prefers-reduced-motion: reduce) {
  .floating-reaction { animation-name: reaction-fade; will-change: opacity; }
  .reaction-toggle, .reaction-repeat { transition: none; }
  @keyframes reaction-fade { 0%, 100% { opacity: 0; } 20%, 70% { opacity: 1; } }
}
