:root {
  color-scheme: dark;
  --arena-base-width: 720px;
  --arena-base-height: 720px;
  --bg: #070a0f;
  --panel: #1a1a1a;
  --panel-strong: #111;
  --panel-border: #343434;
  --text: #f4f7ff;
  --muted: #aab3c8;
  --blue: #4f63ff;
  --pink: #f24aa2;
  --cyan: #30b7ff;
  --lime: #8cd43a;
  --orange: #f3aa3a;
  --violet: #8d55ff;
  --sb-text: #eaf1fc;
  --sb-muted: #8ea0b9;
  --sb-accent: #58ccff;
  --sb-border: rgba(150, 175, 210, 0.24);
  --sb-border-strong: rgba(190, 214, 244, 0.44);
  --sb-surface: #0d1520;
  --sb-surface-soft: #101b2a;
  --sb-surface-strong: #070d15;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-shadow: none !important;
  text-shadow: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: 0;
  overflow: hidden;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
}

:where(button, input, select, [tabindex]):focus-visible {
  outline: 2px solid #70d7ff;
  outline-offset: 2px;
}

.game-layout {
  --hud-width: clamp(300px, 24vw, 380px);
  --arena-size: min(calc(100dvh - 32px), calc(100vw - var(--hud-width) - 48px));
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  /* The arena is height-bound with a fixed 1:1 aspect (720x720 field), so
     it cannot grow horizontally. Sidebar and arena sit adjacent as one
     centered group; leftover width splits evenly to both page edges.
     Keep the surface flat — gradients and filters near the canvas cost real
     frame time during play. */
  grid-template-columns: var(--hud-width) minmax(0, var(--arena-size));
  grid-template-rows: minmax(0, 1fr);
  justify-content: center;
  gap: 16px;
  padding: 16px;
  align-items: stretch;
}

/* The game HUD only shows during a match. visibility (not display) keeps the
   canvas measurable so fitStageToViewport works while it is offstage. */
.game-layout.is-offstage {
  visibility: hidden;
}

/* Sidebar matches the waiting-room chat card exactly: stacked bordered
   cards on the page background, each with a full-width header bar and
   divider (.lobby-chat / .lobby-chat-head). */
.side {
  /* Fixed width, adjacent to the arena in the centered pair. */
  width: 100%;
  justify-self: center;
  border: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  gap: 10px;
}

.side-panel {
  position: relative;
  border: 1px solid rgba(151, 180, 216, 0.2);
  border-radius: 14px;
  background: rgba(9, 14, 22, 0.92);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  box-shadow: none;
}

.side-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(151, 180, 216, 0.14);
  color: #cddcf6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
}

/* The timer and score content already communicate their purpose. Keep these
   labels for assistive technology without spending two full header rows in
   the height-constrained match sidebar. */
.reach > .side-panel-head,
.score-panel > .side-panel-head {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.score-panel .score-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 10px;
}

.side-panel-icon {
  display: grid;
  place-items: center;
  color: #47d6be;
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
}

/* Compact timer row; its visually hidden header still supplies context to
   assistive technology. */
.reach .target-row {
  min-height: 0;
  border: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px;
  padding: 0 2px;
  background: none;
}

.reach .target-pill {
  border: 0;
  padding: 0;
  background: none;
  color: #8ea4c4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.reach .target {
  min-width: 72px;
  display: grid;
  place-items: center;
  color: var(--sb-accent);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 0.9;
  transition: color 160ms ease;
}

.reach .target.is-urgent {
  color: #ff6666;
}

.score-panel {
  flex: 0 1 clamp(180px, 30dvh, 280px);
  min-height: 0;
  align-content: start;
  overflow: hidden;
}

/* Seven- and eight-player rooms need more vertical room than the default
   standings card. The chat remains usable, while overflow stays available as
   a fallback on unusually short viewports. */
.score-panel.is-large-roster {
  flex-basis: clamp(300px, 42dvh, 390px);
}

.score-panel.is-large-roster .score-list {
  gap: 4px;
}

.score-panel.is-large-roster .score-entry {
  min-height: 27px;
  padding-block: 2px;
}

.score-panel.is-large-roster .score-num {
  font-size: 17px;
}

.score-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  min-width: 0;
  list-style: none;
  align-content: start;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 160, 193, 0.42) transparent;
}

.score-entry {
  min-height: 30px;
  border: 1px solid rgba(147, 171, 202, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 27, 40, 0.7) 0%, rgba(11, 18, 28, 0.65) 100%);
  padding: 3px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

/* No transform on hover: the panel clips overflow, so a nudged row loses
   its right edge. */
.score-entry:hover {
  border-color: rgba(184, 209, 240, 0.42);
  background: linear-gradient(180deg, rgba(20, 31, 46, 0.84) 0%, rgba(14, 23, 35, 0.8) 100%);
}

.score-entry.leader {
  border-color: rgba(255, 204, 102, 0.5);
  background:
    linear-gradient(90deg, rgba(255, 196, 92, 0.14) 0%, rgba(255, 196, 92, 0) 60%),
    linear-gradient(180deg, rgba(19, 28, 41, 0.78) 0%, rgba(12, 19, 29, 0.72) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 102, 0.08);
}

.score-entry.leader .score-num {
  color: #ffd98a;
}

.entry-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.score-round-delta {
  min-width: 28px;
  height: 19px;
  padding: 0 6px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: #08121b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
  flex: 0 0 auto;
}

.score-round-delta[hidden] {
  display: none !important;
}

.score-round-delta.is-zero {
  opacity: 0.72;
  filter: saturate(0.7) brightness(1.03);
}

.entry-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.dot {
  width: 6px;
  height: 16px;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.26);
  flex: 0 0 auto;
}

.score-num {
  color: #f4f8ff;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.015em;
}

.chat-panel {
  position: relative;
  margin-top: 0;
  flex: 1 1 320px;
  max-width: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "chat-head"
    "bot-playback"
    "chat-feed"
    "chat-form";
  gap: 12px;
  padding: 0;
  border: 1px solid rgba(151, 180, 216, 0.2);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(9, 14, 22, 0.92);
}

.chat-head {
  grid-area: chat-head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  min-width: 0;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(151, 180, 216, 0.14);
}

/* Card-body children carry their own side margins now that the panel is
   edge-to-edge. */
.chat-panel .bot-playback-controls {
  margin: 0 12px;
  width: auto;
}

.chat-panel .chat-feed {
  margin: 0 12px;
}

.chat-panel .chat-form {
  margin: 0 12px 12px;
}

.chat-title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-title {
  color: #cddcf6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.bot-playback-controls {
  grid-area: bot-playback;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(151, 180, 216, 0.14);
  border-radius: 10px;
  background: rgba(8, 13, 20, 0.5);
}

.bot-playback-controls[hidden] {
  display: none !important;
}

.bot-playback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.bot-playback-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9fb3d0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bot-playback-title i {
  font-size: 12px;
  color: #7aa7ff;
}

.bot-playback-controls.is-recording .bot-playback-title {
  color: #ff8994;
}

.bot-playback-controls.is-recording .bot-playback-title i {
  color: #ff5c6c;
  animation: recordPulse 1100ms ease-in-out infinite;
}

.bot-playback-controls.is-recording .bot-playback-status {
  border-color: rgba(255, 112, 124, 0.55);
  color: #ffb3ba;
}

.bot-playback-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  min-width: 0;
}

.bot-playback-row .chat-icon-btn {
  width: 100%;
}

.chat-icon-btn {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  border: 1px solid var(--sb-border);
  background: rgba(11, 17, 26, 0.92);
  color: #c8d8ef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 100ms ease, color 120ms ease, border-color 120ms ease, background-color 120ms ease;
  box-shadow: none;
  padding: 0;
}

.chat-icon-btn i {
  font-size: 14px;
  line-height: 1;
}

.chat-icon-btn .label {
  display: none;
}

.chat-icon-btn:hover {
  color: #eef4ff;
  border-color: var(--sb-border-strong);
  background: rgba(19, 29, 43, 0.94);
  transform: translateY(-1px);
}

.chat-icon-btn:active {
  transform: translateY(0);
}

