@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@400;500&display=swap');

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

:root {
  --green: #2d7a3a;
  --green-light: #3a9e4a;
  --green-dim: #1a4a22;
  --bg: #0e0e0e;
  --bg2: #161616;
  --bg3: #1e1e1e;
  --bg4: #252525;
  --border: rgba(255, 255, 255, 0.08);
  --border-green: rgba(45, 122, 58, 0.4);
  --text: #f0f0f0;
  --text2: #b8b8b8;
  --text3: #6e6e6e;
  --neg: #c04040;
}

html, body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── SITE HEADER ─────────────────────────────────────────── */

#site-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #0a2010 0%, #14351a 55%, #1e4e27 100%);
  border-bottom: 2px solid rgba(58, 158, 74, 0.35);
}

#site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg,  rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 14px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 14px);
  pointer-events: none;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-accent {
  width: 4px;
  height: 50px;
  background: var(--green-light);
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(58, 158, 74, 0.5);
}

.header-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.header-subtitle {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(58, 158, 74, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  margin-top: 6px;
}

.header-watermark {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 110px;
  font-weight: 700;
  color: rgba(58, 158, 74, 0.07);
  line-height: 1;
  letter-spacing: 0.04em;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}

/* ── NAV ─────────────────────────────────────────────────── */

#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: stretch;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar { display: none; }

.nav-btn {
  flex-shrink: 0;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text3);
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.nav-btn:hover { color: var(--text2); }

.nav-btn.active {
  color: var(--green-light);
  border-bottom-color: var(--green-light);
}

/* ── CONTENT ─────────────────────────────────────────────── */

#content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  display: none;
  padding: 28px 0;
  animation: fadeIn 0.18s ease;
}

.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sec-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green-light);
  margin-bottom: 16px;
}

/* ── TABLES ──────────────────────────────────────────────── */

.tw {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

th.p-col { width: 15%; }

/* Rank column in rank-first tables — pin narrow, right-aligned */
table.rank-first th:first-child { width: 52px; text-align: right; }

/* Player name cells — prevent clipping without graceful truncation */
table:not(.rank-first) td:first-child,
table.rank-first td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.12s;
}

th:first-child { text-align: left; }
th:hover { color: var(--text2); }
th.sorted { color: var(--green-light); }

td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  white-space: nowrap;
  font-size: 14px;
}

td:first-child {
  text-align: left;
  color: var(--text);
  font-weight: 500;
}

tr:hover td { background: var(--bg3); }

.hi  { color: var(--green-light) !important; font-weight: 600; }
.dim { color: var(--text3) !important; }
.neg { color: var(--neg) !important; }

/* ── TOOLTIP ─────────────────────────────────────────────── */

#tooltip-box {
  position: fixed;
  background: #1a2a1d;
  color: #cde8d2;
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  padding: 8px 11px;
  border-radius: 4px;
  border: 1px solid var(--border-green);
  width: 190px;
  line-height: 1.5;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

/* ── PLAYER CARDS ─────────────────────────────────────────── */

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.pc {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  transition: border-color 0.15s;
}

.pc:hover { border-color: var(--border-green); }

.pc-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.pc-rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--green-dim);
  line-height: 1;
  min-width: 40px;
}

.pc-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.pc-num {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.pc-blurb {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text2);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.pc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pc-sv {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.pc-sl {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: center;
  margin-top: 2px;
}

/* ── LINEUP ──────────────────────────────────────────────── */

.lineup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.lcard {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
}

.lc-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green-light);
  margin-bottom: 14px;
}

.lrow {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.lrow:last-child { border-bottom: none; }

.lnum {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dim);
  min-width: 26px;
  text-align: center;
  line-height: 1.3;
}

.linfo { flex: 1; }

.lname {
  font-weight: 500;
  color: var(--text);
  font-size: 14px;
}

.lnum-badge {
  color: var(--text3);
  font-size: 12px;
}

.lpos {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 1px;
}

.lreason {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
  line-height: 1.45;
}

.prow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.prow:last-child { border-bottom: none; }

.pinn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  color: var(--text3);
  min-width: 68px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pname {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

/* ── STEALING ─────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.sbox {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
}

.sbox-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.sbox-lbl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 5px;
  line-height: 1.4;
}

.sbox.g .sbox-val { color: var(--green-light); }
.sbox.r .sbox-val { color: var(--neg); }

.spacer { height: 24px; }

/* ── ADVANCED ─────────────────────────────────────────────── */

.adv-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.adv-btn {
  padding: 9px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text3);
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: -1px;
  transition: color 0.12s;
}

.adv-btn:hover { color: var(--text2); }

.adv-btn.active {
  color: var(--green-light);
  border-bottom-color: var(--green-light);
}

.adv-section { display: none; }
.adv-section.active { display: block; }

/* ── RANK-FIRST TABLES (Rank col before Player) ──────────── */

table.rank-first th:nth-child(2) { text-align: left; }

table.rank-first td:first-child {
  text-align: right;
  color: var(--text2);
  font-weight: 400;
}

table.rank-first td:first-child.hi  { color: var(--green-light) !important; }
table.rank-first td:first-child.dim { color: var(--text3) !important; }

table.rank-first td:nth-child(2) {
  text-align: left;
  color: var(--text);
  font-weight: 500;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .nav-inner { padding: 0 16px; }
  #content    { padding: 0 16px; }
}

@media (max-width: 680px) {
  .lineup-grid { grid-template-columns: 1fr; }
  .stat-grid   { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 440px) {
  .player-grid { grid-template-columns: 1fr; }
  .stat-grid   { grid-template-columns: 1fr 1fr; }
}

/* ── MOBILE TABLES ───────────────────────────────────────── */

@media (max-width: 768px) {
  /* Compact header */
  .header-inner     { padding: 12px 16px; gap: 12px; }
  .header-title     { font-size: 26px; }
  .header-accent    { height: 32px; }
  .header-watermark { display: none; }

  /* Edge-to-edge content for tables */
  #content { padding: 0 8px; }

  /* Switch to auto layout — respects inline min-widths on th,
     lets tables be wider than viewport and scroll inside .tw  */
  table {
    table-layout: auto;
    width: auto;
    min-width: 100%;
  }

  th, td { padding: 8px 10px; }

  th.p-col { width: auto; min-width: 100px; }

  table.rank-first th:first-child {
    width: 40px;
    min-width: 40px;
  }

  /* Sticky rank + player columns so names stay visible while scrolling */
  table.rank-first th:first-child,
  table.rank-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg);
  }

  table.rank-first th:nth-child(2),
  table.rank-first td:nth-child(2) {
    position: sticky;
    left: 40px;
    z-index: 2;
    background: var(--bg);
    border-right: 1px solid var(--border);
  }

  /* Keep sticky cells opaque on row hover */
  tr:hover td:first-child,
  tr:hover td:nth-child(2) {
    background: var(--bg3);
  }
}
