/* Active Games — same shell pattern as deck-builder (covers left board, under sidebox) */

.rooms-list-workspace {
  position: fixed;
  top: 0;
  right: calc(24% - 8px);
  left: 0;
  height: 100vh;
  background: transparent;
  border: none;
  z-index: 900;
  transform: translateX(calc(100% - 8px));
  transition: transform 220ms ease;
  display: flex;
  align-items: stretch;
  overflow: visible;
  pointer-events: none;
}

.rooms-list-workspace.open {
  transform: translateX(0);
  pointer-events: auto;
}

.rooms-list-workspace:not(.open) .rooms-list-inner {
  visibility: hidden;
}

/* Match deck builder: collapse via header button / Escape / tab switch */
.rooms-list-edge-toggle {
  display: none;
}

.rooms-list-inner {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border: 1px solid rgba(100, 200, 255, 0.45);
  box-shadow:
    0 0 18px rgba(100, 200, 255, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.45);
  background: linear-gradient(
    160deg,
    rgba(18, 22, 34, 0.97),
    rgba(10, 12, 20, 0.98)
  );
  color: #e8f4ff;
  overflow: hidden;
}

.rooms-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1vw;
  padding: 0.85vh 0.8vw;
  border-bottom: 1px solid rgba(100, 200, 255, 0.25);
  background: rgba(14, 18, 28, 0.92);
  flex-shrink: 0;
}

.rooms-list-header strong {
  font-size: 1.8vh;
}

.rooms-list-subtitle {
  font-size: 1.45vh;
  margin-top: 0.25vh;
  color: rgba(180, 210, 235, 0.85);
}

.rooms-list-actions {
  display: flex;
  gap: 0.35vw;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rooms-list-actions button {
  color: white;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 1.55vh;
  padding: 0.55vh 0.7vw;
  opacity: 0.92;
}

.rooms-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6vw;
  padding: 0.65vh 0.8vw;
  border-bottom: 1px solid rgba(100, 200, 255, 0.18);
  background: rgba(16, 20, 30, 0.85);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.rooms-list-toolbar__left {
  display: flex;
  align-items: center;
  gap: 0.7vw;
  flex-wrap: wrap;
  min-width: 0;
}

.rooms-list-view-toggle {
  display: inline-flex;
  border: 1px solid rgba(100, 200, 255, 0.35);
  border-radius: 6px;
  overflow: hidden;
}

.rooms-list-view-btn {
  border: none;
  background: transparent;
  color: rgba(200, 230, 245, 0.75);
  font-size: 1.35vh;
  padding: 0.45vh 0.7vw;
  cursor: pointer;
}

.rooms-list-view-btn.is-active {
  background: rgba(0, 180, 220, 0.22);
  color: #dff6ff;
}

.rooms-list-view-btn:hover {
  color: #fff;
}

.rooms-list-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35vw;
  font-size: 1.3vh;
  color: rgba(180, 210, 235, 0.8);
}

.rooms-list-sort-select {
  background: rgba(8, 12, 20, 0.9);
  color: #e8f4ff;
  border: 1px solid rgba(100, 200, 255, 0.35);
  border-radius: 4px;
  font-size: 1.3vh;
  padding: 0.35vh 0.45vw;
}

.rooms-list-hint {
  font-size: 1.35vh;
  color: rgba(180, 210, 235, 0.75);
  margin-left: auto;
}

.rooms-list-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1vh 0.8vw 1.2vh;
  display: flex;
  flex-direction: column;
  gap: 0.85vh;
}

.rooms-list-body:focus {
  outline: none;
}

.rooms-list-body::-webkit-scrollbar {
  width: 8px;
}

.rooms-list-body::-webkit-scrollbar-thumb {
  background: rgba(100, 200, 255, 0.35);
  border-radius: 8px;
}

.rooms-list-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.rooms-list--simple .rooms-list-body {
  gap: 0.55vh;
}

.rooms-list-empty {
  margin: 3vh 1vw;
  text-align: center;
  color: rgba(180, 210, 235, 0.7);
  font-size: 1.55vh;
  line-height: 1.4;
}

.rooms-list-row {
  display: flex;
  flex-direction: column;
  gap: 0.7vh;
  padding: 1vh 0.85vw;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(100, 200, 255, 0.22);
  flex-shrink: 0;
}

/* Simple = two compact rows per server */
.rooms-list-row--simple {
  gap: 0.45vh;
  padding: 0.55vh 0.65vw;
}

