:root {
  color-scheme: dark;
  --bg: #0d1110;
  --ink: #f4f0df;
  --muted: #b7bcae;
  --panel: rgba(18, 26, 25, 0.86);
  --panel-strong: rgba(26, 36, 34, 0.94);
  --line: rgba(244, 240, 223, 0.14);
  --line-hot: rgba(235, 190, 101, 0.58);
  --gold: #f0be61;
  --green: #69c38d;
  --red: #de6f61;
  --blue: #78addb;
  --steel: #8d97a2;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(7, 10, 10, 0.34) 0, rgba(13, 17, 16, 0.86) 480px, var(--bg) 900px),
    url("https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?auto=format&fit=crop&w=2200&q=85") center top / cover fixed;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.hero {
  min-height: 58vh;
  padding: 22px clamp(18px, 4vw, 56px) 34px;
}

.nav,
.hero-grid,
main {
  max-width: 1480px;
  margin: 0 auto;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand,
.nav-actions,
.server-head,
.card-actions,
.section-heading,
.capacity div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-hot);
  border-radius: 7px;
  background: rgba(240, 190, 97, 0.14);
  color: var(--gold);
}

.nav-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button,
.live-chip,
.join-link,
.discord-link,
.segmented button,
.inspect-button,
.copy-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(11, 15, 15, 0.62);
  color: var(--ink);
  padding: 9px 13px;
  text-decoration: none;
}

.ghost-button,
.segmented button,
.inspect-button,
.copy-button {
  cursor: pointer;
}

.ghost-button:hover,
.join-link:hover,
.discord-link:hover,
.inspect-button:hover,
.copy-button:hover {
  border-color: var(--gold);
  background: rgba(240, 190, 97, 0.12);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  align-items: end;
  min-height: 44vh;
  padding-top: 78px;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 900px;
  font-size: clamp(44px, 8vw, 112px);
  line-height: 0.88;
  letter-spacing: 0;
  text-shadow: 0 18px 70px rgba(0, 0, 0, 0.7);
}

.lead {
  max-width: 780px;
  margin-top: 18px;
  color: #e5e3d4;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.45;
}

.champion-panel,
.summary-grid article,
.leaderboard,
.intel-panel,
.servers-section,
.history-panel,
.server-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.champion-panel {
  padding: 22px;
  min-height: 180px;
  background:
    linear-gradient(135deg, rgba(240, 190, 97, 0.18), rgba(105, 195, 141, 0.07)),
    var(--panel-strong);
}

.champion-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1.05;
}

.champion-panel p {
  margin-top: 12px;
  color: var(--muted);
}

main {
  padding: 0 clamp(18px, 4vw, 56px) 54px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: -48px;
  position: relative;
}

.summary-grid article {
  padding: 18px;
}

.summary-grid span,
.detail-grid span,
.card-metrics span,
.server-head p,
#last-checked,
#history-label,
.error-text {
  color: var(--muted);
}

.chart-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend::before {
  content: "";
  width: 22px;
  height: 3px;
  border-radius: 99px;
  background: var(--gold);
}

.legend.latency::before {
  background: #ff5f57;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.main-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.leaderboard,
.intel-panel,
.servers-section,
.history-panel {
  padding: 18px;
}

.section-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading.compact {
  align-items: flex-start;
}

h2 {
  font-size: 24px;
  line-height: 1;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: rgba(9, 12, 12, 0.54);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: rgba(240, 190, 97, 0.18);
  color: var(--ink);
}

.leaderboard-list,
.server-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 88px 90px;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.rank-row:hover,
.rank-row.selected,
.server-card.selected {
  border-color: var(--line-hot);
  background: rgba(240, 190, 97, 0.09);
}

.intel-panel.pulse {
  animation: inspectPulse 900ms ease-out;
}

.intel-panel:focus {
  outline: 2px solid rgba(240, 190, 97, 0.72);
  outline-offset: 4px;
}

@keyframes inspectPulse {
  0% {
    border-color: var(--gold);
    box-shadow: 0 0 0 0 rgba(240, 190, 97, 0.46), var(--shadow);
  }
  100% {
    border-color: var(--line);
    box-shadow: 0 0 0 18px rgba(240, 190, 97, 0), var(--shadow);
  }
}

.rank {
  color: var(--gold);
  font-weight: 900;
}

.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.rank-score,
.rank-medal {
  color: var(--muted);
  text-align: right;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inspection-note {
  margin: -4px 0 14px;
  color: var(--muted);
  line-height: 1.4;
}

.detail-grid div {
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.detail-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.agent-box {
  margin-top: 16px;
}

pre {
  margin: 10px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(240, 190, 97, 0.24);
  border-radius: 8px;
  background: rgba(4, 7, 7, 0.78);
  color: #f4d08b;
  line-height: 1.45;
  white-space: pre-wrap;
}

.server-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.65fr) minmax(260px, 1.15fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  box-shadow: none;
}

.server-head {
  gap: 12px;
  min-width: 0;
}

.server-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
}

.beacon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(222, 111, 97, 0.14);
  flex: 0 0 auto;
}

.beacon.online {
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(105, 195, 141, 0.15), 0 0 28px rgba(105, 195, 141, 0.65);
}

.capacity div {
  justify-content: space-between;
  margin-bottom: 8px;
}

meter {
  width: 100%;
  height: 14px;
}

meter::-webkit-meter-bar {
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

meter::-webkit-meter-optimum-value {
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.card-metrics span {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  white-space: nowrap;
}

.card-metrics strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 16px;
}

.card-actions {
  grid-column: 1 / -1;
  justify-content: end;
  gap: 8px;
}

.join-link.disabled,
.discord-link.disabled {
  pointer-events: none;
  opacity: 0.48;
}

.error-text {
  grid-column: 1 / -1;
}

canvas {
  display: block;
  width: 100%;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty {
  padding: 22px;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .hero-grid,
  .board-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    margin-top: 0;
  }

  .server-card {
    grid-template-columns: 1fr;
  }

  .card-actions {
    justify-content: start;
  }
}

@media (max-width: 680px) {
  .hero {
    min-height: 0;
  }

  .nav,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-grid {
    padding-top: 52px;
  }

  .rank-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .rank-score,
  .rank-medal {
    text-align: left;
  }

  .detail-grid,
  .card-metrics {
    grid-template-columns: 1fr 1fr;
  }
}
