:root {
  color-scheme: dark;
  --bg: #070a14;
  --panel: rgba(18, 24, 40, 0.9);
  --panel-strong: rgba(27, 36, 66, 0.95);
  --border: rgba(88, 182, 255, 0.18);
  --text: #edf2ff;
  --muted: #aacaff;
  --accent: #58b6ff;
  --accent-2: #7cc8ff;
  --success: #7cda8d;
  --destructive: #ff6fa7;
  --shadow: 0 28px 110px rgba(81, 146, 255, 0.15);
  --radius: 24px;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Orbitron', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: radial-gradient(ellipse at top,
      rgb(48, 65, 125) 0%,
      rgb(17, 23, 45) 60%);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.page-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.main-content {
  flex: 1;
}

.background-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.background-glow.top-glow {
  top: -15%;
  left: 50%;
  width: 520px;
  height: 520px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(88, 182, 255, 0.22), transparent 55%);
  filter: blur(120px);
}

.background-glow.bottom-glow {
  bottom: -10%;
  right: -5%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(89, 162, 255, 0.16), transparent 52%);
  filter: blur(120px);
}

.top-nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.logo-image {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 24px rgba(124, 210, 154, 0.2);
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-mark {
  color: var(--accent);
}

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#uiSoundBtn {
  width: 69px;
  height: 51px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;

  background: rgba(18, 24, 40, 0.85);

  cursor: pointer;

  font-size: 1.7rem;
  /* Makes the speaker icon much larger */
  line-height: 1;

  transition: .15s;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 24, 40, 0.85);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.connection-badge[data-connected='true'] {
  color: var(--accent);
}

.badge-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--destructive);
  box-shadow: 0 0 12px rgba(217, 63, 63, 0.5);
}

.badge-dot.connecting {
  background: #ffc940;
  box-shadow: 0 0 12px rgba(255, 201, 64, 0.55);
  animation: pulse 2s ease-in-out infinite;
}

.badge-dot.connected {
  background: var(--success);
  box-shadow: 0 0 12px rgba(124, 210, 154, 0.55);
}

.badge-dot.disconnected {
  background: var(--destructive);
  box-shadow: 0 0 12px rgba(217, 63, 63, 0.5);
}

.connection-badge[data-connected='true'] .badge-dot {
  background: var(--success);
  box-shadow: 0 0 12px rgba(124, 210, 154, 0.55);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.main-content {
  position: relative;
  z-index: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-card,
.panel,
.card-panel,
.button-panel {
  background: rgba(15, 20, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.2);
}

.hero-card {
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 1.5rem;
  border: 1px solid rgba(88, 182, 255, 0.16);
  background: rgba(18, 28, 52, 0.95);
}

.hero-copy {
  display: grid;
  gap: 1rem;
  max-width: 46rem;
}

.hero-logo {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  border: 1px solid rgba(88, 182, 255, 0.28);
  box-shadow: 0 0 40px rgba(88, 182, 255, 0.22);
  object-fit: cover;
}

.action-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.host-card {
  display: flex;
  flex-direction: column;
}

.host-card .button {
  margin-top: auto;
}

.game-section {
  display: grid;
  gap: 1.25rem;
  grid-template-rows: 1fr 140px;
  height: 100%;
}

.action-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  align-content: center;
}

.action-panel .button {
  min-width: 0;
  width: 100%;
  height: 44px;
  flex: none;
}

.room-code.hidden {
  letter-spacing: 0.35em;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.visibility-button svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.section-heading {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.room-card {
  width: 100%;
  background: rgba(15, 20, 36, 0.92);
  border: 1px solid rgba(88, 182, 255, 0.18);
  border-radius: 24px;
  position: relative;
  padding: 2.2rem 1.4rem;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 0 25px rgba(88, 182, 255, 0.04);
  backdrop-filter: blur(10px);
}

.room-card {
  display: grid;
  gap: 1rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 14px;

  padding: 18px;

  background: rgba(20, 26, 45, 0.85);
  border-radius: 18px;
  border: 1px solid rgba(88, 182, 255, 0.18);

  min-height: 320px;
}


.game-info {
  width: 100%;
  margin-bottom: 40px;
}


.game-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: relative;
}


.game-name {
  font-size: 1.4rem;
  font-weight: 800;
}

.game-description {
  margin-top: 7px;
  font-size: 0.9rem;
  opacity: 0.75;
}


.game-mode-section {
  margin-top: auto;
}


.section-heading.small {
  font-size: 0.85rem;
  margin-bottom: 8px;
}


.mode-button.hidden {
  display: none;
}

.mode-disabled {
  cursor: default;
  pointer-events: none;
}

.mode-disabled:hover {
  background: inherit;
  border-color: inherit;
  transform: none;
  box-shadow: none;
}

.game-mode-area {
  margin-top: auto;
}

.room-header {
  width: 100%;
  position: relative;
}

.room-card .room-code {
  margin-top: 0.35rem;
}

.room-card-title,
.status-label-small {
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

.room-top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

.room-code-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
}

.room-name-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  justify-self: center;
}

.room-name-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.room-name-input {
  width: 280px !important;
  height: 40px;
  font-size: 1rem;
  font-weight: 700;
  box-sizing: border-box;
}

#roomNameSaveBtn,
#roomNameCancelBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 10;
}


#roomNameSaveBtn svg,
#roomNameCancelBtn svg {
  display: block;
}

#roomNameSaveBtn {
  color: #4dff7c;
  background: #163d25;
  border-color: rgba(77, 255, 124, 0.45);
  box-shadow: 0 0 10px rgba(77, 255, 124, 0.15);
}


#roomNameSaveBtn svg {
  fill: #4dff7c;
}


