:root {
  --bg:      #0a0c0f;
  --surface: #13171e;
  --border:  #1e2530;
  --accent:  #c8a84b;
  --accent2: #3b82f6;
  --text:    #e8eaf0;
  --muted:   #5a6478;
  --danger:  #ef4444;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.logo span { color: var(--text); }

#user-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.badge-name { color: var(--text); font-weight: 600; }

#logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.2s, color 0.2s;
}
#logout-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Login ── */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 2rem;
  text-align: center;
}

.field-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5rem;
  letter-spacing: 0.06em;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.field-label span { color: var(--accent); }

.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
  max-width: 340px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}
.login-box label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.login-box input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}
.login-box input:focus { border-color: var(--accent); }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0a0c0f;
  border: none;
  padding: 0.8rem;
  border-radius: 6px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.error-msg {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.75rem;
  display: none;
}

/* ── App ── */
#app-screen {
  display: none;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ── Liga Cards ── */
.leagues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.league-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.league-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.league-card.active { border-color: var(--accent); background: #1a1810; }

.league-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.league-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.6rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.4rem;
}
.badge-sf      { background: #1e3a5f; color: var(--accent2); }
.badge-dynasty { background: #2d1f00; color: var(--accent); }

/* ── Roster ── */
#roster-section { display: none; }

.roster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.position-filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.pos-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.25rem 0.7rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
}
.pos-btn:hover, .pos-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #1a1810;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--accent);
  line-height: 1;
}
.stat-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ── Table ── */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}
tbody tr { border-bottom: 1px solid #0f1318; transition: background 0.1s; }
tbody tr:hover { background: var(--surface); }
td { padding: 0.65rem 0.75rem; }

.pos-tag {
  display: inline-block;
  width: 34px;
  text-align: center;
  padding: 0.15rem 0;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.pos-QB  { background: #1e3a5f; color: #60a5fa; }
.pos-RB  { background: #14401f; color: #4ade80; }
.pos-WR  { background: #3b1f00; color: #fb923c; }
.pos-TE  { background: #2d1f3d; color: #c084fc; }
.pos-K   { background: #1a1a2e; color: #818cf8; }
.pos-DEF { background: #1a1a1a; color: #94a3b8; }
.pos-DL, .pos-LB, .pos-DB { background: #2d1f1f; color: #f87171; }

.player-name { font-weight: 500; }
.player-age  { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.player-team { color: var(--muted); font-size: 0.82rem; font-family: 'JetBrains Mono', monospace; }
.player-idp  { color: var(--muted); font-size: 0.78rem; }

/* ── Loading ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--muted); font-size: 0.9rem; vertical-align: middle; }
