/**
 * WiGames — SPA App CSS
 * ========================
 * Styles specific to the SPA shell.
 * Theme variables are in global.css.
 */

/* ─── Screen transitions ──────────────────────── */
.screen {
  transition: opacity 0.2s ease;
}
.screen.hidden {
  display: none !important;
}

/* ─── Role-based visibility ───────────────────── */
body.role-admin .player-only { display: none !important; }
body.role-player .admin-only { display: none !important; }

/* ═══════════════════════════════════════════════
   TOPBAR — Fixed sticky bar
   ═══════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.topbar.hidden { display: none !important; }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  max-width: 64rem;
  margin: 0 auto;
  gap: 0.5rem;
  min-height: 48px;
}

/* User info (avatar + name) — RIGHT side in RTL */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 2px solid var(--color-primary);
  background: rgba(99, 102, 241, 0.12);
  flex-shrink: 0;
}
.topbar-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Team badge — next to player name */
.topbar-team-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1.5px solid;
  background: rgba(0,0,0,0.25);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
}
.topbar-team-badge .tb-avatar {
  font-size: 0.8rem;
  line-height: 1;
}
.topbar-team-badge .tb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-team-badge .tb-score {
  font-weight: 900;
  font-size: 0.75rem;
  color: white;
  margin-inline-start: 0.15rem;
}

/* Connection status — CENTER */
.topbar-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e88;
}
.status-dot.disconnected {
  background: #ef4444;
  box-shadow: 0 0 6px #ef444488;
  animation: statusPulse 1.5s ease infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.status-text {
  font-size: 0.7rem;
  color: var(--color-text-secondary, #94a3b8);
}

/* Dropdown menu — LEFT side in RTL */
.topbar-menu-wrap {
  position: relative;
  flex-shrink: 0;
}
.topbar-menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar-menu-btn:hover {
  background: var(--color-surface-dark);
  color: white;
}
.topbar-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  background: var(--color-surface);
  border: 1px solid var(--color-border, rgba(255,255,255,0.1));
  border-radius: 0.75rem;
  min-width: 170px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 110;
}
.topbar-dropdown.hidden { display: none !important; }
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.8rem;
  color: #e2e8f0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  text-align: right;
}
.topbar-dropdown-item:hover {
  background: var(--color-surface-dark);
}
.topbar-dropdown-item.text-red-400 {
  color: #f87171;
}
.topbar-dropdown-item.text-red-400:hover {
  background: rgba(239, 68, 68, 0.1);
}
.topbar-dropdown-divider {
  height: 1px;
  background: var(--color-border, rgba(255,255,255,0.08));
  margin: 0.25rem 0;
}

/* ═══ ACTION BAR — Admin session controls ═══ */
.action-bar {
  background: var(--color-surface-dark);
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.06));
}
.action-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.375rem 1rem;
  max-width: 64rem;
  margin: 0 auto;
}
.action-bar-right,
.action-bar-center,
.action-bar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.action-bar-right { flex: 1; justify-content: flex-start; }
.action-bar-center { flex: 0 0 auto; justify-content: center; }
.action-bar-left { flex: 1; justify-content: flex-end; }
.action-code-block {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.action-code-label {
  font-size: 0.65rem;
  color: #94a3b8;
}
.action-code-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-primary-light);
  letter-spacing: 0.15em;
}
.action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--color-surface);
  color: #94a3b8;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.action-btn:hover {
  color: white;
  background: var(--color-surface-light);
}
.action-players {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}

/* Content offset for fixed topbar */
.topbar-offset {
  padding-top: 5.5rem; /* topbar + action bar height */
}
body.role-player .topbar-offset {
  padding-top: 3.5rem; /* topbar only (no action bar) */
}