#roomNameCancelBtn {
  color: #ff9fb2;
  background: #5a2230;
  border-color: rgba(255, 159, 178, 0.5);
  box-shadow: 0 0 10px rgba(255, 159, 178, 0.18);
}

#roomNameCancelBtn svg {
  fill: #ff9fb2;
}

.viewer-indicator {
  position: absolute;
  top: -1.3rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
}

.viewer-indicator svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.viewer-indicator.hidden {
  visibility: hidden;
}

.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  min-width: 40px;
}

.copy-container {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.copy-feedback {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);

  margin-top: 4px;

  color: #4ade80;
  font-size: 0.75rem;
  white-space: nowrap;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity 0.2s ease;
}

.copy-feedback.show {
  opacity: 1;
  visibility: visible;
}

.change-game-button {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  height: 40px;
  min-width: 105px;

  border-radius: 18px;
  border: 1px solid rgba(88, 182, 255, 0.35);

  background: rgba(88, 182, 255, 0.14);
  color: var(--accent);

  font-weight: 700;
  font-size: 0.9rem;

  cursor: pointer;

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.change-game-button svg {
  flex-shrink: 0;
}

.change-game-button:hover {
  border-color: #58b6ff;
  background: rgba(88, 182, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(88, 182, 255, 0.35);
}

.game-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(5px);

  z-index: 1000;
}

.game-modal.hidden {
  display: none;
}

.game-modal-card {
  position: relative;

  width: min(480px, 90vw);

  padding: 1.5rem;

  border-radius: 22px;

  background: rgba(15, 20, 36, 0.96);
  border: 1px solid rgba(88, 182, 255, 0.25);

  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}


.game-modal-card h2 {
  margin: 0;
  color: var(--accent);
}

.game-modal-card p {
  margin-top: 6px;
  opacity: .7;
}


.game-modal-close {
  position: absolute;
  right: 15px;
  top: 12px;

  background: none;
  border: none;

  color: white;
  font-size: 24px;
  cursor: pointer;
}


.game-list {
  margin-top: 20px;

  display: flex;
  flex-direction: column;
  gap: 10px;
}


.game-option {

  display: flex;
  align-items: center;
  gap: 15px;

  width: 100%;

  padding: 12px;

  border-radius: 16px;

  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);

  color: white;

  cursor: pointer;

  text-align: left;

  transition: .2s;
}


.game-option:hover {
  border-color: var(--accent);
}


.game-option.selected {

  border-color: #58b6ff;

  background:
    rgba(88, 182, 255, 0.15);
}


.game-avatar {

  width: 56px;
  height: 56px;

  border-radius: 14px;

  object-fit: cover;

  background: rgba(255, 255, 255, 0.08);
}


.game-option-name {

  font-size: 1.1rem;
  font-weight: 700;
}


.game-option-desc {

  font-size: .8rem;
  opacity: .7;
}

.panel-subheader {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.player-slot.assigned {
  border-style: solid;
  background: rgba(88, 182, 255, 0.08);
}

.player-slot .slot-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.65);
}

.player-slot-name {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.host-crown {
  font-size: 0.95em;
  vertical-align: text-top;
}

.you-label {
  opacity: 0.7;
  font-size: 0.9em;
  font-weight: normal;
  margin-left: 4px;
}

.slot-you {
  margin-left: 0.45rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.slot-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.slot-action {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.player-slot.drag-over {
  border-color: rgba(124, 213, 255, 0.75);
  background: rgba(124, 213, 255, 0.13);
}

.visibility-button {
  min-width: 50px;
}

.status-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  width: 150px;
  box-sizing: border-box;

  padding: 1.5rem 1rem;
  border-radius: 18px;

  background: rgba(88, 182, 255, 0.14);
  border: 1px solid rgba(88, 182, 255, 0.25);

  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.status-badge.closed {
  background: rgba(255, 111, 111, 0.14);
  border-color: rgba(255, 111, 111, 0.2);
  color: #ff9999;
}

.status-badge.public {
  background: #163d25;
  color: #4dff7c;
  border: 1px solid rgba(77, 255, 124, 0.25);
}

.status-badge.private {
  outline: 2px solid #4da6ff;
}

.status-badge.state-lobby {
  background: rgba(80, 228, 139, 0.14);
  border-color: rgba(80, 228, 139, 0.28);
  color: #9ef08e;
}

.status-badge.public .status-dot {
  background: #4dff7c;
}

.status-badge.state-lobby .status-dot {
  background: #9ef08e;
  box-shadow: 0 0 12px rgba(158, 240, 142, 0.45);
}

.status-badge.state-in_game {
  background: rgba(255, 195, 65, 0.14);
  border-color: rgba(255, 195, 65, 0.28);
  color: #ffd97a;
}

.status-badge.state-in_game .status-dot {
  background: #ffd97a;
  box-shadow: 0 0 12px rgba(255, 201, 92, 0.45);
}

.status-badge.locked {
  background: #4a3b12;
  color: #ffd84d;
  border: 1px solid rgba(255, 217, 122, 0.25);
}

.status-badge.locked .status-dot {
  background: #ffd84d;
}

.status-badge.locked .status-dot {
  background: #ffd97a;
  box-shadow: 0 0 12px rgba(255, 201, 92, 0.45);
}

.status-dot {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;

  border-radius: 999px;

  background: var(--accent);
  box-shadow: 0 0 18px rgba(88, 182, 255, 0.4);
}

.status-text {
  min-width: 65px;
  text-align: center;
}

.locked-button {
  color: #ffd84d;
  border-color: rgba(255, 216, 77, 0.45);
  box-shadow: 0 0 12px rgba(255, 216, 77, 0.15);
}


.locked-button svg {
  stroke: #ffd84d;
}

.public-button {
  color: #4dff7c;
  border-color: rgba(77, 255, 124, 0.45);
  box-shadow: 0 0 12px rgba(77, 255, 124, 0.15);
}


.public-button svg {
  stroke: #4dff7c;
}


.private-button {
  color: #4da6ff;
  border-color: rgba(77, 166, 255, 0.45);
  box-shadow: 0 0 12px rgba(77, 166, 255, 0.15);
}


.private-button svg {
  fill: #4da6ff;
}

.lobby-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(320px, 0.85fr) minmax(320px, 0.85fr);
}

.lobby-left-column,
.lobby-right-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Don't let the taller card in the row (Match Setup, which varies a lot
   between games/modes) stretch the Select Game card to match its height. */
#lobbyView .lobby-grid {
  align-items: start;
}

