@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --maroon:    #800000;
  --maroon-d:  #5c0000;
  --maroon-l:  #fdf2f2;
  --white:     #ffffff;
  --grey-50:   #f7f7f7;
  --grey-100:  #f0f0f0;
  --grey-200:  #e2e2e2;
  --grey-300:  #cccccc;
  --grey-400:  #9ca3af;
  --grey-600:  #5a5a5a;
  --grey-700:  #374151;
  --grey-900:  #111827;
  --green:     #15803d;
  --green-bg:  #f0fdf4;
  --amber:     #b45309;
  --amber-bg:  #fffbeb;
  --red:       #b91c1c;
  --red-bg:    #fef2f2;
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow:    0 2px 10px rgba(0,0,0,.09);
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Roboto Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--grey-50); color: var(--grey-900); line-height: 1.5; min-height: 100vh; }

/* ═══════════════════════════════════════════
   HEADER — Football pitch at night
   Deep green turf with overhead floodlights
════════════════════════════════════════════ */
#site-header {
  position: relative;
  overflow: hidden;
  /* Base: dark pitch green, darker at edges, lighter in center (floodlight) */
  background:
    radial-gradient(ellipse 120% 200% at 50% 110%, #1a4a1a 0%, #0f2e0f 35%, #081a08 65%, #030d03 100%);
}

/* Pitch stripe pattern — alternating mowed grass bands */
#site-header::before {
  content: '';
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    /* Overhead floodlight cone from top center */
    radial-gradient(ellipse 70% 100% at 50% -10%,
      rgba(255,250,220,.13) 0%,
      rgba(255,250,220,.06) 30%,
      transparent 70%
    ),
    /* Secondary lights from corners */
    radial-gradient(ellipse 40% 60% at 5% 0%, rgba(255,250,200,.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 95% 0%, rgba(255,250,200,.06) 0%, transparent 60%),
    /* Alternating grass stripe pattern */
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,.0)   0px,   rgba(0,0,0,.0)   60px,
      rgba(0,0,0,.08)  60px,  rgba(0,0,0,.08)  120px
    );
}

/* Subtle pitch line (halfway line feel) + accent bar */
#site-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
  height: 4px;
  background: linear-gradient(90deg,
    #cc0000 0%, #dd4400 16%, #ddaa00 32%,
    #ffffff 48%, #ffffff 52%,
    #0044cc 64%, #0033aa 80%, #440088 100%
  );
}

.header-inner {
  display: grid;
  grid-template-columns: 110px 1fr 150px;
  align-items: center;
  padding: 1rem 1.5rem 1.2rem;
  gap: 1rem;
  position: relative; z-index: 2;
  min-height: 120px;
}

/* LEFT: WC Logo */
.header-left { display: flex; align-items: center; justify-content: flex-start; }
.wc-logo {
  height: 90px; width: auto;
  filter: drop-shadow(0 0 20px rgba(255,255,255,.15)) drop-shadow(0 4px 12px rgba(0,0,0,.8));
}

/* CENTER: Brand pill */
.header-center { display: flex; align-items: center; justify-content: center; }
.header-brand {
  display: flex;
  align-items: center;
  gap: .9rem;
  /* White background for logo visibility */
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 16px;
  padding: .65rem 1.3rem .65rem .75rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.booth-logo {
  height: 78px; width: auto;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.2));
  flex-shrink: 0;
}
.header-titles { display: flex; flex-direction: column; gap: .3rem; }
.site-title {
  font-family: var(--font-display);
  color: #1a1a1a;
  font-size: 2.3rem; line-height: 1; letter-spacing: .06em;
  text-shadow: none;
  white-space: nowrap;
}
.header-next {
  display: inline-flex; align-items: center; gap: .3rem;
  color: #444; font-size: .72rem; font-weight: 600;
  background: rgba(0,0,0,.08); border: 1px solid rgba(0,0,0,.1);
  border-radius: 99px; padding: .28rem .8rem;
  white-space: nowrap; width: fit-content;
}
.header-next strong { color: #111; font-weight: 700; }

/* RIGHT: Mascot */
.header-right { display: flex; align-items: flex-end; justify-content: flex-end; }
.mascots-img {
  height: 128px; width: auto;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,.7));
  margin-bottom: -4px;
  mix-blend-mode: normal;
  display: block;
}

/* ═══════════════════════════════════════════
   NAV
════════════════════════════════════════════ */
#main-nav {
  background: #fff; border-bottom: 2px solid var(--grey-200);
  display: flex; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 99;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