/* ═══ ADMIN TAB BAR — Bottom navigation ═══ */
.admin-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border, rgba(255,255,255,0.08));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
  padding: 0.25rem 0;
  padding-bottom: env(safe-area-inset-bottom, 0.25rem);
}
.admin-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0.25rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  position: relative;
  max-width: 120px;
}
.admin-tab:hover { color: #94a3b8; }
.admin-tab.active {
  color: var(--color-primary-light, #818cf8);
}
.admin-tab.active .admin-tab-icon {
  transform: scale(1.15);
}
.admin-tab-icon {
  font-size: 1.25rem;
  transition: transform 0.2s;
  line-height: 1;
}
.admin-tab-label {
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
}
.admin-tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--color-accent, #ef4444);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.admin-tab-badge.hidden { display: none !important; }

/* Admin tab content should have bottom padding for tab bar */
.admin-tab-content {
  padding-bottom: 4.5rem !important;
}
.admin-tab-content.hidden { display: none !important; }

/* ─── Avatar/Color picker ─────────────────────── */
.avatar-btn, .color-btn {
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.avatar-btn:active, .color-btn:active {
  transform: scale(0.9);
}
.avatar-btn.selected {
  box-shadow: 0 0 0 3px var(--color-primary);
  transform: scale(1.1);
}
.color-btn.selected {
  box-shadow: 0 0 0 3px white;
  transform: scale(1.15);
}

/* ═══════════════════════════════════════════════
   JOIN SCREEN — Modern Mobile-First
   ═══════════════════════════════════════════════ */

/* Preview card with floating avatar */
.join-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem 0.75rem;
  position: relative;
  z-index: 1;
}
.join-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 3px solid var(--color-primary);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.35), 0 0 40px rgba(99, 102, 241, 0.15);
  transition: all 0.3s ease;
}

/* Main form card */
.join-card {
  background: var(--color-surface);
  border-radius: 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* Section spacing */
.join-section {
  margin-bottom: 1rem;
}
.join-section:last-of-type {
  margin-bottom: 1.25rem;
}

/* Label */
.join-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

/* Name input */
.join-input {
  width: 100%;
  background: var(--color-surface-dark);
  border: 2px solid var(--color-border);
  border-radius: 0.875rem;
  padding: 0.625rem 1rem;
  font-size: 0.95rem;
  color: var(--color-text);
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.join-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.join-input::placeholder {
  color: var(--color-text-dim);
  font-size: 0.85rem;
}

/* Avatar grid — wrapping, compact on mobile */
.join-avatar-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.3rem;
}
@media (max-width: 380px) {
  .join-avatar-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
  }
}
.join-avatar-grid .avatar-btn {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 0.6rem;
  background: var(--color-surface-dark);
  border: 2px solid transparent;
  transition: all 0.15s ease;
}
.join-avatar-grid .avatar-btn.border-primary {
  border-color: var(--color-primary) !important;
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
  transform: scale(1.08);
}
.join-avatar-grid .avatar-btn.opacity-30 {
  opacity: 0.25;
  filter: grayscale(0.8);
}

/* Color grid — compact circles */
.join-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.35rem;
}
@media (max-width: 380px) {
  .join-color-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 0.3rem;
  }
}
.join-color-grid .color-btn {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}
.join-color-grid .color-btn.ring-2 {
  border-color: white;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

/* Submit button */
.join-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem;
  border-radius: 0.875rem;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  min-height: 48px;
}
.join-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}
.join-submit-btn:active {
  transform: scale(0.98);
}

/* Back button */
.join-back-btn {
  display: block;
  width: 100%;
  text-align: center;
  color: var(--color-text-dim);
  font-size: 0.8rem;
  padding: 0.75rem;
  transition: color 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}
.join-back-btn:hover {
  color: var(--color-text-muted);
}

/* ─── Game card ──────────────────────────────── */
.game-card {
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

/* ─── Beta Badge ─────────────────────────────── */
.beta-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  z-index: 5;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
  pointer-events: none;
}

/* ─── Status Toggle Switch ───────────────────── */
.status-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.status-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.status-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  transition: 0.25s;
}
.status-toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
}
.status-toggle-switch input:checked + .status-toggle-slider {
  background: #f59e0b;
}
.status-toggle-switch input:checked + .status-toggle-slider::before {
  transform: translateX(16px);
}

/* ─── Category Filter Pills ──────────────────── */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