.chat-icon-btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  color: #91a2bc;
  border-color: rgba(129, 147, 176, 0.26);
  background: rgba(11, 17, 26, 0.8);
}

.chat-icon-btn.mute.is-muted {
  border-color: rgba(143, 162, 189, 0.5);
  background: rgba(18, 25, 37, 0.9);
  color: #90a2ba;
}

.chat-icon-btn.pause {
  border-color: rgba(231, 173, 105, 0.5);
  color: #f0bc7a;
}

.chat-icon-btn.pause.is-paused {
  border-color: rgba(131, 216, 160, 0.52);
  color: #9adfaa;
}

.chat-icon-btn.leave {
  border-color: rgba(241, 143, 167, 0.48);
  color: #f2a3b7;
}

.chat-icon-btn.settings {
  border-color: rgba(156, 179, 212, 0.42);
  color: #b9cade;
}

.chat-icon-btn.reload {
  border-color: rgba(88, 204, 255, 0.44);
  color: #9ed8ff;
}

.chat-icon-btn.copy-log {
  border-color: rgba(122, 167, 255, 0.46);
  color: #bad0ff;
}

.chat-icon-btn.settings.is-open {
  border-color: rgba(136, 224, 167, 0.58);
  color: #96e2b3;
}

.chat-icon-btn.trace-record {
  border-color: rgba(255, 112, 124, 0.52);
  color: #ff8994;
}

.chat-icon-btn.trace-record.is-recording {
  border-color: rgba(255, 112, 124, 0.85);
  background: rgba(120, 28, 38, 0.6);
  color: #ff5c6c;
  animation: recordPulse 1100ms ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

.chat-icon-btn.trace-play {
  border-color: rgba(88, 204, 255, 0.44);
  color: #9ed8ff;
}

.chat-icon-btn.trace-play.is-active {
  border-color: rgba(37, 224, 230, 0.72);
  background: rgba(15, 72, 82, 0.72);
  color: #6ff8ff;
}

.bot-playback-status {
  min-width: 0;
  height: 22px;
  padding: 0 10px;
  border: 1px solid rgba(122, 167, 255, 0.24);
  border-radius: 999px;
  background: rgba(9, 15, 23, 0.84);
  color: #c4d6f2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.chat-icon-btn.trace-clear {
  border-color: rgba(241, 143, 167, 0.42);
  color: #ef9aac;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 140ms ease, visibility 0s linear 0s;
}

.settings-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease, visibility 0s linear 120ms;
}

/* Settings modal in the lobby-card design language: same border, surface,
   and gradient accent strip. */
.settings-card {
  position: relative;
  width: min(480px, 96vw);
  max-height: min(88vh, 860px);
  border-radius: 8px;
  border: 1px solid rgba(184, 205, 232, 0.22);
  background:
    linear-gradient(145deg, rgba(71, 214, 190, 0.1) 0%, rgba(71, 214, 190, 0) 44%),
    linear-gradient(180deg, rgba(27, 34, 44, 0.98) 0%, rgba(12, 15, 21, 0.97) 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.settings-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #47d6be, #7aa7ff, #ffb75c, #ff6b9d);
}

.settings-head {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid rgba(151, 180, 216, 0.14);
  background: none;
}

.settings-title {
  margin: 0;
  color: #cddcf6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 109, 109, 0.52);
  background: rgba(255, 109, 109, 0.16);
  color: #ff9f9f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 120ms ease;
}

.settings-close-btn:hover {
  filter: brightness(1.16);
}

.settings-list {
  padding: 12px 14px 14px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  background: none;
  scrollbar-width: thin;
}

.account-setting {
  min-height: 52px;
  border-radius: 10px;
  border: 1px solid rgba(151, 180, 216, 0.14);
  background: rgba(10, 14, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px;
}

.label-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.account-setting-label {
  color: #dbe6f8;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.setting-wrapper {
  min-width: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.setting-note {
  color: #8f9ab2;
  font-size: 12px;
  white-space: nowrap;
}

.settings-value-input {
  width: 58px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.1);
  color: #d7e4ff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  padding: 0 6px;
  outline: none;
}

.settings-value-input:focus {
  border-color: rgba(185, 255, 50, 0.55);
  box-shadow: 0 0 0 1px rgba(185, 255, 50, 0.24);
}

.settings-static-chip {
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.09);
  color: #9fb0d2;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  white-space: nowrap;
}

.settings-controls {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}

.settings-controls-key {
  min-width: 96px;
  height: 28px;
  border: none;
  background: #3b3b3b;
  color: rgba(229, 229, 229, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 110ms ease, color 110ms ease, background-color 110ms ease;
  padding: 0 12px;
  line-height: 1;
  font-size: 18px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.settings-controls-key:hover {
  color: #f3f7ff;
  filter: brightness(1.08);
}

.settings-controls-key.is-capturing {
  color: #e7ecf8;
  background: #4a4a4a;
}

.settings-controls-key.left {
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%);
}

.settings-controls-key.right {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}

.settings-controls-separator {
  width: 1px;
  height: 18px;
  background: rgba(0, 0, 0, 0.45);
}

.settings-range {
  width: 140px;
  accent-color: #47d6be;
}

.settings-toggle {
  width: 52px;
  height: 28px;
  border: none;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: filter 120ms ease, background-color 120ms ease;
}

.settings-toggle.on {
  background-color: rgba(71, 214, 190, 0.55);
}

.settings-toggle.off {
  background-color: rgba(255, 109, 109, 0.5);
}

.settings-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #b9ff32;
  transition: transform 140ms ease, background-color 140ms ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.settings-toggle.off .settings-toggle-thumb {
  background: #ff6d6d;
  transform: translateX(24px);
}

.settings-toggle.on .settings-toggle-thumb {
  transform: translateX(0);
}

.settings-toggle:hover {
  filter: brightness(1.08);
}

.settings-foot {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.settings-refresh-hint {
  color: #8f9ab2;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.settings-refresh-btn {
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(140, 212, 58, 0.52);
  background: rgba(77, 116, 28, 0.35);
  color: #e8ffd1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 11px;
  cursor: pointer;
}

.settings-refresh-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-feed {
  grid-area: chat-feed;
  height: auto;
  min-height: 140px;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid rgba(147, 171, 202, 0.24);
  border-radius: 10px;
  background: rgba(7, 13, 20, 0.9);
  padding: 9px 10px;
  display: grid;
  align-content: start;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 160, 193, 0.42) transparent;
}

.chat-line {
  position: relative;
  margin: 0;
  color: #dde9fb;
  font-size: 12px;
  line-height: 1.25;
  word-break: break-word;
  font-weight: 500;
}

/* Admin-only delete affordance, revealed on hover. */
.chat-line-delete {
  display: none;
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  padding: 0;
  background: rgba(151, 180, 216, 0.14);
  color: #9fb2d4;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.chat-line:hover .chat-line-delete {
  display: inline-flex;
}

.chat-line-delete:hover {
  background: rgba(255, 99, 118, 0.24);
  color: #ffd9dd;
}

.chat-line.system {
  color: #f4f7ff;
  font-style: italic;
}

.chat-line-time {
  display: inline-block;
  margin-right: 7px;
  color: #6f819d;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat-line-name {
  color: #70d7ff;
  font-weight: 700;
}

.chat-line-name.self {
  color: #9edfff;
}

.chat-form {
  grid-area: chat-form;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: center;
}

.chat-input {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(147, 171, 202, 0.34);
  border-radius: 10px;
  background: rgba(7, 13, 20, 0.96);
  color: #edf3ff;
  padding: 0 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.chat-input:focus {
  border-color: rgba(128, 203, 238, 0.86);
  box-shadow: 0 0 0 2px rgba(88, 204, 255, 0.2);
}

#powerups,
#game,
#heads,
#arenaFrame,
.round-overlay {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  align-self: start;
}

#powerups,
#game,
#heads {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

#powerups {
  z-index: 1;
  background: #000;
}

#game {
  z-index: 2;
  background: transparent;
}

#heads {
  z-index: 3;
}

#arenaFrame {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  border: 2px solid rgba(244, 247, 255, 0.8);
  box-shadow: none;
  box-sizing: border-box;
}