#lobbyView .game-section {
  height: auto;
}

.game-section,
.players-section {
  display: grid;
  gap: 1.25rem;
}

.banner-card {
  padding: 1.5rem;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(74, 158, 255, 0.16), rgba(17, 28, 58, 0.92));
  border: 1px solid rgba(88, 182, 255, 0.18);
  display: grid;
  gap: 1rem;
}

.banner-label {
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.85rem;
}

.game-banner {
  width: 100%;
  aspect-ratio: 16 / 7;

  border-radius: 18px;
  overflow: hidden;

  background-color: #0f1526;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;

  border: 1px solid rgba(255, 255, 255, .06);
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mode-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 1rem 1.15rem;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-button.active-mode {
  background: linear-gradient(135deg, rgba(88, 182, 255, 0.35), rgba(124, 213, 255, 0.2));
  border-color: rgba(88, 182, 255, 0.45);
}

.game-players-list {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

.player-slot {
  height: 88px;
  min-height: 88px;
  border-radius: 18px;
  border: 1px solid rgba(88, 182, 255, .25);
  background: rgba(255, 255, 255, .05);
  padding: .75rem;

  display: grid;
  grid-template-columns: 1fr auto;

  position: relative;

}

.player-slot:has(.player-context-menu.open) {
  z-index: 1000;
}

.player-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.player-host-info {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
}

.host-tag {
  color: #6eff9b;
  font-size: .65rem;
  letter-spacing: .12em;
}

.player-menu-button {
  border: none;
  background: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

.player-slot.dragging {
  opacity: .75;
}

.player-context-menu {
  display: none;
  position: absolute;
  right: 10px;
  top: 40px;

  z-index: 9999;
  /* above slots */

  background: rgba(20, 25, 40, 1);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 14px;

  padding: .35rem;
  overflow: hidden;

  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}

.player-context-menu.open {
  display: grid;
}


.player-context-menu button {
  white-space: nowrap;
  min-width: 170px;

  border: none;
  padding: .55rem .7rem;

  color: white;
  text-align: left;
  cursor: pointer;

  transition:
    background .15s ease,
    transform .15s ease;
}


/* Promote */
.player-context-menu .transfer-host {
  color: #7dcaff;
}

.player-context-menu .transfer-host:hover {
  background: rgba(88, 182, 255, .35);
}


/* Kick */
.player-context-menu .kick-player {
  color: #ffe27a;
}

.player-context-menu .kick-player:hover {
  background: rgba(255, 210, 80, .35);
}


/* Ban */
.player-context-menu .ban-player {
  color: #ff8a8a;
}

.player-context-menu .ban-player:hover {
  background: rgba(255, 80, 80, .35);
}

.player-crown {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.host-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #7cffb2;
  font-size: 0.7rem;
  font-weight: bold;
}

.host-badge span {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
}

.empty-slot {
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .45);
}

.empty-slot .slot-empty {
  border: none;
}

.player-card {
  display: flex;
  flex-direction: column;
}

.player-name {
  grid-column: 1;
  grid-row: 1;

  align-self: center;

  text-align: left;

  max-width: 125px;

  font-size: 1rem;
  line-height: 1.15;

  overflow-wrap: anywhere;
}

.player-slot-meta {
  grid-column: 1;
  grid-row: 2;

  align-self: end;

  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.player-slot-meta.disconnected {
  color: #ff5555;
  font-weight: bold;
}

.player-slot-meta.ready {
  color: #6eff9b;
}

.player-context-menu button {
  white-space: nowrap;
  min-width: 150px;
}

.player-kick {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.player-ban {
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: center;
}

.player-kick,
.player-ban {
  height: 26px;
  font-size: 0.65rem;
  border-radius: 10px;
}

#matchSetupContainer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: 0.75rem;

  /* Width of .teams-container's middle "auto" (VS) column, approximated
     to match the real .vs-text content. This is what actually makes
     mode-1's two boxes narrower than a plain 50/50 split — Devil Runner's
     other rows reserve the same amount of space here even where they
     don't show a visible VS, so every box ends up the same width.
     Tune this one value if boxes don't quite match mode-1's. */
  --devil-vs-width: 3.5rem;
}

.teams-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}


.team-box {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(88, 182, 255, .18);
}


.team-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}


.vs-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  margin-right: 6px;
}


.vs-text {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
}


.vs-mode {
  font-size: .7rem;
  opacity: .7;
}

.standby-area {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  width: calc((100% - 3rem) / 2);
}

.standby-title {
  margin-bottom: .5rem;
}

.standby-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
  align-content: end;
  width: 160%;
}

.standby-player {
  background: rgba(255, 255, 255, .04);
  width: 100%;
  max-width: none;
  position: relative;
  z-index: 1;
}

#gamePlayersList {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}

.player-slot.drop-highlight {
  border-color: var(--accent);
  box-shadow:
    0 0 18px rgba(88, 182, 255, .45);
  transform: scale(1.02);
}

