/* ============================================================
   Dopers 420 Stats — design system
   Industrial dark theme. No framework, no runtime compiler.
   Type: Barlow Condensed (display) / Barlow (body) / JetBrains Mono (data)
   ============================================================ */

:root {
  --bg: #0a0e0b;
  --panel: #101511;
  --panel-2: #151c16;
  --panel-hover: #182019;
  --line: #1f2921;
  --line-2: #2c3a2f;
  --text: #e8efe9;
  --text-dim: #9db3a3;
  --text-faint: #61756a;
  --green: #2fd566;
  --green-strong: #22c55e;
  --green-dim: rgba(47, 213, 102, 0.12);
  --green-line: rgba(47, 213, 102, 0.28);
  --rust: #e1634a;
  --rust-dim: rgba(225, 99, 74, 0.12);
  --gold: #eab308;
  --silver: #b8c4bd;
  --bronze: #c9803f;
  --blue: #4aa8e0;
  --amber: #e0a83c;
  --purple: #b07fe0;
  --cyan: #43c6c0;
  --lime: #a3d94c;
  --pink: #dd7bb1;
  --steam: #66c0f4;
  --radius: 10px;
  --radius-sm: 6px;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-color: #2c3a2f var(--bg); }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(47, 213, 102, 0.055), transparent 70%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

::selection { background: rgba(47, 213, 102, 0.3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #26332a; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #33453a; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

.hidden { display: none !important; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 11, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

/* signature: industrial hazard tape under the header */
.hazard {
  height: 4px;
  background: repeating-linear-gradient(
    -55deg,
    var(--green-strong) 0 14px,
    transparent 14px 28px
  );
  opacity: 0.55;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.brand-name .b-dopers { color: var(--green); text-shadow: 0 0 24px rgba(47, 213, 102, 0.45); }
.brand-name .b-420 { color: var(--text-faint); }
.brand-sub {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-left: 1px solid var(--line-2);
  padding-left: 10px;
}

.header-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* search */
.search-box { position: relative; min-width: 0; }
.search-input {
  font: 14px var(--font-body);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px 9px 34px;
  width: 250px;
  max-width: 44vw;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-faint); pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  z-index: 60;
}
.search-result-item {
  display: block; padding: 9px 12px; font-size: 14px; color: var(--text);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.active { background: var(--green-dim); color: var(--green); }
.search-empty { padding: 10px 12px; font-size: 13px; color: var(--text-faint); }

/* auth */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn:hover { color: var(--text); border-color: var(--text-faint); }
.btn-steam { background: #17222e; border-color: rgba(102, 192, 244, 0.35); color: #c7d5e0; }
.btn-steam:hover { background: #1d2f42; color: #fff; border-color: rgba(102, 192, 244, 0.6); }
.btn-steam svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-green { border-color: var(--green-line); color: var(--green); }
.btn-green:hover { background: var(--green-dim); color: var(--green); border-color: var(--green); }

/* ---------- layout ---------- */

.main { max-width: 1120px; width: 100%; margin: 0 auto; padding: 40px 20px 64px; flex: 1; }

.view-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 6vw, 56px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  text-align: center;
}
.view-sub {
  text-align: center;
  color: var(--text-faint);
  font-size: 15px;
  margin: 10px 0 44px;
  letter-spacing: 0.04em;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--green);
  text-align: center;
  margin-bottom: 6px;
}

/* ---------- server plates (home) ---------- */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.server-plate {
  position: relative;
  display: block;
  text-align: left;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.server-plate::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--plate-color, var(--green));
  opacity: 0.85;
}
.server-plate:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.plate-region {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.plate-city {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.18s;
}
.server-plate:hover .plate-city { color: var(--plate-color, var(--green)); }
.plate-meta {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}
.plate-arrow {
  position: absolute; right: 20px; bottom: 18px;
  color: var(--text-faint);
  transition: transform 0.18s, color 0.18s;
}
.server-plate:hover .plate-arrow { transform: translateX(4px); color: var(--plate-color, var(--green)); }

/* ---------- leaderboard ---------- */

.lb-header {
  display: flex; flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-faint);
  margin-bottom: 8px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text-dim); }
.back-link svg { width: 14px; height: 14px; }

.lb-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1;
  text-transform: uppercase;
}
.lb-title .lb-accent { color: var(--green); }

.seg {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  border-right: 1px solid var(--line);
  transition: background 0.15s, color 0.15s;
}
.seg button:last-child { border-right: none; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--green-dim); color: var(--green); }

.sort-row {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 18px;
  scrollbar-width: none;
}
.sort-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--text-dim);
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip.on { background: var(--green-dim); border-color: var(--green); color: var(--green); }