.round-overlay {
  position: relative;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 6;
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    opacity 160ms ease,
    visibility 0s linear 160ms;
}

.round-overlay.is-visible {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.round-overlay-card {
  position: relative;
  width: 100%;
  min-height: 68px;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  border-top: 1px solid rgba(180, 205, 236, 0.24);
  border-bottom: 1px solid rgba(180, 205, 236, 0.24);
  background: rgba(5, 8, 13, 0.86);
  animation: roundCardIn 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes roundCardIn {
  from { opacity: 0; transform: scaleX(0.82); }
  to { opacity: 1; transform: scaleX(1); }
}

.winner-block {
  min-width: 0;
}

.winner-icon,
.winner-kicker {
  display: none;
}

.round-overlay .winner {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  font-size: clamp(16px, 2.6vw, 24px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.round-overlay .winner-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
  font-weight: 900;
}

.round-overlay .winner-tail {
  color: #f4f8ff;
  font-weight: 900;
  flex: 0 0 auto;
  opacity: 0.96;
}

.round-overlay .next {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.round-overlay .next-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #e4ebf7;
  opacity: 0.86;
}

.round-overlay .countdown {
  font-size: 38px;
  font-weight: 900;
  line-height: 0.78;
  min-width: 32px;
  text-align: right;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.round-overlay .match-results {
  display: none;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 6px;
}

.match-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 6px;
  color: #7f91aa;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.round-overlay .match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid rgba(151, 180, 216, 0.15);
  border-radius: 10px;
  background: rgba(16, 24, 36, 0.78);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #f7fbff;
}

.round-overlay .match-row.is-winner {
  border-color: rgba(255, 210, 104, 0.42);
  background: rgba(59, 48, 19, 0.42);
}

.round-overlay .match-row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.round-overlay .match-row-position {
  width: 20px;
  color: #8192aa;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.round-overlay .match-row.is-winner .match-row-position {
  color: #ffd86b;
}

.round-overlay .match-row-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-overlay .match-row-right {
  display: flex;
  align-items: baseline;
  gap: 9px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.round-overlay .match-row-rank {
  color: #f9fcff;
  opacity: 0.96;
}

.round-overlay.is-match-end {
  background: rgba(0, 0, 0, 0.42);
}

.round-overlay.is-match-end .round-overlay-card {
  width: min(540px, calc(100% - 40px));
  max-height: calc(100% - 40px);
  padding: 24px;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 18px;
  overflow-y: auto;
  border: 1px solid rgba(170, 196, 228, 0.28);
  border-radius: 18px;
  background: rgba(7, 11, 17, 0.96);
  animation-name: matchCardIn;
}

@keyframes matchCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.round-overlay.is-match-end .winner-block {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.round-overlay.is-match-end .winner-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 205, 87, 0.42);
  border-radius: 50%;
  background: rgba(255, 197, 61, 0.12);
  color: #ffd35c;
  font-size: 19px;
}

.round-overlay.is-match-end .winner-kicker {
  display: block;
  color: #8fa2bb;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.round-overlay.is-match-end .winner {
  max-width: 100%;
  display: grid;
  justify-items: center;
  gap: 5px;
  font-size: clamp(24px, 4.6vw, 38px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.round-overlay.is-match-end .next {
  justify-self: center;
  min-height: 28px;
  padding: 0 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(151, 180, 216, 0.18);
  border-radius: 999px;
  background: rgba(151, 180, 216, 0.07);
}

.round-overlay.is-match-end .next-label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.1em;
  color: #a8b8cf;
  text-transform: uppercase;
}

.round-overlay.is-match-end .countdown {
  display: block;
  font-size: 16px;
  min-width: 0;
  line-height: 1;
}

.round-overlay.is-match-end .match-results {
  display: grid;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px 12px;
  /* Opaque base: the arena canvases keep an inline visibility:visible (so they
     survive the game layout going offstage), so a translucent overlay would let
     the canvas + sidebar bleed through behind the login card. */
  background:
    radial-gradient(940px 460px at 78% -8%, rgba(79, 99, 255, 0.19), transparent 62%),
    radial-gradient(780px 430px at -8% 96%, rgba(242, 74, 162, 0.16), transparent 60%),
    linear-gradient(
      115deg,
      rgb(9, 12, 18) 0%,
      rgb(16, 16, 20) 52%,
      rgb(9, 17, 14) 100%
    );
  overflow-x: hidden;
  overflow-y: auto;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(470px, 92vw);
  border-radius: 8px;
  border: 1px solid rgba(212, 224, 255, 0.18);
  background:
    linear-gradient(155deg, rgba(79, 99, 255, 0.13) 0%, rgba(79, 99, 255, 0) 38%),
    linear-gradient(330deg, rgba(242, 74, 162, 0.12) 0%, rgba(242, 74, 162, 0) 44%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.022) 42%, rgba(255, 255, 255, 0.046) 100%),
    rgba(18, 19, 23, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 28px 24px 22px;
  display: grid;
  gap: 16px;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--lime), var(--orange), var(--pink));
}

.auth-brand {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.auth-logo-text {
  line-height: 0.96;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: clamp(32px, 5.4vw, 44px);
  margin: 0;
}

.auth-logo-text span {
  display: block;
}

.auth-logo-curve {
  color: #ffffff;
}

.auth-logo-gen {
  background: linear-gradient(
    90deg,
    var(--cyan) 0%,
    var(--lime) 35%,
    var(--orange) 67%,
    var(--pink) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.auth-input-wrap {
  display: grid;
  gap: 8px;
}

.auth-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #bcc5da;
}

.auth-input {
  width: 100%;
  height: 52px;
  border: 1px solid rgba(194, 208, 245, 0.24);
  border-radius: 8px;
  background: rgba(3, 5, 8, 0.72);
  color: var(--text);
  padding: 0 15px;
  font-size: 20px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.auth-input:focus {
  border-color: rgba(48, 183, 255, 0.78);
  background: rgba(5, 8, 13, 0.92);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.auth-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  height: 48px;
  padding: 0 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 100ms ease, filter 120ms ease, opacity 120ms ease;
}

.auth-btn-icon {
  width: 25px;
  height: 25px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.95);
  flex: 0 0 auto;
}

.auth-btn-icon i {
  font-size: 15px;
  line-height: 1;
}

.auth-btn:hover {
  filter: brightness(1.05);
}

.auth-btn:active {
  transform: translateY(1px);
}

.auth-btn[disabled] {
  opacity: 0.56;
  cursor: not-allowed;
}

.auth-btn-signin {
  background: linear-gradient(90deg, #4f63ff 0%, #6f54ff 100%);
}

.auth-btn-register {
  background: linear-gradient(90deg, #f24aa2 0%, #d44cff 100%);
}

.auth-btn-guest {
  color: #0d2007;
  background: linear-gradient(90deg, #a9e35c 0%, #7dc72f 100%);
}

.auth-btn-guest .auth-btn-icon {
  background: rgba(10, 28, 5, 0.16);
  border-color: rgba(10, 28, 5, 0.18);
  color: #0d2007;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(194, 208, 245, 0.16);
}

.auth-passkey-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-passkey-row .auth-btn {
  font-size: 15px;
}

@media (max-width: 520px) {
  .auth-passkey-row {
    grid-template-columns: 1fr;
  }
}

.auth-status {
  margin: 0;
  min-height: 18px;
  color: #dce4f7;
  font-size: 13px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0;
}

.auth-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(140, 212, 58, 0.72);
}

.auth-status.error {
  color: #ff9fcf;
}

.auth-status.error::before {
  background: var(--pink);
  box-shadow: 0 0 10px rgba(242, 74, 162, 0.8);
}

.lobby-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 24px 14px;
  background:
    linear-gradient(135deg, rgba(7, 12, 19, 0.9) 0%, rgba(13, 19, 27, 0.84) 48%, rgba(24, 17, 24, 0.88) 100%),
    linear-gradient(90deg, rgba(71, 214, 190, 0.08), rgba(255, 183, 92, 0.07));
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 220ms cubic-bezier(0.22, 0.61, 0.36, 1),
    visibility 0s linear 0s;
  will-change: opacity;
}

.lobby-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 190ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 190ms;
}

.lobby-card {
  position: relative;
  width: min(900px, 95vw);
  border-radius: 8px;
  border: 1px solid rgba(184, 205, 232, 0.22);
  background:
    linear-gradient(145deg, rgba(71, 214, 190, 0.12) 0%, rgba(71, 214, 190, 0) 44%),
    linear-gradient(325deg, rgba(255, 183, 92, 0.11) 0%, rgba(255, 183, 92, 0) 46%),
    linear-gradient(180deg, rgba(27, 34, 44, 0.95) 0%, rgba(12, 15, 21, 0.94) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 28px 22px 20px;
  display: grid;
  gap: 16px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    transform 230ms cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 190ms ease;
  will-change: transform, opacity;
}

.lobby-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #47d6be, #7aa7ff, #ffb75c, #ff6b9d);
}

.lobby-card > * {
  min-width: 0;
}

.lobby-overlay.is-room .lobby-card {
  max-height: min(calc(100dvh - 48px), 720px);
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
}

.lobby-overlay.hidden .lobby-card {
  opacity: 0;
  transform: translateY(12px) scale(0.985);
}

.lobby-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.lobby-head-main {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 320px;
}

.lobby-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.lobby-title {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 900;
}

.lobby-room-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 31px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(122, 167, 255, 0.5);
  background: rgba(67, 86, 132, 0.22);
  color: #e3ecff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lobby-room-pill.room-count {
  border-color: rgba(48, 183, 255, 0.5);
  background: rgba(48, 183, 255, 0.14);
  color: #d8f1ff;
}

/* Always-visible "who am I" readout: the same name shown to other players,
   so a guest's server-assigned handle is never a surprise. */
.lobby-identity-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(151, 180, 216, 0.3);
  background: rgba(18, 22, 34, 0.6);
  color: #dce6ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
}

.lobby-identity-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-identity-tag {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(243, 170, 58, 0.5);
  background: rgba(243, 170, 58, 0.22);
  color: #ffd9a0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lobby-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.lobby-copy-btn {
  height: 31px;
  padding: 0 12px;
  border: 1px solid rgba(71, 214, 190, 0.5);
  border-radius: 8px;
  background: rgba(9, 38, 37, 0.7);
  color: #cafff5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.lobby-copy-btn:hover {
  border-color: rgba(92, 232, 207, 0.72);
  background: rgba(13, 55, 52, 0.78);
  color: #edfffb;
}

.lobby-copy-btn:active {
  transform: translateY(1px);
}

.lobby-back-btn {
  height: 31px;
  padding: 0 11px;
  border: 1px solid rgba(151, 170, 204, 0.45);
  border-radius: 8px;
  background: rgba(18, 24, 34, 0.82);
  color: #dbe6f8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.lobby-back-btn:hover {
  border-color: rgba(199, 214, 238, 0.72);
  background: rgba(29, 38, 53, 0.9);
  color: #f3f7ff;
}

.lobby-back-btn:focus-visible {
  outline: none;
  border-color: rgba(95, 151, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(79, 99, 255, 0.24);
}

.lobby-logout-btn {
  height: 31px;
  padding: 0 11px;
  border: 1px solid rgba(255, 138, 150, 0.42);
  border-radius: 8px;
  background: rgba(44, 17, 24, 0.72);
  color: #ffdadf;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.lobby-logout-btn:hover {
  border-color: rgba(255, 168, 178, 0.7);
  background: rgba(64, 24, 33, 0.85);
  color: #fff0f2;
}

.lobby-logout-btn:active {
  transform: translateY(1px);
}

.lobby-logout-btn:focus-visible {
  outline: none;
  border-color: rgba(255, 138, 150, 0.88);
  box-shadow: 0 0 0 3px rgba(255, 99, 118, 0.22);
}

.lobby-logout-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Guest mode: the button invites signing in instead of warning about leaving. */
.lobby-logout-btn.is-login {
  border-color: rgba(129, 148, 255, 0.5);
  background: rgba(24, 28, 58, 0.78);
  color: #dfe5ff;
}

.lobby-logout-btn.is-login:hover {
  border-color: rgba(154, 170, 255, 0.8);
  background: rgba(36, 42, 86, 0.9);
  color: #f0f3ff;
}

.lobby-logout-btn.is-login:focus-visible {
  border-color: rgba(154, 170, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(101, 123, 255, 0.24);
}

.lobby-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.lobby-stat {
  position: relative;
  border: 1px solid rgba(151, 180, 216, 0.22);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(20, 28, 40, 0.86), rgba(8, 11, 16, 0.78));
  padding: 9px 12px 9px 14px;
  display: grid;
  gap: 4px;
  min-height: 58px;
  overflow: hidden;
}

.lobby-stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #47d6be;
}

.lobby-stat:nth-of-type(2)::before {
  background: #7aa7ff;
}

.lobby-stat-label {
  color: #8ea4c6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lobby-stat-value {
  color: #f1f6ff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

#lobby-start-rule {
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.lobby-ready {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  border-radius: 9px;
  border: 1px solid rgba(151, 180, 216, 0.22);
  background: linear-gradient(180deg, rgba(20, 28, 40, 0.86), rgba(8, 11, 16, 0.78));
  min-height: 58px;
}

.lobby-ready::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff6b9d;
  box-shadow: 0 0 10px rgba(255, 107, 157, 0.72);
}

.lobby-ready.ready::before {
  background: #a7e95f;
  box-shadow: 0 0 10px rgba(167, 233, 95, 0.76);
}

.lobby-ready.browsing::before {
  background: #47d6be;
  box-shadow: 0 0 10px rgba(71, 214, 190, 0.72);
}

.lobby-ready.starting::before {
  background: #7aa7ff;
  box-shadow: 0 0 10px rgba(122, 167, 255, 0.78);
  animation: lobbyPulse 860ms ease-in-out infinite;
}

.lobby-overlay.is-room .lobby-stats {
  grid-template-columns: minmax(110px, 0.72fr) minmax(230px, 1.45fr) minmax(150px, 0.9fr);
}

.lobby-overlay.is-room .lobby-stat,
.lobby-overlay.is-room .lobby-ready {
  background: linear-gradient(180deg, rgba(18, 25, 35, 0.92), rgba(7, 10, 15, 0.88));
  min-height: 56px;
}

.lobby-progress {
  width: 100%;
  height: 8px;
  border: 1px solid rgba(151, 180, 216, 0.26);
  border-radius: 999px;
  background: rgba(7, 9, 12, 0.86);
  overflow: hidden;
}

.lobby-progress-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7a7ff5 0%, #47d6be 56%, #b8e45a 100%);
  box-shadow: 0 0 14px rgba(71, 214, 190, 0.42);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 160ms ease;
}

.lobby-hint {
  margin: 0;
  color: #a2b2d0;
  font-size: 12px;
  line-height: 1.35;
  min-height: 16px;
}

.lobby-overlay.is-room .lobby-hint {
  min-height: 20px;
  padding-left: 1px;
  color: #aebddd;
}

.lobby-section-hidden {
  display: none !important;
}

.lobby-room-actions {
  display: grid;
  grid-template-columns:
    minmax(170px, 2fr)
    minmax(130px, 1.35fr)
    minmax(82px, 0.72fr)
    minmax(82px, 0.72fr)
    minmax(122px, 1fr)
    40px
    minmax(116px, 0.95fr);
  gap: 8px;
  align-items: center;
}

.lobby-room-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(120, 138, 174, 0.35);
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.82);
  color: #edf3ff;
  padding: 0 11px;
  font-size: 14px;
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.lobby-room-input:focus {
  border-color: rgba(79, 99, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(79, 99, 255, 0.2);
}

.lobby-room-btn {
  height: 38px;
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(120, 138, 174, 0.35);
  border-radius: 8px;
  background: rgba(18, 22, 31, 0.88);
  color: #d7e4ff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.05;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.lobby-room-btn:hover {
  border-color: rgba(160, 186, 230, 0.7);
  background: rgba(27, 33, 45, 0.9);
  color: #eef4ff;
}

.lobby-room-btn:focus-visible {
  outline: none;
  border-color: rgba(95, 151, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(79, 99, 255, 0.24);
}

.lobby-room-btn.primary {
  border-color: rgba(79, 99, 255, 0.62);
  background: linear-gradient(90deg, rgba(79, 99, 255, 0.62) 0%, rgba(111, 84, 255, 0.58) 100%);
  color: #fff;
}

.lobby-room-btn.primary:hover {
  border-color: rgba(103, 143, 255, 0.82);
  background: linear-gradient(90deg, rgba(79, 99, 255, 0.72) 0%, rgba(111, 84, 255, 0.66) 100%);
}

.lobby-room-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: 0.92;
}

.lobby-room-btn.icon-only {
  padding: 0;
  text-indent: 0;
}

.lobby-room-select {
  height: 38px;
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(120, 138, 174, 0.35);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(22, 27, 38, 0.9) 0%, rgba(11, 12, 16, 0.9) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b8c9ec' d='M2.15 4.15a.5.5 0 0 1 .7 0L6 7.3l3.15-3.15a.5.5 0 1 1 .7.7L6.35 8.35a.5.5 0 0 1-.7 0L2.15 4.85a.5.5 0 0 1 0-.7Z'/%3E%3C/svg%3E");
  color: #edf3ff;
  padding: 0 34px 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-repeat: no-repeat, no-repeat;
  background-position: center, right 11px center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 130ms ease, box-shadow 130ms ease, background-color 130ms ease;
}

.lobby-room-select:hover {
  border-color: rgba(158, 184, 226, 0.6);
}

.lobby-room-select:focus-visible {
  border-color: rgba(95, 151, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(79, 99, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.lobby-room-select option {
  background: #0f131b;
  color: #edf3ff;
}

#lobby-refresh-rooms-btn {
  letter-spacing: 0;
}

#lobby-refresh-rooms-btn .lobby-room-btn-icon {
  transform-origin: center;
  transition: transform 180ms ease;
}

#lobby-refresh-rooms-btn:hover .lobby-room-btn-icon {
  transform: rotate(45deg);
}

#lobby-refresh-rooms-btn,
#lobby-new-room-btn {
  line-height: 1;
}

