:root {
  /* Core Colors */
  --bg: oklch(18% 0.04 259);
  --border-default: oklch(35% 0.04 259);
  --card-bg: oklch(25% 0.04 259);
  --muted: oklch(70% 0.04 259);
  --text: oklch(98% 0.01 259);

  /* Status Colors */
  --offline: oklch(65% 0.2 25);
  --online: oklch(75% 0.15 150);

  /* Game Identity Colors */
  --color-cs2: #e8af30;
  --color-et: #556b2f;
  --color-hl2: #708090;
  --color-l4d2: #d42f19;
  --color-mc: #4a6f28;
  --color-q2: #5d4037;
  --color-q3: #a31d1d;
  --color-sof2: #475569;
  --color-tf2: #b85c1d;
  --color-ut2004: #1d4ed8;

  /* Geometry & Effects */
  --card-pad: 16px;
  --gap-main: 24px;
  --glass-border: rgba(255, 255, 255, 0.15);
  --overlay-dark: rgba(0, 0, 0, 0.35);
  --overlay-light: rgba(255, 255, 255, 0.05);
  --radius: 12px;

  /* Typography */
  --font-mono: ui-monospace, monospace;
  --fs-mono: 0.8rem;
  --fs-small: 0.65rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  margin: 0;
}

/* --- THE FLEX GRID --- */
#audit-container {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-main);
  justify-content: flex-start; /* Aligns servers to the left. Use 'center' if preferred */
  margin: 20px auto;
  max-width: 1600px;
  padding: 0 20px;
  width: 100%;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.3s ease;

  /* Flex Logic: Sets base width for 3 columns on large screens */
  width: calc(33.333% - (var(--gap-main) * 2 / 3));
  min-width: 380px; /* Adjust this to prevent cards getting too narrow */
  flex-grow: 0;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 1300px) {
  .card {
    width: calc(50% - (var(--gap-main) / 2));
  }
}

@media (max-width: 850px) {
  .card {
    width: 100%;
    min-width: unset;
  }
}

/* --- CARD COMPONENTS --- */
.card-header {
  align-items: center;
  color: white;
  display: flex;
  gap: 15px;
  padding: var(--card-pad);
  position: relative;
}

.header-main {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.header-main h2 {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.server-logo {
  background: var(--overlay-dark);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  flex-shrink: 0;
  height: 90px;
  object-fit: cover;
  width: 90px;
}

.address {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  margin-top: 2px;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  background: var(--overlay-dark);
  border-radius: 20px;
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-top: 10px;
  padding: 3px 10px;
  text-transform: uppercase;
  width: fit-content;
}

.status-offline {
  border: 1px solid var(--offline);
  color: var(--offline);
}
.status-online {
  border: 1px solid var(--online);
  color: var(--online);
}

.body {
  padding: 10px 20px;
}

.data-row {
  align-items: flex-start;
  border-bottom: 1px solid var(--overlay-light);
  display: flex;
  font-size: 0.9rem;
  gap: 16px;
  justify-content: space-between;
  padding: 8px 0;
}

.label {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding-top: 3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.value {
  color: var(--text);
  flex-grow: 1;
  font-family: var(--font-mono);
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: right;
  word-break: break-word;
}

.tag-container {
  border-bottom: 1px solid var(--overlay-light);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0;
}

.mod-tag {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 700;
  padding: 3px 8px;
  text-transform: uppercase;
}

/* --- PLAYER LIST --- */
.player-list {
  margin-top: 15px;
  padding-top: 5px;
}

.roster-title {
  color: var(--muted);
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.player-row {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 24px;
}

.player-name {
  color: var(--text);
  flex-grow: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-stats {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-left: auto;
  opacity: 0.5;
}

.bot-pill {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  color: var(--muted);
  font-size: 0.55rem;
  font-weight: 800;
  margin-left: 8px;
  padding: 1px 4px;
}

.empty-msg {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* --- LOADER & REFRESH --- */
.loader-container {
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  bottom: 12px;
  cursor: pointer;
  display: flex !important;
  height: 32px;
  justify-content: center;
  position: absolute;
  right: 12px;
  transition: all 0.2s ease;
  width: 32px;
  z-index: 100;
}

.loader-container:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}
.loader-container:active {
  transform: scale(0.9);
}

.loader {
  animation: spin 0.8s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top: 2px solid white;
  display: none;
  height: 14px;
  width: 14px;
}

.loader-container.loading .loader {
  display: block !important;
}
.loader-container.loading .refresh-icon {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.refresh-icon {
  display: block;
  height: 16px;
  pointer-events: none;
  width: 16px;
}

.meta-prefix {
  display: flex;
  font-size: var(--fs-small);
  font-weight: 900;
  gap: 6px;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  overflow: hidden;
  text-transform: uppercase;
  white-space: nowrap;
}

.meta-game {
  color: rgba(255, 255, 255, 0.95);
}
.meta-site {
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}
