  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #0a0f1e; --bg2: #111827; --bg3: #1a2235; --bg4: #222d42;
    --card: #161d30; --border: rgba(255,255,255,0.07); --border2: rgba(255,255,255,0.14);
    --gold: #f5a623; --gold2: #e8941a; --green: #22c55e; --blue: #60a5fa;
    --red: #f87171; --text: #f1f5f9; --muted: #94a3b8; --muted2: #64748b;
    --radius: 10px; --radius-lg: 14px;
  }
  body { font-family: 'Barlow', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 15px; line-height: 1.5; }

  /* HEADER */
  header {
    background: #0d1426; border-bottom: 1px solid rgba(245,166,35,0.25);
    padding: 0 1.25rem; position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; gap: 1rem; height: 60px;
  }
  .logo { font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; color: var(--gold); letter-spacing: 2px; white-space: nowrap; }
  .logo span { color: var(--text); }
  .header-stats { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
  .stat-pill { font-size: 12px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 5px; }
  .stat-pill b { color: var(--text); font-weight: 600; }
  .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.5s ease-in-out infinite; flex-shrink: 0; }
  @keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(0.75)} }

  /* LAYOUT */
  .layout { display: grid; grid-template-columns: 272px 1fr; min-height: calc(100vh - 60px); }

  /* SIDEBAR */
  aside { background: var(--bg2); border-right: 1px solid var(--border); padding: 1rem; overflow-y: auto; position: sticky; top: 60px; height: calc(100vh - 60px); }
  .sidebar-title { font-family: 'Bebas Neue', sans-serif; font-size: 0.95rem; letter-spacing: 2px; color: var(--gold); margin-bottom: 0.6rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--border); }
  .fav-count { font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 0.6rem; }
  .fav-count b { color: var(--gold); }
  .sidebar-actions { display: flex; gap: 5px; margin-bottom: 0.75rem; }
  .btn-sm { flex: 1; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border2); background: transparent; color: var(--muted); font-family: 'Barlow', sans-serif; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
  .btn-sm:hover { background: var(--bg3); color: var(--text); }
  .btn-sm.primary { background: var(--gold); color: #0a0f1e; border-color: var(--gold); font-weight: 600; }
  .btn-sm.primary:hover { background: var(--gold2); }
  .group-label { font-size: 10px; font-weight: 600; letter-spacing: 1.5px; color: var(--muted2); text-transform: uppercase; padding: 5px 3px 2px; }
  .team-grid { display: flex; flex-direction: column; gap: 2px; margin-bottom: 1rem; }
  .team-btn { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-family: 'Barlow', sans-serif; font-size: 13px; font-weight: 500; text-align: left; transition: all 0.12s; width: 100%; }
  .team-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
  .team-btn.selected { background: rgba(245,166,35,0.1); color: var(--gold); border-color: rgba(245,166,35,0.35); }
  .team-flag { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
  .team-name { flex: 1; line-height: 1.2; }
  .team-check { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid var(--border2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.12s; font-size: 9px; }
  .team-btn.selected .team-check { background: var(--gold); border-color: var(--gold); color: #0a0f1e; font-weight: 700; }
  .team-btn.selected .team-check::after { content: '✓'; }

  /* SIDEBAR SEARCH */
  .sidebar-search-wrap { position: relative; margin-bottom: 0.5rem; }
  .sidebar-search { width: 100%; padding: 6px 10px 6px 30px; border-radius: 7px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text); font-family: 'Barlow', sans-serif; font-size: 13px; outline: none; transition: border-color 0.15s; }
  .sidebar-search:focus { border-color: var(--gold); }
  .sidebar-search::placeholder { color: var(--muted2); }
  .sidebar-search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted2); pointer-events: none; }

  /* API STATUS */
  .api-status { font-size: 11px; padding: 6px 8px; border-radius: 6px; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 6px; }
  .api-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted2); flex-shrink: 0; }
  .api-status.ok .dot { background: var(--green); }
  .api-status.err .dot { background: var(--red); }
  .api-status.loading .dot { background: var(--gold); animation: pulse 1s infinite; }

  /* MATCH MODAL */
  .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
  .modal-backdrop.open { opacity: 1; pointer-events: all; }
  .modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: 18px; width: 100%; max-width: 420px; padding: 1.5rem; transform: translateY(12px) scale(0.97); transition: transform 0.22s; }
  .modal-backdrop.open .modal { transform: translateY(0) scale(1); }
  .modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; gap: 8px; }
  .modal-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.05rem; letter-spacing: 1.5px; color: var(--gold); line-height: 1.2; }
  .modal-subtitle { font-size: 12px; color: var(--muted2); margin-top: 2px; }
  .modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 2px 4px; border-radius: 4px; transition: color 0.15s, background 0.15s; flex-shrink: 0; }
  .modal-close:hover { color: var(--text); background: var(--bg3); }
  .modal-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
  .modal-score-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 1.25rem; }
  .modal-team-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
  .modal-team-flag { font-size: 2.2rem; line-height: 1; }
  .modal-team-name { font-size: 13px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.2; }
  .modal-score-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .modal-score { font-family: 'Bebas Neue', sans-serif; font-size: 2.4rem; color: var(--text); line-height: 1; }
  .modal-score.tbd { color: var(--muted2); font-size: 1.6rem; }
  .modal-section-label { font-size: 10px; font-weight: 600; letter-spacing: 1.5px; color: var(--muted2); text-transform: uppercase; margin-bottom: 0.5rem; }
  .modal-team-rows { display: flex; flex-direction: column; gap: 6px; }
  .modal-team-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg3); transition: border-color 0.15s; }
  .modal-team-row.is-fav { border-color: rgba(245,166,35,0.45); background: rgba(245,166,35,0.06); }
  .modal-team-row-flag { font-size: 1.4rem; flex-shrink: 0; }
  .modal-team-row-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); }
  .modal-team-row-group { font-size: 11px; color: var(--muted2); }
  .fav-toggle { padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border2); background: transparent; color: var(--muted); font-family: 'Barlow', sans-serif; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
  .fav-toggle:hover { background: var(--bg4); color: var(--text); }
  .fav-toggle.active { background: rgba(245,166,35,0.15); color: var(--gold); border-color: rgba(245,166,35,0.4); }
  .fav-toggle.active:hover { background: rgba(245,166,35,0.25); }

  /* MAIN */
  main { padding: 1.25rem; overflow-y: auto; }

  /* CONTROLS */
  .controls { display: flex; align-items: center; gap: 8px; margin-bottom: 1.25rem; flex-wrap: wrap; }
  .view-tabs { display: flex; background: var(--bg2); border-radius: 7px; padding: 3px; border: 1px solid var(--border); }
  .view-tab { padding: 4px 12px; border-radius: 4px; border: none; background: transparent; color: var(--muted); font-family: 'Barlow', sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.12s; }
  .view-tab.active { background: var(--gold); color: #0a0f1e; font-weight: 600; }
  .filter-select, .search-box { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border2); background: var(--bg2); color: var(--text); font-family: 'Barlow', sans-serif; font-size: 13px; }
  .search-box { width: 170px; }
  .search-box::placeholder { color: var(--muted2); }
  .filter-select option { background: var(--bg2); }
  .result-count { margin-left: auto; font-size: 12px; color: var(--muted); }
  .result-count b { color: var(--text); }
  .refresh-btn { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border2); background: transparent; color: var(--muted); font-family: 'Barlow', sans-serif; font-size: 12px; cursor: pointer; transition: all 0.15s; }
  .refresh-btn:hover { background: var(--bg3); color: var(--text); }

  /* ROUNDS */
  .round-group { margin-bottom: 1.5rem; }
  .round-header { font-family: 'Bebas Neue', sans-serif; font-size: 1rem; letter-spacing: 2px; color: var(--muted); margin-bottom: 0.6rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
  .round-count { font-family: 'Barlow', sans-serif; font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--muted2); }

  /* MATCH CARDS */
  .matches-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 9px; }
  .match-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; transition: border-color 0.2s, transform 0.15s; position: relative; }
  .match-card:hover { border-color: var(--border2); transform: translateY(-1px); }
  .match-card.favorite { border-color: rgba(245,166,35,0.45); background: linear-gradient(135deg, rgba(245,166,35,0.05) 0%, var(--card) 100%); }
  .match-card.favorite::after { content: '★'; position: absolute; top: 9px; right: 11px; font-size: 11px; color: var(--gold); }
  .match-meta { display: flex; align-items: center; gap: 5px; margin-bottom: 9px; }
  .match-date { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
  .match-badge { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.3px; }
  .match-badge.group { background: rgba(96,165,250,0.13); color: var(--blue); }
  .match-badge.knockout { background: rgba(245,166,35,0.13); color: var(--gold); }
  .match-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; margin-bottom: 9px; }
  .team-side { display: flex; flex-direction: column; gap: 2px; }
  .team-side.right { align-items: flex-end; text-align: right; }
  .team-emoji { font-size: 17px; line-height: 1; }
  .team-label { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.25; }
  .score-block { display: flex; align-items: center; justify-content: center; gap: 3px; }
  .score-num { font-family: 'Bebas Neue', sans-serif; font-size: 1.75rem; color: var(--text); line-height: 1; min-width: 22px; text-align: center; }
  .score-dash { font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem; color: var(--muted2); }
  .score-block.tbd .score-num { color: var(--muted2); font-size: 1.1rem; }
  .match-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
  .venue-info { font-size: 11px; color: var(--muted2); }
  .match-time { font-size: 11px; color: var(--muted); font-weight: 500; }
  .status-badge { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.5px; text-transform: uppercase; }
  .status-badge.live { background: rgba(34,197,94,0.14); color: var(--green); animation: pulse 1.5s infinite; }
  .status-badge.ft { background: rgba(100,116,139,0.18); color: var(--muted); }
  .status-badge.today { background: rgba(245,166,35,0.14); color: var(--gold); }
  .status-badge.soon { background: rgba(96,165,250,0.12); color: var(--blue); }

  /* EMPTY STATE */
  .empty-state { text-align: center; padding: 3.5rem 2rem; color: var(--muted2); }
  .empty-state .big { font-size: 2.5rem; margin-bottom: 0.75rem; }
  .empty-state h3 { font-size: 1rem; color: var(--muted); margin-bottom: 0.4rem; }
  .empty-state p { font-size: 13px; max-width: 300px; margin: 0 auto; }

  /* COOKIE TOAST */
  .toast { position: fixed; bottom: 1rem; right: 1rem; background: var(--bg3); border: 1px solid rgba(245,166,35,0.35); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; z-index: 500; opacity: 0; transform: translateY(8px); transition: all 0.25s; pointer-events: none; }
  .toast.show { opacity: 1; transform: translateY(0); }

  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: var(--bg2); }
  ::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

  @media (max-width: 720px) {
    .layout { grid-template-columns: 1fr; }
    aside { position: static; height: auto; max-height: 280px; }
    .header-stats { display: none; }
    .matches-grid { grid-template-columns: 1fr; }
  }

  /* ── HEADER: left group for hamburger + logo ─────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── HAMBURGER BUTTON ────────────────────────────────────────────────────── */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.hamburger:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

