/* ─────────────────────────────────────────
   PlexTracker — main.css
   Navy + Orange Mineplex theme
───────────────────────────────────────── */

:root {
  --navy:       #0d1117;
  --navy2:      #161b22;
  --navy3:      #1c2230;
  --navy4:      #21293a;
  --border:     rgba(255,255,255,0.07);
  --border2:    rgba(255,255,255,0.13);
  --orange:     #f97316;
  --orange2:    #c2500a;
  --orange-dim: rgba(249,115,22,0.1);
  --blue:       #3b82f6;
  --blue-dim:   rgba(59,130,246,0.1);
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,0.1);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,0.1);
  --yellow:     #eab308;
  --text:       #e6edf3;
  --text2:      #7d8590;
  --text3:      #3d444d;
  --mono:       'JetBrains Mono', monospace;
  --radius:     8px;
  --radius-lg:  12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy2); }
::-webkit-scrollbar-thumb { background: var(--navy4); border-radius: 3px; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 54px;
  background: rgba(13,17,23,0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  flex-shrink: 0;
}
.nav-logo-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-logo-text { color: var(--text); }
.nav-logo-sub { color: var(--text2); font-weight: 400; font-size: 12px; }

.nav-links { display: flex; gap: 2px; margin-left: 8px; }
.nav-link {
  padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--text2); transition: color 0.12s, background 0.12s;
}
.nav-link:hover { color: var(--text); background: var(--navy3); }
.nav-link.active { color: var(--text); background: var(--navy3); }

.nav-search { display: flex; gap: 6px; margin-left: auto; }
.nav-search-input {
  background: var(--navy2); border: 1px solid var(--border2); border-radius: 6px;
  padding: 6px 12px; color: var(--text); font-family: inherit; font-size: 13px; outline: none;
  width: 200px; transition: border-color 0.15s, width 0.2s;
}
.nav-search-input:focus { border-color: var(--orange); width: 240px; }
.nav-search-input::placeholder { color: var(--text3); }
.nav-search-btn {
  background: var(--navy3); border: 1px solid var(--border2); color: var(--text2);
  border-radius: 6px; padding: 6px 14px; font-size: 13px; font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav-search-btn:hover { background: var(--navy4); color: var(--text); }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--orange); color: white; border: none;
  border-radius: var(--radius); padding: 9px 20px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
  transition: background 0.12s, transform 0.1s;
}
.btn-primary:hover { background: var(--orange2); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--navy3); color: var(--text); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 9px 20px;
  font-size: 13px; font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
}
.btn-secondary:hover { background: var(--navy4); border-color: var(--border2); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

.link-btn {
  background: none; border: none; color: var(--text2); font-size: 12px;
  font-weight: 500; transition: color 0.12s; padding: 0;
}
.link-btn:hover { color: var(--text); }

/* ── CHIPS ── */
.chip {
  padding: 5px 12px; border-radius: 100px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border2); background: none; color: var(--text2);
  transition: all 0.12s; font-family: inherit;
}
.chip:hover { color: var(--text); background: var(--navy3); border-color: var(--border2); }
.chip.active { background: var(--orange); border-color: var(--orange); color: white; }

.mode-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── HERO ── */
.hero {
  position: relative; overflow: hidden;
  padding: 72px 24px 60px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, rgba(249,115,22,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; }
.hero-eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--orange); margin-bottom: 16px;
}
.hero-title {
  font-size: clamp(28px, 5vw, 48px); font-weight: 900;
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 14px;
}
.hero-accent { color: var(--orange); }
.hero-sub {
  font-size: 14px; color: var(--text2); line-height: 1.65;
  max-width: 420px; margin: 0 auto 32px;
}
.hero-search {
  display: flex; gap: 8px;
  background: var(--navy2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 5px 5px 5px 16px;
  transition: border-color 0.15s;
}
.hero-search:focus-within { border-color: var(--orange); }
.hero-search-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: inherit; font-size: 14px; color: var(--text);
}
.hero-search-input::placeholder { color: var(--text3); }

