:root {
  --ink: #071018;
  --text: #f4f1ea;
  --muted: #b7c0cc;
  --line: rgba(255, 255, 255, 0.12);
  --panel: rgba(8, 14, 22, 0.72);
  --panel-strong: rgba(8, 14, 22, 0.84);
  --accent: #ff9a4a;
  --accent-2: #6eb6ff;
  --accent-3: #c4a35a;
  --good: #7ddea0;
  --table-head: rgba(255, 154, 74, 0.16);
  --max: 1180px;
  --radius: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--ink);
  line-height: 1.5;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("assets/hero.png") center top / cover no-repeat fixed;
}

.backdrop-veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7, 16, 24, 0.28) 0%, rgba(7, 16, 24, 0.55) 42%, rgba(7, 16, 24, 0.88) 100%),
    radial-gradient(ellipse at 70% 20%, rgba(255, 120, 60, 0.18), transparent 55%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  background: rgba(7, 16, 24, 0.7);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 12rem;
  text-decoration: none;
  color: inherit;
}

.nav a.active {
  color: var(--accent);
}

.chart-frame.leaderboard {
  height: auto;
  min-height: 360px;
}

.brand-logo {
  width: 3.1rem;
  height: 3.1rem;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.brand-kicker {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav a:hover { color: var(--accent); }

.scope-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-chip-host {
  min-height: 0;
}

.mode-chip-row {
  flex-wrap: nowrap;
}

.mode-chip {
  padding: 0.32rem 0.7rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.scope-label {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.server-select {
  appearance: none;
  min-width: 12.5rem;
  max-width: 18rem;
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 14px) calc(50% - 3px) / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 9px) calc(50% - 3px) / 6px 6px no-repeat,
    rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
}

.server-select:focus {
  outline: 1px solid rgba(110, 182, 255, 0.55);
  outline-offset: 1px;
}

.server-select option {
  background: #0d1620;
  color: var(--text);
}

.updated {
  color: var(--muted);
  font-size: 0.75rem;
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

main {
  width: min(var(--max), calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.hero, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  background:
    linear-gradient(135deg, rgba(255, 154, 74, 0.08), transparent 42%),
    var(--panel);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

.hero h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 16ch;
}

.lede {
  margin-top: 0.75rem;
  color: var(--muted);
  max-width: 38rem;
  font-size: 1.02rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.stat-card {
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-card .value {
  margin-top: 0.4rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.55rem;
  font-weight: 500;
}

.panel { padding: clamp(1.2rem, 2.5vw, 1.7rem); }

.section-head {
  margin-bottom: 1.1rem;
}

.section-head.tight {
  margin-top: 1.4rem;
  margin-bottom: 0.9rem;
}

.section-head h2,
.section-head h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-head p {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.95rem 1rem 0.85rem;
}

.chart-card h3 {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.chart-frame {
  position: relative;
  height: 280px;
}

.chart-frame.tall { height: 320px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}

.detail-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0.85rem;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 600;
}

.detail-card header span:last-child {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
}

.detail-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.detail-card td {
  padding: 0.42rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-card td:first-child { color: #c9d1db; }
.detail-card td:last-child {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.table-search {
  flex: 1 1 14rem;
  min-width: 12rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
}

.table-search::placeholder { color: rgba(183, 192, 204, 0.75); }
.table-search:focus {
  outline: 1px solid rgba(110, 182, 255, 0.55);
  outline-offset: 1px;
}

.table-hint {
  margin: -0.35rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.table-hint a {
  color: var(--accent-2);
  text-decoration: none;
}

.table-hint a:hover { text-decoration: underline; }

.table-toolbar .scope-label {
  flex: 0 0 auto;
}

.picker-block {
  margin-bottom: 0.25rem;
}

.chip-host { min-height: 2.4rem; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: rgba(110, 182, 255, 0.45);
  background: rgba(110, 182, 255, 0.08);
}

.chip.is-active {
  border-color: rgba(255, 154, 74, 0.7);
  background: rgba(255, 154, 74, 0.16);
  color: #fff;
}

.chip-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--accent-2);
}

.chip.is-active .chip-count { color: var(--accent); }

.category-layout {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.category-rail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.category-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.84rem;
  cursor: pointer;
}

.category-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.category-btn.is-active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 154, 74, 0.12);
}

.category-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--accent-2);
}

.player-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(110, 182, 255, 0.35);
}

.player-link:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.profile-pin {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.profile-actions .chip {
  text-decoration: none;
}

code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85em;
  color: var(--accent-2);
}

@media (max-width: 980px) {
  .category-layout { grid-template-columns: 1fr; }
  .category-rail { flex-direction: row; flex-wrap: wrap; }
  .category-btn { width: auto; }
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable:hover { color: var(--accent-2); }
th.sortable.sorted { color: var(--accent); }
th.sortable.sort-idle { color: var(--muted); }
th.sortable.sort-idle:hover { color: var(--accent-2); }

.lookup-panel {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.lookup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.lookup-row .table-search { flex: 1 1 18rem; }

.pilot-card {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  padding: 1rem 1.1rem;
}

.pilot-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.85rem;
}

.pilot-card-head h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.pilot-card-scope {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pilot-card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
}

.pilot-card-grid .label {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pilot-card-grid .value {
  display: block;
  margin-top: 0.25rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.2rem;
  font-weight: 500;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.detail-columns h4 {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.mini-list {
  list-style: none;
  display: grid;
  gap: 0.28rem;
}

.mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.84rem;
}

.mini-list li span:last-child {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent-2);
}

@media (max-width: 980px) {
  .pilot-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-columns { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .pilot-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}

tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.92rem;
}

tbody td:not(:nth-child(2)) {
  font-family: "IBM Plex Mono", monospace;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
tbody tr.clickable-row { cursor: pointer; }
tbody tr.clickable-row:hover { background: rgba(110, 182, 255, 0.08); }

.facts {
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.facts li {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 0.5rem 0;
}

footer {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer strong { color: var(--text); font-weight: 600; }
.muted { opacity: 0.85; }

@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; }
  .stat-grid,
  .chart-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .scope-controls { width: 100%; justify-content: flex-start; }
  .server-select { max-width: none; flex: 1; }
  .updated { width: 100%; }
  .hero h2 { max-width: none; }
}
