:root {
  color-scheme: dark;
  --bg: #0b0d18;
  --bg-soft: #121529;
  --panel: rgba(22, 26, 49, 0.82);
  --panel-solid: #171b32;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f2fb;
  --muted: #9ca3c4;
  --brand: #8b7bff;
  --brand-soft: rgba(139, 123, 255, 0.16);
  --gold: #ffd166;
  --green: #4ade80;
  --red: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(139, 123, 255, 0.24), transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(74, 222, 128, 0.12), transparent 35%),
    var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #9b8cff, #6954e8);
  box-shadow: 0 10px 30px rgba(105, 84, 232, 0.35);
  font-size: 22px;
}
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .2px; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.readonly-badge {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 99px;
  color: #c9c2ff; background: var(--brand-soft);
  border: 1px solid rgba(139, 123, 255, 0.3);
  font-size: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.status-card {
  position: relative;
  overflow: hidden;
  padding: 21px 22px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.status-card::after {
  content: "";
  position: absolute; inset: auto -30% -70% auto;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(139, 123, 255, 0.13);
  filter: blur(8px);
}
.status-card.ok::after { background: rgba(74, 222, 128, 0.12); }
.status-card.bad::after { background: rgba(251, 113, 133, 0.12); }

.status-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.status-label { color: var(--muted); font-size: 12px; letter-spacing: .6px; }
.status-title { margin-top: 7px; font-size: 19px; font-weight: 700; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-pill.online { color: #bbf7d0; background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.25); }
.status-pill.online .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(74,222,128,.14); }
.status-pill.offline { color: #fecdd3; background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.25); }
.status-pill.offline .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(251,113,133,.14); }

.status-meta {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
  overflow-wrap: anywhere; word-break: break-word;
}
.status-meta b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.layout > * { min-width: 0; }
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 19px 21px 0;
}
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 99px;
  color: var(--muted); background: rgba(255,255,255,.05);
  border: 1px solid var(--border); font-size: 11px;
}
.live-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.live-badge.live { color: #bbf7d0; background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.25); }
.live-badge.live::before { background: var(--green); box-shadow: 0 0 0 3px rgba(74,222,128,.14); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.panel-body { padding: 18px 21px 22px; }

.group-tabs { display: flex; flex-wrap: wrap; gap: 9px; padding: 17px 21px 0; }
.group-tab {
  appearance: none; cursor: pointer;
  padding: 8px 13px; border-radius: 11px;
  color: var(--muted); background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  font: inherit; font-size: 12.5px;
  transition: .18s ease;
}
.group-tab:hover { color: var(--text); background: rgba(255,255,255,.08); }
.group-tab.active {
  color: #fff; background: var(--brand-soft);
  border-color: rgba(139,123,255,.45);
  box-shadow: inset 0 0 0 1px rgba(139,123,255,.12);
}

.podium {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px; margin: 20px 0;
}
.podium-card {
  position: relative; overflow: hidden;
  min-height: 132px; padding: 15px 14px;
  border-radius: 16px; text-align: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
}
.podium-card.first {
  background: linear-gradient(160deg, rgba(255,209,102,.18), rgba(139,123,255,.12));
  border-color: rgba(255,209,102,.32);
}
.podium-rank {
  position: absolute; top: 10px; right: 12px;
  font-size: 11px; color: var(--muted);
}
.podium-avatar {
  width: 42px; height: 42px; margin: 0 auto 9px;
  display: grid; place-items: center;
  border-radius: 50%; font-weight: 700;
  background: linear-gradient(145deg, #8b7bff, #4ade80);
  color: #0b0d18;
}
.podium-card.first .podium-avatar { background: linear-gradient(145deg, #ffd166, #ff9f68); }
.podium-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-points { margin-top: 7px; color: var(--gold); font-size: 19px; font-weight: 800; }
.podium-points small { color: var(--muted); font-size: 10px; font-weight: 500; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.search {
  flex: 1 1 210px; min-width: 160px;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 11px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
}
.search input {
  width: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 13px;
}
.search input::placeholder { color: #737b9c; }
.sorts { display: flex; gap: 7px; }
.sort-btn {
  appearance: none; cursor: pointer;
  padding: 8px 11px; border-radius: 10px;
  color: var(--muted); background: rgba(255,255,255,.04);
  border: 1px solid var(--border); font: inherit; font-size: 12px;
}
.sort-btn.active { color: #fff; background: var(--brand-soft); border-color: rgba(139,123,255,.45); }

.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
thead th {
  padding: 12px 14px; text-align: left;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  background: rgba(255,255,255,.035);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,.055); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.rank-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-num.top { color: var(--gold); font-weight: 700; }
.user { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.mini-avatar {
  width: 28px; height: 28px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 9px;
  background: rgba(139,123,255,.2); color: #d9d3ff;
  font-size: 12px; font-weight: 700;
}
.user-name { overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.title-tag {
  display: inline-block; margin-left: 6px; padding: 2px 6px;
  border-radius: 6px; color: #ffe3a3; background: rgba(255,209,102,.12);
  font-size: 10px;
}
.points { color: var(--gold); font-weight: 700; }
.muted { color: var(--muted); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.side-card { padding: 20px; }
.side-card h3 { margin: 0 0 15px; font-size: 14px; }
.stat-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 12.5px;
}
.stat-row:last-child { border-bottom: 0; }
.stat-row b { font-size: 17px; max-width: 62%; text-align: right; overflow-wrap: anywhere; word-break: break-word; }
.stat-row:first-child b { font-size: 13px; text-align: left; max-width: 70%; }
.note {
  margin-top: 14px; padding: 12px; border-radius: 12px;
  color: #a9a3d6; background: rgba(139,123,255,.1);
  border: 1px solid rgba(139,123,255,.18);
  font-size: 11.5px; line-height: 1.65;
}

.footer {
  margin-top: 26px; text-align: center;
  color: #6f789b; font-size: 11.5px; line-height: 1.7;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side-panel { order: -1; }
}
@media (max-width: 640px) {
  .shell { width: min(calc(100% - 20px), 1180px); padding-top: 18px; }
  .topbar { align-items: flex-start; }
  .readonly-badge { max-width: 138px; padding: 6px 9px; font-size: 10px; line-height: 1.4; white-space: normal; text-align: right; }
  .status-grid { grid-template-columns: 1fr; }
  .status-card { padding: 17px 16px; }
  .status-meta { gap: 8px 14px; font-size: 11.5px; }
  .podium { grid-template-columns: 1fr; }
  .podium-card { min-height: 0; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; text-align: left; }
  .podium-avatar { margin: 0; }
  .podium-rank { position: static; }
  .podium-points { margin: 0; }
  .panel-head, .panel-body, .group-tabs { padding-left: 15px; padding-right: 15px; }
}