/* Animate to X when active */
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── LAYOUT: sidebar off-canvas ──────────────────────────────────────────── */
.layout {
  display: block; /* main takes full width now */
  position: relative;
}

/* The sidebar is always off-canvas, slides in on .open */
aside#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 88vw;
  height: 100dvh;
  z-index: 200;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* keep your existing sidebar background/border styles */
}

aside#sidebar.open {
  transform: translateX(0);
  box-shadow: 4px 0 32px rgba(0,0,0,0.5);
}

/* Close button inside sidebar */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 0;
}

.sidebar-header .sidebar-title {
  /* override any existing margin/padding so it sits in the flex row */
  margin: 0;
  padding: 0;
}

.sidebar-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px 8px;
  border-radius: 6px;
  transition: opacity 0.15s, background 0.15s;
}

.sidebar-close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}

/* ── OVERLAY ─────────────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ── MAIN takes full width ───────────────────────────────────────────────── */
main {
  width: 100%;
  max-width: 100%;
}

/* ── TEAM LIST: scrollable area inside sidebar ───────────────────────────── */
#team-list {
  overflow-y: auto;
  /* removes any padding that caused the gap when groups were hidden */
  padding-top: 0;
}

/* Ensure group-label + grid collapse cleanly with no leftover margin */
.group-label {
  /* keep your existing styles; just make sure margin-top doesn't bleed */
  margin-top: 0;
}

.team-grid {
  /* no extra top padding that would show when label is hidden */
  padding-top: 0;
}

aside#sidebar {
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: 100dvh !important;
}

.about-link {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: color 0.2s;
}
.about-link:hover { color: rgba(255,255,255,0.9); }

  /* Footer note */
  .about-footer-note {
    font-family: 'Barlow', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.3);
    line-height: 1.6;
    text-align: center;
  }

  .about-footer-note a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    transition: color 0.2s;
  }
  .about-footer-note a:hover { color: rgba(255,255,255,0.8); }

  .match-goals {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 14px 10px;
  font-size: 12px;
  color: var(--text-muted, #888);
}
.goals-col.right { text-align: right; }
.goal-entry { line-height: 1.5; white-space: nowrap; }
.goal-min { opacity: 0.7; }