.lobby-room-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: min(340px, 38vh);
  overflow: auto;
}

.lobby-room-empty {
  min-height: 86px;
  border: 1px dashed rgba(130, 154, 198, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(79, 99, 255, 0.075), rgba(242, 74, 162, 0.055)),
    rgba(5, 8, 12, 0.7);
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.lobby-room-empty-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(136, 160, 224, 0.32);
  background: rgba(79, 99, 255, 0.12);
  color: #cbd8ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.lobby-room-empty-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.lobby-room-empty-title {
  color: #f1f5ff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.lobby-room-empty-note {
  color: #98a9c9;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.lobby-room-entry {
  border: 1px solid rgba(120, 138, 174, 0.26);
  border-radius: 8px;
  background: rgba(6, 9, 14, 0.8);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease;
}

.lobby-room-entry:hover {
  border-color: rgba(88, 204, 255, 0.72);
  background: rgba(15, 22, 31, 0.9);
}

.lobby-room-entry-title {
  color: #eef4ff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.lobby-room-entry-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.lobby-room-entry-id-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(120, 138, 174, 0.4);
  background: rgba(16, 22, 31, 0.82);
  color: #c7d8ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.25;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: nowrap;
}

.lobby-room-entry-detail {
  color: #9aaed6;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lobby-room-entry-pill {
  border-radius: 6px;
  border: 1px solid rgba(79, 99, 255, 0.46);
  color: #ccdcff;
  background: rgba(79, 99, 255, 0.16);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 8px;
  white-space: nowrap;
}

