/* ── World Cup 2026 — Custom Styles ───────────────────────────────────────── */

:root {
  --c-bg:        #060d18;
  --c-surface:   #0d1a2d;
  --c-surface2:  #112035;
  --c-border:    #1a2e4a;
  --c-text:      #c9d8ed;
  --c-muted:     #4a6a8a;
  --c-accent:    #22c55e;
  --c-live:      #ef4444;
  --c-gold:      #f59e0b;
}

/* ── Light mode overrides ─────────────────────────────────────────────────── */
html.light {
  --c-bg:      #f0f5f9;
  --c-surface: #ffffff;
  --c-surface2:#e8f0f7;
  --c-border:  #c8d8e8;
  --c-text:    #1a2b3c;
  --c-muted:   #547080;
}
html.light body { background: var(--c-bg); color: var(--c-text); }
html.light .navbar { background: rgba(240,245,249,.95); }
html.light .modal-box { background: #fff; }
html.light .score { color: #1a2b3c; }
html.light .match-card:hover { border-color: #94b8d4; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

/* ── Live badge ───────────────────────────────────────────────────────────── */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--c-live);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-live::before {
  content: '';
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(0.6); }
}

/* ── Match card ───────────────────────────────────────────────────────────── */
.match-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  transition: border-color .2s, transform .15s;
  cursor: pointer;
}

.match-card:hover {
  border-color: #2a4a70;
  transform: translateY(-1px);
}

.match-card.is-live {
  border-color: rgba(239,68,68,.5);
  box-shadow: 0 0 20px rgba(239,68,68,.12);
}

.match-card.is-finished { opacity: .85; }

/* ── Score display ────────────────────────────────────────────────────────── */
.score {
  font-size: 1.75rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  min-width: 3.5rem;
  text-align: center;
}

.score.vs {
  font-size: 1rem;
  color: var(--c-muted);
  font-weight: 600;
}

/* ── Team display ─────────────────────────────────────────────────────────── */
.team-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.team-flag { font-size: 2rem; line-height: 1; }
.team-crest { width: 40px; height: 40px; object-fit: contain; }

/* ── Emoji flag font fix (Chrome on Windows) ─────────────────────────────── */
.emoji-flag,
.team-flag {
  font-family: "Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji",
               "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  display: inline-block;
}

.team-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-text);
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Group filter bar ────────────────────────────────────────────────────── */
.grp-filter-btn {
  padding: .3rem .75rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.grp-filter-btn:hover { background: var(--c-border); color: var(--c-text); }
.grp-filter-btn.active { background: var(--c-accent); border-color: var(--c-accent); color: #000; }

/* ── Theme toggle button ─────────────────────────────────────────────────── */
#theme-toggle {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  border-radius: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
#theme-toggle:hover { background: var(--c-border); color: var(--c-text); }

/* ── Favourite star SVG button ───────────────────────────────────────────── */
.fav-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  line-height: 1;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform .15s;
}
.fav-star-btn:hover  { transform: scale(1.2); }
.fav-star-btn.active { animation: star-pop .35s ease; }

@keyframes star-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45) rotate(-12deg); }
  70%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}

/* ── Favourite match card highlight ─────────────────────────────────────── */
.match-card.fav-match {
  border-color: rgba(245,158,11,.5);
  box-shadow: 0 0 16px rgba(245,158,11,.08);
}
.fav-match-label {
  display: inline;
  color: var(--c-gold);
  font-weight: 700;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ── Group card ──────────────────────────────────────────────────────────── */
.group-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  overflow: hidden;
}

.group-header {
  background: var(--c-surface2);
  padding: .5rem 1rem;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-muted);
}

/* ── Tab buttons ─────────────────────────────────────────────────────────── */
.tab-btn {
  padding: .45rem 1.1rem;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--c-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tab-btn:hover   { background: var(--c-surface2); color: var(--c-text); }
.tab-btn.active  { background: var(--c-accent); color: #000; }
.tab-btn.has-live { position: relative; }
.tab-btn.has-live::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  background: var(--c-live);
  border-radius: 50%;
  animation: pulse-dot 1.2s infinite;
}

/* ── Event list ──────────────────────────────────────────────────────────── */
.event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: .78rem;
}

.event-item .min { color: var(--c-muted); min-width: 30px; text-align: right; font-size: .7rem; }
.event-item .icon { font-size: .9rem; }
.event-item .player { color: var(--c-text); }
.event-item .assist { color: var(--c-muted); font-size: .72rem; }

/* ── TV badges ───────────────────────────────────────────────────────────── */
.tv-badge {
  display: inline-flex;
  align-items: center;
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: .02em;
  margin-right: 3px;
}

/* ── Timezone selector ────────────────────────────────────────────────────── */
.tz-select {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-radius: 8px;
  padding: .3rem .7rem;
  font-size: .8rem;
  cursor: pointer;
  outline: none;
}
.tz-select:focus { border-color: var(--c-accent); }

/* ── Bracket ─────────────────────────────────────────────────────────────── */
.bracket-container {
  overflow-x: auto;
  padding-bottom: 1rem;
}

.bracket-round { min-width: 160px; }

.bracket-match {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.bracket-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem .75rem;
  font-size: .78rem;
  font-weight: 600;
}
.bracket-team:first-child { border-bottom: 1px solid var(--c-border); }
.bracket-team.winner { color: var(--c-accent); }

/* ── Shimmer loading ─────────────────────────────────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, var(--c-surface) 25%, var(--c-surface2) 50%, var(--c-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Hero section ────────────────────────────────────────────────────────── */
.hero-match {
  background: linear-gradient(135deg, #071525 0%, #0d2a45 50%, #071525 100%);
  border: 1px solid #1a3a5c;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero-match::before {
  content: '⚽';
  position: absolute;
  font-size: 12rem;
  opacity: .04;
  right: -2rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ── Section headers ─────────────────────────────────────────────────────── */
.section-title {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: .75rem;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
  background: rgba(6,13,24,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer-link {
  color: var(--c-accent);
  font-weight: 600;
  text-decoration: none;
}
.footer-link:hover { text-decoration: underline; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 18px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .score { font-size: 1.4rem; }
  .team-flag { font-size: 1.6rem; }
  .team-name { max-width: 70px; font-size: .7rem; }
}

/* ── Scorers table ───────────────────────────────────────────────────────── */
.scorers-table { width: 100%; border-collapse: collapse; }
.scorers-table th {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
}
.scorers-table td {
  padding: 10px 12px;
  font-size: .85rem;
  color: var(--c-text);
  border-bottom: 1px solid rgba(26,46,74,.4);
}
.scorers-table tr:last-child td { border-bottom: none; }
.scorers-table tr:hover td { background: rgba(255,255,255,.025); }
.scorers-table tr.top-scorer td { background: rgba(245,158,11,.06); }
.scorers-table tr.top-scorer td:last-child { color: var(--c-gold); }

/* ── TV badge links ──────────────────────────────────────────────────────── */
a .tv-badge           { text-decoration: none; }
a:hover .tv-badge     { filter: brightness(1.3); opacity: .9; }

/* ── Animated gradient text ──────────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(90deg, #22c55e, #3b82f6, #f59e0b, #22c55e);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 4s linear infinite;
}
@keyframes gradient-shift { 0%{background-position:0%} 100%{background-position:300%} }
