/* ═══════════════════════════════════════════════
   NewTiers — MCTiers-inspired Design System
   ═══════════════════════════════════════════════ */

:root {
  /* Colors */
  --bg:        #0c0c0e;
  --bg-2:      #111114;
  --bg-card:   #141418;
  --bg-card2:  #18181d;
  --border:    #222228;
  --border-2:  #2a2a33;
  --border-hl: #3a3a48;

  /* Text */
  --text:      #f0f0f4;
  --text-2:    #8a8a9a;
  --text-3:    #46464e;
  --text-4:    #2e2e36;

  /* Accent — Red */
  --red:       #e03535;
  --red-2:     #ff4444;
  --red-glow:  rgba(224, 53, 53, 0.18);
  --red-tint:  rgba(224, 53, 53, 0.08);

  /* Rank metals */
  --gold:       #d4a73b;
  --gold-bg:    rgba(212, 167, 59, 0.08);
  --gold-tint:  rgba(212, 167, 59, 0.04);
  --silver:     #8fa4b8;
  --silver-bg:  rgba(143, 164, 184, 0.07);
  --bronze:     #b07040;
  --bronze-bg:  rgba(176, 112, 64, 0.07);

  /* Typography */
  --font:  'Inter', system-ui, sans-serif;
  --mono:  'JetBrains Mono', monospace;

  /* Layout */
  --navbar-h: 4.25rem;
  --max-w:    1280px;
  --radius:   12px;
  --radius-sm: 7px;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: var(--font); }

/* ── Background grid ────────────────────────────── */
#app {
  position: relative;
  min-height: 100vh;
}
#app::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
#app::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 420px;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(224,53,53,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── FLOATING NAVBAR ─────────────────────────────── */
#navbar {
  position: fixed;
  top: .85rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: var(--max-w);
  z-index: 200;
  background: rgba(20, 20, 24, 0.85);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  transition: box-shadow 0.2s;
}
#navbar:hover {
  box-shadow:
    0 8px 40px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.05) inset;
}

#nav-inner {
  display: flex;
  align-items: center;
  height: var(--navbar-h);
  padding: 0 1.25rem;
  gap: .75rem;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-right: .5rem;
  flex-shrink: 0;
}
.nav-logo img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
}
.nav-logo span {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: .15rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .42rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-link svg { opacity: 0.6; transition: opacity .15s; flex-shrink: 0; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
  color: var(--red-2);
  background: var(--red-tint);
}
.nav-link.active svg { opacity: 1; }

/* Search */
.nav-search-wrap {
  margin-left: auto;
}
.nav-search-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: .4rem .85rem;
  width: 220px;
  transition: border-color .15s, background .15s, width .25s ease, box-shadow .15s;
}
.nav-search-box:focus-within {
  border-color: var(--border-hl);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(224,53,53,0.1);
  width: 260px;
}
.nav-search-box svg { color: var(--text-3); flex-shrink: 0; }
.nav-search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: .85rem;
  width: 100%;
}
.nav-search-box input::placeholder { color: var(--text-3); }
.nav-search-box kbd {
  background: var(--border);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: .65rem;
  padding: .1rem .4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  padding: .35rem;
  border-radius: 6px;
  margin-left: .5rem;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }

/* ── VIEWS ───────────────────────────────────────── */
.view { position: relative; z-index: 1; }
.view.hidden { display: none !important; }

/* ── PAGE CONTAINER ──────────────────────────────── */
.page-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

/* ── HERO SECTION ────────────────────────────────── */
.hero-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding: 2.5rem 0 1.5rem;
}
.hero-text h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: .6rem;
}
.gradient-text {
  background: linear-gradient(135deg, #e03535, #ff6666);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-text p {
  font-size: .95rem;
  color: var(--text-2);
  max-width: 340px;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  flex-shrink: 0;
}
.hero-stat {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  min-width: 90px;
}
.hero-stat-num {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--red-2);
  line-height: 1;
  margin-bottom: .3rem;
}
.hero-stat-lbl {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-3);
}

/* ── CARD ────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 24px rgba(0,0,0,0.3);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.4rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .15rem;
}
.card-sub {
  font-size: .8rem;
  color: var(--text-2);
}

/* ── LEADERBOARD ─────────────────────────────────── */
.lb-thead {
  display: grid;
  grid-template-columns: 56px 1fr 120px 100px;
  padding: .55rem 1.25rem;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
}
.lbh-pts { text-align: right; }

/* lb rows */
.lb-row {
  display: grid;
  grid-template-columns: 56px 1fr 120px 100px;
  align-items: center;
  padding: .65rem 1.25rem;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(255,255,255,.025); }

/* rank numbers */
.tc-rank {
  font-family: var(--mono);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-3);
}
.r-gold   { background: var(--gold-bg); }
.r-silver { background: var(--silver-bg); }
.r-bronze { background: var(--bronze-bg); }
.r-gold   .tc-rank { color: var(--gold); }
.r-silver .tc-rank { color: var(--silver); }
.r-bronze .tc-rank { color: var(--bronze); }

/* player cell */
.tc-player {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}
.player-skin {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  image-rendering: pixelated;
  background: var(--bg-card2);
  border: 1px solid var(--border-2);
  flex-shrink: 0;
}
.player-name-wrap { min-width: 0; }
.player-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-sub {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--text-3);
  margin-top: 1px;
}

/* tier tag */
.tc-tier { display: flex; align-items: center; }
.tier-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .5px;
  padding: .18rem .55rem;
  border-radius: 5px;
  border: 1px solid currentColor;
}

