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

:root {
  --bg:        #0a0a14;
  --surface:   #12121f;
  --card:      #181828;
  --card-h:    #1f1f35;
  --border:    rgba(255,255,255,.08);
  --border-h:  rgba(255,255,255,.15);

  --green:     #00ff87;
  --green-dim: #00c86a;
  --red:       #e90052;
  --yellow:    #ffd700;
  --blue:      #00b2ff;
  --purple:    #7f5af0;

  --text:      #f0f0f8;
  --muted:     #8888aa;
  --faint:     #444460;

  --radius:    12px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
strong { font-weight: 600; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  flex: 1;
  padding: 32px 20px 60px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-badge {
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 2px 6px;
  border-radius: 4px;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.logo-text em {
  font-style: normal;
  color: var(--green);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s, background .15s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--card-h);
}

.nav-logout { color: var(--red); }
.nav-logout:hover { background: rgba(233,0,82,.12); color: var(--red); }

.nav-user {
  font-size: 13px;
  color: var(--muted);
  padding: 0 8px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}

.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--green);
  color: #000;
}

.btn-secondary {
  background: var(--card-h);
  color: var(--text);
  border: 1px solid var(--border-h);
}

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

.btn-google {
  background: #fff;
  color: #333;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: var(--radius);
  width: 100%;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.btn-google:hover { opacity: .92; }

.google-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash-messages { margin-bottom: 20px; }
.flash {
  background: rgba(233,0,82,.15);
  border: 1px solid rgba(233,0,82,.3);
  color: #ff7ab0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 8px;
}

/* ── Auth / Login ────────────────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 0;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.auth-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 20px;
}

.auth-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.auth-title span { color: var(--green); }

.auth-sub {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 28px;
  line-height: 1.6;
}

.how-it-works {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.how-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
}

.how-icon { font-size: 18px; flex-shrink: 0; line-height: 1.4; }

.how-item strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.how-item span { color: var(--muted); }

.auth-note {
  font-size: 12px;
  color: var(--faint);
  margin-top: 12px;
}

/* ── Nickname form ───────────────────────────────────────────────────────── */
.nickname-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 10px;
}

.nickname-input {
  background: var(--surface);
  border: 1px solid var(--border-h);
  color: var(--text);
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  text-align: center;
}

.nickname-input:focus { border-color: var(--green); }
.nickname-input::placeholder { color: var(--faint); }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.locked-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(233,0,82,.2);
  color: var(--red);
  border: 1px solid rgba(233,0,82,.3);
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}

.lock-info {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.lock-info strong { color: var(--text); }

/* ── Gameweek nav pills ──────────────────────────────────────────────────── */
.gw-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 520px;
}

.gw-pill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all .15s;
}

.gw-pill:hover { border-color: var(--border-h); color: var(--text); }
.gw-pill.active { background: var(--green); color: #000; border-color: var(--green); font-weight: 700; }

/* ── Fixtures grid ───────────────────────────────────────────────────────── */
.fixtures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* ── Fixture card ─────────────────────────────────────────────────────────── */
.fixture-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s, box-shadow .15s;
}

.fixture-card:hover { border-color: var(--border-h); box-shadow: var(--shadow); }
.fixture-card.live { border-color: rgba(0,178,255,.35); }
.fixture-card.finished { opacity: .9; }

/* Status bar */
.fixture-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.status-chip.upcoming { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.status-chip.live     { background: rgba(0,178,255,.2); color: var(--blue); border: 1px solid rgba(0,178,255,.4); animation: pulse 1.5s infinite; }
.status-chip.finished { background: var(--surface); color: var(--faint); border: 1px solid var(--border); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

.score-display {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text);
}

/* Teams row */
.teams-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-block.away { text-align: right; align-items: flex-end; }

.team-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.team-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--faint);
  text-transform: uppercase;
}

.team-block.winner .team-name { color: var(--green); }

.vs-divider {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Prediction bar */
.pred-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pred-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface);
  gap: 1px;
}

.pred-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: rgba(0,0,0,.6);
  transition: width .4s;
  min-width: 0;
  overflow: hidden;
}

.pred-seg.home { background: var(--blue); }
.pred-seg.draw { background: var(--yellow); }
.pred-seg.away { background: var(--red); }

.pred-counts {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--faint);
}

.pred-counts .pred-total { margin-left: auto; }

/* Prediction area */
.prediction-area { }

/* Prediction form */
.pred-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
}

.pred-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.3;
  text-align: center;
}

.pred-btn small { font-size: 10px; color: var(--muted); font-weight: 400; display: block; margin-top: 2px; }

.pred-btn:hover { border-color: var(--border-h); background: var(--card-h); }

.pred-btn.home.selected  { background: rgba(0,178,255,.15); border-color: var(--blue); color: var(--blue); }
.pred-btn.draw.selected  { background: rgba(255,215,0,.12); border-color: var(--yellow); color: var(--yellow); }
.pred-btn.away.selected  { background: rgba(233,0,82,.15); border-color: var(--red); color: var(--red); }

.pred-btn.home:hover  { border-color: var(--blue); }
.pred-btn.draw:hover  { border-color: var(--yellow); }
.pred-btn.away:hover  { border-color: var(--red); }

/* My prediction display */
.my-pred-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.my-pred-label { font-size: 12px; color: var(--faint); }

.pred-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.pred-chip.pred-home { background: rgba(0,178,255,.12); color: var(--blue); border-color: rgba(0,178,255,.3); }
.pred-chip.pred-draw { background: rgba(255,215,0,.1); color: var(--yellow); border-color: rgba(255,215,0,.25); }
.pred-chip.pred-away { background: rgba(233,0,82,.12); color: var(--red); border-color: rgba(233,0,82,.3); }

.pred-chip.correct { outline: 1.5px solid var(--green); }
.pred-chip.wrong   { opacity: .45; }

.pts-earned {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  margin-left: auto;
}

.pts-zero {
  font-size: 13px;
  color: var(--faint);
  margin-left: auto;
}

.no-pred { font-size: 12px; color: var(--faint); font-style: italic; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); font-size: 15px; max-width: 420px; margin: 0 auto; }

/* ── Rules note ──────────────────────────────────────────────────────────── */
.rules-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.rules-note strong { color: var(--text); }

/* ── Leaderboard ─────────────────────────────────────────────────────────── */
.leaderboard-wrap {
  overflow-x: auto;
  margin-bottom: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.leaderboard-table thead tr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--faint);
  text-transform: uppercase;
  white-space: nowrap;
}

.leaderboard-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.leaderboard-table tbody tr:last-child td { border-bottom: none; }

.leaderboard-table tbody tr { transition: background .12s; }
.leaderboard-table tbody tr:hover { background: var(--card-h); }

.rank-col { width: 44px; text-align: center; }
.num-col  { text-align: right; }
.gw-col   { color: var(--muted); min-width: 56px; }
.total-col { color: var(--green); min-width: 80px; }

.player-col { font-weight: 600; }

.rank-1 td { background: rgba(255,215,0,.05); }
.rank-2 td { background: rgba(192,192,192,.04); }
.rank-3 td { background: rgba(205,127,50,.04); }

.my-row > td { background: rgba(127,90,240,.07) !important; }

.you-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--purple);
  border: 1px solid var(--purple);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  opacity: .8;
  vertical-align: middle;
}

.zero { color: var(--faint); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; height: auto; padding: 10px 0; gap: 8px; }
  .logo-text { font-size: 13px; }
  .gw-col { display: none; }
  .fixtures-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}
