/* ────────────────────────────────────────────
   Design tokens
   ──────────────────────────────────────────── */
:root {
  --pitch: #11221A;
  --chalk: #EDEFE6;
  --gold:  #D8A93D;
  --clay:  #9B4434;
  --sky:   #3E8FC4;

  --text:        var(--chalk);
  --text-muted:  #8a9289;
  --surface:     #1a2e24;
  --surface-2:   #223428;
  --border:      #2e4438;

  --font-display: 'Anton', sans-serif;
  --font-body:    'Manrope', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius: 6px;
  --transition: 120ms ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--pitch);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--sky);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ────────────────────────────────────────────
   Top bar
   ──────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--chalk);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-brand:hover { color: var(--gold); text-decoration: none; }

.topbar-top3 {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  flex-wrap: wrap;
}

.top3-entry {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.top3-pos { color: var(--text-muted); }
.top3-name { font-weight: 600; }
.top3-pts {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
}

.topbar-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sky);
  white-space: nowrap;
}

/* ────────────────────────────────────────────
   Main layout
   ──────────────────────────────────────────── */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ────────────────────────────────────────────
   Join page
   ──────────────────────────────────────────── */
.join-page {
  max-width: 400px;
  margin: 3rem auto;
  text-align: center;
}

.join-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--chalk);
  margin-bottom: 0.75rem;
}

.join-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.join-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition);
}
.join-input::placeholder { color: var(--text-muted); }
.join-input:focus { border-color: var(--sky); outline: none; }

.join-hint {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-error {
  color: var(--clay);
  background: rgba(155, 68, 52, 0.12);
  border: 1px solid rgba(155, 68, 52, 0.35);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

/* ────────────────────────────────────────────
   Link page
   ──────────────────────────────────────────── */
.link-page {
  max-width: 480px;
  margin: 2.5rem auto;
  text-align: center;
}

.link-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.link-desc {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.link-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.link-input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ────────────────────────────────────────────
   Buttons
   ──────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--sky);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--transition);
}
.btn-primary:hover { opacity: 0.88; text-decoration: none; color: #fff; }

.btn-ghost {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--sky); color: var(--sky); text-decoration: none; }

.btn-copy {
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
}
.btn-copy:hover { background: var(--sky); border-color: var(--sky); }

.btn-save {
  padding: 0.45rem 0.9rem;
  background: var(--sky);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}
.btn-save:hover:not(:disabled) { opacity: 0.85; }
.btn-save:disabled { opacity: 0.5; cursor: default; }
.btn-save.btn-saved { background: var(--gold); }

/* ────────────────────────────────────────────
   Picks page
   ──────────────────────────────────────────── */
.picks-page {}

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

.picks-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.highlight { color: var(--gold); }

/* Stage sections */
.stage-section { margin-bottom: 2.5rem; }

.stage-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Match card grid */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

/* ────────────────────────────────────────────
   Match card — the signature left-border stripe
   ──────────────────────────────────────────── */
.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 1rem 1.25rem;
  border-left: 4px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}

/* Accuracy stripe */
.accuracy-pending { border-left-color: var(--border); border-left-style: dashed; }
.accuracy-exact   { border-left-color: var(--gold); }
.accuracy-correct { border-left-color: var(--sky); }
.accuracy-wrong   { border-left-color: var(--clay); }

.card-teams {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.team {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
  min-width: 80px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.team-b { justify-content: flex-end; }

.crest {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.card-vs {
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.card-result {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.result-score {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.result-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-badge {
  color: var(--gold);
  font-weight: 700;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.card-kickoff {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Pick form inside card */
.pick-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pick-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pick-score {
  width: 2.5rem;
  padding: 0.35rem 0.45rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
  -moz-appearance: textfield;
  transition: border-color var(--transition);
}
.pick-score::-webkit-inner-spin-button,
.pick-score::-webkit-outer-spin-button { -webkit-appearance: none; }
.pick-score:focus { border-color: var(--sky); outline: none; }

.pick-sep {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Locked pick display */
.pick-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.pick-label { color: var(--text-muted); font-size: 0.75rem; }

.pick-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
}

.pick-display--none .pick-label { font-style: italic; opacity: 0.55; }

/* ────────────────────────────────────────────
   Ranking page
   ──────────────────────────────────────────── */
.ranking-page {}

.ranking-header { margin-bottom: 1.5rem; }

.ranking-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.03em;
}

.ranking-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ranking-table thead {
  background: var(--surface-2);
}

.ranking-table th,
.ranking-table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.ranking-table th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.ranking-table tbody tr:last-child td { border-bottom: none; }
.ranking-table tbody tr:hover { background: var(--surface); }

.row-leader { background: rgba(216, 169, 61, 0.08); }
.row-leader:hover { background: rgba(216, 169, 61, 0.13) !important; }

.name-leader { color: var(--gold); font-weight: 700; }

.col-pos  { width: 2.5rem; }
.col-name { }
.col-num  { width: 3rem; text-align: right; }
.col-form { width: 8rem; }

.mono { font-family: var(--font-mono); }

.points-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--chalk);
  font-size: 0.95rem;
}

/* Form dots */
.form-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.form-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.form-dot--exact   { background: var(--gold); }
.form-dot--correct { background: var(--sky); }
.form-dot--wrong   { background: var(--clay); }
.form-dot--pending {
  background: transparent;
  border: 1.5px dashed var(--border);
}

.ranking-note {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ────────────────────────────────────────────
   Empty state
   ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

/* ────────────────────────────────────────────
   Responsive
   ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar { padding: 0.5rem 1rem; }
  .topbar-top3 { display: none; }
  .main-content { padding: 1.25rem 1rem; }
  .join-title { font-size: 2rem; }
  .match-grid { grid-template-columns: 1fr; }
  .col-form { display: none; }
  .ranking-table th, .ranking-table td { padding: 0.5rem 0.65rem; }
}