.panel {
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
table.data thead th {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: right;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
table.data thead th.th-rank { text-align: left; width: 56px; }
table.data thead th.th-player { text-align: left; }
table.data tbody td {
  padding: 12px 16px;
  font-size: 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.row-click { cursor: pointer; transition: background 0.12s; }
table.data tbody tr.row-click:hover { background: rgba(255, 255, 255, 0.025); }

.td-rank { text-align: left !important; font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.td-player { text-align: left !important; font-weight: 600; color: var(--text); max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.td-hot { font-weight: 700; color: var(--green); }
.td-hot.is-deaths { color: var(--rust); }
.td-hot.is-gold { color: var(--gold); }
.td-dim { color: var(--text-dim); }

/* podium rows */
tr.podium td { background: rgba(255, 255, 255, 0.012); }
tr.podium .td-rank { font-weight: 700; font-size: 14px; }
tr.podium-1 { box-shadow: inset 3px 0 0 var(--gold); }
tr.podium-1 .td-rank { color: var(--gold); }
tr.podium-2 { box-shadow: inset 3px 0 0 var(--silver); }
tr.podium-2 .td-rank { color: var(--silver); }
tr.podium-3 { box-shadow: inset 3px 0 0 var(--bronze); }
tr.podium-3 .td-rank { color: var(--bronze); }

.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 15px;
}
.error-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--rust);
  font-size: 15px;
}
.error-state .btn { margin-top: 14px; }

/* skeleton */
.skeleton {
  display: inline-block;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #161d17 25%, #1d2620 50%, #161d17 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- player profile ---------- */

.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.avatar-tile {
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 34px; font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
}
.profile-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1;
  overflow-wrap: anywhere;
}
.profile-meta {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.notice {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-dim);
}
.notice strong { color: var(--green); font-weight: 600; }
.notice a { color: var(--green); }
.notice a:hover { text-decoration: underline; }

.server-card { margin-bottom: 24px; padding: 24px; }
.server-card-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.server-card-title .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--card-color, var(--green)); }

.pill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-pill {
  background: rgba(47, 213, 102, 0.05);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
.stat-pill .pl {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.stat-pill .pv {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sec-h {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 22px 0 10px;
}
.sec-note { font-size: 12px; color: var(--text-faint); margin: -6px 0 10px; }

.private-rule {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--green-line);
}
.private-rule h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--green);
}
.private-rule span { font-size: 11px; color: var(--text-faint); font-style: italic; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 8px; }
.kv {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
}
.kv .k { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* horizontal stat bars */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 7px; }
.bar-label { width: 140px; flex-shrink: 0; font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 22px; background: rgba(255, 255, 255, 0.04); border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex; align-items: center;
  padding: 0 8px;
  min-width: fit-content;
  font-size: 11px; font-weight: 700; color: #06130a;
  white-space: nowrap;
  transition: width 0.5s ease-out;
}
.bar-side { width: 70px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.mini-table-wrap { overflow-x: auto; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
table.mini th {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
  text-align: right; padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
}
table.mini th:first-child { text-align: left; }
table.mini td {
  padding: 7px 10px; text-align: right;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.mini td:first-child { text-align: left; color: var(--text); }
table.mini tr:last-child td { border-bottom: none; }
.acc-good { color: var(--green) !important; font-weight: 600; }
.acc-mid { color: var(--gold) !important; }
.hs-hot { color: var(--amber) !important; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.site-footer .f-brand { font-family: var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }

/* ---------- motion / a11y ---------- */

.fade-in { animation: fadeIn 0.28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .header-inner { padding: 10px 14px; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .brand-name { font-size: 24px; }
  .search-input { width: 160px; }
  .main { padding: 26px 14px 48px; }
  .view-sub { margin-bottom: 28px; }
  .plate-city { font-size: 32px; }
  .bar-label { width: 96px; }
  .bar-side { width: 52px; }
  .server-card { padding: 16px; }
}
