/* ============================================================
   WC26 Hub — Design System
   Dark, sporty theme inspired by the tri-host palette:
   Canada red, Mexico green, USA blue + trophy gold accents.
   ============================================================ */

:root {
  --bg: #0a0e1a;
  --bg-2: #0e1424;
  --surface: #131a2e;
  --surface-2: #1a2340;
  --surface-3: #222d52;
  --line: #25304f;
  --line-2: #344266;

  --text: #eef1f8;
  --text-dim: #9aa5c0;
  --text-faint: #6b7693;

  --red: #e63946;
  --green: #19c37d;
  --blue: #3f8efc;
  --gold: #ffc94d;
  --gold-2: #e8a820;
  --purple: #9d6bff;

  --accent: var(--gold);
  --gradient-hosts: linear-gradient(90deg, #e63946 0%, #19c37d 50%, #3f8efc 100%);
  --gradient-gold: linear-gradient(135deg, #ffd97a 0%, #e8a820 100%);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --win: #19c37d;
  --draw: #ffc94d;
  --loss: #e63946;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(63, 142, 252, .10), transparent 60%),
    radial-gradient(900px 450px at 0% 0%, rgba(230, 57, 70, .07), transparent 55%),
    radial-gradient(900px 600px at 50% 110%, rgba(25, 195, 125, .06), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Header / Nav ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--gradient-hosts);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: .5px;
  white-space: nowrap;
}
.brand-ball { font-size: 1.5rem; filter: drop-shadow(0 0 8px rgba(255, 201, 77, .45)); }
.brand-26 {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-dim);
  align-self: flex-end;
  margin-bottom: 5px;
}
.brand-hosts { font-size: .85rem; letter-spacing: 2px; margin-left: 2px; }

.nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  padding: 8px 13px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: #0a0e1a; background: var(--gold); }

/* ---------------- Layout ---------------- */

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 70px;
  min-height: 70vh;
  outline: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 20px;
  font-size: .85rem;
  color: var(--text-dim);
}
.footer-inner p { margin: 4px 0; }

.page-title {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -.5px;
}
.page-lead { color: var(--text-dim); margin: 0 0 26px; max-width: 760px; }

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 34px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------------- Cards ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card.pad { padding: 18px; }
.card-hover { transition: transform .18s, border-color .18s, box-shadow .18s; }
.card-hover:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-body { padding: 16px; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: .92rem;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-faint); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #0a0e1a; }
.btn-primary:hover { background: #ffd97a; border-color: #ffd97a; }
.btn-green { background: var(--green); border-color: var(--green); color: #062b1c; }
.btn-green:hover { background: #2bdb92; border-color: #2bdb92; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(230, 57, 70, .12); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 13px; font-size: .82rem; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }

/* ---------------- Badges & pills ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.badge-gold { background: rgba(255, 201, 77, .15); color: var(--gold); }
.badge-green { background: rgba(25, 195, 125, .15); color: var(--green); }
.badge-red { background: rgba(230, 57, 70, .16); color: #ff7b85; }
.badge-blue { background: rgba(63, 142, 252, .15); color: #7eb3ff; }
.badge-live { background: rgba(230, 57, 70, .18); color: #ff7b85; animation: pulse 1.4s infinite; }

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.pill:hover { border-color: var(--text-faint); }
.pill.active { background: var(--gold); border-color: var(--gold); color: #0a0e1a; }

/* ---------------- Tabs ---------------- */

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tab {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
}
.tab:hover { color: var(--text); border-color: var(--line-2); }
.tab.active { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }

/* ---------------- Tables ---------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.table th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint);
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: center; font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }

/* ---------------- Forms ---------------- */

.input, .select {
  font-family: var(--font);
  font-size: .95rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .select:focus { border-color: var(--gold); }
.input::placeholder { color: var(--text-faint); }
.select option { background: var(--bg-2); }

/* ---------------- Team bits & imagery ---------------- */

.flag { font-size: 1.15em; line-height: 1; }
.team-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }

.flag-wrap { display: inline-flex; align-items: center; line-height: 1; }
.flag-img {
  height: 1.05em;
  width: auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 1px 3px rgba(0, 0, 0, .4);
  display: block;
}
.flag-big .flag-img, .flag-big.flag-wrap .flag-img { height: 2.2em; border-radius: 6px; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .5px;
  color: #0a0e1a;
  background: var(--surface-3);
  flex-shrink: 0;
}
.avatar-GK { background: linear-gradient(135deg, #ffd97a, #e8a820); }
.avatar-DF { background: linear-gradient(135deg, #7eb3ff, #2f6fd0); }
.avatar-MF { background: linear-gradient(135deg, #4fe0a3, #14935e); }
.avatar-FW { background: linear-gradient(135deg, #ff8a93, #d22f3d); }

.photo {
  width: 100%;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
}
.photo-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.photo-frame .photo-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 14px 10px;
  background: linear-gradient(transparent, rgba(5, 8, 16, .88));
  font-size: .82rem;
  color: var(--text-dim);
}

/* ---------------- Progress / stat bars ---------------- */

.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--gold);
  transition: width .5s ease;
}

.stat-duel { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; margin: 7px 0; }
.stat-duel .label { text-align: center; font-size: .78rem; color: var(--text-dim); font-weight: 600; grid-column: 1 / -1; margin-bottom: -4px; }
.stat-duel .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-duel .val.right { text-align: right; }
.stat-duel .bars { display: flex; gap: 3px; height: 8px; }
.stat-duel .bars .home, .stat-duel .bars .away { border-radius: 99px; transition: flex .5s ease; }
.stat-duel .bars .home { background: var(--blue); }
.stat-duel .bars .away { background: var(--red); }

/* ---------------- Modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, .75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp .22s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(18px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------------- Toast ---------------- */

#toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-weight: 600;
  font-size: .92rem;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
}
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

/* ---------------- Market odds widgets (js/markets.js) ---------------- */

.mkt-row {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr 52px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.mkt-row .mkt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.mkt-bar {
  display: block;
  height: 10px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.mkt-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #19c37d, #ffd97a);
  transition: width .6s ease;
}
.mkt-pct { text-align: right; font-weight: 800; font-size: .88rem; }
.mkt-mini { padding: 10px 0 2px; }

.mkt-embed iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.mkt-embed-cta { margin-top: 10px; width: 100%; }

.mkt-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  margin: 14px 0;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: linear-gradient(110deg, rgba(25, 195, 125, .10), rgba(255, 201, 77, .07));
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.mkt-banner:hover { border-color: var(--green); transform: translateY(-1px); }
.mkt-banner-icon { font-size: 1.4rem; }
.mkt-banner-text strong { display: block; }

/* live badge clock */
.live-clock { color: #ff7b85; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------------- Utilities ---------------- */

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.gold { color: var(--gold); }
.green { color: var(--green); }
.red { color: var(--red); }
.blue { color: var(--blue); }
.center { text-align: center; }
.bold { font-weight: 700; }
.small { font-size: .85rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 28px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
.tnum { font-variant-numeric: tabular-nums; }

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-dim);
}
.empty-state .big { font-size: 2.4rem; margin-bottom: 10px; }

::selection { background: rgba(255, 201, 77, .35); }

@media (max-width: 640px) {
  .page-title { font-size: 1.55rem; }
  .app-main { padding: 20px 14px 60px; }
}