.rooms-list-row__line {
  display: flex;
  align-items: center;
  gap: 0.45vw;
  min-width: 0;
}

.rooms-list-row__line--primary {
  cursor: pointer;
  border-radius: 4px;
  padding: 0.15vh 0.15vw;
}

.rooms-list-row__line--primary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.rooms-list-row--simple .rooms-list-row__id {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.4vh;
}

.rooms-list-row__stat,
.rooms-list-row__meta-chip {
  flex: 0 0 auto;
  font-size: 1.2vh;
  color: rgba(190, 220, 235, 0.85);
  white-space: nowrap;
}

.rooms-list-row__meta-chip {
  max-width: 9vw;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.rooms-list-row__line--actions {
  display: flex;
  gap: 0.4vw;
}

.rooms-list-row--simple .rooms-list-row__join,
.rooms-list-row--simple .rooms-list-row__spectate {
  padding: 0.4vh 0.5vw;
  font-size: 1.25vh;
}

.rooms-list-row--waiting {
  border-color: rgba(80, 220, 140, 0.45);
  background: rgba(18, 42, 28, 0.55);
}

.rooms-list-row--waiting .rooms-list-row__server-name,
.rooms-list-row--waiting .rooms-list-row__meta-value,
.rooms-list-row--waiting .rooms-list-row__button-value,
.rooms-list-row--waiting .rooms-list-row__stat,
.rooms-list-row--waiting .rooms-list-row__meta-chip,
.rooms-list-row--waiting .rooms-list-row__id {
  color: #eef8f0;
}

.rooms-list-row--waiting .rooms-list-row__col-label {
  color: rgba(180, 235, 195, 0.88);
}

.rooms-list-row--full,
.rooms-list-row--inGame {
  border-color: rgba(100, 170, 255, 0.4);
}

.rooms-list-row--locked {
  border-color: rgba(255, 180, 80, 0.4);
}

.rooms-list-row--placeholder {
  border-style: dashed;
}

.rooms-list-row__main {
  cursor: pointer;
  border-radius: 6px;
  padding: 0.15vh 0.1vw;
}

.rooms-list-row__main:hover {
  background: rgba(255, 255, 255, 0.04);
}

.rooms-list-row__id {
  font-weight: 600;
  font-size: 1.55vh;
  word-break: break-all;
  color: #dff6ff;
}

.rooms-list-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5vw;
  font-size: 1.3vh;
  color: rgba(190, 220, 235, 0.8);
}

.rooms-list-row__badge {
  display: inline-block;
  flex: 0 0 auto;
  padding: 0.15vh 0.55vw;
  border-radius: 999px;
  background: rgba(0, 180, 220, 0.18);
  border: 1px solid rgba(0, 200, 230, 0.35);
  color: #9eecff;
  font-size: 1.15vh;
  white-space: nowrap;
}

.rooms-list-row--waiting .rooms-list-row__badge {
  background: rgba(20, 90, 50, 0.85);
  border-color: rgba(100, 230, 150, 0.55);
  color: #e8fff0;
}

.rooms-list-row--locked .rooms-list-row__badge {
  background: rgba(220, 140, 40, 0.18);
  border-color: rgba(255, 180, 80, 0.4);
  color: #ffd59a;
}

.rooms-list-row__players {
  font-size: 1.35vh;
  color: rgba(200, 230, 245, 0.7);
}

.rooms-list-row__actions {
  display: flex;
  gap: 0.5vw;
}

.rooms-list-row__join,
.rooms-list-row__spectate {
  flex: 1;
  border: none;
  border-radius: 4px;
  padding: 0.65vh 0.6vw;
  cursor: pointer;
  font-size: 1.4vh;
  color: #fff;
  opacity: 0.92;
}

.rooms-list-row__join {
  background: linear-gradient(
    to bottom,
    rgba(90, 130, 188, 0.95),
    rgba(60, 100, 158, 0.95)
  );
}

.rooms-list-row__spectate {
  background: linear-gradient(to bottom, #666, #4a4a46);
}

.rooms-list-row__join:hover:not(:disabled),
.rooms-list-row__spectate:hover {
  filter: brightness(1.08);
}

.rooms-list-row__join:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Lobby button stays in sidebox */
#openRoomsListButton {
  width: 100%;
  margin-bottom: 1.2vh;
  color: #fff;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 2vh;
  background: linear-gradient(
    to bottom,
    rgba(90, 130, 188, 0.92),
    rgba(60, 100, 158, 0.92)
  );
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s;
  opacity: 0.95;
}