#main-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  flex: 1; min-width: 80px; padding: .85rem .5rem;
  background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px;
  color: var(--grey-600); font-family: var(--font-display); font-size: 1rem; letter-spacing: .06em;
  cursor: pointer; white-space: nowrap; transition: color .15s, border-color .15s;
}
.nav-btn:hover { color: var(--maroon); }
.nav-btn.active { color: var(--maroon); border-bottom-color: var(--maroon); }

/* ═══════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════ */
main { max-width: 100%; margin: 0 auto; padding: .85rem 1.5rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.mb-2 { margin-bottom: .85rem; }

/* Summary: leaderboard left, matches right — both as wide as possible */
.summary-desktop-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1rem;
  align-items: stretch;
}
.summary-right {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
/* Today's matches card fills remaining height */
.summary-right .card {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.summary-right .card #today-matches-content {
  flex: 1;
}

@media (max-width: 960px) {
  .summary-desktop-grid { display: block; }
  .summary-right { margin-top: .85rem; }
}

/* ═══════════════════════════════════════════
   CARDS
════════════════════════════════════════════ */
.card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--grey-200); overflow: hidden; }
.card-header { padding: .65rem 1rem; border-bottom: 1px solid var(--grey-100); display: flex; align-items: center; gap: .5rem; background: var(--grey-50); }
.card-title { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .06em; color: var(--grey-900); }

/* ═══════════════════════════════════════════
   BADGES
════════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; padding: .2em .65em; border-radius: 999px; font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.badge-today      { background: var(--maroon); color: #fff; }
.badge-live       { background: #dc2626; color: #fff; animation: pulse 1.5s infinite; }
.badge-final,
.badge-concluded  { background: #374151; color: #fff; }
.badge-upcoming   { background: var(--grey-200); color: var(--grey-700); }
.badge-pending    { background: #f59e0b; color: #fff; }
.badge-group      { background: var(--grey-100); color: var(--grey-700); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ═══════════════════════════════════════════
   LEADERBOARD
════════════════════════════════════════════ */
.leaderboard { width: 100%; border-collapse: collapse; font-size: .83rem; }
.leaderboard thead tr { border-bottom: 2px solid var(--grey-200); }
.leaderboard th {
  padding: .48rem .6rem;
  font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--grey-600); text-align: left; white-space: nowrap;
  background: var(--grey-50);
}
.leaderboard td { padding: .42rem .6rem; border-bottom: 1px solid var(--grey-100); white-space: nowrap; }
.leaderboard tr:last-child td { border-bottom: none; }
.leaderboard tr:hover td { background: var(--grey-50); }

