/* Lightspeed Mace Tiers — rankings site styles. Dark, flat, one accent. */

:root {
  --bg: #0b0c10;
  --surface: #111317;
  --surface-2: #171a1f;
  --surface-3: #1e2229;
  --border: #22262d;
  --border-2: #2d323b;
  --text: #e9ebef;
  --text-2: #aeb4bf;
  --muted: #7a8291;
  --accent: #e8b84a;
  --accent-hover: #f2c75f;
  --accent-ink: #15110a;
  --danger: #e36c67;

  --t1: #e8b84a;
  --t2: #c2c9d3;
  --t3: #c98c5f;
  --t4: #d4605e;
  --t5: #8b93a2;

  --r-na: #f0a08c;
  --r-eu: #8db3ff;
  --r-as: #e39bd6;
  --r-au: #f6cd84;
  --r-sa: #d6c66d;
  --r-me: #8adcb0;
  --r-af: #c6b7ff;

  --radius: 8px;
  --container: 1080px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { flex: none; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name span { color: var(--muted); font-weight: 500; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  color: var(--text-2);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.12s, background-color 0.12s;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[hidden] { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-3); border-color: var(--muted); }
.site-nav .btn-primary, .btn-primary {
  margin-left: 6px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.site-nav .btn-primary:hover, .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }

/* ------------------------------------------------------------- page head */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 32px;
  flex-wrap: wrap;
  padding: 44px 0 28px;
}
.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.lede { margin: 0; color: var(--text-2); font-size: 15px; max-width: 56ch; }

.stats {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stats li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 112px;
  padding: 10px 18px;
  border-right: 1px solid var(--border);
}
.stats li:last-child { border-right: 0; }
.stats strong {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats span { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* --------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs { display: flex; gap: 24px; }
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 12px 2px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.filters { display: flex; gap: 8px; padding-bottom: 10px; }
.search-wrap { position: relative; display: block; min-width: 0; }
.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}
.search-wrap input, .filters select {
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.search-wrap input { width: 230px; padding: 0 10px 0 32px; }
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input::-webkit-search-cancel-button { -webkit-appearance: none; }
.filters select {
  flex: none;
  max-width: 100%;
  padding: 0 30px 0 10px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5l3 3 3-3' fill='none' stroke='%237a8291' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.search-wrap input:focus, .filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
}
.notice.error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }

/* -------------------------------------------------------------- rankings */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.rankings { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rankings th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.rankings td {
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.rankings tbody tr:last-child td { border-bottom: 0; }
.rankings tbody tr { cursor: pointer; transition: background-color 0.12s; }
.rankings tbody tr:hover { background: var(--surface-2); }

.c-rank { width: 64px; }
.c-region { width: 130px; }
.c-tier { width: 110px; }
.c-points { width: 90px; text-align: right; }
td.c-points { font-weight: 500; font-variant-numeric: tabular-nums; }

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rank.m1 { color: var(--t1); background: color-mix(in srgb, var(--t1) 16%, transparent); }
.rank.m2 { color: var(--t2); background: color-mix(in srgb, var(--t2) 14%, transparent); }
.rank.m3 { color: var(--t3); background: color-mix(in srgb, var(--t3) 16%, transparent); }

.player { display: flex; align-items: center; gap: 12px; font-weight: 500; min-width: 0; }
.player .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--surface-3);
  image-rendering: pixelated;
  object-fit: cover;
}
.avatar.fallback, .skin.fallback { image-rendering: auto; }

.region {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.region::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rc, var(--muted));
}
.region.NA { --rc: var(--r-na); }
.region.EU { --rc: var(--r-eu); }
.region.AS { --rc: var(--r-as); }
.region.AU { --rc: var(--r-au); }
.region.SA { --rc: var(--r-sa); }
.region.ME { --rc: var(--r-me); }
.region.AF { --rc: var(--r-af); }
.region.none { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.region.none::before { display: none; }

.tier {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--tc, var(--text-2));
  background: color-mix(in srgb, var(--tc, var(--muted)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc, var(--muted)) 40%, transparent);
}
.tier.low {
  background: transparent;
  border-color: color-mix(in srgb, var(--tc, var(--muted)) 32%, transparent);
  color: color-mix(in srgb, var(--tc, var(--muted)) 88%, var(--text));
}

.empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------- tier list */

.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.board[hidden] { display: none; }
.tier-col {
  border: 1px solid var(--border);
  border-top: 3px solid var(--tc, var(--muted));
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.tier-col header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.tier-col h3 { margin: 0; font-size: 14px; font-weight: 600; }
.tier-col header small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.group { padding: 6px 0 8px; }
.group + .group { border-top: 1px solid var(--border); }
.group-label {
  display: flex;
  justify-content: space-between;
  padding: 4px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-label b { font-weight: 600; color: var(--tc, var(--text-2)); }
.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s;
}
.entry:hover { background: var(--surface-2); }
.entry .avatar { width: 22px; height: 22px; border-radius: 4px; }
.entry .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .rg { margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.entry-empty { padding: 4px 14px 6px; font-size: 12px; color: var(--muted); }

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

.site-footer { margin-top: 48px; border-top: 1px solid var(--border); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 10px 24px;
  flex-wrap: wrap;
  padding: 22px 20px 40px;
  color: var(--muted);
  font-size: 12.5px;
}
.legend { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- player card */

.player-dialog {
  width: min(540px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.player-dialog::backdrop { background: rgba(4, 5, 8, 0.72); }
.player-card { position: relative; display: grid; grid-template-columns: 150px 1fr; margin: 0; outline: none; }
.skin-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.skin { width: 100px; height: auto; image-rendering: pixelated; }
.player-body { padding: 26px 26px 24px; min-width: 0; }
.player-body h2 { margin: 0 0 10px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.badges { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  margin: 0 0 20px;
  font-size: 13px;
}
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  word-break: break-all;
}
.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.close:hover { background: var(--surface-3); color: var(--text); }

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

@media (max-width: 1000px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .page-head { padding-top: 32px; }
  h1 { font-size: 26px; }
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .stats li { min-width: 0; padding: 10px 14px; border-right: 0; }
  .stats li:nth-child(odd) { border-right: 1px solid var(--border); }
  .stats li:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
  .stats span { white-space: normal; }
  .filters { width: 100%; }
  .search-wrap { flex: 1; }
  .search-wrap input { width: 100%; }
  .c-region, td.c-region { display: none; }
  .c-rank { width: 48px; }
  .c-tier { width: 76px; }
  .c-points { width: 64px; }
  .rankings th, .rankings td { padding-left: 12px; padding-right: 12px; }
  .rank { min-width: 26px; height: 26px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-card { grid-template-columns: 1fr; }
  .skin-wrap { border-right: 0; border-bottom: 1px solid var(--border); padding: 18px; }
  .skin { width: 72px; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 480px) {
  .board { grid-template-columns: 1fr; }
  .brand-name span { display: none; }
  .site-nav { gap: 2px; }
  .site-nav a { padding: 6px 8px; font-size: 13px; }
  .site-nav .btn-primary { margin-left: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
