/* =========================================================
   World Cup Brazil 2027 - styles
   Light / dark themes via CSS variables on <html data-theme>
   ========================================================= */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1320px;

  /* Brazil palette (fixed) */
  --br-green: #009c3b;
  --br-yellow: #ffd60a;
  --br-blue: #1f4fd8;
}

/* ---------- Dark (default) ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #17223b;
  --surface-3: #1d2a49;
  --border: rgba(148, 163, 184, .16);
  --border-strong: rgba(148, 163, 184, .32);
  --text: #e8edf7;
  --text-2: #9aa7bf;
  --accent: #ffd60a;          /* highlights, selected tab */
  --on-accent: #10151f;
  --accent-text: #ffd60a;     /* accent used as text colour */
  --green: #34d27b;
  --green-soft: rgba(52, 210, 123, .12);
  --green-text: #4ade80;
  --link: #8ab4ff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --header-bg: rgba(17, 26, 46, .82);
  --map-bg: #1a2233;
  --pin-ring: #ffffff;
}

/* ---------- Light ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --surface-3: #e4e9f2;
  --border: rgba(15, 23, 42, .10);
  --border-strong: rgba(15, 23, 42, .22);
  --text: #0f172a;
  --text-2: #556178;
  --accent: #ffd60a;
  --on-accent: #10151f;
  --accent-text: #0b6b37;
  --green: #12a150;
  --green-soft: rgba(18, 161, 80, .10);
  --green-text: #0b7a3c;
  --link: #1d4ed8;
  --shadow: 0 8px 26px rgba(15, 23, 42, .10);
  --header-bg: rgba(255, 255, 255, .86);
  --map-bg: #e5e9f0;
  --pin-ring: #0f172a;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
  transition: background-color .25s ease, color .25s ease;
}
main { flex: 1 0 auto; width: 100%; padding-bottom: .75rem; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--link); }
[hidden] { display: none !important; }
.num, .gcard td, .si-capnum, .mini-matches .d, .bmeta { font-variant-numeric: tabular-nums; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; color: var(--on-accent); background: var(--accent); padding: .5rem 1rem; border-radius: 8px; z-index: 2000; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

h1, h2, h3, h4 { letter-spacing: -.02em; }
section { padding: 2rem 0 1rem; }
h2 { font-size: 1.6rem; font-weight: 750; margin: 0 0 .3rem; }
.note { color: var(--text-2); margin: 0 0 1.25rem; max-width: 52rem; }

/* ---------- Form controls ---------- */
select, input[type="search"], button { font: inherit; }
select, input[type="search"] {
  padding: .55rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); min-height: 2.5rem;
  transition: border-color .15s, box-shadow .15s;
}
select:hover, input[type="search"]:hover { border-color: var(--text-2); }
select:focus, input[type="search"]:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 25%, transparent); }
input::placeholder { color: var(--text-2); opacity: .8; }
input[type="checkbox"] { accent-color: var(--green); width: 1rem; height: 1rem; }
button { cursor: pointer; color: inherit; background: none; border: 0; padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; min-height: 2.5rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(.95); background: var(--accent); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 1000; padding: .8rem 0 1rem; background: linear-gradient(180deg, var(--bg) 70%, transparent); }
.header-card {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.25rem; flex-wrap: wrap;
  padding: .85rem 1.1rem; border-radius: 18px; border: 1px solid var(--border);
  background: var(--header-bg); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: var(--shadow);
}
.header-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--br-green) 0 40%, var(--br-yellow) 40% 70%, var(--br-blue) 70%);
}
.brand { display: flex; align-items: center; gap: .8rem; min-width: 0; color: inherit; text-decoration: none; border-radius: 12px; cursor: pointer; }
.brand:hover h1 { opacity: .9; }
.brand:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
.logo { display: block; width: 2.6rem; height: 2.6rem; flex: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.brand h1 { margin: 0; font-size: 1.35rem; font-weight: 800; line-height: 1.15; }
.brand h1 span { color: var(--accent-text); }
.eyebrow { margin: .15rem 0 0; font-size: .78rem; font-weight: 500; color: var(--text-2); }

.header-actions { display: flex; align-items: center; gap: .6rem; }
.tabs {
  display: flex; gap: .2rem; padding: .25rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tabs button {
  padding: .5rem 1.05rem; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--text-2);
  transition: background-color .15s, color .15s;
}
.tabs button:hover { color: var(--text); background: var(--surface-3); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }

.tz {
  display: flex; align-items: center; gap: .15rem; padding-left: .75rem; border-radius: 999px; height: 2.6rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: background-color .15s, border-color .15s;
}
.tz:hover { background: var(--surface-3); border-color: var(--border-strong); }
.tz:focus-within { border-color: var(--link); }
.tz svg { width: 1.05rem; height: 1.05rem; flex: none; }
.tz select {
  appearance: none; -webkit-appearance: none; background-color: transparent; border: 0; color: var(--text); min-height: 0;
  font-size: .85rem; font-weight: 600; padding: .5rem 1.6rem .5rem .4rem; max-width: 11.5rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 13px) 55%, calc(100% - 8px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.tz select:focus { outline: none; box-shadow: none; }
.tz-note { margin: -.6rem 0 1rem; font-size: .85rem; color: var(--text-2); }
.theme-toggle {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: background-color .15s, transform .15s;
}
.theme-toggle:hover { background: var(--surface-3); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }

/* ---------- Schedule ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem;
}
.filters label, .filters .field { display: flex; flex-direction: column; gap: .3rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }

.filters select, .filters input[type="search"] { min-width: 11rem; font-weight: 500; text-transform: none; letter-spacing: 0; }
.count { color: var(--text-2); font-size: .85rem; margin: .9rem 0 0; }

.day { margin-top: 1.6rem; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 .55rem .1rem; }
.day-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.day-head span { font-size: .78rem; color: var(--text-2); }
.rows { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.match {
  display: grid; grid-template-columns: 4.2rem minmax(0, 1.5fr) minmax(0, 1.2fr) auto; align-items: center; gap: .25rem 1rem;
  padding: .8rem 1.1rem; border-top: 1px solid var(--border);
  transition: background-color .15s;
}
.match:first-child { border-top: 0; }
.match:hover { background: var(--surface-2); }
.match.hl { --hl: var(--green); background: color-mix(in srgb, var(--hl) 14%, transparent); box-shadow: inset 3px 0 0 var(--hl); }
.has-hl .match:not(.hl) { opacity: .5; }
.has-hl .match:not(.hl):hover { opacity: .85; }
.match .num { font-size: .75rem; font-weight: 700; color: var(--text-2); letter-spacing: .04em; }
.match .teams { font-weight: 650; display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.match .teams .vs { color: var(--text-2); font-weight: 500; font-size: .85em; }
.match .tbd { color: var(--text-2); font-weight: 600; }
.match .where { font-size: .88rem; color: var(--text-2); min-width: 0; }
.match .where button { color: var(--link); font-weight: 600; }
.match .where button:hover { text-decoration: underline; }
.match .when { display: none; }
.tag {
  display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  padding: .25rem .6rem; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
}
.tag.ko { background: var(--green-soft); color: var(--green-text); }
.tag.final { background: var(--accent); color: var(--on-accent); }
.empty { padding: 2rem; text-align: center; color: var(--text-2); }

/* ---------- Groups ---------- */
.gnote { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1.1rem; margin-bottom: 1.1rem; }
.gnote p { margin: 0; font-size: .9rem; color: var(--text-2); }
.glegend { display: flex; flex-wrap: wrap; gap: .45rem 1.2rem; margin-top: .6rem !important; }
.glegend span { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; }
.gb {
  display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; margin-left: .45rem;
  font-style: normal; font-weight: 800; font-size: .68rem; color: #10151f;
}
.glegend .gb { margin-left: 0; }
.b1 { background: #ffd60a; } .b2 { background: #7cb3ff; } .b3 { background: #ffb259; } .bq { background: #4ade80; } .be { background: #ef4444; color: #fff; }

.groups-grid { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem .95rem 1rem; }
.gcard h3 { margin: 0 0 .5rem; font-size: 1.1rem; font-weight: 750; display: flex; align-items: center; gap: .55rem; }
.gcard h3::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; background: var(--dot, var(--accent)); flex: none; }
.gcard table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.gcard th { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); text-align: center; padding: .35rem .2rem; border-bottom: 1px solid var(--border-strong); }
.gcard td { padding: .6rem .2rem; text-align: center; border-bottom: 1px solid var(--border); color: var(--text-2); }
.gcard tr:last-child td { border-bottom: 0; }
.gcard .tl { text-align: left; }
.gcard td.rk { width: 1.4rem; font-size: .78rem; }
.gcard .tn { font-weight: 700; color: var(--text); }
.gcard .tbd { font-weight: 500; }
.gcard td.pts { font-weight: 800; color: var(--text); font-size: .95rem; }

/* ---------- Knockout bracket ---------- */
.bracket-scroll { overflow-x: auto; padding-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.bracket {
  --line2: var(--border-strong);
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 28px; width: 100%;
  grid-template-rows: auto repeat(4, clamp(76px, 12vh, 112px)) auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
}
@media (max-width: 1100px) { .bracket { min-width: 1100px; } }
@media (min-width: 1100px) { .bracket .bcard { font-size: clamp(.72rem, 1vw, .88rem); } .bracket .bmeta { font-size: clamp(.6rem, .8vw, .72rem); } }
.bhead {
  text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-2); border-bottom: 1px solid var(--border-strong); padding-bottom: .45rem; margin-bottom: .45rem;
}
.bm { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: stretch; }
.bm.c { align-items: center; }
.bcard { width: 100%; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; font-size: .8rem; }
.bcard.final { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bmeta { font-size: .66rem; color: var(--text-2); padding: .28rem .5rem; background: var(--surface-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bteam { padding: .32rem .5rem; font-weight: 600; }
.bteam + .bteam { border-top: 1px solid var(--border); }
.trophy { position: absolute; left: 0; right: 0; bottom: calc(50% + 42px); font-size: 1.8rem; text-align: center; }
.bm.bronze { margin-top: -4.5rem; }   /* sits closer to the Final */
.bm.bronze .bhead { width: 100%; }
/* connector lines (column gap is 28px: each side draws 14px) */
.bm.l::after, .bm.r::after { content: ""; position: absolute; width: 14px; border: 0 solid var(--line2); }
.bm.l::after { left: 100%; }
.bm.r::after { right: 100%; }
.bm.l.top::after { top: 50%; bottom: 0; border-top-width: 2px; border-right-width: 2px; }
.bm.l.bot::after { top: 0; bottom: 50%; border-bottom-width: 2px; border-right-width: 2px; }
.bm.r.top::after { top: 50%; bottom: 0; border-top-width: 2px; border-left-width: 2px; }
.bm.r.bot::after { top: 0; bottom: 50%; border-bottom-width: 2px; border-left-width: 2px; }
.bm.l.mid::after, .bm.r.mid::after { top: 50%; width: 28px; border-top-width: 2px; }
.bm.in::before { content: ""; position: absolute; top: 50%; width: 14px; border-top: 2px solid var(--line2); }
.bm.l.in::before { right: 100%; }
.bm.r.in::before { left: 100%; }

/* ---------- Map & stadiums ---------- */
.map-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 1rem; align-items: stretch; }
#stadium-map { height: calc(100vh - 255px); min-height: 480px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--map-bg); z-index: 1; }
.side {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem;
  height: calc(100vh - 255px); min-height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem;
}
.side.list-view { gap: .6rem; }
.side h3 { margin: 0; font-size: 1.2rem; font-weight: 750; }
.side h4 { margin: .5rem 0 0; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.side p { margin: 0; font-size: .92rem; }
.side .note { margin: 0; font-size: .9rem; }
.side .city { color: var(--green-text); font-weight: 650; }
.side dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; font-size: .9rem; }
.side dt { color: var(--text-2); }
.side dd { margin: 0; font-weight: 600; }
.roles { display: flex; flex-wrap: wrap; gap: .35rem; }
.side .actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .4rem; }
.side .actions a, .side .actions button {
  display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 600; text-decoration: none;
  padding: .5rem .85rem; min-height: 2.4rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
}
.side .actions button { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.side .actions a:hover { background: var(--surface-3); }
.linkbtn { align-self: flex-start; color: var(--link); font-weight: 600; font-size: .9rem; }
.linkbtn:hover { text-decoration: underline; }

.stad-list, .mini-matches { list-style: none; margin: 0; padding: 0; }
/* the stadium list stretches to the full height of the map, one even row per stadium */
.stad-list { flex: 1 1 auto; display: flex; flex-direction: column; gap: .45rem; min-height: 0; }
.stad-list li { flex: 1 1 0; min-height: 0; display: flex; }
.stad-list button.stad-item {
  width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .5rem .95rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: inset 3px 0 0 var(--green); transition: background-color .15s, box-shadow .15s;
}
.stad-list button.stad-item:hover { background: var(--surface-3); box-shadow: inset 3px 0 0 var(--accent); }
.si-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.si-city { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.si-name { font-weight: 500; font-size: .82rem; color: var(--text-2); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-go { color: var(--text-2); font-size: 1.5rem; line-height: 1; flex: none; transition: transform .15s, color .15s; }
.stad-list button.stad-item:hover .si-go { color: var(--accent-text); transform: translateX(2px); }.mini-matches { font-size: .85rem; }
.mini-matches li { display: flex; gap: .7rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.mini-matches .d { color: var(--text-2); min-width: 3.6rem; }

.rail-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem .8rem; display: flex; flex-direction: column; gap: .5rem; }
.rail-toggle { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 600; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .74rem; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.legend-item i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }

/* map pins and Leaflet theming */
.pin span {
  display: block; width: 22px; height: 22px; margin: 2px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--br-green); box-shadow: 0 0 0 2px var(--pin-ring), 0 2px 8px rgba(0, 0, 0, .45);
  transition: transform .15s, background-color .15s;
}
.pin:hover span, .pin.active span { background: #fff; transform: scale(1.25); }
.leaflet-container { background: var(--map-bg); font-family: var(--font); }
.leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--border); }
.leaflet-bar a:hover { background: var(--surface-3); }
.leaflet-bar { border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--text-2); }
.leaflet-control-attribution a { color: var(--link); }
.leaflet-tooltip { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow); font-weight: 600; }
.leaflet-tooltip::before { display: none; }
.pin-label { font-size: .74rem; padding: 2px 8px; }

/* ---------- Multi-team highlight menu ---------- */
.filters .field-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.team-field { position: relative; }
.select-like {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; min-width: 11rem; min-height: 2.5rem; text-align: left;
  padding: .55rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-weight: 500; font-size: .85rem; text-transform: none; letter-spacing: 0;
}
.select-like::after { content: ""; width: .45rem; height: .45rem; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg) translateY(-2px); flex: none; }
.select-like:hover { border-color: var(--text-2); }
.select-like[aria-expanded="true"] { border-color: var(--link); }
.team-pop {
  position: absolute; z-index: 1500; top: calc(100% + .35rem); left: 0; min-width: 14rem; max-height: 18rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .35rem;
}
.pop-item { display: flex !important; flex-direction: row !important; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 8px; cursor: pointer;
  font-size: .9rem !important; font-weight: 500 !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; }
