/* ==========================================================================
   World Cup 2026 Prediction Pool — global stylesheet
   No framework. Mobile-first, light/dark aware via prefers-color-scheme.
   ========================================================================== */

:root {
  color-scheme: light dark;
  --color-bg: #ffffff;
  --color-surface: #f8fafc;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-accent: #2563eb;
  --color-accent-contrast: #ffffff;
  --color-border: #e2e8f0;
  --color-success: #16a34a;
  --color-warning-bg: #fef3c7;
  --color-warning-text: #92400e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --maxw: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-text: #e2e8f0;
    --color-muted: #94a3b8;
    --color-accent: #60a5fa;
    --color-accent-contrast: #0f172a;
    --color-border: #334155;
    --color-success: #4ade80;
    --color-warning-bg: #422006;
    --color-warning-text: #fcd34d;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand:hover { text-decoration: none; }
.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: 0.95rem;
}
.site-nav a:hover { background: var(--color-bg); text-decoration: none; }
.site-nav a.active { color: var(--color-accent); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 0 0 0.5rem; }
.hero p { color: var(--color-muted); font-size: 1.1rem; max-width: 640px; margin: 0.5rem auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn.secondary {
  background: transparent;
  color: var(--color-accent);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; margin-top: 1.5rem; }

/* ---------- Cards / sections ---------- */
main { padding: 2rem 0 4rem; }
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.section-title { margin-top: 2.5rem; }
.muted { color: var(--color-muted); }

/* ---------- Banner ---------- */
.banner {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}

/* ---------- Feature grid (home) ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ---------- Groups / predictions ---------- */
.group-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.group-card h3 { margin: 0 0 0.75rem; display: flex; align-items: center; justify-content: space-between; }
.group-badge {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}
.team-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--color-border);
}
.team-row:first-of-type { border-top: none; }
.team-flag { font-size: 1.3rem; width: 1.6rem; text-align: center; }
.team-name { flex: 1; }
.pos-select {
  font: inherit;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  min-width: 130px;
}
.pos-select.dup { border-color: #dc2626; }

/* ---------- Fields ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field select, .field input {
  font: inherit;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-muted); font-weight: 600; }
.pts { font-weight: 700; color: var(--color-accent); white-space: nowrap; }

/* ---------- Save bar ---------- */
.savebar {
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 0.85rem 0;
  margin-top: 2rem;
}
.savebar .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.save-status { color: var(--color-muted); font-size: 0.9rem; }
.save-status.ok { color: var(--color-success); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.9rem;
  padding: 2rem 0;
  text-align: center;
}

/* ---------- Misc ---------- */
.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-muted);
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}