/* ---------------------------------------------------------------------------
   Devil Runner Match Setup layouts
   .teams-container is a 3-column GRID (1fr auto 1fr). The middle "auto"
   column sizes itself to the real VS text, which is what makes mode-1's
   two boxes narrower than a plain 50/50 split. Devil Runner's other rows
   reserve that same amount of horizontal space (via --devil-vs-width)
   even where they don't show a visible VS there, so every box across
   every mode ends up the same width as mode-1's.

   Reuses existing classes as-is, no changes needed to them:
     .team-box, .team-header, .team-list, .vs-container, .vs-text,
     .standby-area, .standby-list, .panel-subheader
--------------------------------------------------------------------------- */

/* Wrapper for multi-row layouts (mode-2/mode-3):
       Player 1   Player 2
             VS
       Player 3   Player 4        */
.devil-runner-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* Two-box rows: same 3-column shape as .teams-container (1fr / vs-width /
   1fr), but since there's no vs-container item here to naturally fall
   into the middle column, the 2nd box has to be placed explicitly —
   otherwise grid auto-placement drops it into that narrow middle column
   instead of the 3rd one. */
.teams-container.devil-runner-row {
  grid-template-columns: 1fr var(--devil-vs-width, 3.5rem) 1fr;
}

.teams-container.devil-runner-row .team-box+.team-box {
  grid-column: 3;
}

/* Single-box row (mode-2's 3rd player) and solo mode (mode-0): same
   3-column shape again, so the reserved gap matches too. The box spans
   the full row and is centered with an explicit width equal to what a
   1fr column resolves to in that shape — (100% - gap - 2 gutters) / 2. */
.teams-container.devil-runner-row.devil-runner-row-single,
.teams-container.devil-runner-solo {
  grid-template-columns: 1fr var(--devil-vs-width, 3.5rem) 1fr;
  justify-items: center;
}

.teams-container.devil-runner-row.devil-runner-row-single .team-box,
.teams-container.devil-runner-solo .team-box {
  grid-column: 1 / -1;
  width: calc((100% - var(--devil-vs-width, 3.5rem) - 2rem) / 2);
}

/* Centered "VS" divider between rows */
.devil-runner-vs-row {
  justify-content: center;
  align-items: center;
  padding: 0.15rem 0;
}

