/* In-game reactions and quick chat.
   Every value comes from tokens.css — no hardcoded colours or radii. */

/* ── The bubble ──────────────────────────────────────────────────────────
   Drawn attached to its sender's seat, carrying their avatar and name, so a
   reaction always says who sent it. */
.rx-bubble {
  position: fixed;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  max-width: min(78vw, 320px);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transition: opacity var(--dur-fast) ease, transform var(--dur-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

/* Your own reactions are tinted, so the two sides never read the same. */
.rx-bubble.rx-mine {
  background: var(--bg-card);
  border-color: var(--gold);
}

.rx-bubble.rx-in  { opacity: 1; transform: translateY(0) scale(1); }
.rx-bubble.rx-out { opacity: 0; transform: translateY(-8px) scale(0.96); }

/* Seats at the top of the screen open downward; seats at the bottom open up. */
.rx-bubble.rx-top    { transform-origin: top center; }
.rx-bubble.rx-bottom { transform-origin: bottom center; }

.rx-avatar {
  inline-size: 22px;
  block-size: 22px;
  border-radius: var(--r-full);
  object-fit: cover;
  flex: none;
}

.rx-avatar-blank {
  display: grid;
  place-items: center;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.rx-emoji {
  font-size: 24px;
  line-height: 1;
  flex: none;
}

.rx-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rx-who {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  max-inline-size: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── The picker ──────────────────────────────────────────────────────────
   A bottom sheet: the only region a thumb reaches on a tall phone. */
.rx-panel {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
  background: var(--bg-elevated);
  border-start-start-radius: var(--r-xl);
  border-start-end-radius: var(--r-xl);
  border-block-start: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform var(--dur-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

/* `display: flex` above outranks the user-agent's `[hidden] { display: none }`,
   so without this the panel is never actually hidden — it just sits translated
   off-screen, still focusable and still catching taps along the bottom edge. */
.rx-panel[hidden] { display: none !important; }

.rx-panel.rx-panel-in { transform: translateY(0); }

.rx-panel-grip {
  inline-size: 36px;
  block-size: 4px;
  border-radius: var(--r-full);
  background: var(--border-hover, rgba(255, 255, 255, 0.18));
  margin: var(--s-1) auto var(--s-1);
}

.rx-row {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-block-end: var(--s-1);
}

.rx-row::-webkit-scrollbar { display: none; }

/* 48px keeps every control above the 44px minimum tap target with room to spare. */
.rx-pick {
  flex: none;
  min-block-size: 48px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: transform var(--dur-fast) ease, background var(--dur-fast) ease;
}

.rx-pick-emote {
  inline-size: 48px;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.rx-pick-phrase {
  padding-inline: var(--s-4);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.rx-pick:hover  { background: var(--bg-hover); }
.rx-pick:active { transform: scale(0.93); }
.rx-pick:disabled { opacity: 0.4; cursor: default; }
.rx-pick:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .rx-bubble, .rx-panel, .rx-pick { transition: none; }
}
