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

:root {
  --accent: #00cc88;
  --accent-dark: #009966;
  --nc-blue: #4a9eff;
  --nc-red: #ff4a4a;
  --nc-green: #4aff7a;
  --nc-gold: #ffd700;
  --nc-purple: #c084fc;
  --nc-cyan: #22d3ee;
  --nc-orange: #fb923c;
  --nc-pink: #f472b6;
  --nc-white: #ffffff;
}

body {
  background: #0a0f0d;
  color: #e0e0e0;
  font-family: 'Segoe UI', sans-serif;
  min-height: 100vh;
}

header {
  background: #111a16;
  padding: 20px 32px;
  border-bottom: 2px solid #1a2e24;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 16px; }

header h1 { font-size: 1.8rem; color: #fff; letter-spacing: 1px; }

.site-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.site-link:hover { opacity: 1; }

.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

header input {
  background: #1a2e24;
  border: 1px solid #2a3e34;
  color: #e0e0e0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  width: 240px;
}
header input:focus { border-color: var(--accent); }

#searchBtn {
  background: #1a2e24;
  border: 1px solid #2a3e34;
  color: #e0e0e0;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
#searchBtn:hover { background: #2a3e34; }

main { padding: 32px; max-width: 1000px; margin: 0 auto; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 16px 32px 0;
  max-width: 1000px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.tab {
  background: #111a16;
  border: 1px solid #1a2e24;
  color: #888;
  padding: 8px 18px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
  border-bottom: none;
}
.tab:hover { color: #fff; background: #1a2e24; }
.tab.active { background: #111a16; color: #fff; border-color: #2a3e34; border-bottom: 2px solid var(--accent); }

.tab-content { display: block; }
.tab-content.hidden { display: none; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #111a16;
  border-radius: 10px;
  overflow: hidden;
}

thead tr {
  background: #1a2e24;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: #888;
}

th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid #1a2e24; }
tbody tr:last-child td { border-bottom: none; }

.player-row { cursor: pointer; transition: background 0.15s; }
.player-row:hover { background: #162218; }

.player-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-cell img { width: 28px; height: 28px; border-radius: 4px; image-rendering: pixelated; }
.player-name { font-weight: 500; }

.points { color: #fff; font-weight: bold; }
.gm-count { color: #888; font-size: 0.85rem; }
.tier-pts-cell { color: var(--accent); font-weight: bold; font-size: 0.9rem; }

.rank-num { color: #555; font-weight: bold; }
.rank-num.top1 { color: #ffd700; }
.rank-num.top2 { color: #c0c0c0; }
.rank-num.top3 { color: #cd7f32; }

/* ── Rank badges ─────────────────────────────────────────── */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.85rem;
  color: #fff;
}

.rank-LT5, .rank-LT4, .rank-LT3 { background: #555; }
.rank-LT2, .rank-LT1             { background: #00aa00; }
.rank-HT5, .rank-HT4, .rank-HT3 { background: #0055ff; }
.rank-HT2                        { background: #ff6600; }
.rank-HT1                        { background: #cc0000; }
.rank-unranked                   { background: #1a2e24; color: #555; }

.tier-prefix { font-size: 0.7rem; font-weight: 900; letter-spacing: 0.5px; opacity: 0.85; }
.tier-prefix-p { color: #ffe066; }
.tier-prefix-r { color: #aaaaaa; }

.region-badge {
  display: inline-block;
  background: #1a2e24;
  border: 1px solid #2a4e34;
  color: #00cc88;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.loading { text-align: center; color: #555; padding: 40px !important; }

/* ── Modal ───────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-box {
  background: #111a16;
  border: 1px solid #1a2e24;
  border-radius: 12px;
  padding: 28px;
  width: 500px;
  max-width: 95vw;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none; border: none;
  color: #888; font-size: 1.1rem; cursor: pointer;
}
.modal-close:hover { color: #fff; }

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.modal-header img { width: 64px; height: 64px; border-radius: 8px; image-rendering: pixelated; }
.modal-header h2 { font-size: 1.4rem; color: #fff; }
.modal-header > div > span { color: var(--accent); font-size: 0.9rem; font-weight: bold; }

.modal-regions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

.modal-tiers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tier-card {
  background: #1a2e24;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tier-card.unranked { opacity: 0.35; }
.gm-label { font-size: 0.85rem; color: #aaa; min-width: 80px; }
.tier-pts { font-size: 0.75rem; color: var(--accent); font-weight: bold; }
.unranked-text { font-size: 0.8rem; color: #555; }