/* Responsive: stack to one column on narrow viewports */
@media (max-width: 480px) {
  .teams-container.devil-runner-row {
    grid-template-columns: 1fr;
  }

  .teams-container.devil-runner-row .team-box+.team-box {
    grid-column: 1;
  }

  .teams-container.devil-runner-row.devil-runner-row-single .team-box,
  .teams-container.devil-runner-solo .team-box {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   Click Clash Match Setup layouts
   .teams-container is a 3-column GRID (1fr auto 1fr). The middle "auto"
   column sizes itself to the real VS text, which is what makes mode-1's
   two boxes narrower than a plain 50/50 split. Click Clash's other rows
   reserve that same amount of horizontal space (via --click-clash-vs-width)
   even where they don't show a visible VS there, so every box across
   every mode ends up the same width as mode-1's.

   Reuses existing classes as-is, no changes needed to them:
     .team-box, .team-header, .team-list, .vs-container, .vs-text,
     .standby-area, .standby-list, .panel-subheader
--------------------------------------------------------------------------- */

/* Wrapper for multi-row layouts (mode-2/mode-3):
       Player 1   Player 2
             VS
       Player 3   Player 4        */
.click-clash-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* Two-box rows: same 3-column shape as .teams-container (1fr / vs-width /
   1fr), but since there's no vs-container item here to naturally fall
   into the middle column, the 2nd box has to be placed explicitly —
   otherwise grid auto-placement drops it into that narrow middle column
   instead of the 3rd one. */
.teams-container.click-clash-row {
  grid-template-columns: 1fr var(--click-clash-vs-width, 3.5rem) 1fr;
}

.teams-container.click-clash-row .team-box+.team-box {
  grid-column: 3;
}

/* Single-box row (mode-2's 3rd player) and solo mode (mode-0): same
   3-column shape again, so the reserved gap matches too. The box spans
   the full row and is centered with an explicit width equal to what a
   1fr column resolves to in that shape — (100% - gap - 2 gutters) / 2. */
.teams-container.click-clash-row.click-clash-row-single,
.teams-container.click-clash-solo {
  grid-template-columns: 1fr var(--click-clash-vs-width, 3.5rem) 1fr;
  justify-items: center;
}

.teams-container.click-clash-row.click-clash-row-single .team-box,
.teams-container.click-clash-solo .team-box {
  grid-column: 1 / -1;
  width: calc((100% - var(--click-clash-vs-width, 3.5rem) - 2rem) / 2);
}

/* Centered "VS" divider between rows */
.click-clash-vs-row {
  justify-content: center;
  align-items: center;
  padding: 0.15rem 0;
}

/* Responsive: stack to one column on narrow viewports */
@media (max-width: 480px) {
  .teams-container.click-clash-row {
    grid-template-columns: 1fr;
  }

  .teams-container.click-clash-row .team-box+.team-box {
    grid-column: 1;
  }

  .teams-container.click-clash-row.click-clash-row-single .team-box,
  .teams-container.click-clash-solo .team-box {
    width: 100%;
  }
}

.room-popup {

  position: fixed;

  top: 50%;
  left: 50%;

  transform:
    translateX(-50%) translateY(-20px);

  background:
    rgba(20, 25, 40, .95);

  border:
    1px solid rgba(255, 255, 255, .2);

  color: white;

  padding:
    .75rem 1.25rem;

  border-radius: 14px;

  z-index: 99999;

  opacity: 0;

  transition:
    .25s ease;

  pointer-events: none;

}


.room-popup.show {

  opacity: 1;

  transform:
    translateX(-50%) translateY(0);

}

/* Footer adjustments */
.footer-note {
  text-align: center;
  font-size: 0.78rem;
  opacity: 0.9;
  margin-top: auto;
  padding-top: 1.5rem;
}

.split-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.split-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.split-copy {
  margin: 0;
  color: rgba(237, 242, 255, 0.74);
  line-height: 1.7;
}

/* Make the gap between the join copy text and input larger */
.join-card .split-copy {
  margin-bottom: 1.25rem;
}

.code-input {
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
}

.eyebrow {
  margin: 0.35rem auto;
  display: inline-block;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(88, 182, 255, 0.22);
  background: rgba(88, 182, 255, 0.08);
  color: var(--accent);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.75rem;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 4vw, 4.75rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-text {
  margin: 0;
  max-width: 42rem;
  color: rgba(237, 242, 255, 0.78);
  font-size: 1rem;
  line-height: 1.85;
}

.panel-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.card-panel {
  padding: 1.75rem;
}

.panel-title,
.status-label {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: rgba(255, 255, 255, 0.65);
}

.panel-title {
  font-weight: 700;
}

.input-field {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: rgba(11, 16, 34, 0.9);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-field:focus {
  border-color: rgba(88, 182, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(88, 182, 255, 0.12);
}

.input-row {
  display: grid;
  gap: 1rem;
}

/* Username input should be centered and sized to 16 characters */
.username-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.username-card .input-field {
  width: calc(18ch + 2rem);
  text-align: center;
  font-family: var(--font-mono);
}

#usernameInput {
  padding: 0.75rem;
  font-size: 1.15rem;
}

.username-card .username-summary {
  text-align: center;
  margin-bottom: 1rem;
}

.username-card .username-summary-label {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.username-card .username-current {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: #ffffff;
}

.username-entry {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .7rem;
  width: 25%;
}

.username-entry .input-field {
  width: 220px;
  flex: none;
}

.username-entry .button {
  width: 25%;
  flex: none;
  min-width: 80px;
}

.username-card .panel-title {
  margin: 0;
  text-align: center;
}

.username-feedback {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  min-height: 1.25rem;
  text-align: center;
}

#usernameFeedback {
  margin-bottom: -10px;
}

.username-feedback.error-text {
  color: #ff7a7a;
}

.username-feedback.success-text {
  color: #8ce3ff;
}

.server-error-card {
  max-width: 520px;
  margin: 2.5rem auto;
  text-align: center;
}


.server-error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}


.server-error-title {
  font-family: Orbitron, sans-serif;
  font-size: 2rem;
  margin-bottom: 1rem;
}


.server-error-text {
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 18px;
  padding: 1rem 1.25rem;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  border: 1px solid transparent;

  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

/* BLUE */
.primary-button,
.ready-button-not-ready,
.join-player-button {
  background: rgba(88, 182, 255, 0.14);
  border-color: rgba(88, 182, 255, 0.35);
  color: rgb(88, 182, 255);
}

.primary-button:hover,
.ready-button-not-ready:hover,
.join-player-button:hover {
  background: rgba(88, 182, 255, 0.22);
  border-color: rgba(88, 182, 255, 0.5);
}

/* GREEN */
.success-button,
.ready-button-ready {
  background: rgba(85, 220, 120, 0.15);
  border-color: rgba(85, 220, 120, 0.5);
  color: rgb(85, 220, 120);
}

.success-button:hover,
.ready-button-ready:hover {
  background: rgba(85, 220, 120, 0.25);
}

/* RED */
.destructive-button {
  background: rgba(255, 80, 80, 0.1);
  border-color: rgba(255, 80, 80, 0.4);
  color: rgb(255, 110, 110);
}

.destructive-button:hover {
  background: rgba(255, 80, 80, 0.2);
}

/* GRAY */
.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.button:disabled,
.button.disabled {
  opacity: 0.55;
  cursor: default;
  /* instead of not-allowed */
}

.button:disabled:hover,
.button.disabled:hover {
  transform: none;
}

/* Waiting state (blue) */
.start-button-waiting {
  background: rgba(88, 182, 255, 0.14);
  border-color: rgba(88, 182, 255, 0.35);
  color: rgb(88, 182, 255);
}

.start-button-waiting:hover {
  background: rgba(88, 182, 255, 0.14);
  border-color: rgba(88, 182, 255, 0.35);
  color: rgb(88, 182, 255);
  transform: none;
}

/* Green ready-to-start state */
.start-button-ready {
  background: rgba(85, 220, 120, 0.15);
  border-color: rgba(85, 220, 120, 0.5);
  color: rgb(85, 220, 120);
}

.start-button-ready:hover {
  background: rgba(85, 220, 120, 0.25);
}

.link-button {
  background: transparent;
  color: var(--text);
  border: none;
  padding: 0;
  font-size: 0.95rem;
  text-decoration: underline;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  width: 100%;
}

.room-status-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  justify-self: end;
}

.room-status-area button {
  flex-shrink: 0;
}

.room-code-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}


.room-code-label {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  white-space: nowrap;
}

.room-code {
  font-family: var(--font-mono);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

#maxPlayersSelect {
  font-size: 1rem;
}

#dragPlayersHint {
  position: absolute;
  margin-top: -10px;
}

.panel-meta {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.8rem;
}

.player-item,
.spectator-item,
.list-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1rem 1rem;
}

.player-item {
  padding: 1rem;
}

.host {
  background: linear-gradient(135deg, rgba(124, 210, 154, 0.4), rgba(141, 156, 255, 0.4));
}

.player {
  background: rgba(255, 255, 255, 0.08);
}

.ready {
  color: var(--accent);
}

.idle {
  color: rgba(255, 255, 255, 0.55);
}

.username-panel-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.username-panel-content .username-label {
  flex-shrink: 0;
}

.username-label {
  font-size: .75rem;
  letter-spacing: .25em;
  color: rgba(255, 255, 255, .65);
  font-weight: 700;
}

