:root {
  --bg: #07060a;
  --bg-2: #0d0a14;
  --panel: #120e1c;
  --panel-2: #181128;
  --border: #2a1f44;
  --text: #ece6ff;
  --muted: #8a7fb0;
  --accent: #b46bff;
  --accent-2: #7a3bff;
  --accent-soft: rgba(180, 107, 255, 0.15);
  --good: #7cf7c4;
  --bad: #ff6b8a;
  --shadow: 0 10px 40px rgba(122, 59, 255, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(
      1200px 600px at 80% -10%,
      rgba(122, 59, 255, 0.18),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at -10% 110%,
      rgba(180, 107, 255, 0.1),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(122, 59, 255, 0.08), transparent);
  flex-wrap: wrap;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ff00b3, #7a3bff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 0 var(--logo-glow-r, 10px) rgba(255, 0, 179, var(--logo-glow-a, 0.35)));
  will-change: filter;
}
.brand h1 a {
  text-decoration: none;
  color: inherit;
  -webkit-text-fill-color: inherit;
}
.brand .tag {
  color: var(--muted);
  font-size: 13px;
  border-left: 1px solid var(--border);
  padding-left: 14px;
  margin-left: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-link {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.header-link:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.stats {
  display: flex;
  gap: 28px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.stat .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
}

.filters {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px 40px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  background: var(--panel);
  color: var(--muted);
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  backface-visibility: hidden;
  box-shadow: 0 0 0 1px var(--border);
  transition:
    color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.chip:hover {
  color: var(--text);
  box-shadow: 0 0 0 1.5px var(--accent);
}
.chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow:
    0 0 0 1.5px var(--accent),
    0 0 14px rgba(180, 107, 255, 0.25);
}

#search {
  margin-left: auto;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  min-width: 240px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  padding: 28px 40px 60px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: none;
  border-radius: 14px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  backface-visibility: hidden;
  perspective: 1000px;
  box-shadow: 0 0 0 1px var(--border);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.card:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1.5px var(--accent),
    var(--shadow);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1.5px var(--accent),
    var(--shadow);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    400px 100px at 100% 0,
    rgba(180, 107, 255, 0.08),
    transparent 60%
  );
  pointer-events: none;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-name .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
}
.badge.region {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  margin: 5px 0;
}
.row > span:first-child {
  color: var(--muted);
  width: 88px;
  flex-shrink: 0;
}
.row .v {
  color: var(--text);
  flex: 1;
}
.row .v.mono {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
}

.players-list {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}
.players-list .p {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed transparent;
}
.players-list .p.has-mode {
  border-bottom-color: var(--border);
}
.players-list .p:last-child {
  border-bottom-color: transparent;
}
.players-list .p .p-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.players-list .p .p-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.players-list .p .n {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.steam-link {
  color: inherit;
  text-decoration: none;
}
a.steam-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
.players-list .p .t {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  flex-shrink: 0;
  min-width: 6ch;
  text-align: right;
}

.mode-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0;
}

.kz-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  line-height: 1;
}
.kz-timer {
  color: var(--muted);
  display: inline-block;
  min-width: 13ch;
}
.kz-timer.running {
  color: var(--good);
}
.kz-timer.paused {
  color: var(--accent);
}
.kz-timer.idle {
  color: var(--muted);
  font-style: italic;
}
.kz-meta {
  color: var(--muted);
  min-width: 8ch;
  text-align: right;
  display: inline-block;
}
.kz-meta.pro {
  color: var(--good);
  font-weight: 700;
  letter-spacing: 1px;
  min-width: 8ch;
  text-align: right;
  display: inline-block;
}

.card-actions {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn:hover {
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
}
.btn.connect {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn.connect:hover {
  background: var(--accent);
  flex-shrink: 0;
  border-color: var(--accent);
}
.btn.copy.copied {
  color: var(--good);
  border-color: var(--good);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}
.dot.off {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
}

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--muted);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 6, 10, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.modal.open {
  opacity: 1;
  pointer-events: auto;
}
.modal[hidden] {
  display: none;
}
.modal-panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: none;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  box-shadow:
    var(--shadow),
    0 0 0 1px var(--border);
  position: relative;
  backface-visibility: hidden;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.modal-titlewrap {
  min-width: 0;
  flex: 1;
}
.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}
.modal-badges {
  margin-top: 10px;
  justify-content: flex-start;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  transition: color 0.15s ease;
}
.modal-close:hover {
  color: var(--accent);
}
.modal-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.modal-section {
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.modal-players {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  max-height: 280px;
}
.modal-actions {
  padding-top: 18px;
}
.empty-inline {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0;
}