/* ── HOME SECTION ── */
.home-section { padding: 40px 24px 60px; }
.home-section-inner { max-width: 860px; margin: 0 auto; }
.section-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text2); }

.player-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.player-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy2); border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 12px 5px 6px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  text-decoration: none; color: var(--text);
}
.player-chip:hover { border-color: var(--border2); background: var(--navy3); }
.player-chip img { width: 22px; height: 22px; border-radius: 4px; }
.chip-empty { font-size: 13px; color: var(--text3); }

.divider { height: 1px; background: var(--border); margin: 28px 0; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feature-card {
  background: var(--navy2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.feature-icon { font-size: 22px; margin-bottom: 10px; }
.feature-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.feature-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ── PAGE WRAP ── */
.page-wrap { max-width: 900px; margin: 0 auto; padding: 32px 24px 60px; }

.inner-page-header { margin-bottom: 24px; }
.inner-page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.inner-page-sub { font-size: 13px; color: var(--text2); }

/* ── PROFILE HEADER ── */
.profile-header {
  background: var(--navy2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px;
}
.profile-header-inner {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 20px; align-items: start; padding: 24px;
}
.profile-avatar-wrap { flex-shrink: 0; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 10px;
  border: 2px solid var(--border2); background: var(--navy3);
  image-rendering: pixelated;
}
.profile-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.profile-name { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.profile-rank {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
}
.profile-meta { font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.profile-actions { display: flex; gap: 8px; }

.profile-kpis { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; min-width: 120px; }
.kpi { text-align: right; }
.kpi-val { font-size: 20px; font-weight: 800; font-family: var(--mono); letter-spacing: -0.02em; }
.kpi-label { font-size: 10px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-val.orange { color: var(--orange); }
.kpi-val.blue   { color: var(--blue); }
.kpi-val.green  { color: var(--green); }

/* ── PROFILE BODY ── */
.profile-body {}
.game-filters { display: flex; gap: 6px; margin-bottom: 16px; }

/* ── GAME GRID ── */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.game-card {
  background: var(--navy2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color 0.15s;
}
.game-card:hover { border-color: var(--border2); }
.game-card.has-data { border-color: rgba(249,115,22,0.15); }

.game-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.game-card-icon { font-size: 20px; flex-shrink: 0; }
.game-card-name { font-size: 13px; font-weight: 700; flex: 1; }
.game-card-wins { font-size: 13px; font-family: var(--mono); font-weight: 600; color: var(--orange); }
.game-card-toggle { font-size: 11px; color: var(--text3); margin-left: 8px; transition: transform 0.2s; }
.game-card.expanded .game-card-toggle { transform: rotate(180deg); }

.game-card-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 12px 16px; gap: 8px; border-bottom: 1px solid var(--border);
}
.gs { display: flex; flex-direction: column; gap: 2px; }
.gs-label { font-size: 10px; color: var(--text2); font-weight: 500; }
.gs-val { font-size: 14px; font-family: var(--mono); font-weight: 700; }

.game-card-detail {
  display: none; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.game-card.expanded .game-card-detail { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; }
.detail-stat { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.detail-stat:last-child { border-bottom: none; }
.detail-label { font-size: 12px; color: var(--text2); }
.detail-val { font-size: 12px; font-family: var(--mono); font-weight: 600; }

.game-card-nodata { padding: 16px; font-size: 12px; color: var(--text3); }

/* ── COMPARE ── */
.compare-inputs-wrap {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 12px; align-items: center; margin-bottom: 16px;
}
.compare-input-group {}
.vs-divider {
  font-size: 11px; font-weight: 800; color: var(--text2);
  letter-spacing: 0.06em; text-align: center; padding-top: 22px;
}
.field-label { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.field-input {
  width: 100%; background: var(--navy2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 9px 12px;
  color: var(--text); font-family: inherit; font-size: 13px; outline: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--orange); }

.cmp-table {
  background: var(--navy2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.cmp-header-row {
  display: grid; grid-template-columns: 1fr 140px 1fr;
  background: var(--navy3); border-bottom: 1px solid var(--border);
}
.cmp-header-player {
  padding: 14px 18px; font-size: 15px; font-weight: 800;
  display: flex; align-items: center; gap: 10px;
}
.cmp-header-player img { width: 28px; height: 28px; border-radius: 5px; }
.cmp-header-player.right { justify-content: flex-end; }
.cmp-header-label { padding: 14px 8px; text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); display: flex; align-items: center; justify-content: center; }

.cmp-row { display: grid; grid-template-columns: 1fr 140px 1fr; border-bottom: 1px solid var(--border); }
.cmp-row:last-child { border-bottom: none; }
.cmp-cell { padding: 11px 18px; }
.cmp-cell.right { text-align: right; }
.cmp-stat-label { padding: 11px 0; text-align: center; font-size: 11px; color: var(--text2); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.cmp-val { font-size: 14px; font-family: var(--mono); font-weight: 700; }
.cmp-val.win  { color: var(--orange); }
.cmp-val.lose { color: var(--text3); }

/* ── LEADERBOARD ── */
.lb-table { background: var(--navy2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.lb-row { display: grid; grid-template-columns: 48px 1fr 100px 100px 80px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.lb-row:last-child { border-bottom: none; }
.lb-row.lb-head { cursor: default; background: var(--navy3); }
.lb-row:not(.lb-head):hover { background: var(--navy3); }
.lb-rank { font-size: 12px; font-family: var(--mono); font-weight: 700; color: var(--text2); }
.lb-rank.gold   { color: #f59e0b; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #b45309; }
.lb-player { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.lb-face { width: 26px; height: 26px; border-radius: 4px; background: var(--navy3); overflow: hidden; flex-shrink: 0; }
.lb-face img { width: 100%; height: 100%; }
.lb-pname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-stat { font-size: 12px; font-family: var(--mono); color: var(--text2); text-align: right; }
.lb-stat.hi { color: var(--text); font-weight: 700; }
.lb-hdr { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text3); text-align: right; }

/* ── STATES ── */
.state-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--text2); font-size: 13px; }
.state-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); border-radius: var(--radius); padding: 12px 16px; color: #f87171; font-size: 13px; }
.state-empty { text-align: center; padding: 56px; color: var(--text2); font-size: 13px; }
.state-empty-icon { font-size: 30px; margin-bottom: 10px; opacity: 0.25; }

.spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid var(--border2); border-top-color: var(--orange);
  border-radius: 50%; animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RANK BADGES ── */
.rank-eternal   { background: #7c5900; color: #fde68a; }
.rank-immortal  { background: #4a0000; color: #fca5a5; }
.rank-legend    { background: #2e1a4a; color: #c4b5fd; }
.rank-titan     { background: #431407; color: #fdba74; }
.rank-ultra     { background: #1e3256; color: #93c5fd; }
.rank-hero      { background: #14532d; color: #86efac; }
.rank-default   { background: var(--navy3); color: var(--text2); }

/* ── FOOTER ── */
.footer { border-top: 1px solid var(--border); padding: 24px; margin-top: auto; }
.footer-inner { max-width: 860px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.footer-logo { display: flex; align-items: center; gap: 8px; }
.footer-note { font-size: 12px; color: var(--text3); }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .nav-logo-sub { display: none; }
  .nav-search { display: none; }
  .nav-links { gap: 0; }
  .nav-link { padding: 5px 8px; font-size: 12px; }
  .hero-title { font-size: 28px; }
  .feature-grid { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: 1fr; }
  .profile-header-inner { grid-template-columns: auto 1fr; }
  .profile-kpis { display: none; }
  .compare-inputs-wrap { grid-template-columns: 1fr; }
  .vs-divider { padding-top: 0; }
  .lb-row { grid-template-columns: 40px 1fr 80px; }
  .lb-stat:nth-child(4), .lb-stat:nth-child(5), .lb-hdr:nth-child(4), .lb-hdr:nth-child(5) { display: none; }
  .cmp-header-row, .cmp-row { grid-template-columns: 1fr 100px 1fr; }
}