.main-actions-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.feature-card {
  height: 190px;
  min-height: 190px;
  flex-direction: column;
  justify-content: center;
  gap: .8rem;
  transition:
    transform .2s ease,
    border-color .2s ease,
    box-shadow .2s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color:
    rgba(0, 255, 255, .75);
  box-shadow:
    0 0 25px rgba(0, 255, 255, .22),
    inset 0 0 18px rgba(0, 255, 255, .08);
}

.feature-title {
  margin: 0;
  font-size: 1.25rem;
  color: white;
}

.feature-copy {
  color: rgba(255, 255, 255, .65);
  max-width: 320px;
}

.browse-card,
.quick-card {
  border-color: rgba(255, 255, 255, .12);
  box-shadow: none;
}

.join-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .7rem;
}

.join-action-row .input-field {
  width: 140px;
}

.join-action-row input {
  min-width: 0;
}

.spectator-section {
  margin-top: 2rem;
}

.spectator-divider {
  height: 1px;
  background:
    linear-gradient(90deg,
      transparent,
      rgba(0, 255, 255, .35),
      transparent);
  margin-bottom: 1rem;
}

.spectator-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  color: rgba(255, 255, 255, .55);
  text-align: right;
  margin-right: 2.5rem;
}

.spectator-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

.spectator-action {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  padding: 0.5rem 1rem;
  margin-left: 1rem;
}

.spectator-action .button {
  width: 75%;
  min-width: 120px;
}

.spectator-description {
  min-height: auto;
  display: block;
  color:
    rgba(255, 255, 255, .55);
  font-size: .85rem;
  margin-bottom: .8rem;
}

.muted-button {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .15);
  color: rgba(255, 255, 255, .7);
}

.chat-card {
  display: flex;
  flex-direction: column;
  height: 340px;
  overflow: hidden;
}


.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -5px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -15px;
}

.chat-action-button {
  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 8px;

  background: rgba(255, 255, 255, .05);

  color: #DCE8FF;
  font-size: 1rem;

  cursor: pointer;

  transition:
    background .15s,
    transform .15s;
}

.chat-action-button:hover {
  background: rgba(255, 255, 255, .1);
  transform: translateY(-1px);
}

.chat-action-button:active {
  transform: translateY(0);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #2B4E7D;
  border-radius: 20px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #458BFF;
}


.chat-message {
  font-size: .9rem;
  line-height: 1.45;
  color: #DDE9FF;
  word-break: break-word;
}


.chat-message:last-child {
  border-bottom: none;
}

.chat-name {
  color: #63B3FF;
  font-weight: 600;
}

.chat-system-message {
  color: rgba(255, 255, 255, .38);
  font-size: .8rem;
  font-style: italic;
  padding: 2px 0;
}

.chat-text {
  color: #D8E7FF;
  font-size: .88rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: -10px;
}

.chat-input {
  flex: 1;
  overflow-y: hidden;
  resize: none;
  height: 42px;
  max-height: 90px;
  border-radius: 12px;
  border: 1px solid rgba(80, 120, 180, .45);
  background: #18233A;
  color: white;
  padding: 10px 14px;
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: .15s;
}

.chat-input:focus {
  border-color: #4AA3FF;
  box-shadow: 0 0 0 3px rgba(74, 163, 255, .12);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, .35);
}

.chat-send-button {
  width: 84px;
  border: none;
  border-radius: 12px;
  background: #2E6EFF;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}

.chat-send-button:hover {
  background: #458BFF;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-self: start;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.room-browser-modal {
  width: 700px;
  max-width: 95vw;
  height: 650px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #131722;
  border: 1px solid #2b3348;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 24px 10px;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.modal-header p {
  margin-top: 4px;
  color: #8d97aa;
  font-size: .8rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid #3b4357;
  border-radius: 10px;
  color: white;
  cursor: pointer;
}

.modal-close:hover {
  border-color: #ff5555;
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 18px;
}

.browser-toolbar input {
  width: 320px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 10px;
  background: #1b2030;
  color: white;
}

.browser-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 24px 12px;
}

.filter-label {
  width: 60px;
  margin-top: 6px;
  color: #95a3ba;
  font-size: .8rem;
  font-weight: 600;
}

.filter-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 6px 14px;
  border: 1px solid #39445d;
  border-radius: 999px;
  background: #1d2434;
  color: #aeb8c8;
  cursor: pointer;
  transition: .15s;
}

.filter-chip:hover {
  border-color: #4b6bff;
}

.filter-chip.active {
  background: #2d58ff;
  border-color: #2d58ff;
  color: white;
}

.btn-clear {
  width: 110px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: #4b6bff;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}

.btn-clear:hover {
  background: #5a79ff;
}

.btn-update {
  width: 120px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: #2ecc71;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-update:hover {
  background: #3ee084;
}

.refresh-icon {
  font-size: 14px;
  line-height: 1;
}

.room-count {
  padding: 0 24px 12px;
  color: #97a4b9;
  font-size: .9rem;
}

.room-browser-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 0 20px 20px;
}

.room-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 150px 78px 78px;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid #2d3448;
  border-radius: 12px;
  background: #1a2030;
  transition: .2s;
}

.room-row:hover {
  border-color: #4b6bff;
}

.room-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #283149;
  font-weight: bold;
  font-size: .9rem;
}