.lobby-host-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Top command bar: room stats, settings, bot fill, and Start/Stop share one
   compact surface so the setup controls read as a single dashboard strip. */
.lobby-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(151, 180, 216, 0.2);
  border-radius: 10px;
  background:
    linear-gradient(120deg, rgba(71, 214, 190, 0.1), rgba(167, 233, 95, 0.08) 54%, rgba(122, 167, 255, 0.07)),
    rgba(7, 11, 17, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.lobby-topbar .lobby-stats {
  flex: 1 1 420px;
  min-width: 0;
}

.lobby-action-row {
  flex: 1.5 1 640px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
}

.lobby-host-bots {
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid rgba(151, 180, 216, 0.3);
  border-radius: 9px;
  background: rgba(7, 11, 17, 0.58);
  gap: 3px;
}

.lobby-host-actions {
  flex: 1 1 170px;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
}

.lobby-action-row .lobby-host-start {
  height: auto;
  min-height: 38px;
}

.lobby-host-settings {
  flex: 999 1 430px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.lobby-host-settings .lobby-room-select {
  flex: 0 0 78px;
  width: 78px;
  height: 36px;
  padding-inline: 10px 24px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(7, 11, 17, 0.72);
}

.lobby-host-settings .lobby-host-btn {
  flex: 0 0 36px;
  width: 36px;
  padding: 0;
}

/* Host Start / Auto Start segmented toggle: replaces a dropdown with a
   sliding two-way switch, so both options and the current one are always
   legible at a glance instead of hidden behind a click. */
.lobby-startmode-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 36px;
  padding: 3px;
  border: 1px solid rgba(151, 180, 216, 0.34);
  border-radius: 9px;
  background: rgba(13, 18, 26, 0.76);
}

.lobby-startmode-option {
  position: relative;
  z-index: 1;
  min-width: 88px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #93a5c4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 130ms ease;
}

.lobby-startmode-option.is-active {
  color: #0d2007;
}

.lobby-startmode-option:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(95, 151, 255, 0.65);
}

.lobby-startmode-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 6px;
  background: linear-gradient(90deg, #a9e35c, #7dc72f);
  transition: transform 160ms cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}

.lobby-startmode-toggle[data-mode="auto"] .lobby-startmode-thumb {
  transform: translateX(100%);
}

.lobby-host-step-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid rgba(151, 180, 216, 0.42);
  border-radius: 7px;
  background: rgba(24, 33, 47, 0.9);
  color: #e3ecff;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.lobby-host-step-btn:not(:disabled):hover {
  border-color: rgba(122, 167, 255, 0.72);
  background: rgba(34, 46, 65, 0.92);
  color: #eef4ff;
}

.lobby-host-step-btn:focus-visible {
  outline: none;
  border-color: rgba(95, 151, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(79, 99, 255, 0.24);
}

.lobby-host-step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lobby-host-start {
  flex: 1 1 0;
  height: 46px;
  padding: 0 16px;
  min-width: 120px;
  font-size: 13px;
}

.lobby-host-actions .lobby-host-btn.primary {
  flex: 1 1 auto;
  letter-spacing: 0.08em;
}

.lobby-host-start + .lobby-host-start {
  margin-left: 0;
}

.lobby-host-meta {
  min-height: 36px;
  min-width: 92px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #c9d9fb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  white-space: nowrap;
}

.lobby-host-btn[hidden] {
  display: none !important;
}

.lobby-host-btn {
  height: 36px;
  border: 1px solid rgba(151, 180, 216, 0.42);
  border-radius: 8px;
  background: rgba(24, 33, 47, 0.9);
  color: #e3ecff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.lobby-host-btn i {
  font-size: 15px;
  line-height: 1;
}

.lobby-host-btn:not(:disabled):hover {
  border-color: rgba(122, 167, 255, 0.72);
  background: rgba(34, 46, 65, 0.92);
  color: #eef4ff;
}

.lobby-host-btn:focus-visible {
  outline: none;
  border-color: rgba(95, 151, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(79, 99, 255, 0.24);
}

.lobby-host-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.lobby-host-btn.primary {
  border-color: rgba(167, 233, 95, 0.5);
  background: rgba(167, 233, 95, 0.1);
  color: #cdeea3;
}

.lobby-host-btn.primary:not(:disabled):hover {
  border-color: rgba(167, 233, 95, 0.7);
  background: rgba(167, 233, 95, 0.16);
  color: #e4ffc4;
  box-shadow: 0 0 0 1px rgba(167, 233, 95, 0.18), 0 6px 18px rgba(167, 233, 95, 0.14);
}

.lobby-player-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  max-height: min(344px, 42vh);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.lobby-player {
  --lobby-player-color: #7aa7ff;
  --lobby-player-color-soft: rgba(122, 167, 255, 0.14);
  --lobby-player-color-border: rgba(122, 167, 255, 0.58);
  --lobby-player-ink: #ffffff;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(151, 180, 216, 0.16);
  border-radius: 9px;
  background: rgba(15, 21, 31, 0.5);
  padding: 10px 12px 10px 15px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  transition: border-color 130ms ease, transform 130ms ease, background 130ms ease;
}

.lobby-player:not(.lobby-player-slot-empty)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--lobby-player-color);
}

