:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07090d;
  color: #f4f7fb;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #171126 0, #080a0f 45%, #05070a 100%); }
button, input { font: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 64px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.04em; }
h2 { margin-bottom: 8px; }
.eyebrow { margin-bottom: 8px; font-size: .75rem; font-weight: 800; letter-spacing: .18em; color: #a98cf5; }
.muted { color: #9da7b6; }
.small { font-size: .84rem; }
.hidden { display: none !important; }
.card { border: 1px solid #252a35; border-radius: 16px; background: rgba(15, 18, 25, .92); box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.login-card { max-width: 460px; padding: 26px; }
label { display: block; margin: 18px 0 8px; font-weight: 700; }
input { width: 100%; border: 1px solid #363d4d; border-radius: 10px; padding: 13px 14px; background: #0b0e14; color: #fff; outline: none; }
input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
.button { border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer; font-weight: 800; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.primary { background: #7c3aed; color: white; }
.secondary { background: #202632; color: #eef2f7; border: 1px solid #343b49; }
.danger { background: #d9364f; color: white; }
.full { width: 100%; margin-top: 16px; }
.message { min-height: 1.2em; margin: 12px 0 0; color: #ff8a9b; }
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 16px; }
.status-grid .card { padding: 20px; }
.label { display: block; margin-bottom: 9px; color: #99a4b4; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.status-grid strong { display: block; margin-bottom: 5px; font-size: 1.3rem; }
.section-card { padding: 22px; margin-top: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.backup-list, .job-list { display: grid; gap: 10px; }
.backup-row, .job-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; align-items: center; border: 1px solid #292f3b; border-radius: 12px; padding: 15px; background: #0b0e14; }
.backup-name, .job-title { font-weight: 800; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; color: #929dac; font-size: .82rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; background: #253044; }
.badge.successful { background: #123c2b; color: #7ce7ac; }
.badge.failed { background: #471b25; color: #ff9aaa; }
.badge.pending, .badge.claimed { background: #3b3214; color: #f4d267; }
.badge.downloading, .badge.verifying, .badge.stopping_server, .badge.restoring, .badge.starting_server { background: #1c3152; color: #87b6ff; }
dialog { width: min(560px, calc(100% - 32px)); border: 1px solid #353c4b; border-radius: 16px; padding: 0; background: #10141c; color: #fff; }
dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(4px); }
.dialog-card { padding: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.empty { padding: 24px; border: 1px dashed #343b48; border-radius: 12px; text-align: center; color: #929dac; }
@media (max-width: 760px) {
  .status-grid { grid-template-columns: 1fr; }
  .backup-row, .job-row { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar .button { align-self: flex-start; }
}


/* Centered layout */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar {
  position: relative;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}

.topbar > div {
  width: 100%;
}

.topbar .button {
  position: absolute;
  right: 0;
  top: 0;
}

.login-card {
  width: min(460px, 100%);
  margin: 0 auto;
}

body.panel-open .shell {
  justify-content: flex-start;
}

@media (max-width: 760px) {
  .topbar .button {
    position: static;
    align-self: center;
  }
}


/* Agent connection glow */
.agent-card {
  position: relative;
  overflow: hidden;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.agent-card::after {
  content: "";
  position: absolute;
  inset: auto -45px -65px auto;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.22;
  filter: blur(26px);
  transition: background 220ms ease;
}

.agent-card #agentStatus {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-card #agentStatus::before {
  content: "";
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  animation: agent-status-pulse 2s ease-in-out infinite;
}

.agent-card.agent-online {
  border-color: rgba(38, 211, 117, 0.72);
  background:
    linear-gradient(135deg, rgba(15, 45, 29, 0.58), rgba(15, 18, 25, 0.94));
  box-shadow:
    0 0 0 1px rgba(38, 211, 117, 0.08),
    0 0 22px rgba(38, 211, 117, 0.24),
    inset 0 0 24px rgba(38, 211, 117, 0.06);
}

.agent-card.agent-online::after {
  background: #26d375;
}

.agent-card.agent-online #agentStatus {
  color: #86f5b7;
}

.agent-card.agent-online #agentStatus::before {
  background: #26d375;
  box-shadow:
    0 0 8px #26d375,
    0 0 18px rgba(38, 211, 117, 0.9);
}

.agent-card.agent-offline {
  border-color: rgba(232, 62, 87, 0.66);
  background:
    linear-gradient(135deg, rgba(55, 18, 26, 0.58), rgba(15, 18, 25, 0.94));
  box-shadow:
    0 0 0 1px rgba(232, 62, 87, 0.08),
    0 0 20px rgba(232, 62, 87, 0.2),
    inset 0 0 22px rgba(232, 62, 87, 0.05);
}

.agent-card.agent-offline::after {
  background: #e83e57;
}

.agent-card.agent-offline #agentStatus {
  color: #ff9aaa;
}

.agent-card.agent-offline #agentStatus::before {
  background: #e83e57;
  box-shadow:
    0 0 8px #e83e57,
    0 0 17px rgba(232, 62, 87, 0.82);
}

.agent-card.agent-busy {
  border-color: rgba(245, 190, 66, 0.68);
  background:
    linear-gradient(135deg, rgba(55, 42, 15, 0.58), rgba(15, 18, 25, 0.94));
  box-shadow:
    0 0 0 1px rgba(245, 190, 66, 0.08),
    0 0 22px rgba(245, 190, 66, 0.22),
    inset 0 0 22px rgba(245, 190, 66, 0.05);
}

.agent-card.agent-busy::after {
  background: #f5be42;
}

.agent-card.agent-busy #agentStatus {
  color: #ffe19a;
}

.agent-card.agent-busy #agentStatus::before {
  background: #f5be42;
  box-shadow:
    0 0 8px #f5be42,
    0 0 18px rgba(245, 190, 66, 0.86);
}

@keyframes agent-status-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.52;
    transform: scale(0.78);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-card #agentStatus::before {
    animation: none;
  }
}


/* Permanent solid agent status */
#agentStatus,
#agentStatus::before,
.agent-card #agentStatus,
.agent-card #agentStatus::before {
  animation: none !important;
  transition: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.agent-card.agent-online #agentStatus::before {
  background: #26d375 !important;
  box-shadow:
    0 0 8px #26d375,
    0 0 18px rgba(38, 211, 117, 0.9) !important;
}


/* Current player session */
.status-grid {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

.player-card {
  min-width: 0;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(77, 170, 255, 0.34);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(31, 91, 145, 0.22);
  color: #a9d7ff;
  font-size: 0.76rem;
  font-weight: 750;
}

.player-chip.more {
  border-color: rgba(169, 140, 245, 0.38);
  background: rgba(124, 58, 237, 0.2);
  color: #cbb8ff;
}

@media (max-width: 1100px) {
  .status-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

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

/* Admin System tabs and player pages */
.status-grid {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

.main-tabs,
.player-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.main-tabs {
  margin: 20px 0 6px;
  padding: 7px;
  border: 1px solid #292f3b;
  border-radius: 14px;
  background: rgba(11, 14, 20, 0.9);
}

.main-tab,
.player-tab {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 17px;
  background: transparent;
  color: #929dac;
  cursor: pointer;
  font-weight: 850;
  white-space: nowrap;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.main-tab:hover,
.player-tab:hover {
  color: #f4f7fb;
  background: rgba(255, 255, 255, 0.04);
}

.main-tab.active {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(124, 58, 237, 0.2);
  color: #d7c8ff;
}

.player-tabs {
  margin: 20px 0;
  border-bottom: 1px solid #2c323e;
  padding-bottom: 10px;
}

.player-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.player-tab.active {
  border-color: rgba(65, 159, 255, 0.5);
  background: rgba(31, 91, 145, 0.22);
  color: #b3dcff;
}

.tab-count {
  min-width: 25px;
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  text-align: center;
  font-size: 0.72rem;
}

.players-heading,
.player-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.player-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-search {
  width: min(360px, 55vw);
  margin: 0;
}

.player-panel h3 {
  margin: 0 0 5px;
}

.player-record-list {
  display: grid;
  gap: 10px;
  min-height: 110px;
}

.scrollable-list {
  max-height: 620px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #3a4352 #11151d;
}

.player-record {
  display: grid;
  grid-template-columns:
    54px
    minmax(170px, 1.1fr)
    minmax(250px, 1.8fr)
    auto;
  align-items: center;
  gap: 15px;
  border: 1px solid #292f3b;
  border-radius: 13px;
  padding: 14px;
  background: #0b0e14;
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid #3a4251;
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      rgba(124, 58, 237, 0.5),
      rgba(31, 91, 145, 0.45)
    );
  color: white;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-record-name {
  color: #f4f7fb;
  font-size: 1rem;
  font-weight: 900;
}

.player-identity {
  display: grid;
  gap: 3px;
  margin-top: 5px;
  color: #8f9baa;
  font-size: 0.77rem;
  overflow-wrap: anywhere;
}

.player-record-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 15px;
  color: #a5afbd;
  font-size: 0.8rem;
}

.player-record-details b {
  color: #d8dee7;
}

.player-record-profile {
  display: flex;
  justify-content: flex-end;
}

.profile-button {
  text-decoration: none;
  white-space: nowrap;
}

.player-ban-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.player-ban-status.banned {
  background: rgba(217, 54, 79, 0.18);
  color: #ff9aaa;
  border: 1px solid rgba(217, 54, 79, 0.35);
}

.player-ban-status.unbanned {
  background: rgba(38, 211, 117, 0.14);
  color: #83efb4;
  border: 1px solid rgba(38, 211, 117, 0.3);
}

/* Agent status remains solid, never blinking */
#agentStatus,
#agentStatus::before,
.agent-card #agentStatus,
.agent-card #agentStatus::before {
  animation: none !important;
  transition: none !important;
  opacity: 1 !important;
  transform: none !important;
}

@media (max-width: 1100px) {
  .status-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .player-record {
    grid-template-columns:
      52px minmax(0, 1fr);
  }

  .player-record-details,
  .player-record-profile {
    grid-column: 2;
  }

  .player-record-profile {
    justify-content: flex-start;
  }
}

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

  .players-heading {
    flex-direction: column;
  }

  .player-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .player-search {
    width: 100%;
  }

  .main-tab,
  .player-tab {
    padding: 10px 12px;
  }
}


/* Live status card icons */
.card-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.card-icon svg {
  width: 15px;
  height: 15px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-agent {
  color: #42e78b;
  background: rgba(38, 211, 117, 0.11);
}

.icon-players {
  color: #65baff;
  background: rgba(65, 159, 255, 0.11);
}

.icon-backups {
  color: #b18cff;
  background: rgba(139, 92, 246, 0.12);
}

.icon-operation {
  color: #ffca66;
  background: rgba(245, 190, 66, 0.11);
}

.status-grid > .card {
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.status-grid > .card:hover {
  transform: translateY(-2px);
  border-color: rgba(143, 155, 174, 0.5);
}

/* Agent dot remains completely solid */
.agent-card #agentStatus::before,
#agentStatus::before {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

/* Remove Steam Profile buttons */
.player-record-profile {
  display: none !important;
}

.player-record {
  grid-template-columns:
    54px
    minmax(180px, 1.2fr)
    minmax(280px, 1.8fr)
    !important;
}

/* Solid green connected-player display */
#currentLobbyList .online-player-record {
  border-color:
    rgba(38, 211, 117, 0.62);

  background:
    linear-gradient(
      90deg,
      rgba(18, 65, 39, 0.42),
      rgba(11, 14, 20, 0.98)
    );

  box-shadow:
    0 0 18px
    rgba(38, 211, 117, 0.13),
    inset 0 0 18px
    rgba(38, 211, 117, 0.04);
}

.solid-online-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  border: 1px solid
    rgba(38, 211, 117, 0.38);

  border-radius: 999px;

  padding: 4px 9px;

  background:
    rgba(38, 211, 117, 0.12);

  color: #79f0ad;

  font-size: 0.72rem;
  font-weight: 900;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.solid-online-dot {
  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: #26d375;

  box-shadow:
    0 0 7px #26d375,
    0 0 13px
    rgba(38, 211, 117, 0.65);

  animation: none !important;
}

/* Staff roles */
.staff-role {
  display: inline-flex;
  align-items: center;

  border-radius: 999px;

  padding: 5px 10px;

  font-size: 0.7rem;
  font-weight: 900;

  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.staff-role.super-admin {
  color: #dfc5ff;

  border: 1px solid
    rgba(167, 99, 255, 0.5);

  background:
    rgba(124, 58, 237, 0.2);
}

.staff-role.admin {
  color: #9bd4ff;

  border: 1px solid
    rgba(65, 159, 255, 0.45);

  background:
    rgba(31, 91, 145, 0.21);
}


/* Current Lobby Online badge at far-right */
#currentLobbyList .online-player-record {
  grid-template-columns:
    54px
    minmax(180px, 1.2fr)
    minmax(280px, 1.8fr)
    auto !important;
}

#currentLobbyList .solid-online-status {
  align-self: center;
  justify-self: end;
  margin-left: 18px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  #currentLobbyList .online-player-record {
    grid-template-columns:
      52px
      minmax(0, 1fr)
      auto !important;
  }

  #currentLobbyList .online-player-record
  .player-record-details {
    grid-column: 2;
  }

  #currentLobbyList .solid-online-status {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

@media (max-width: 650px) {
  #currentLobbyList .online-player-record {
    grid-template-columns:
      52px
      minmax(0, 1fr) !important;
  }

  #currentLobbyList .solid-online-status {
    grid-column: 2;
    grid-row: auto;
    justify-self: start;
    margin-left: 0;
  }
}