.room-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.room-name {
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-subtitle {
  margin-top: 3px;
  color: #8ea0ba;
  font-size: .8rem;
  white-space: nowrap;
}

.room-game {
  color: #4b9cff;
  font-size: .8rem;
}

.room-mode {
  color: #9ea8ba;
  text-align: center;
}

.room-actions {
  display: contents;
}

.join-room-btn,
.watch-room-btn {
  width: 72px;
  height: 34px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.join-room-btn {
  border: none;
  background: #3b6cff;
  color: white;
}

.join-room-btn:hover {
  background: #4c79ff;
}

.watch-room-btn {
  border: 1px solid #3a465d;
  background: #222b3f;
  color: #d2dae7;
}

.watch-room-btn:hover {
  border-color: #5b6c8c;
}

.browser-feedback-modal {
  width: min(420px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border: 1px solid #2d3448;
  border-radius: 16px;
  background: #131722;
  box-shadow: 0 25px 80px rgba(0, 0, 0, .55);
}

.browser-feedback-modal h3 {
  margin: 0;
  color: white;
}

.browser-feedback-modal p {
  margin: 0;
  color: #aeb8c8;
  line-height: 1.4;
}

.browser-feedback-modal button {
  align-self: flex-end;
  width: 100px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #4b6bff;
  color: white;
  cursor: pointer;
}

.game-modal-card {
  position: relative;

  width: min(700px, calc(100vw - 40px));
  max-height: min(750px, calc(100vh - 40px));

  display: flex;
  flex-direction: column;

  overflow: hidden;
}

.game-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;

  overflow-y: auto;

  /*
   * Space between the game cards and scrollbar.
   */
  padding: 4px 22px 4px 4px;

  /*
   * Allows the grid to shrink inside the modal.
   */
  min-height: 0;
}

.game-search {
  width: 100%;
  box-sizing: border-box;

  margin: 8px 0 12px;

  padding: 10px 14px;

  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;

  background: rgba(255, 255, 255, 0.06);
  color: inherit;

  font: inherit;
  outline: none;
}

.game-search::placeholder {
  opacity: 0.55;
}

.game-search:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

.room-game-players,
.room-lobby-players {
  white-space: nowrap;
}

.room-game-players {
  font-weight: 700;
}

.room-players {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 4px;
  font-size: .78rem;
}

.room-player-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d9e0ec;
}

.player-status {
  width: 8px;
  align-self: stretch;
  flex-shrink: 0;
  border-radius: 999px;
}

.player-status.green {
  background: #55d96b;
}

.player-status.yellow {
  background: #f0c74c;
}

.player-status.red {
  background: #ef6a6a;
}

.game-options-container {
  margin: 24px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-options-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-options-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}

.game-options-label {
  color: var(--text-secondary, #94a3b8);
  font-size: 14px;
  min-width: 120px;
}

.game-options-input {
  width: 80px;
}

.game-header {
  margin-bottom: 1.25rem;
}

.game-header-room-name {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-align: center;
  flex: 1;
  color: var(--text);
}

.game-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.game-header-btn {
  width: auto !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.75rem !important;
  min-width: 140px;
}

#gameOptionsContainer .lobby-grid {
  align-items: start;
}

#gameOptionsHost {
  min-height: 0px;
}

#game-standby-title {
  margin-top: 1rem;
}

.controls-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: .15s;
}

.controls-card:hover {
  transform: translateY(-2px);
  border-color: rgba(90, 140, 255, .55);
}

.quick-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.controls-header {
  margin: -5px;
}

.quick-controls-grid {
  display: flex;
  flex-direction: column;
}

.quick-control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quick-control-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  transition: background .15s;
}

.control-more {
  margin-top: 10px;
  margin-bottom: -10px;
  border: none;
  background: none;
  color: #79BFFF;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s;
}

.controls-popup {
  width: min(720px, 90vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(95, 130, 190, .35);
  background:
    linear-gradient(180deg,
      rgba(24, 35, 58, .98),
      rgba(17, 26, 46, .98));
  box-shadow:
    0 18px 50px rgba(0, 0, 0, .65),
    inset 0 1px 0 rgba(255, 255, 255, .03);
}

.controls-popup .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03);
}

.controls-popup h2 {
  margin: 0;
  color: white;
  font-size: 1.35rem;
  font-weight: 700;
}

.controls-popup-content {
  overflow-y: auto;
  padding: 22px;
}

.controls-section-title {
  margin: 0 0 16px;
  color: #6EC2FF;
  font-size: 1.05rem;
  font-weight: 700;
}

.controls-divider {
  margin: 24px 0;
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, .08);
}

.controls-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 26px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-description {
  color: rgba(255, 255, 255, .92);
  font-size: .92rem;
}

.key-group {
  display: flex;
  gap: 6px;

  flex-shrink: 0;
}

.key {
  min-width: 36px;
  height: 30px;

  padding: 0 10px;
  white-space: nowrap;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 7px;

  background: linear-gradient(#E8E8E8, #CFCFCF);

  color: #222;

  font-size: .85rem;
  font-weight: 700;

  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, .18),
    0 2px 4px rgba(0, 0, 0, .18);
}

.quick-control-item .key {
  min-width: 30px;
}