/* Leader row: maroon bold name, white background */
.leaderboard tr.rank-1 td { background: #fff !important; }
.leaderboard tr.rank-1 td.col-match { background: #f9f9f9 !important; }
.leaderboard tr.rank-1 .player-name { font-weight: 800; color: var(--maroon); }

.col-rank { text-align: center; width: 32px; font-size: .72rem; font-weight: 700; color: var(--grey-400); }
.col-pts  { text-align: center; font-family: var(--font-display); font-size: 1.05rem; }
.col-acc  { text-align: center; font-size: .74rem; color: var(--grey-600); }

/* Match prediction columns — pure white, light grey separator only */
.col-match { text-align: center; background: #f9f9f9 !important; border-left: 1px solid var(--grey-200); }
.leaderboard th.col-match { background: #f9f9f9 !important; color: var(--grey-700); border-left: 1px solid var(--grey-200); font-size: .58rem; }
.leaderboard th.col-match:first-of-type,
.leaderboard td.col-match:first-of-type { border-left: 2px solid var(--grey-300); }
.leaderboard tr.rank-1 td.col-match { background: #f9f9f9 !important; }

.match-col-header { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.match-col-flags  { display: flex; align-items: center; gap: 3px; }
.match-col-time   { font-size: .57rem; color: var(--grey-400); font-weight: 500; text-transform: none; letter-spacing: 0; }

/* Prediction pills */
.pred-pill { display: inline-block; font-size: .73rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: .1em .4em; border-radius: 4px; min-width: 34px; text-align: center; }
.pred-exact   { color: #fff;    background: #15803d; }   /* dark green = exact */
.pred-correct { color: #14532d; background: #bbf7d0; }   /* light green = right outcome */
.pred-wrong   { color: #991b1b; background: #fee2e2; }   /* red = wrong */
.pred-pending { color: #4b5563; background: #f3f4f6; }   /* grey = pending */

/* ═══════════════════════════════════════════
   MATCH CARDS
════════════════════════════════════════════ */
.matches-stack { display: flex; flex-direction: column; gap: .6rem; padding: .75rem; }
.matches-row   { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: .6rem; padding: .75rem; }

.fixture-card {
  background: #fff; border: 1px solid var(--grey-200);
  border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow-sm);
}
.fixture-top { display: flex; align-items: center; gap: .3rem; margin-bottom: .55rem; }
.fixture-meta { font-size: .66rem; color: var(--grey-400); margin-left: auto; }

.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .4rem; }
.team-block { display: flex; align-items: center; gap: .42rem; }
.team-block.away { flex-direction: row-reverse; text-align: right; }

.flag-img { width: 28px; height: 20px; object-fit: cover; border-radius: 2px; border: 1px solid var(--grey-200); flex-shrink: 0; }
.flag-img.sm { width: 17px; height: 12px; }

.team-name { font-size: .84rem; font-weight: 600; color: var(--grey-900); line-height: 1.2; }
.team-code { font-size: .67rem; color: var(--grey-400); }

.score-block { text-align: center; min-width: 48px; }
.score-display { font-family: var(--font-display); font-size: 1.45rem; color: var(--grey-900); letter-spacing: .06em; line-height: 1; }
.score-sep { color: var(--grey-400); }
.kickoff-time { font-size: .78rem; color: var(--grey-600); font-weight: 600; }
.venue-text { font-size: .67rem; color: var(--grey-400); text-align: center; margin-top: .22rem; }

/* ═══════════════════════════════════════════
   FIXTURES TOOLBAR
════════════════════════════════════════════ */
.fixtures-toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.search-box { padding: .55rem .75rem; border: 1px solid var(--grey-300); border-radius: var(--radius); font: inherit; font-size: .875rem; background: #fff; }
.search-box:focus { outline: 2px solid var(--maroon); border-color: var(--maroon); }
.show-all-toggle { display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--grey-700); cursor: pointer; white-space: nowrap; }
.show-all-toggle input { accent-color: var(--maroon); cursor: pointer; }
.day-group { margin-bottom: 1.1rem; }
.day-label { font-family: var(--font-display); font-size: 1rem; letter-spacing: .06em; color: var(--grey-700); margin-bottom: .45rem; padding-left: .1rem; }

/* ═══════════════════════════════════════════
   PREDICTIONS TAB
════════════════════════════════════════════ */
.compare-selectors { display: flex; gap: .6rem; margin-bottom: .75rem; flex-wrap: wrap; }
.compare-selectors select { flex: 1; min-width: 130px; padding: .55rem .65rem; border: 1px solid var(--grey-300); border-radius: var(--radius-sm); font: inherit; font-size: .85rem; background: #fff; }
.compare-table-container { position: relative; max-height: 70vh; overflow-y: auto; overflow-x: auto; border: 1px solid var(--grey-200); border-radius: var(--radius-sm); }
.compare-table-wrap { min-width: 500px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: .79rem; }
.compare-table thead th { padding: .42rem .6rem; font-size: .63rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--grey-600); border-bottom: 2px solid var(--grey-200); background: var(--grey-50); white-space: nowrap; position: sticky; top: 0; z-index: 3; }
.compare-table td { padding: .42rem .6rem; border-bottom: 1px solid var(--grey-100); }
.compare-table tr:hover td { background: var(--grey-50); }
.compare-table .stage-sep td { background: var(--grey-100); font-size: .65rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--grey-600); padding: .22rem .6rem; }

/* ═══════════════════════════════════════════
   KNOCKOUT
════════════════════════════════════════════ */
.bracket-rounds { display: flex; gap: .7rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.bracket-round { min-width: 135px; flex-shrink: 0; }
.bracket-round-title { font-family: var(--font-display); font-size: .88rem; letter-spacing: .05em; color: var(--grey-600); margin-bottom: .45rem; text-align: center; }
.bracket-match { background: #fff; border: 1px solid var(--grey-200); border-radius: var(--radius-sm); margin-bottom: .55rem; overflow: hidden; }
.bracket-team { display: flex; align-items: center; gap: .3rem; padding: .32rem .5rem; font-size: .75rem; font-weight: 500; }
.bracket-team:first-child { border-bottom: 1px solid var(--grey-100); }
.bracket-team.tbd { color: var(--grey-400); font-style: italic; }
.bracket-team.winner { font-weight: 700; background: #fefce8; }
.bracket-match-num { font-size: .56rem; color: var(--grey-400); padding: .14rem .5rem; background: var(--grey-50); border-top: 1px solid var(--grey-100); text-align: center; }

/* ═══════════════════════════════════════════
   ADMIN
════════════════════════════════════════════ */
.admin-banner { background: #fffbeb; border: 1px solid #f59e0b; border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: .85rem; font-size: .81rem; color: #92400e; }
.admin-gate { max-width: 360px; margin: 4rem auto; text-align: center; }
.admin-gate h2 { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: .06em; margin-bottom: 1rem; }
.form-row { display: flex; gap: .5rem; margin-bottom: .75rem; }
.form-row input { flex: 1; padding: .6rem .75rem; border: 1px solid var(--grey-300); border-radius: var(--radius-sm); font: inherit; font-size: .875rem; }
.btn { padding: .5rem .9rem; border-radius: var(--radius-sm); border: none; font: 600 .83rem/1 var(--font); cursor: pointer; transition: background .15s; }
.btn-primary { background: var(--maroon); color: #fff; }
.btn-primary:hover { background: var(--maroon-d); }
.btn-secondary { background: var(--grey-100); color: var(--grey-700); border: 1px solid var(--grey-300); }
.btn-save-server { background: #15803d; color: #fff; font-size: .88rem; padding: .6rem 1.2rem; border-radius: var(--radius); }
.btn-save-server:hover { background: #166534; }
.btn-save-server:disabled { background: var(--grey-400); cursor: wait; }
.btn-export { background: var(--maroon); color: #fff; font-size: .88rem; padding: .6rem 1.2rem; border-radius: var(--radius); }
.btn-export:hover { background: var(--maroon-d); }
.btn-screenshot { background: #1d4ed8; color: #fff; font-size: .88rem; padding: .6rem 1.2rem; border-radius: var(--radius); }
.btn-screenshot:hover { background: #1e3a8a; }
.btn-screenshot:disabled { background: var(--grey-400); cursor: wait; }
.admin-match-row { display: grid; grid-template-columns: 2.2rem 1fr auto auto auto auto; align-items: center; gap: .4rem; padding: .38rem .7rem; border-bottom: 1px solid var(--grey-100); font-size: .78rem; }
.admin-match-row:last-child { border-bottom: none; }
.score-input { width: 2.9rem; padding: .24rem .28rem; border: 1px solid var(--grey-300); border-radius: var(--radius-sm); font: 600 .8rem var(--font-mono); text-align: center; }
.final-toggle { display: flex; align-items: center; gap: .22rem; font-size: .7rem; color: var(--grey-600); cursor: pointer; }
.final-toggle input { cursor: pointer; accent-color: var(--maroon); }

/* ═══════════════════════════════════════════
   UTILITIES
════════════════════════════════════════════ */
.text-muted { color: var(--grey-400); }
.text-sm { font-size: .8rem; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-md { gap: .75rem; }
.empty-state { text-align: center; padding: 1.75rem 1rem; color: var(--grey-400); font-size: .88rem; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--grey-200); border-top-color: var(--maroon); border-radius: 50%; animation: spin .7s linear infinite; margin: 1.75rem auto; display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.chart-wrap { position: relative; height: 240px; }

/* ═══════════════════════════════════════════
   RESPONSIVE VISIBILITY
════════════════════════════════════════════ */
.desktop-only { display: table-cell; }
.mobile-only  { display: none; }

/* ═══════════════════════════════════════════
   MOBILE  (≤640px)
════════════════════════════════════════════ */
@media (max-width: 640px) {
  main { padding: .55rem; }
  .header-inner {
    grid-template-columns: 64px 1fr 86px;
    padding: .6rem .75rem .7rem;
    min-height: 88px; gap: .45rem;
  }
  .wc-logo { height: 54px; }
  .booth-logo { height: 50px; }
  .site-title { font-size: 1.3rem; }
  .mascots-img { height: 80px; }
  .header-brand { padding: .38rem .6rem .38rem .45rem; gap: .48rem; border-radius: 10px; }
  .leaderboard th, .leaderboard td { padding: .32rem .38rem; font-size: .73rem; }
  .desktop-only { display: none !important; }
  .mobile-only  { display: block; }
  tr .mobile-only { display: table-cell; }
  .matches-row { grid-template-columns: 1fr; }
  .compare-table-container { max-height: 60vh; }
  .summary-desktop-grid { display: block; }
  .summary-right { margin-top: .85rem; }
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--grey-100); }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 99px; }
