:root {
  --bg: #0f172a;
  --bg-elevated: #ffffff;
  --page-bg: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.topnav {
  background: var(--bg);
  color: white;
}

.topnav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  color: white;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  flex: 1;
}

.nav-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-links a:hover { color: white; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.auth-card {
  max-width: 380px;
  margin: 3rem auto;
}

h1 { font-size: 1.4rem; margin-top: 0; }
h2 { font-size: 1.1rem; }

form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

form.stacked-form { display: flex; flex-direction: column; gap: 0.25rem; max-width: 360px; }

input[type="text"], input[type="password"], input[type="number"], select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

button, .link-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

button:hover { background: var(--primary-dark); }
button:disabled { background: #94a3b8; cursor: not-allowed; }
button.danger { background: #b91c1c; }
button.danger:hover { background: #7f1d1d; }

.link-button {
  background: none;
  color: var(--primary);
  padding: 0;
  text-decoration: underline;
  font-size: 0.85rem;
}

.checkbox { display: flex; align-items: center; gap: 0.4rem; }
.checkbox input { width: auto; }

.alert {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.actions form, .actions a {
  margin-right: 0.5rem;
  display: inline-block;
}
.actions input[type="text"] { display: inline-block; width: 140px; }

.picks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.week-picker select { width: auto; display: inline-block; }

.progress-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}

.game-list { display: flex; flex-direction: column; gap: 0.75rem; }

.game-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}
.game-row.locked { background: #f8fafc; }

.game-time {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}
.tag-final { background: #e2e8f0; color: #334155; }
.tag-live { background: #fee2e2; color: #991b1b; }

.game-teams { display: flex; flex-direction: column; gap: 0.4rem; }

.team-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
}
.team-option.picked { background: #eff6ff; }

.team-name { flex: 1; font-size: 0.95rem; }
.team-score { font-weight: 700; width: 2rem; text-align: right; }

.badge {
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.inline-form { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.score-form { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.score-input { width: 70px; display: inline-block; }

.pw-reveal {
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.user-picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.user-picks-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.user-picks-name {
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.pick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pick-chip {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}
.chip-hidden { background: #f1f5f9; color: var(--muted); font-weight: 500; }
.chip-live { background: #fee2e2; color: #991b1b; }
.chip-win { background: var(--ok-bg); color: var(--ok-text); }
.chip-loss { background: var(--error-bg); color: var(--error-text); }
