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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ─── NAME SCREEN ──────────────────────────────────────────────────────────── */
.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(160deg, #0d1117 0%, #1a2a1a 100%);
}

.name-modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.wc-logo { font-size: 3rem; margin-bottom: 0.5rem; }

.name-modal h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f5c518;
  margin-bottom: 0.25rem;
}

.name-modal .subtitle {
  color: #8b949e;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.name-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.name-btn {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.name-btn:hover { background: #1f6feb; border-color: #388bfd; }

.divider {
  color: #8b949e;
  font-size: 0.85rem;
  margin: 1rem 0;
  position: relative;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #30363d;
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

.add-name-row {
  display: flex;
  gap: 0.5rem;
}

.add-name-row input {
  flex: 1;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  outline: none;
}
.add-name-row input:focus { border-color: #388bfd; }

.add-name-row button {
  background: #238636;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s;
}
.add-name-row button:hover { background: #2ea043; }

.loading-names, .empty-names {
  color: #8b949e;
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* ─── APP HEADER ───────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f5c518;
}

.switch-btn {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 20px;
  color: #e6edf3;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.switch-btn:hover { background: #30363d; }

/* ─── TAB NAV ──────────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #8b949e;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: #f5c518; border-bottom-color: #f5c518; }
.tab-btn:hover:not(.active) { color: #e6edf3; }

/* ─── MAIN CONTENT ─────────────────────────────────────────────────────────── */
main { padding-bottom: 4rem; }

/* ─── DAY SECTIONS ─────────────────────────────────────────────────────────── */
.day-section { margin-bottom: 0.5rem; }

.day-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 1rem 0.4rem;
}

/* ─── GAME CARDS ───────────────────────────────────────────────────────────── */
.game-card {
  background: #161b22;
  border-top: 1px solid #21262d;
  border-bottom: 1px solid #21262d;
  padding: 0.9rem 1rem;
  transition: background 0.1s;
}
.game-card + .game-card { border-top: none; }
.game-card.locked { opacity: 0.85; }
.game-card.correct { border-left: 3px solid #2ea043; }
.game-card.wrong   { border-left: 3px solid #da3633; }

.game-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.game-time {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 500;
}

.lock-icon { font-size: 0.7rem; }

.game-teams {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.team-name {
  font-size: 1rem;
  font-weight: 600;
  color: #e6edf3;
}

.vs {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 400;
}

.game-pick-row { margin-top: 0.1rem; }

.pick-select {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  cursor: pointer;
  outline: none;
  appearance: auto;
}
.pick-select:focus { border-color: #388bfd; }

.result-row {
  font-size: 0.85rem;
  color: #8b949e;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.result-row strong { color: #e6edf3; }

.pick-badge {
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
}
.badge-correct { background: #1a3f1a; color: #3fb950; }
.badge-wrong   { background: #3f1a1a; color: #f85149; }
.badge-none    { background: #21262d; color: #8b949e; }

.locked-pick {
  font-size: 0.85rem;
  color: #8b949e;
}
.locked-pick strong { color: #e6edf3; }
.locked-pick.no-pick { font-style: italic; }

/* ─── LEADERBOARD ──────────────────────────────────────────────────────────── */
#leaderboardList { padding: 1rem; }

.lb-header {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #30363d;
  margin-bottom: 0.5rem;
}

.lb-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  padding: 0.85rem 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  background: #161b22;
  border: 1px solid #21262d;
  transition: border-color 0.15s;
}
.lb-row.lb-me {
  border-color: #f5c518;
  background: #1a1a0d;
}

.lb-rank { font-size: 1.1rem; }

.lb-name {
  font-size: 1rem;
  font-weight: 600;
  color: #e6edf3;
}

.lb-score {
  font-size: 1rem;
  font-weight: 700;
  color: #f5c518;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  text-align: center;
  color: #8b949e;
  padding: 3rem 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ─── FOOTER / ADMIN TRIGGER ───────────────────────────────────────────────── */
.app-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 0.75rem 1rem;
}

.admin-trigger {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s;
}
.admin-trigger:hover { opacity: 0.8; }

/* ─── ADMIN PANEL ──────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.admin-inner {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.admin-header h2 { font-size: 1.1rem; color: #f5c518; }
.admin-header button {
  background: #21262d;
  border: none;
  border-radius: 50%;
  color: #e6edf3;
  font-size: 1rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #21262d;
}

.admin-game-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}
.admin-teams {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e6edf3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-time { font-size: 0.75rem; color: #8b949e; }

.admin-select {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 160px;
}