.pop-item:hover { background: var(--surface-2); }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; border: 1px solid var(--border-strong); flex: none; }
.pop-clear { width: 100%; margin-top: .25rem; padding: .5rem; border-top: 1px solid var(--border); color: var(--link); font-size: .85rem; font-weight: 600; text-align: center; }
.pop-clear:hover { text-decoration: underline; }
.pop-empty { margin: 0; padding: .6rem; font-size: .85rem; color: var(--text-2); }
.chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .35rem .25rem .65rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: .82rem; font-weight: 600; }
.chip .swatch { border: 0; }
.chip-x { display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; color: var(--text-2); font-size: 1rem; line-height: 1; }
.chip-x:hover { background: var(--surface-3); color: var(--text); }
@media (max-width: 700px) { .team-field { flex: 1 1 100%; } .select-like { width: 100%; font-size: 16px; } .team-pop { right: 0; } }
/* base map switcher + dark treatment for the Streets map */
.basemap-switch {
  display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.basemap-switch button {
  padding: .35rem .8rem; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--text-2); font-family: var(--font);
  transition: background-color .15s, color .15s;
}
.basemap-switch button:hover { color: var(--text); background: var(--surface-3); }
.basemap-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
:root[data-theme="dark"] #stadium-map[data-base="satellite"] .leaflet-tile-pane { filter: brightness(.85); }
.leaflet-pane.leaflet-mapLabels-pane { pointer-events: none; }
/* ---------- Footer ---------- */
footer { margin-top: auto; padding: .75rem 0 1.1rem; color: var(--text-2); font-size: .75rem; text-align: center; }
footer p { margin: 0; }
footer a { color: var(--link); }