.lobby-player:not(.lobby-player-slot-empty):hover {
  border-color: var(--lobby-player-color-border);
  transform: translateX(1px);
}

.lobby-player-bot {
  background: rgba(17, 20, 30, 0.5);
}

.lobby-player:not(.lobby-player-slot-empty) {
  border-color: rgba(151, 180, 216, 0.2);
}

.lobby-player-chip {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--lobby-player-ink);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  background: var(--lobby-player-color);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.lobby-player-chip.bot {
  background: var(--lobby-player-color);
}

.lobby-player-chip.is-paintable {
  cursor: pointer;
  position: relative;
  transition: transform 130ms ease, box-shadow 130ms ease;
}

.lobby-player-chip.is-paintable::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.38);
  opacity: 0;
  transition: opacity 130ms ease;
}

.lobby-player-chip.is-paintable:hover,
.lobby-player-chip.is-paintable:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 0 12px var(--lobby-player-color-border);
  outline: none;
}

.lobby-player-chip.is-paintable:hover::after,
.lobby-player-chip.is-paintable:focus-visible::after {
  opacity: 1;
}

/* Start countdown lives on the START GAME button: the label counts
   5-4-3-2-1-Go! and clicking it stops the countdown while stops remain. */
.lobby-host-start.counting {
  min-width: 150px;
  border-color: rgba(255, 183, 92, 0.75);
  color: #ffd9a1;
  font-variant-numeric: tabular-nums;
}

.lobby-host-start.counting.tick {
  animation: lobby-start-tick 340ms ease-out;
}

@keyframes lobby-start-tick {
  from { transform: scale(1.08); }
  to { transform: scale(1); }
}

/* Settings gear on the waiting-room chat header. */
.lobby-settings-btn {
  margin-left: auto;
}

/* Boxed color picker anchored near the slot chip: a preview bar with the
   highlighted color's name above a grid of swatches. */
.lobby-color-pop {
  position: fixed;
  z-index: 90;
  width: 210px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(151, 180, 216, 0.28);
  background: rgba(13, 18, 28, 0.97);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  animation: lobby-color-pop-in 150ms ease-out;
}

@keyframes lobby-color-pop-in {
  from { transform: scale(0.92) translateY(-4px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.lobby-color-preview-bar {
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 90ms ease;
}

.lobby-color-preview-name {
  margin-top: 7px;
  min-height: 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-color-pop.preview-taken .lobby-color-preview-bar {
  opacity: 0.45;
}

.lobby-color-pop.preview-taken .lobby-color-preview-name {
  opacity: 0.65;
}

.lobby-color-grid {
  margin-top: 11px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  justify-items: center;
}

.lobby-color-swatch,
.lobby-color-dice {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  cursor: pointer;
  animation: lobby-color-swatch-in 190ms ease-out backwards;
  animation-delay: var(--swatch-delay, 0ms);
  transition: transform 110ms ease, border-color 110ms ease, box-shadow 110ms ease;
}

.lobby-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.22);
}

.lobby-color-dice {
  border: 1px dashed rgba(151, 180, 216, 0.5);
  background: rgba(21, 28, 41, 0.9);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.lobby-color-dice:hover {
  border-color: rgba(219, 232, 255, 0.85);
  transform: scale(1.18);
}

@keyframes lobby-color-swatch-in {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lobby-color-swatch:hover:not(:disabled) {
  transform: scale(1.24);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  z-index: 1;
}

.lobby-color-swatch.current {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(13, 18, 28, 0.9), 0 0 0 3.5px rgba(255, 255, 255, 0.85);
}

.lobby-color-swatch.taken {
  cursor: not-allowed;
  opacity: 0.38;
  background-image: linear-gradient(
    135deg,
    transparent 44%,
    rgba(10, 12, 18, 0.9) 44%,
    rgba(10, 12, 18, 0.9) 56%,
    transparent 56%
  );
}

/* Host moderation menu: same boxed language as the color picker. */
.lobby-player-menu {
  position: fixed;
  z-index: 90;
  min-width: 172px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(151, 180, 216, 0.28);
  background: rgba(13, 18, 28, 0.97);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  display: grid;
  gap: 3px;
  animation: lobby-color-pop-in 150ms ease-out;
}

.lobby-player-menu-head {
  padding: 4px 8px 7px;
  border-bottom: 1px solid rgba(151, 180, 216, 0.16);
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cddcf6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-player-menu-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dbe6f7;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 110ms ease, color 110ms ease;
}

.lobby-player-menu-btn:hover:not(:disabled) {
  background: rgba(122, 167, 255, 0.16);
  color: #ffffff;
}

.lobby-player-menu-btn.danger:hover:not(:disabled) {
  background: rgba(255, 107, 125, 0.18);
  color: #ffb3bd;
}

.lobby-player-menu-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lobby-player-menu-btn .bi {
  font-size: 13px;
  opacity: 0.85;
}

.lobby-player-muted-icon {
  margin-left: 7px;
  font-size: 12px;
  color: #ff9daa;
  opacity: 0.9;
}

/* Spectator strip under the roster. */
.lobby-spectators {
  border: 1px solid rgba(151, 180, 216, 0.16);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.6);
  padding: 10px 14px 11px;
}

.lobby-spectators-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cddcf6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lobby-spectators-count {
  color: #8ea4c4;
}

.lobby-spectate-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Pager appears only when the spectator list overflows one page; it sits
   right of the head, pushing the Watch/Play toggle off its auto margin. */
.lobby-spectators-pager {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lobby-spectators-pager + .lobby-spectate-toggle {
  margin-left: 10px;
}

.lobby-spectators-pager.lobby-section-hidden + .lobby-spectate-toggle {
  margin-left: auto;
}

.lobby-spectators-page-label {
  min-width: 30px;
  text-align: center;
  color: #8ea4c4;
  letter-spacing: 0.06em;
}

.lobby-host-step-btn.small {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: 6px;
}

.lobby-spectator-list {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.lobby-spectator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid rgba(151, 180, 216, 0.2);
  border-radius: 999px;
  background: rgba(15, 21, 31, 0.55);
  color: #dbe6f7;
  font-size: 13px;
  font-weight: 600;
}

.lobby-spectator-empty {
  border-style: dashed;
  color: #71839f;
  font-weight: 500;
}

.lobby-spectator-eye {
  font-size: 12px;
  color: #8ea4c4;
}

.lobby-spectator.is-manageable {
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.lobby-spectator.is-manageable:hover {
  border-color: rgba(219, 232, 255, 0.55);
  background: rgba(24, 33, 47, 0.75);
}

.lobby-spectator-tag {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lobby-spectator-tag.you {
  background: rgba(255, 225, 53, 0.14);
  border: 1px solid rgba(255, 225, 53, 0.5);
  color: #ffe135;
}

.lobby-spectator-tag.host {
  background: rgba(255, 187, 92, 0.13);
  border: 1px solid rgba(255, 187, 92, 0.48);
  color: #ffd294;
}

.lobby-spectator-tag.plays-next {
  background: rgba(71, 214, 190, 0.12);
  border: 1px solid rgba(71, 214, 190, 0.5);
  color: #47d6be;
}

.lobby-player-name {
  font-size: 16px;
  font-weight: 700;
  color: #f2f6ff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player-name-icon {
  color: var(--lobby-player-color);
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
}

.lobby-player-host-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 187, 92, 0.48);
  background: rgba(255, 187, 92, 0.13);
  color: #ffd294;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.lobby-player-you {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--lobby-player-color-border);
  background: var(--lobby-player-color-soft);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #e7eefc;
  text-transform: uppercase;
  font-weight: 800;
  white-space: nowrap;
}

.lobby-player-you:empty {
  display: none;
}

.lobby-player-action {
  min-width: 108px;
  display: flex;
  justify-content: flex-end;
}

.lobby-player-action-btn {
  height: 30px;
  border: 1px solid rgba(151, 180, 216, 0.46);
  border-radius: 8px;
  background: rgba(22, 31, 44, 0.9);
  color: #e8f0ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 130ms ease, background 130ms ease;
}

.lobby-player-action-btn:hover {
  border-color: rgba(122, 167, 255, 0.74);
  background: rgba(34, 47, 66, 0.92);
}

.lobby-player-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.lobby-player-fill-btn {
  border-color: rgba(167, 233, 95, 0.5);
  background: rgba(32, 48, 25, 0.78);
  color: #e7ffd4;
}

.lobby-player-fill-btn:hover {
  border-color: rgba(188, 244, 114, 0.78);
  background: rgba(43, 62, 31, 0.9);
}

.lobby-player-remove-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-color: rgba(194, 210, 236, 0.26);
  background: rgba(14, 18, 26, 0.56);
  color: #c8d4e8;
}

.lobby-player-remove-btn:hover {
  border-color: rgba(255, 133, 174, 0.76);
  background: rgba(72, 24, 43, 0.86);
  color: #fff4f7;
}

.lobby-player-remove-btn i {
  font-size: 12px;
  line-height: 1;
}

.lobby-player-slot-empty {
  border-style: dashed;
  border-color: rgba(151, 180, 216, 0.18);
  background: rgba(10, 14, 20, 0.32);
}

.lobby-player-chip.empty {
  border-color: rgba(153, 169, 206, 0.28);
  background: rgba(120, 138, 174, 0.18);
  color: #aebbdd;
}

.lobby-player-name.empty {
  color: #8996b2;
  font-weight: 600;
}

.lobby-player-you.empty {
  color: #8996b2;
  border-color: rgba(151, 180, 216, 0.2);
  background: rgba(151, 180, 216, 0.06);
}

@keyframes lobbyPulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1080px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .game-layout {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, min(78dvh, 720px)) auto;
    gap: 8px;
    padding: 8px;
    height: auto;
  }

  #powerups,
  #game,
  #heads,
  #arenaFrame,
  .round-overlay {
    grid-column: 1;
    grid-row: 1;
  }

  .side {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-height: 0;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    align-items: start;
    gap: 10px;
    padding: 10px;
  }

  .reach {
    grid-column: 1;
  }

  .score-panel {
    grid-column: 2;
    min-height: 180px;
  }

  .chat-panel {
    grid-column: 1 / -1;
    min-height: 220px;
  }

  .logo-wrap {
    height: 94px;
  }

  .settings-card {
    width: min(560px, 98vw);
  }

  .settings-range {
    width: 110px;
  }

  .round-overlay .winner {
    font-size: 15px;
  }

  .round-overlay .next {
    gap: 6px;
  }

  .round-overlay .next-label {
    font-size: 12px;
  }

  .round-overlay .countdown {
    font-size: 32px;
    min-width: 20px;
  }

  .round-overlay.is-match-end .round-overlay-card {
    width: min(500px, calc(100% - 32px));
    padding: 20px;
    gap: 14px;
  }

  .round-overlay.is-match-end .winner {
    font-size: 30px;
    gap: 6px;
    letter-spacing: -0.04em;
  }

  .round-overlay.is-match-end .next-label {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .round-overlay.is-match-end .countdown {
    font-size: 16px;
    min-width: 0;
  }

  .round-overlay.is-match-end .match-row {
    font-size: 13px;
    gap: 8px;
  }

  .auth-card {
    justify-self: center;
  }
}

@media (max-width: 900px) {
  .lobby-room-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  #lobby-room-name-input,
  #lobby-room-input {
    grid-column: 1 / -1;
  }

  #lobby-create-min-select,
  #lobby-create-max-select,
  #lobby-create-mode-select {
    grid-column: span 2;
  }

  #lobby-refresh-rooms-btn,
  #lobby-new-room-btn {
    grid-column: span 2;
  }

  #lobby-new-room-btn {
    grid-column: span 4;
  }
}