#openRoomsListButton:hover {
  filter: brightness(1.06);
}

#roomPassword {
  width: 100%;
  margin-bottom: 1.2vh;
}

#roomPasswordInput {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.9);
  color: #2a3140;
  font-size: 1.8vh;
}

#passwordWarning {
  display: none;
  margin: 0 0 1vh;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(180, 40, 40, 0.2);
  border: 1px solid rgba(180, 60, 60, 0.4);
  color: #7a2020;
  font-size: 1.5vh;
}

/* Clear Server / Meta / Button columns */
.rooms-list-row__cols {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 0.65vw;
  margin-bottom: 0.45vh;
}

.rooms-list-row__col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15vh;
}

.rooms-list-row__col-label {
  font-size: 1.05vh;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(154, 216, 234, 0.7);
  font-weight: 600;
}

.rooms-list-row__server-name {
  font-size: 1.55vh;
  font-weight: 700;
  color: #e8f4ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rooms-list-row__meta-value,
.rooms-list-row__button-value {
  font-size: 1.4vh;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rooms-list-row__meta-value {
  color: #9ad8ea;
}

.rooms-list-row__button-value,
.rooms-list-row__button-chip {
  color: #c4b5fd;
}

.rooms-list-row__id-sub {
  font-size: 1.15vh;
  color: rgba(180, 210, 235, 0.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rooms-list-row--simple .rooms-list-row__line--primary {
  flex-wrap: wrap;
  row-gap: 0.35vh;
}

.rooms-list-row--simple .rooms-list-row__col--server {
  flex: 1 1 22%;
  min-width: 7vw;
}

.rooms-list-row--simple .rooms-list-row__col--meta,
.rooms-list-row--simple .rooms-list-row__col--button {
  flex: 0 1 14%;
  min-width: 5vw;
}

.rooms-list-row--simple .rooms-list-row__col {
  flex-direction: column;
}

.rooms-list-row__button-chip,
.rooms-list-row__meta-chip {
  max-width: 9vw;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.95;
  font-size: 1.2vh;
  white-space: nowrap;
}

/* Join / password popup */
.rooms-join-modal {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 18, 0.62);
  padding: 2vh 2vw;
}

.rooms-join-modal[hidden] {
  display: none !important;
}

.rooms-join-modal__box {
  width: min(420px, 92vw);
  border-radius: 12px;
  border: 1px solid rgba(100, 200, 255, 0.4);
  background: linear-gradient(160deg, rgba(18, 22, 34, 0.98), rgba(10, 12, 20, 0.99));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 18px rgba(100, 200, 255, 0.15);
  color: #e8f4ff;
  padding: 1.2rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.rooms-join-modal__title {
  font-size: 1.9vh;
  font-weight: 700;
}

.rooms-join-modal__subtitle {
  margin: 0;
  font-size: 1.35vh;
  color: rgba(180, 210, 235, 0.85);
  line-height: 1.35;
}

.rooms-join-modal__label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 1.3vh;
  font-weight: 600;
  color: #dceefb;
}

.rooms-join-modal__label[hidden] {
  display: none !important;
}

.rooms-join-modal__input {
  border-radius: 8px;
  border: 1px solid rgba(100, 200, 255, 0.35);
  background: rgba(20, 28, 42, 0.95);
  color: #e8f4ff;
  padding: 0.55rem 0.65rem;
  font-size: 1.45vh;
}

.rooms-join-modal__input::placeholder {
  color: rgba(180, 210, 235, 0.55);
}

body.dark-mode-1 .rooms-join-modal__input {
  color: #e8f4ff;
  background: rgba(20, 28, 42, 0.95);
}

body.dark-mode-1 .rooms-join-modal__input::placeholder {
  color: rgba(180, 210, 235, 0.55);
}

.rooms-join-modal__check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.35vh;
}

.rooms-join-modal__error {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(180, 40, 40, 0.22);
  border: 1px solid rgba(220, 90, 90, 0.45);
  color: #f5b4b4;
  font-size: 1.3vh;
}

.rooms-join-modal__error[hidden] {
  display: none !important;
}

.rooms-join-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.rooms-join-modal__actions button {
  border-radius: 8px;
  border: none;
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 1.4vh;
}