/* ---------- Tablet ---------- */
@media (max-width: 1180px) { .groups-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  #stadium-map { height: 55vh; min-height: 320px; }
  .side, .side.list-view { height: auto; min-height: 0; }
  .stad-list li { flex: none; }
  .stad-list button.stad-item { min-height: 3.4rem; }
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .hide-sm { display: none; }
  .wrap { padding: 0 .85rem; }
  section { padding: 1.4rem 0 .75rem; }
  h2 { font-size: 1.35rem; }
  .site-header { position: static; padding: .6rem 0 .8rem; background: none; }
  .header-card { padding: .75rem .85rem; gap: .6rem; border-radius: 16px; }
  .brand { gap: .6rem; flex: 1 1 100%; }
  .logo { width: 2.3rem; height: 2.3rem; }
  .brand h1 { font-size: 1.2rem; }
  .eyebrow { font-size: .68rem; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .tabs { flex: 1 1 100%; justify-content: space-between; }
  .tz { flex: 1 1 auto; }
  .tz select { max-width: none; width: 100%; font-size: 16px; }
  .tabs button { flex: 1 1 0; padding: .5rem .2rem; font-size: .82rem; text-align: center; }

  select, input[type="search"] { font-size: 16px; }   /* stops iOS zooming into fields */
  .filters { gap: .6rem; padding: .8rem; }
  .filters label { flex: 1 1 100%; }
  .filters select, .filters input[type="search"] { width: 100%; min-width: 0; }
  .filters #f-reset { flex: none; }

  .match { grid-template-columns: 1fr auto; grid-template-areas: "num tag" "teams teams" "where where"; padding: .75rem .9rem; gap: .2rem .6rem; }
  .match .num { grid-area: num; }
  .match .tag { grid-area: tag; }
  .match .teams { grid-area: teams; font-size: 1rem; }
  .match .where { grid-area: where; font-size: .82rem; }

  .groups-grid { grid-template-columns: 1fr; gap: .75rem; }
  .gnote { padding: .7rem .85rem; }
  .gnote p { font-size: .82rem; }

  #knockout .note::after { content: ' Swipe sideways to see the whole bracket.'; }
  .bracket { padding: .75rem; }

  .side { padding: .9rem; }
  #stadium-map { order: -1; }   /* map first, details below */
  .pin-label { font-size: .68rem; padding: 0 5px; }
  footer { padding: .6rem .85rem 1rem; }
}
@media (max-width: 400px) { .eyebrow { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