@media (max-width: 680px) {
  .side {
    grid-template-columns: 1fr;
  }

  .reach,
  .score-panel,
  .chat-panel {
    grid-column: 1;
  }

  .lobby-room-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lobby-host-settings .lobby-room-select {
    flex: 1 1 auto;
  }

  #lobby-room-name-input,
  #lobby-room-input,
  #lobby-create-mode-select {
    grid-column: 1 / -1;
  }

  #lobby-create-min-select,
  #lobby-create-max-select,
  #lobby-refresh-rooms-btn,
  #lobby-new-room-btn {
    grid-column: span 1;
  }

  .lobby-player {
    grid-template-columns: auto 1fr;
    row-gap: 6px;
  }

  .account-setting {
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 10px;
  }

  .setting-wrapper {
    width: 100%;
    justify-content: flex-start;
  }

  .settings-range {
    width: min(100%, 160px);
  }

  .lobby-player-name,
  .lobby-player-you,
  .lobby-player-action {
    grid-column: 2;
  }

  .lobby-player-you,
  .lobby-player-action {
    justify-self: start;
  }

  .round-overlay .winner {
    font-size: 12px;
  }

  .round-overlay .next-label {
    font-size: 10px;
  }

  .round-overlay .countdown {
    font-size: 26px;
    min-width: 16px;
  }

  .round-overlay.is-match-end .round-overlay-card {
    width: calc(100% - 24px);
    padding: 16px;
    gap: 12px;
  }

  .round-overlay.is-match-end .winner {
    font-size: 24px;
  }

  .round-overlay.is-match-end .next-label {
    font-size: 9px;
  }

  .round-overlay.is-match-end .countdown {
    font-size: 15px;
    min-width: 0;
  }

  .round-overlay.is-match-end .match-row {
    font-size: 12px;
    min-height: 34px;
  }
}