/* points */
.tc-pts {
  font-family: var(--mono);
  font-size: .875rem;
  font-weight: 700;
  color: var(--red-2);
  text-align: right;
}
.tc-pts small {
  font-size: .62rem;
  font-weight: 500;
  color: var(--text-3);
}

/* ── STATE ROW ───────────────────────────────────── */
.state-row {
  padding: 3.5rem;
  text-align: center;
  color: var(--text-2);
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
}

/* ── SPINNER ──────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BACK BUTTON ─────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 500;
  padding: .45rem 1rem;
  margin-bottom: 1.5rem;
  transition: color .15s, border-color .15s, background .15s;
}
.back-btn:hover {
  color: var(--text);
  border-color: var(--border-hl);
  background: var(--bg-card2);
}

/* ── PLAYER PROFILE ──────────────────────────────── */
.profile-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 32px rgba(0,0,0,0.3);
}
.profile-skin-lg {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  image-rendering: pixelated;
  background: var(--bg-card2);
  border: 1px solid var(--border-2);
  flex-shrink: 0;
}
.profile-identity { flex: 1; min-width: 0; }
.profile-ign {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: .3rem;
}
.profile-did {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--text-3);
}
.profile-pts-block {
  text-align: right;
  flex-shrink: 0;
}
.profile-pts-num {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--red-2);
  line-height: 1;
}
.profile-pts-lbl {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: .25rem;
}

/* Retired notice */
.retired-bar {
  background: rgba(212, 167, 59, 0.06);
  border: 1px solid rgba(212, 167, 59, 0.2);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .85rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: .875rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.retired-bar strong { color: var(--gold); }

/* Section label */
.section-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 1.5rem 0 .75rem;
}
.section-head-text {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Tiers table */
.tiers-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tiers-thead {
  display: grid;
  grid-template-columns: 1fr 100px 80px 140px;
  padding: .5rem 1.1rem;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
}
.tiers-row {
  display: grid;
  grid-template-columns: 1fr 100px 80px 140px;
  align-items: center;
  padding: .7rem 1.1rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.tiers-row:last-child { border-bottom: none; }
.tiers-row:hover { background: rgba(255,255,255,.02); }
.tiers-server { font-weight: 600; color: var(--text); font-size: .875rem; }
.tiers-tier {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .8rem;
}
.tiers-pts { font-family: var(--mono); color: var(--text-2); font-size: .8rem; }
.tiers-date { font-family: var(--mono); font-size: .68rem; color: var(--text-3); }

/* Dynamic tier text colors */
.t-HT1{color:#ff2244} .t-LT1{color:#ff6677}
.t-HT2{color:#ff8800} .t-LT2{color:#ffaa44}
.t-HT3{color:#f5d800} .t-LT3{color:#f5e87a}
.t-HT4{color:#22ccff} .t-LT4{color:#77ddff}
.t-HT5{color:#888}    .t-LT5{color:#aaa}

/* ── DISCORD GRID ────────────────────────────────── */
.discord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: .85rem;
}
.discord-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.discord-card:hover {
  border-color: var(--border-hl);
  background: var(--bg-card2);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}
.dc-icon {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: var(--red-tint);
  border: 1px solid var(--red-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--red-2);
  flex-shrink: 0;
  letter-spacing: .5px;
}
.dc-info { flex: 1; min-width: 0; }
.dc-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  margin-bottom: .15rem;
}
.dc-inv {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--text-3);
}
.dc-arrow {
  color: var(--text-3);
  flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.discord-card:hover .dc-arrow {
  color: var(--text-2);
  transform: translate(2px, -2px);
}

/* ── 404 ─────────────────────────────────────────── */
.notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  gap: .5rem;
  text-align: center;
}
.notfound-num {
  font-family: var(--mono);
  font-size: 6rem;
  font-weight: 900;
  color: var(--red);
  line-height: 1;
  letter-spacing: -4px;
  text-shadow: 0 0 80px rgba(224,53,53,0.4);
}
.notfound-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-top: .25rem;
}
.notfound p { color: var(--text-2); font-size: .9rem; }

/* ── FOOTER ──────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 1.5rem 1.25rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: .75rem;
  color: var(--text-3);
}

/* ── UTILITY ─────────────────────────────────────── */
.hidden { display: none !important; }

/* ── MOBILE ──────────────────────────────────────── */
@media (max-width: 768px) {
  #navbar { top: .5rem; width: calc(100% - 1rem); }
  #nav-inner { padding: 0 .85rem; gap: .4rem; }

  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }

  .nav-logo span { font-size: .9rem; }

  .nav-search-box { width: 160px; }
  .nav-search-box:focus-within { width: 190px; }
  .nav-search-box kbd { display: none; }

  .hero-section { flex-direction: column; align-items: flex-start; gap: 1.25rem; padding-top: 1.5rem; }
  .hero-stats { width: 100%; justify-content: flex-start; }

  .lb-thead { grid-template-columns: 44px 1fr 90px; }
  .lbh-pts { display: none; }
  .lb-row { grid-template-columns: 44px 1fr 90px; }
  .tc-pts { display: none; }

  .tiers-thead, .tiers-row { grid-template-columns: 1fr 80px 140px; }
  .tiers-pts { display: none; }

  .discord-grid { grid-template-columns: 1fr; }

  .footer-inner { flex-direction: column; text-align: center; }

  .profile-banner { flex-wrap: wrap; }
  .profile-pts-block { text-align: left; }
}

@media (max-width: 520px) {
  .lb-thead { grid-template-columns: 36px 1fr 90px; }
  .lb-row { grid-template-columns: 36px 1fr 90px; }
  .page-container { padding: 1.5rem .85rem 4rem; }
  .tiers-thead, .tiers-row { grid-template-columns: 1fr 80px; }
  .tiers-date { display: none; }
}