.quick-controls-title {
  margin: 6px 0 2px;
  color: #6EC2FF;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.game-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  margin: 12px auto 0;
  background: rgba(15, 20, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
}

.game-ctrl-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.game-ctrl-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.game-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.game-ctrl-mute {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.game-ctrl-mute:hover {
  background: rgba(255, 255, 255, 0.12);
}

.game-ctrl-mute.muted {
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.35);
  color: rgb(255, 110, 110);
}

.game-ctrl-mute.muted svg {
  stroke: rgb(255, 110, 110);
}

.audio-ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-ctrl-label {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 30px;
}

.game-ctrl-icon {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.game-ctrl-icon:hover {
  opacity: 1;
}

.game-ctrl-icon.muted {
  opacity: 0.35;
}

.audio-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(88, 182, 255, 0.4);
}

.audio-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* =========================================================
   ABOUT PAGE
   ========================================================= */

.about-brand-link {
  color: inherit;
  text-decoration: none;
}

.about-brand-link:hover {
  text-decoration: none;
}

.about-page {
  width: min(100%, 900px);
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
}

.about-hero {
  text-align: center;
  padding: 1.5rem 0 0.75rem;
}

.about-hero h1 {
  margin: 0.75rem 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.about-hero .hero-text {
  margin: 0 auto;
  max-width: 650px;
}

.about-section {
  display: grid;
  gap: 0.9rem;
}

.about-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
}

.about-copy {
  margin: 0;
  color: rgba(237, 242, 255, 0.74);
  line-height: 1.75;
}

.about-copy strong {
  color: var(--text);
}

.about-signoff {
  color: var(--accent);
  font-family: var(--font-mono);
}

.about-section-heading {
  display: grid;
  gap: 0.5rem;
}

.about-section-heading .panel-title {
  margin-bottom: 0;
}


/* =========================================================
   FAQ
   ========================================================= */

.about-faq-list {
  display: grid;
  gap: 0.75rem;
}

.about-faq {
  padding: 0;
  overflow: hidden;
}

.about-faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  user-select: none;
}

.about-faq summary::-webkit-details-marker {
  display: none;
}

.about-faq summary::after {
  content: "+";
  float: right;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

.about-faq[open] summary::after {
  content: "−";
}

.about-faq .about-copy {
  padding: 0 1.5rem 1.35rem;
}


/* =========================================================
   FEEDBACK
   ========================================================= */

.feedback-section {
  margin-top: 0.25rem;
}

.feedback-form {
  display: grid;
  gap: 1.15rem;
  margin-top: 0.5rem;
}

.feedback-field {
  display: grid;
  gap: 0.5rem;
}

.feedback-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.feedback-label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.72);
}

.feedback-optional,
.feedback-required {
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.42);
}

.feedback-required {
  color: rgba(88, 182, 255, 0.8);
}

.feedback-select {
  appearance: none;
  cursor: pointer;
}

.feedback-message {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.feedback-counter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.42);
}

.feedback-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.42);
}

.feedback-warning {
  display: grid;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 193, 7, 0.25);
  border-radius: 14px;
  background: rgba(255, 193, 7, 0.07);
  color: rgba(255, 235, 180, 0.85);
  font-size: 0.8rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.feedback-warning strong {
  color: rgba(255, 210, 90, 0.95);
}

.hidden {
  display: none !important;
}

.feedback-status {
  min-height: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.feedback-status.error {
  color: #ff8585;
}

.feedback-status.success {
  color: #7ee2a8;
}

.feedback-submit {
  justify-self: start;
  min-width: 160px;
}

.about-back-button {
  text-decoration: none;
  white-space: nowrap;
}

.about-footer {
  margin-top: 0;
  padding-bottom: 1rem;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

  .about-page {
    width: 100%;
  }

  .about-back-button {
    padding: 0.65rem 0.9rem;
    font-size: 0.78rem;
  }

  .about-title {
    font-size: 1.2rem;
  }

  .card-panel.about-section {
    padding: 1.35rem;
  }

  .feedback-label-row {
    align-items: flex-start;
  }

  .feedback-submit {
    width: 100%;
  }

}

.feedback-cta {
  text-align: center;
}

.feedback-ctb {
  display: block;
  margin: 0 auto;
}

.feedback-cta-copy {
  max-width: 38rem;
  margin: 0 auto 1.5rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.7;
}

.feedback-button {
  border: 1px solid rgba(88, 182, 255, 0.55);
  border-radius: 12px;
  padding: 0.8rem 1.4rem;
  background: rgba(88, 182, 255, 0.14);
  color: #58b6ff;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.feedback-button:hover {
  background: rgba(88, 182, 255, 0.22);
  border-color: rgba(88, 182, 255, 0.8);
  box-shadow: 0 0 20px rgba(88, 182, 255, 0.12);
  transform: translateY(-1px);
}

.feedback-button:active {
  transform: translateY(0);
}

/* Modal */

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.feedback-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.feedback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
}

.feedback-dialog {
  position: relative;
  width: min(100%, 560px);
  max-height: min(90vh, 760px);
  overflow-y: auto;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(11, 16, 34, 0.98);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  transform: translateY(12px) scale(0.98);
  transition: transform 180ms ease;
}

.feedback-modal.open .feedback-dialog {
  transform: translateY(0) scale(1);
}

.feedback-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.feedback-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.feedback-modal .eyebrow {
  margin-right: 3rem;
}

.feedback-modal .split-title {
  margin-bottom: 0.75rem;
}

.feedback-modal-copy {
  margin: 0 0 1.5rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.6;
}

.feedback-field {
  margin-bottom: 1.15rem;
}

.feedback-field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.feedback-field label span {
  font-weight: 400;
  opacity: 0.55;
}

.feedback-field label .required {
  color: #58b6ff;
  opacity: 1;
}

.feedback-field textarea {
  min-height: 150px;
  resize: vertical;
}

.feedback-counter {
  margin-top: 0.35rem;
  text-align: right;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
}

.feedback-status {
  min-height: 1.2rem;
  margin-bottom: 0.75rem;
  color: #ff8d8d;
  font-size: 0.8rem;
}

.feedback-submit {
  width: 100%;
}

.feedback-success {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.feedback-success-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(88, 182, 255, 0.45);
  border-radius: 50%;
  background: rgba(88, 182, 255, 0.1);
  color: #58b6ff;
  font-size: 1.5rem;
  font-weight: 700;
}

.feedback-success p {
  max-width: 30rem;
  margin: 0 auto 1.5rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.7;
}

@media (max-width: 600px) {
  .feedback-modal {
    padding: 0.75rem;
  }

  .feedback-dialog {
    padding: 1.5rem;
    border-radius: 18px;
  }
}

.feedback-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}