@media (max-width: 520px) {
  .auth-overlay {
    padding: 18px 14px;
    place-items: start center;
  }

  .auth-card {
    padding: 23px 18px 18px;
  }

  .auth-input {
    font-size: 18px;
  }

  .lobby-card {
    padding: 20px 15px 16px;
  }

  .lobby-head {
    flex-direction: column;
  }

  .lobby-head-main {
    width: 100%;
    flex: 0 1 auto;
  }

  .lobby-head-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .lobby-stats {
    grid-template-columns: 1fr;
  }

  .lobby-overlay.is-room .lobby-stats {
    grid-template-columns: minmax(0, 0.72fr) minmax(140px, 1.45fr) minmax(72px, 0.9fr);
  }

  .lobby-room-actions {
    grid-template-columns: 1fr;
  }

  .lobby-host-actions .lobby-host-start {
    min-width: 0;
    padding-inline: 7px;
    font-size: 11px;
  }

  .lobby-room-btn {
    width: 100%;
  }

  .lobby-room-select {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   Waiting-room redesign (room mode). The browser-mode lobby keeps the
   original card styling; these overrides apply once a room is joined.
--------------------------------------------------------------------------- */

.lobby-eyebrow {
  display: none;
  color: #47d6be;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.lobby-overlay.is-room .lobby-eyebrow {
  display: block;
}

/* The title carries the room name now; the pill would repeat it. */
.lobby-overlay.is-room .lobby-room-pill {
  display: none;
}

.lobby-overlay.is-room .lobby-title {
  font-size: 26px;
  letter-spacing: -0.01em;
}

/* Three floating cards become embedded status cells inside the shared strip. */
.lobby-overlay.is-room .lobby-stats {
  grid-template-columns: auto auto 1fr;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: none;
  padding: 0;
  align-items: center;
}

.lobby-overlay.is-room .lobby-stat {
  border: 0;
  border-radius: 0;
  background: none;
  min-height: 0;
  padding: 0 22px 0 0;
  gap: 2px;
}

.lobby-overlay.is-room .lobby-stat::before {
  display: none;
}

.lobby-overlay.is-room .lobby-stat:nth-of-type(2) {
  border-left: 1px solid rgba(151, 180, 216, 0.16);
  padding-left: 22px;
}

.lobby-overlay.is-room .lobby-ready {
  justify-self: end;
  border: 1px solid rgba(151, 180, 216, 0.22);
  border-radius: 999px;
  background: rgba(10, 14, 20, 0.6);
  min-height: 0;
  padding: 7px 14px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Progress becomes a thin accent line tucked under the strip. */
.lobby-overlay.is-room .lobby-progress {
  height: 4px;
  border: 0;
  background: rgba(151, 180, 216, 0.12);
  margin-top: -8px;
}

.lobby-overlay.is-room .lobby-progress-fill {
  background: linear-gradient(90deg, #47d6be, #a7e95f);
  box-shadow: none;
}

/* Roster: two columns on wide screens, tighter rows. */
.lobby-overlay.is-room .lobby-player-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--lobby-slot-rows, 4), auto);
  grid-auto-flow: column;
  gap: 8px;
}

@media (max-width: 719px) {
  .lobby-overlay.is-room .lobby-player-list {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}

.lobby-overlay.is-room .lobby-player {
  min-height: 46px;
  padding: 8px 10px 8px 13px;
}

/* Empty slots recede so occupied slots read at a glance. */
.lobby-overlay.is-room .lobby-player-slot-empty {
  background: none;
  border-color: rgba(151, 180, 216, 0.12);
}

.lobby-overlay.is-room .lobby-player-chip.empty {
  background: none;
  border: 1px dashed rgba(153, 169, 206, 0.32);
  color: #6f7d99;
}

/* "+ Bot" is a ghost action until hovered; six solid green buttons were
   louder than the primary Start button. */
.lobby-overlay.is-room .lobby-player-fill-btn {
  border-color: rgba(151, 180, 216, 0.22);
  background: none;
  color: #93a5c4;
}

.lobby-overlay.is-room .lobby-player-fill-btn:hover:not(:disabled) {
  border-color: rgba(188, 244, 114, 0.78);
  background: rgba(43, 62, 31, 0.9);
  color: #e7ffd4;
}

@media (max-width: 719px) {
  .lobby-host-actions {
    flex: 1 1 100%;
    justify-content: stretch;
  }

  .lobby-host-start {
    flex: 1 1 auto;
  }
}

/* ---------------------------------------------------------------------------
   Waiting room: full-viewport layout with a Twitch-style chat column.
--------------------------------------------------------------------------- */

.lobby-overlay.is-room {
  padding: 0;
}

.lobby-overlay.is-room .lobby-card {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 26px 30px 22px;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 400px);
  column-gap: 24px;
}

.lobby-overlay.is-room .lobby-card > * {
  grid-column: 1;
}

.lobby-overlay.is-room .lobby-chat {
  grid-column: 2;
  grid-row: 1 / -1;
}

/* The roster fills whatever height is left. */
.lobby-overlay.is-room .lobby-player-list {
  max-height: none;
  align-content: start;
}

.lobby-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(151, 180, 216, 0.16);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.6);
  overflow: hidden;
}

.lobby-chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(151, 180, 216, 0.14);
  color: #cddcf6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lobby-chat-head i {
  color: #47d6be;
  font-size: 13px;
}

.lobby-chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
}

/* The re-mounted feed/form stretch to the chat column. */
.lobby-chat-body .chat-feed {
  flex: 1;
  min-height: 0;
}

/* The shared feed reads the same in the waiting room and the in-game
   sidebar: borderless on the panel surface. */
.lobby-chat-body .chat-feed,
.chat-panel .chat-feed {
  border: 0;
  background: none;
  padding: 2px 2px 0;
}

/* Twitch-style lines: roomier, hover highlight, timestamps on hover only. */
.lobby-chat-body .chat-line,
.chat-panel .chat-line {
  font-size: 13px;
  line-height: 1.4;
  padding: 3px 6px;
  border-radius: 6px;
}

.lobby-chat-body .chat-line:hover,
.chat-panel .chat-line:hover {
  background: rgba(151, 180, 216, 0.08);
}

.lobby-chat-body .chat-line-time,
.chat-panel .chat-line-time {
  display: none;
}

.lobby-chat-body .chat-line:hover .chat-line-time,
.chat-panel .chat-line:hover .chat-line-time {
  display: inline-block;
}

/* FrankerFaceZ emote images sit inline with the text, Twitch-style: slightly
   taller than the line, overflowing evenly without stretching it. */
.chat-emote-img {
  height: 22px;
  width: auto;
  max-width: 66px;
  margin: -5px 1px;
  vertical-align: middle;
}

/* Emote-only messages render a bit bigger, Twitch-style. */
.chat-line.emote-only .chat-emote-img {
  height: 28px;
  max-width: 84px;
  margin: -4px 2px;
}

/* Emote button + picker in the chat form. */
.chat-form {
  position: relative;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

/* Guests get a message in place of the input, not a disabled field beside
   it: #chatGuestLock and #chatFormFields are mutually exclusive, toggled
   together in app.js. Both live inside #chatForm so they travel with it
   between the lobby chat card and the in-match sidebar (see mountChatPanel). */
.chat-guest-lock {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(243, 170, 58, 0.4);
  border-radius: 10px;
  background: rgba(58, 40, 10, 0.55);
  color: #ffd9a0;
  font-size: 12px;
  line-height: 1.35;
}

.chat-guest-lock i {
  flex: 0 0 auto;
  font-size: 13px;
}

.chat-guest-lock[hidden] {
  display: none;
}

.chat-form-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.chat-form-fields[hidden] {
  display: none;
}

.chat-emote-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(147, 171, 202, 0.34);
  border-radius: 10px;
  background: rgba(7, 13, 20, 0.96);
  color: #9fb2d2;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 130ms ease, color 130ms ease;
}

.chat-emote-btn:hover,
.chat-emote-btn.is-open {
  border-color: rgba(128, 203, 238, 0.86);
  color: #eaf3ff;
}

.chat-emote-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(6, 34px);
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(151, 180, 216, 0.28);
  border-radius: 12px;
  background: rgba(12, 17, 25, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.chat-emote-pop[hidden] {
  display: none !important;
}

.chat-emote-option {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: none;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-emote-option:hover {
  background: rgba(151, 180, 216, 0.16);
}

.chat-emote-option .chat-emote-img {
  height: 26px;
  max-width: 30px;
  margin: 0;
  object-fit: contain;
}

/* Stack on narrow screens: chat gets its own band under the roster. */
@media (max-width: 900px) {
  .lobby-overlay.is-room .lobby-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 14px 14px;
    overflow-y: auto;
  }

  .lobby-overlay.is-room .lobby-chat {
    grid-column: 1;
    grid-row: auto;
    height: 38dvh;
    min-height: 220px;
  }

  .lobby-overlay.is-room .lobby-player-list {
    max-height: 40dvh;
  }
}

/* ---------------------------------------------------------------------------
   Room browser (Lobby): same full-viewport treatment. Content stays centered
   at a readable width; the room list fills the remaining height.
--------------------------------------------------------------------------- */

.lobby-overlay.is-browser {
  padding: 0;
}

.lobby-overlay.is-browser .lobby-card {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 30px max(30px, calc((100vw - 1280px) / 2)) 24px;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 400px);
  column-gap: 24px;
  align-content: start;
}

.lobby-overlay.is-browser .lobby-card > * {
  grid-column: 1;
}

/* Same Twitch-style chat column as the waiting room, fed by lobby chat. */
.lobby-overlay.is-browser .lobby-chat {
  grid-column: 2;
  grid-row: 1 / -1;
}

.lobby-overlay.is-browser .lobby-title {
  font-size: 26px;
}

.lobby-overlay.is-browser .lobby-room-list {
  max-height: none;
  align-content: start;
}

@media (max-width: 900px) {
  .lobby-overlay.is-browser .lobby-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 14px 14px;
    overflow-y: auto;
  }

  .lobby-overlay.is-browser .lobby-chat {
    grid-column: 1;
    grid-row: auto;
    height: 38dvh;
    min-height: 220px;
  }

  /* Cap the room list so it scrolls internally instead of pushing the chat
     band off-screen — the same treatment the waiting-room roster gets. */
  .lobby-overlay.is-browser .lobby-room-list {
    max-height: 40dvh;
  }
}
