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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, #071a0e 0%, #0d2818 40%, #071a0e 100%);
  background-attachment: fixed;
  color: #f0fdf4;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.main { flex: 1; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(11,31,18,0.9);
  backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: 72rem; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; gap: 1rem; flex-wrap: wrap;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; }
.nav-icon { font-size: 1.5rem; }
.nav-title { font-weight: 700; color: #fff; line-height: 1.2; }
.nav-subtitle { font-size: 0.75rem; color: rgba(110,231,183,0.7); }
.nav-links { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-link {
  padding: 0.375rem 0.75rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500;
  color: rgba(209,250,229,0.8); transition: background 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-link.active { background: #10b981; color: #fff; }

/* Layout */
.container { max-width: 72rem; margin: 0 auto; padding: 2rem 1rem; }
.container-narrow { max-width: 56rem; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.875rem; font-weight: 700; color: #fff; }
.subtitle { margin-top: 0.25rem; color: rgba(110,231,183,0.6); font-size: 0.95rem; }
.hint { font-size: 0.875rem; font-weight: 400; color: rgba(110,231,183,0.5); }
.fine-print { margin-top: 0.75rem; font-size: 0.75rem; color: rgba(110,231,183,0.4); }
.muted { color: rgba(209,250,229,0.5); }
.section-block { margin-bottom: 2.5rem; }
.section-block h2 { font-size: 1.25rem; font-weight: 700; color: #fff; margin-bottom: 1rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1rem; }
.section-head h2 { margin-bottom: 0; }

/* Grids */
.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 2rem; }
@media (min-width: 640px) { .stat-cards { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  border: 1px solid rgba(255,255,255,0.1); border-radius: 0.75rem;
  background: rgba(255,255,255,0.05); padding: 1rem; text-align: center;
}
.stat-icon { font-size: 1.5rem; }
.stat-value { margin-top: 0.25rem; font-size: 1.5rem; font-weight: 700; color: #fff; }
.stat-label { font-size: 0.75rem; color: rgba(110,231,183,0.5); }

.grid-2 { display: grid; gap: 2.5rem; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-4 { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.mt { margin-top: 2rem; }

/* Badges */
.badge { border-radius: 9999px; background: rgba(255,255,255,0.1); padding: 0.125rem 0.5rem; font-size: 0.75rem; }
.badge-violet {
  border-radius: 9999px; border: 1px solid rgba(167,139,250,0.3);
  background: rgba(139,92,246,0.1); padding: 0.25rem 0.75rem;
  font-size: 0.75rem; color: #ddd6fe;
}
.notice {
  margin-bottom: 1rem; border-radius: 0.5rem;
  border: 1px solid rgba(16,185,129,0.3); background: rgba(16,185,129,0.1);
  padding: 0.5rem 1rem; font-size: 0.875rem; color: #a7f3d0;
}
.notice-violet {
  border-radius: 0.75rem; border: 1px solid rgba(167,139,250,0.2);
  background: rgba(139,92,246,0.05); padding: 0.75rem 1rem;
  font-size: 0.875rem; color: rgba(221,214,254,0.7);
}

/* Table */
.table-wrap { overflow-x: auto; border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { padding: 0.75rem 1rem; text-align: left; color: rgba(110,231,183,0.7); font-weight: 500; border-bottom: 1px solid rgba(255,255,255,0.1); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.table .center { text-align: center; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 9999px;
  background: rgba(255,255,255,0.1); font-size: 0.75rem; font-weight: 700;
}
.player-name { font-weight: 600; color: #fff; }
.ai-name { color: #ddd6fe; font-weight: 600; }
.pts-badge {
  display: inline-block; border-radius: 9999px;
  background: rgba(16,185,129,0.2); padding: 0.125rem 0.75rem;
  font-weight: 700; color: #6ee7b7;
}
.row-gold { background: rgba(245,158,11,0.1); }
.row-silver { background: rgba(156,163,175,0.05); }
.row-bronze { background: rgba(194,65,12,0.1); }
.row-ai { background: rgba(139,92,246,0.1); }
.text-gold { color: #fcd34d; }

/* Fixture cards */
.fixture-list { display: grid; gap: 0.75rem; }
.fixture-card {
  border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05); padding: 1rem;
  transition: border-color 0.15s;
}
.fixture-card:hover { border-color: rgba(255,255,255,0.2); }
.fixture-card.played { border-color: rgba(16,185,129,0.3); background: rgba(6,78,59,0.3); }
.fixture-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem; font-size: 0.75rem; color: rgba(110,231,183,0.6);
}
.fixture-teams { display: flex; align-items: center; gap: 0.75rem; }
.team { flex: 1; font-weight: 600; color: #fff; }
.team-right { text-align: right; }
.fixture-score { display: flex; flex-direction: column; align-items: center; min-width: 4.5rem; }
.score { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.score.final { color: #6ee7b7; }
.score.pending { color: rgba(255,255,255,0.4); }
.final-label { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(52,211,153,0.7); }

.predictions { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.1); }
.predictions-label {
  margin-bottom: 0.5rem; font-size: 0.75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em; color: rgba(110,231,183,0.5);
}
.prediction-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.875rem; padding: 0.125rem 0;
}
.prediction-row.ai-row {
  border-radius: 0.375rem; background: rgba(139,92,246,0.1);
  padding: 0.125rem 0.5rem; margin: 0 -0.5rem;
}
.pred-score { font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.9); }
.pts-chip {
  margin-left: 0.5rem; border-radius: 0.25rem; padding: 0.125rem 0.375rem;
  font-size: 0.75rem; font-weight: 700;
}
.pts-chip.gold { background: rgba(245,158,11,0.3); color: #fcd34d; }
.pts-chip.green { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.pts-chip.zero { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.3); }

/* Stat boxes & trophies */
.stat-box {
  border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05); padding: 1rem;
}
.stat-box h3 { font-size: 1rem; font-weight: 600; color: #fff; margin-bottom: 0.75rem; }
.stat-box-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.875rem; color: rgba(110,231,183,0.7); }
.stat-box-head .uppercase { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(110,231,183,0.5); }
.stat-winner { font-weight: 700; color: #fff; font-size: 1rem; }
.stat-detail { margin-top: 0.25rem; font-size: 0.75rem; color: rgba(209,250,229,0.5); }
.vs-ai-list { list-style: none; }
.vs-ai-list li { display: flex; justify-content: space-between; font-size: 0.875rem; padding: 0.25rem 0; }
.positive { font-weight: 700; color: #6ee7b7; font-variant-numeric: tabular-nums; }
.negative { font-weight: 700; color: rgba(252,165,165,0.8); font-variant-numeric: tabular-nums; }
.story-text { font-size: 0.875rem; color: rgba(209,250,229,0.7); }
.trophy-card {
  border-radius: 0.75rem; border: 1px solid rgba(251,191,36,0.2);
  background: linear-gradient(135deg, rgba(245,158,11,0.1), transparent);
  padding: 1rem;
}
.trophy-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: #fcd34d; margin-bottom: 0.5rem; }
.trophy-winner { font-size: 1.125rem; font-weight: 700; color: #fff; }
.trophy-sub { margin-top: 0.25rem; font-size: 0.75rem; color: rgba(209,250,229,0.5); }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  border-radius: 0.5rem; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500;
  background: rgba(255,255,255,0.05); color: rgba(209,250,229,0.7); transition: background 0.15s;
}
.tab:hover { background: rgba(255,255,255,0.1); }
.tab.active { background: #10b981; color: #fff; }
.tab-count { font-size: 0.75rem; opacity: 0.6; }

/* Admin */
.admin-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
}
.score-input {
  width: 3.5rem; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1); padding: 0.5rem; text-align: center;
  font-size: 1.125rem; font-weight: 700; color: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.score-input:hover { border-color: rgba(255,255,255,0.3); }
.score-input:focus { outline: none; border-color: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,0.15); }
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.score-input::placeholder { color: rgba(255,255,255,0.25); font-weight: 500; }
.dash { color: rgba(255,255,255,0.4); font-weight: 700; }
.btn {
  border: none; border-radius: 0.5rem; padding: 0.5rem 1rem;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.btn-primary { background: #10b981; color: #fff; }
.btn-primary:hover { background: #34d399; }
.btn-secondary {
  background: transparent; border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-block { display: block; width: 100%; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #ef4444; }

.page-header-row {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.notice-error {
  border-color: rgba(248,113,113,0.3); background: rgba(220,38,38,0.1); color: #fecaca;
}
.card-panel {
  border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05); padding: 1.25rem;
}
.auth-form { max-width: 28rem; }
.form-row { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; color: rgba(209,250,229,0.8); }
.form-input {
  width: 100%; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1); padding: 0.625rem 0.75rem; color: #fff; font-size: 0.9375rem;
}
.form-input:focus { outline: none; border-color: #34d399; }

/* Custom selects — native dropdowns look wrong on dark backgrounds without this */
.select-wrap {
  position: relative;
  width: 100%;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(110,231,183,0.75);
  pointer-events: none;
}
.select-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(7,26,14,0.65);
  padding: 0.625rem 2.25rem 0.625rem 0.875rem;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.select-input:hover {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
}
.select-input:focus {
  outline: none;
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,0.15);
}
.select-input option,
.select-input optgroup {
  background: #0d2818;
  color: #f0fdf4;
}

.form-hint { font-size: 0.8125rem; color: rgba(110,231,183,0.5); margin-top: 0.375rem; }
.auth-switch { margin-top: 1.5rem; font-size: 0.875rem; color: rgba(209,250,229,0.6); }
.auth-switch a { color: #6ee7b7; text-decoration: underline; }
.inline-form { display: inline; }
.text-right { text-align: right; }
.badge-muted { background: rgba(255,255,255,0.05); color: rgba(209,250,229,0.5); }
.empty-state { padding: 2rem 0; text-align: center; }

/* Predictions page */
.predictions-toolbar {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
}
.predictions-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
}
.predictions-filter-field {
  flex: 1;
  min-width: min(100%, 14rem);
}
.predictions-filter-field .form-label {
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(110,231,183,0.65);
}
.predictions-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(16,185,129,0.25);
  background: rgba(16,185,129,0.08);
  min-width: 8.5rem;
}
.predictions-progress-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #6ee7b7;
  line-height: 1.2;
}
.predictions-progress-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(110,231,183,0.55);
}
.predictions-toolbar-hint {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8125rem;
  color: rgba(209,250,229,0.55);
}
.admin-filters.predictions-toolbar { padding: 1rem 1.25rem; }
.admin-filters .predictions-toolbar-main { width: 100%; }

.admin-predictions-summary { margin-bottom: 1rem; }
.admin-section-tabs { margin-bottom: 1.5rem; }
.admin-fixture-card .admin-teams-form { flex: 1; min-width: 100%; }
.team-input {
  flex: 1; min-width: 8rem; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1); padding: 0.5rem 0.75rem; font-size: 0.9375rem;
  font-weight: 600; color: #fff;
}
.team-input:focus { outline: none; border-color: #34d399; }
.team-input-placeholder { font-style: italic; color: rgba(209,250,229,0.55); }
.team-input:read-only { opacity: 0.7; cursor: not-allowed; }

.prediction-entry {
  padding: 1rem 1.125rem;
}
.prediction-entry.has-prediction {
  border-color: rgba(16,185,129,0.35);
  background: rgba(6,78,59,0.18);
}
.prediction-entry .fixture-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.625rem;
  margin-bottom: 0.875rem;
}
.prediction-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.5rem 1.25rem 3.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem 0.625rem;
}
.prediction-input-row .team {
  font-size: 0.9375rem;
  line-height: 1.3;
  min-width: 0;
  word-break: break-word;
}
.prediction-input-row .team-right { text-align: right; }
.prediction-input-row .score-input {
  width: 100%;
  min-width: 0;
}
.prediction-input-row .dash {
  text-align: center;
  font-size: 1.125rem;
}
.team-tbd { color: rgba(209,250,229,0.5); font-style: italic; font-size: 0.875rem; }
.predictions-save-bar {
  margin-top: 1.75rem;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
}
.predictions-save-bar .btn-primary {
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
}
.predictions-save-bar .form-hint {
  margin-top: 0;
  flex: 1;
  min-width: 12rem;
}
.ai-regenerate-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}
.ai-regenerate-copy strong {
  display: block;
  color: #ddd6fe;
  margin-bottom: 0.25rem;
}
.ai-regenerate-copy .form-hint {
  margin-top: 0;
  max-width: 36rem;
}
.venue {
  opacity: 0.75;
  font-size: 0.6875rem;
  max-width: 100%;
}

@media (max-width: 639px) {
  .predictions-toolbar-main {
    flex-direction: column;
    align-items: stretch;
  }
  .predictions-progress {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
  }
  .prediction-input-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "team1 team2"
      "score1 score2"
      "dash dash";
    gap: 0.625rem;
  }
  .prediction-input-row .team-right {
    grid-area: team1;
    text-align: left;
  }
  .prediction-input-row .team:not(.team-right) {
    grid-area: team2;
  }
  .prediction-input-row .score-input:first-of-type { grid-area: score1; }
  .prediction-input-row .score-input:last-of-type { grid-area: score2; }
  .prediction-input-row .dash {
    grid-area: dash;
    display: none;
  }
  .prediction-input-row .score-input {
    justify-self: stretch;
  }
  .predictions-save-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .predictions-save-bar .btn-primary { width: 100%; }
}

/* Legacy filter aliases */
.round-filter, .admin-filters {
  display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; align-items: flex-end;
}
.admin-filters .form-row { flex: 1; min-width: 12rem; margin-bottom: 0; }
.round-filter-label { font-size: 0.875rem; color: rgba(209,250,229,0.7); }
.round-select { min-width: 12rem; }

/* Rules & bars */
.rules-list { list-style: none; }
.rules-list li {
  display: flex; justify-content: space-between; gap: 0.75rem;
  font-size: 0.875rem; color: rgba(209,250,229,0.7); padding: 0.375rem 0;
}
.rules-list strong { color: #6ee7b7; flex-shrink: 0; }
.bar-row { margin-bottom: 0.75rem; }
.bar-label { display: flex; justify-content: space-between; font-size: 0.875rem; margin-bottom: 0.25rem; }
.bar-label span { color: rgba(255,255,255,0.8); }
.bar-label strong { color: #6ee7b7; }
.bar-track { height: 0.5rem; border-radius: 9999px; background: rgba(255,255,255,0.1); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9999px; background: linear-gradient(90deg, #059669, #34d399); }

/* Footer */
.footer {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 1rem; text-align: center;
  font-size: 0.75rem; color: rgba(110,231,183,0.4);
}

/* Responsive table cols */
@media (max-width: 639px) { .hide-sm { display: none; } }
@media (max-width: 767px) { .hide-md { display: none; } }
@media (max-width: 1023px) { .hide-lg { display: none; } }
