header,
.topbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* Floor the width so the room label cannot be squeezed to zero by
   .header-actions, which is flex: 0 0 auto and never shrinks. When the two no
   longer fit side by side the header wraps instead of collapsing the label. */
header > div,
.topbar > div {
  min-width: 5rem;
}

#contextLabel {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  color: #667085;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.header-actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

body.game-room-context .header-actions #startButton:not(.hidden):not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, #6738e8, #0ea5e9, #14b8a6, #f97316);
  background-size: 240% 240%;
  animation:
    start-button-breathe 2.4s ease-in-out infinite,
    start-button-color-shift 6s ease-in-out infinite;
  box-shadow:
    0 0 0 0 rgba(20, 184, 166, 0.34),
    0 8px 18px rgba(103, 56, 232, 0.24);
}

body.game-room-context .header-actions #startButton:not(.hidden):not(:disabled):hover {
  animation-play-state: paused;
}

@keyframes start-button-breathe {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(20, 184, 166, 0.34),
      0 8px 18px rgba(103, 56, 232, 0.24);
  }

  50% {
    transform: scale(1.045);
    box-shadow:
      0 0 0 9px rgba(249, 115, 22, 0),
      0 10px 22px rgba(14, 165, 233, 0.28);
  }
}

@keyframes start-button-color-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.game-room-context .header-actions #startButton:not(.hidden):not(:disabled) {
    animation: none;
  }
}

@media (max-width: 640px) {
  header,
  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .header-actions {
    justify-content: flex-end;
  }
}