.category-pill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: var(--color-surface-dark);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.category-pill:hover {
  background: var(--color-surface-light);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.category-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.category-pill .pill-icon { font-size: 0.85rem; }
.category-pill .pill-label { line-height: 1; }
.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.game-card:active {
  transform: scale(0.97);
}
.game-card.selected {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 2px var(--color-primary), 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ─── Reorder mode ───────────────────────────── */
.reorder-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  color: #fff;
  cursor: grab;
  z-index: 5;
  transition: background 0.15s;
}
.reorder-handle:active {
  cursor: grabbing;
  background: rgba(99, 102, 241, 0.7);
}

.game-card.reorder-active {
  animation: reorder-pulse 1.5s ease-in-out infinite;
  position: relative;
}
@keyframes reorder-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
  50% { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35); }
}

.game-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  box-shadow: none !important;
}

.game-card.drag-over {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary), 0 0 20px rgba(99, 102, 241, 0.4);
  transform: scale(1.03);
}

/* ─── Settings UI ────────────────────────────── */

/* Settings group card */
.settings-group {
  background: var(--color-surface-dark);
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
}
.settings-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.05));
  border-bottom: 1px solid var(--color-border);
}
.settings-group-icon {
  font-size: 1rem;
  line-height: 1;
}
.settings-group-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary-light);
  letter-spacing: 0.02em;
}
.settings-group-body {
  padding: 0.25rem 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-row:hover {
  background: rgba(255,255,255,0.03);
}
.setting-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text);
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--color-surface-dark);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
}

/* Toggle switch — uses hidden checkbox + sibling selector */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-surface-dark);
  border: 2px solid var(--color-border);
  border-radius: 999px;
  transition: background 0.25s, border-color 0.25s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #94a3b8;
  border-radius: 50%;
  top: 2px;
  right: 2px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
/* Checked state */
.toggle-switch input:checked + .toggle-slider {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(-20px);
  background: white;
}
/* Focus ring for accessibility */
.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* ─── Player pill in list ────────────────────── */
.player-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  background: var(--color-surface-dark);
  transition: all 0.2s ease;
  position: relative;
}

/* ─── Lobby pill entrance animation ──────────── */
.lobby-pill-enter {
  animation: lobbyFadeInUp 0.35s ease both;
}
@keyframes lobbyFadeInUp {
  0%   { opacity: 0; transform: translateY(12px) scale(0.85); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Pulse glow for newly joined player */
.lobby-pill-new {
  animation: lobbyPulseGlow 0.6s ease 2;
}
@keyframes lobbyPulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
  50%      { box-shadow: 0 0 12px 3px var(--color-primary); }
}

/* ─── Full-screen floating reaction emoji ───── */
.reaction-float {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
  animation: reactionRise var(--duration, 3s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.reaction-float-label {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  white-space: nowrap;
  animation: reactionLabelFade 1.8s ease forwards;
}
@keyframes reactionRise {
  0%   { opacity: 0; transform: scale(0) translateY(0) rotate(0deg); }
  8%   { opacity: 0.9; transform: scale(1.4) translateY(-10px) rotate(-8deg); }
  15%  { opacity: 0.85; transform: scale(1) translateY(-30px) rotate(5deg); }
  40%  { opacity: 0.7; transform: scale(1.1) translateY(-120px) rotate(-3deg); }
  70%  { opacity: 0.4; transform: scale(0.95) translateY(-220px) rotate(6deg); }
  100% { opacity: 0; transform: scale(0.6) translateY(-340px) rotate(-4deg); }
}
@keyframes reactionLabelFade {
  0%   { opacity: 0; transform: translateY(0) scale(0.8); }
  15%  { opacity: 1; transform: translateY(-8px) scale(1); }
  50%  { opacity: 0.8; transform: translateY(-20px); }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* ─── Topbar reaction picker ─────────────────── */
.reaction-picker {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border, rgba(255,255,255,0.1));
  border-radius: 0.75rem;
  padding: 0.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 120;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.25rem;
  min-width: 200px;
}
.reaction-picker.hidden { display: none !important; }
.reaction-picker button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: none;
  background: transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.reaction-picker button:hover {
  background: var(--color-surface-dark);
  transform: scale(1.2);
}
.reaction-picker button:active {
  transform: scale(0.9);
}

/* ─── Admin Kick button ──────────────────────── */
.kick-btn {
  opacity: 0;
  transition: opacity 0.2s;
}
.player-pill:hover .kick-btn {
  opacity: 1;
}

/* ─── Theme dots ─────────────────────────────── */
.theme-dot.active {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.5);
  transform: scale(1.2);
}

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }

/* ─── Score animation ────────────────────────── */
.score-animate {
  animation: scorePop 0.4s ease;
}
@keyframes scorePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); color: var(--color-primary-light); }
  100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════
   TEAMS SYSTEM
   ═══════════════════════════════════════════════ */

