:root {
  --accent: #16a085;
  --accent-dark: #0f8a72;
  --bg: #f1f3f5;
  --bg-subtle: #e9ecef;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.07);
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
  --radius: 14px;
  --home: #2980b9;
  --away: #e67e22;
  --draw: #95a5a6;
  --nav-bg: rgba(241, 243, 245, 0.96);
  --footer-bg: rgba(241, 243, 245, 0.96);
}

[data-bs-theme="dark"] {
  --bg: #080e1c;
  --bg-subtle: #0d1424;
  --surface: #111827;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --nav-bg: rgba(8, 14, 28, 0.94);
  --footer-bg: rgba(8, 14, 28, 0.94);
  --home: #74b9e8;
  --away: #f5b041;
  --draw: #94a3b8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

:root:not([data-bs-theme="dark"]) body {
  background:
    radial-gradient(ellipse 70% 50% at 12% 0%, rgba(22, 160, 133, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 5%, rgba(41, 128, 185, 0.03) 0%, transparent 50%),
    linear-gradient(180deg, #eceff2 0%, #eff1f4 30%, #f1f3f5 60%, #eff2f4 100%);
  background-attachment: fixed;
}

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

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

.wrap {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
  flex: 1;
}

/* ── Nav (brand left, links right — same as main site) ───────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--accent);
}

.nav-inner {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-wordmark {
  font-family: Lora, Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-wordmark:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-left: auto;
}

.nav-link-item {
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  transition: color 0.15s;
}

.nav-link-item:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-btn-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  color: #6366f1;
  margin-left: 0.4rem;
}

.nav-btn-theme:hover {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.18);
}

[data-bs-theme="dark"] .nav-btn-theme {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

[data-bs-theme="dark"] .nav-btn-theme:hover {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.18);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: 2.25rem 0 1.35rem;
}

.hero.compact {
  padding-top: 1.75rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.hero h1 {
  font-family: Lora, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 0.65rem;
  color: var(--text);
}

.lede,
.muted {
  color: var(--text-muted);
}

.lede {
  max-width: 40rem;
  margin: 0;
  font-size: 0.95rem;
}

.vs {
  color: var(--text-faint);
  font-weight: 400;
}

/* ── Cards / panels ──────────────────────────────────────────── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  padding-bottom: 2.5rem;
}

.panel,
.match-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.match-card {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.match-card:hover {
  border-color: rgba(22, 160, 133, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.match-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 500;
}

.match-teams {
  display: grid;
  gap: 0.15rem;
  font-weight: 600;
  color: var(--text);
}

.prob-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-subtle);
}

.prob-bar.large {
  height: 12px;
}

.prob-bar .home {
  background: var(--home);
}

.prob-bar .draw {
  background: var(--draw);
}

.prob-bar .away {
  background: var(--away);
}

.prob-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.prob-labels.large {
  margin-top: 0.75rem;
  text-align: center;
}

.prob-labels.large strong {
  display: block;
  color: var(--text);
  font-size: 1.35rem;
}

.form-row {
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

.form.big {
  font-size: 1.25rem;
  color: var(--text);
}

/* ── Table ───────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2.5rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

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

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

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.team-cell img {
  border-radius: 2px;
}

.elo {
  color: var(--text-faint);
  margin-left: 0.35rem;
}

/* ── Detail ──────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.stats dt {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0;
}

.stats dd {
  margin: 0.15rem 0 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.form-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-compare h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.h2h {
  list-style: none;
  padding: 0;
  margin: 0;
}

.h2h li {
  display: grid;
  grid-template-columns: 6rem 1fr auto;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.h2h li:last-child {
  border-bottom: none;
}

.h2h time,
.h2h small {
  color: var(--text-muted);
}

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

.scoreline {
  font-family: Lora, Georgia, serif;
  font-size: 1.5rem;
  margin: 0.35rem 0 0;
}

.empty pre,
code {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.empty pre {
  padding: 0.85rem 1rem;
  overflow-x: auto;
}

code {
  padding: 0.1rem 0.35rem;
  font-size: 0.85em;
}

.back {
  margin: 1.5rem 0 2.5rem;
}

.back a {
  font-size: 0.88rem;
  font-weight: 500;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding: 2rem 2.5rem;
  border-top: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--footer-bg);
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-brand {
  font-family: Lora, Georgia, serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.footer-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-faint);
}

.footer-links {
  display: flex;
  gap: 1.75rem;
}

.footer-links a {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  .nav-inner {
    width: min(1080px, calc(100% - 2rem));
    height: auto;
    min-height: 58px;
    padding: 0.65rem 0;
  }

  .wrap {
    width: min(1080px, calc(100% - 2rem));
  }

  .site-footer {
    padding: 1.5rem 1.25rem;
  }

  .h2h li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}