/* Teams toggle switch */
.teams-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.teams-toggle-switch input { opacity: 0; width: 0; height: 0; }
.teams-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(100,116,139,0.4);
  transition: 0.3s;
  border-radius: 24px;
}
.teams-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
.teams-toggle-switch input:checked + .teams-toggle-slider {
  background-color: var(--color-primary, #6366f1);
}
.teams-toggle-switch input:checked + .teams-toggle-slider::before {
  transform: translateX(20px);
}

/* Team count & scoring mode buttons */
.team-count-btn,
.scoring-mode-btn {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid rgba(100,116,139,0.3);
  border-radius: 0.75rem;
  background: transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.team-count-btn:hover,
.scoring-mode-btn:hover {
  border-color: var(--color-primary);
  color: white;
}
.team-count-btn.active,
.scoring-mode-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

/* Team card */
.team-card {
  border: 1px solid rgba(100,116,139,0.15);
  transition: border-color 0.2s;
}
.team-card:hover {
  border-color: rgba(100,116,139,0.3);
}

/* Team name input */
.team-name-input {
  font-family: inherit;
}

/* Team group header (in admin player list / lobby) */
.team-group-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-right: 3px solid #6366f1;
  border-radius: 0 0.25rem 0.25rem 0;
  background: rgba(100,116,139,0.06);
}
.team-group-header:first-child {
  margin-top: 0;
}

/* Team badge dot (inline with player pill) */
.team-badge-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 10px;
  flex-shrink: 0;
  line-height: 1;
}

/* Team popup picker (color/avatar) */
.team-popup-picker {
  position: absolute;
  z-index: 50;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  background: var(--color-surface-dark, #1a1a2e);
  border: 1px solid rgba(100,116,139,0.2);
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: fadeInDown 0.15s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Team dot in players grid bar */
.player-grid-team-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin: 0 2px;
}

/* ═══════════════════════════════════════════════
   LIGHT THEME — Topbar Dropdown
   ═══════════════════════════════════════════════ */
[data-theme="light"] .topbar-dropdown {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .topbar-dropdown-item {
  color: #1e293b;
}
[data-theme="light"] .topbar-dropdown-item:hover {
  background: #f1f5f9;
}
[data-theme="light"] .topbar-dropdown-item.text-red-400 {
  color: #dc2626;
}
[data-theme="light"] .topbar-dropdown-item.text-red-400:hover {
  background: #fef2f2;
}
[data-theme="light"] .topbar-dropdown-divider {
  background: rgba(0, 0, 0, 0.08);
}

/* ── Admin Start Button: Keep white text ─────── */
[data-theme="light"] #adminStartGameBtn {
  color: #ffffff !important;
}

/* ── Admin Settings Panel (Light) ───────────── */
[data-theme="light"] #adminSettingsPanel .text-white {
  color: #000000 !important;
}
[data-theme="light"] #adminSettingsPanel .text-gray-300,
[data-theme="light"] #adminSettingsPanel .text-gray-400,
[data-theme="light"] #adminSettingsPanel .text-gray-500 {
  color: #374151 !important;
}
[data-theme="light"] #adminSettingsPanel .bg-surface-dark {
  background: #f1f5f9;
}
[data-theme="light"] #adminSettingsPanel input.text-white {
  color: #000000 !important;
}
