/* ============================================================
   World Cup 26 — design system v2
   One typeface (Archivo variable: expanded display, condensed
   labels), one accent (gold), flat surfaces, hairlines.
   ============================================================ */

@font-face {
  font-family: 'Archivo';
  src: url('../assets/fonts/Archivo-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-stretch: 62.5% 125%;
  font-display: swap;
}

:root {
  --bg: #0a0d0a;
  --surface: #10140f;
  --surface-2: #161b14;
  --hairline: rgba(235, 245, 230, 0.09);
  --hairline-strong: rgba(235, 245, 230, 0.16);
  --text: #f2f5ef;
  --text-2: rgba(242, 245, 239, 0.64);
  --text-3: rgba(242, 245, 239, 0.38);
  --accent: #ffc700;
  --accent-dim: rgba(255, 199, 0, 0.14);
  --live: #ff4d52;
  --ok: #34d27b;
  --font: 'Archivo', system-ui, sans-serif;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);      /* out-quad  */
  --ease-strong: cubic-bezier(0.23, 1, 0.32, 1);      /* out-quint */
  --ease-move: cubic-bezier(0.645, 0.045, 0.355, 1);  /* in-out-cubic */

  --r-card: 12px;
  --r-chip: 8px;
}

/* condensed overline / expanded display voices of the same family */
.ov, .d-dow, .stage-tag, .tz-help, .status-badge, .hb-label, .bnode-meta,
.bracket-col-title, .group-table th, .md-top, .md-poss-label, .stat-row .sl,
.md-ft, .day-meta, .today-tag, .md-section-title {
  font-stretch: 78%;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* faint grain — texture without gradients */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

.pitch-bg { display: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; color: inherit; }
button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(10, 13, 10, 0.82);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--hairline);
}

.wordmark { display: inline-flex; align-items: baseline; text-decoration: none; }
.wordmark:hover { text-decoration: none; }
.wordmark-ball { display: none; }
.wordmark-text {
  font-stretch: 125%;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: uppercase;
}
.wordmark-text em { font-style: normal; color: var(--accent); margin-left: 1px; }

.topbar-actions { display: inline-flex; align-items: center; gap: 14px; }

.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.3;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
@media (hover: hover) { .fav-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); } }
.fav-btn:active { transform: scale(0.97); }
.fav-btn.has-fav { color: var(--text); }

.tz-control { display: inline-flex; align-items: center; gap: 12px; }
.tz-help {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
}
/* opens the timezone modal; shows the current zone abbr(s) */
.tz-edit {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.3;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
@media (hover: hover) { .tz-edit:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); } }
.tz-edit:active { transform: scale(0.97); }

.tz-toggle[hidden] { display: none; }
.tz-toggle {
  position: relative;
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--surface);
}
.tz-toggle button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1.3;
  color: var(--text-2);
  cursor: pointer;
  transition: color 150ms ease;
}
.tz-toggle button[aria-pressed='true'] { color: #161200; }
.tz-toggle-pill {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: transform 220ms var(--ease-strong), width 220ms var(--ease-strong);
}

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: clamp(36px, 6vw, 60px) 20px 0;
}
.hero-title {
  margin: 0;
  font-stretch: 125%;
  font-weight: 900;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.hero-year { color: var(--accent); }
.hero-sub {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-stretch: 78%;
}
.hero-sub strong { color: var(--text-2); font-weight: 700; }

/* next favorite-team band — flat, hairline-framed */
.hero-fav[hidden] { display: none; }
.hero-fav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 20px;
  max-width: 720px;
  margin: 28px auto 0;
  padding: 14px 24px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}
.hb-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-fav.is-live .hb-label { color: var(--live); }
.hb-match { font-weight: 800; font-size: 14px; }
.hb-when { color: var(--text-2); font-variant-numeric: tabular-nums; }
.hb-rel {
  font-weight: 750;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: var(--r-chip);
  padding: 2px 9px;
  font-size: 12px;
}

/* ---------- tabs: sliding underline ---------- */
.tabs {
  position: sticky;
  top: 56px;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 28px);
  margin: 28px auto 0;
  padding: 0 16px;
  max-width: 1060px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(10, 13, 10, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-pill {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: transform 220ms var(--ease-strong), width 220ms var(--ease-strong);
}
.tab {
  border: 0;
  background: transparent;
  padding: 13px 2px 12px;
  font-size: 12px;
  font-weight: 750;
  font-stretch: 78%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--text-3);
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); }

/* ---------- views ---------- */
main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 28px) 72px;
}
.view { display: none; }
.view.is-active { display: block; animation: viewIn 180ms var(--ease) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .view.is-active { animation: none; } }

.section-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin: 36px 0 16px;
}
.section-heading:first-child { margin-top: 8px; }
.section-heading h2 {
  margin: 0;
  font-stretch: 125%;
  font-weight: 850;
  font-size: clamp(18px, 3vw, 22px);
  text-transform: uppercase;
  letter-spacing: 0;
}
.section-heading .sub { color: var(--text-3); font-size: 12px; font-weight: 600; }

.empty-note {
  margin: 20px 0 8px;
  padding: 28px;
  border-radius: var(--r-card);
  border: 1px dashed var(--hairline-strong);
  color: var(--text-2);
  text-align: center;
  font-size: 13px;
}

/* entrance for list items / cards — applied only on user-initiated renders
   (.anim on the view container); background refreshes re-render without it */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.anim .match-row, .anim .match-card, .anim .group-card {
  animation: riseIn 240ms var(--ease-strong) backwards;
}
@media (prefers-reduced-motion: reduce) {
  .anim .match-row, .anim .match-card, .anim .group-card { animation: none; }
}

/* placeholder "flag" chip for unknown teams (2A, W74, …) */
.flag-ph {
  display: inline-grid;
  place-items: center;
  justify-self: start;
  min-width: 30px;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px dashed var(--hairline-strong);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-3);
  white-space: nowrap;
  font-stretch: 78%;
}

/* ---------- big match cards (Today) — broadcast scoreboard ---------- */
/* the Today view is a centered stage */
#view-today .section-heading { justify-content: center; text-align: center; }
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 400px));
  justify-content: center;
  gap: 12px;
}
.match-card {
  position: relative;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  background: var(--surface);
  padding: 14px 18px 0;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .match-card:hover { border-color: var(--hairline-strong); transform: translateY(-2px); }
}
.match-card:active { transform: scale(0.99); }
/* live match: a slow breathing glow draws the eye without shouting */
.match-card.is-live { border-color: rgba(255, 77, 82, 0.3); }
.match-card.is-live::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    0 0 30px -8px rgba(255, 77, 82, 0.45),
    inset 0 1px 14px -10px rgba(255, 77, 82, 0.6);
  animation: liveBreath 2.8s ease-in-out infinite;
}
@keyframes liveBreath {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .match-card.is-live::after { animation: none; opacity: 0.5; }
}

/* favorite-team accent: a short bar inset from the rounded corners */
.match-card.is-fav::before,
.group-card.is-fav::before,
.bnode.is-fav::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.mc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-stretch: 78%;
}
.mc-stage .num { font-weight: 600; opacity: 0.7; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-chip);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}
.status-badge.upcoming { background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.status-badge.soon { background: var(--accent-dim); color: var(--accent); }
.status-badge.live { background: rgba(255, 77, 82, 0.13); color: var(--live); }
.status-badge.ft { background: rgba(52, 210, 123, 0.12); color: var(--ok); }
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* symmetric scoreboard: flag/name | score | flag/name */
.mc-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  padding-bottom: 16px;
}
.mc-side {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
  min-width: 0;
}
.mc-side .flag { font-size: 38px; line-height: 1; }
.mc-side .flag-ph { font-size: 11px; height: 24px; min-width: 38px; justify-self: center; }
.mc-side .nm {
  font-weight: 750;
  font-size: 13.5px;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc-side .code { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--text-3); margin-top: 1px; }
.mc-side.placeholder .nm { color: var(--text-2); font-weight: 600; font-size: 12px; white-space: normal; }
.mc-side.winner .nm { color: var(--accent); }

.mc-mid {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding-top: 4px;
  min-width: 86px;
}
.mc-score-line {
  font-stretch: 125%;
  font-weight: 900;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.mc-score-line.dim { color: var(--text-3); font-size: 20px; padding-top: 7px; }
.mc-minute { font-size: 11px; font-weight: 800; color: var(--live); font-variant-numeric: tabular-nums; }

.mc-bottom {
  display: grid;
  justify-items: center;
  gap: 1px;
  margin: 0 -18px;
  padding: 9px 18px 10px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.mc-times { font-weight: 700; white-space: nowrap; }
.mc-times .t-secondary { color: var(--accent); }
.mc-times .dot-sep { color: var(--text-3); margin: 0 6px; }
.mc-venue {
  color: var(--text-3);
  font-weight: 600;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ---------- matches: editorial list ---------- */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 0 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--hairline);
}
.chip {
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r-chip);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
@media (hover: hover) { .chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); } }
.chip:active { transform: scale(0.97); }
.chip.is-on {
  background: var(--accent-dim);
  border-color: rgba(255, 199, 0, 0.45);
  color: var(--accent);
}
.filterbar select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-chip);
  padding: 6px 28px 6px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.filterbar .spacer { flex: 1; }
.filterbar .count { font-size: 11px; color: var(--text-3); font-weight: 650; font-variant-numeric: tabular-nums; }

/* date strip — quiet calendar */
.datestrip {
  position: sticky;
  top: 100px;
  z-index: 19;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 10px 4px;
  margin: 0 0 4px;
  background: linear-gradient(rgba(10, 13, 10, 0.94), rgba(10, 13, 10, 0.94));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
  scrollbar-width: none;
}
.datestrip::-webkit-scrollbar { display: none; }
.daypill {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 44px;
  padding: 6px 6px 7px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.daypill .d-dow { font-size: 9px; font-weight: 750; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.daypill .d-num {
  font-weight: 850;
  font-stretch: 110%;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.daypill .d-mon { display: none; }
@media (hover: hover) { .daypill:hover { background: rgba(255, 255, 255, 0.05); } }
.daypill:active { transform: scale(0.96); }
.daypill.is-active { border-color: var(--hairline-strong); background: var(--surface-2); }
.daypill.is-active .d-num { color: var(--text); }
.daypill.is-today .d-num { color: var(--accent); }
.daypill.is-today .d-dow { color: var(--accent); }
.daypill.has-fav { position: relative; }
.daypill.has-fav::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.day-section { margin-bottom: 8px; scroll-margin-top: 168px; }
.day-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 28px 0 6px;
}
.day-header h3 {
  margin: 0;
  font-stretch: 125%;
  font-weight: 850;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.day-header .day-meta { font-size: 11px; color: var(--text-3); font-weight: 650; }
.day-header.is-today h3 { color: var(--text); }
.day-header .today-tag {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.16em;
  padding: 2px 7px;
  border-radius: 5px;
  color: #161200;
  background: var(--accent);
  transform: translateY(-1px);
}

/* match row — hairline-separated list, no boxes */
.match-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 200px;
  align-items: center;
  gap: 16px;
  padding: 12px 10px 12px 14px;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  cursor: pointer;
  transition: background 150ms ease;
  position: relative;
}
.day-section .match-row:last-child { border-bottom-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  .match-row:hover { background: rgba(255, 255, 255, 0.035); border-radius: 10px; }
}
.match-row:active { background: rgba(255, 255, 255, 0.05); }
.match-row.is-fav { box-shadow: inset 3px 0 0 var(--accent); background: rgba(255, 199, 0, 0.04); border-radius: 0 10px 10px 0; }

.mr-time { display: grid; gap: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mr-time .t-first { font-weight: 800; font-size: 13.5px; line-height: 1.45; }
.mr-time .t-second { font-weight: 650; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.mr-time .t-second.t-secondary { color: var(--accent); }
.mr-time .t-status { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; font-stretch: 78%; margin-top: 2px; }
.mr-time .t-status.live { color: var(--live); }
.mr-time .t-status.ft { color: var(--ok); }

.mr-fixture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mr-side {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
}
.mr-side.home { justify-content: flex-end; text-align: right; }
.mr-side .flag { font-size: 20px; line-height: 1; }
.mr-side .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-side.placeholder { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.mr-side.placeholder .flag { opacity: 0.45; filter: grayscale(1); }
.mr-side.winner .nm { color: var(--accent); }
.mr-side .nm-code { display: none; font-weight: 800; letter-spacing: 0.06em; }
.mr-center {
  text-align: center;
  font-weight: 650;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.mr-center.score {
  color: var(--text);
  font-stretch: 110%;
  font-weight: 850;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.mr-meta {
  display: grid;
  justify-items: end;
  gap: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-align: right;
  min-width: 0;
}
.mr-meta .stage-tag {
  color: var(--text-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9.5px;
  font-weight: 750;
}
.mr-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------- groups ---------- */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.group-card {
  position: relative;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  background: var(--surface);
  padding: 16px 18px 10px;
  transition: border-color 150ms ease;
}
@media (hover: hover) { .group-card:hover { border-color: var(--hairline-strong); } }
.group-card h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 12px;
  font-stretch: 125%;
  font-weight: 850;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.group-card h3 .gp-hint {
  font-stretch: 78%;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.group-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.group-table th {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: center;
  padding: 2px 3px 8px;
}
.group-table th.t-team { text-align: left; }
.group-table td {
  padding: 7px 3px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  border-top: 1px solid var(--hairline);
  font-size: 12px;
}
.group-table td.t-team {
  text-align: left;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}
.group-table td.t-pts { color: var(--text); font-weight: 850; }
.group-table .flag { font-size: 17px; }
.group-table tr.q-direct td:first-child { box-shadow: inset 2px 0 0 var(--ok); }
.group-table tr.q-third td:first-child { box-shadow: inset 2px 0 0 rgba(255, 199, 0, 0.45); }
.groups-legend {
  margin: 18px 2px 0;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.groups-legend .lg { display: inline-flex; align-items: center; gap: 8px; }
.groups-legend .swatch { width: 3px; height: 12px; border-radius: 2px; }
.groups-legend .swatch.direct { background: var(--ok); }
.groups-legend .swatch.third { background: rgba(255, 199, 0, 0.45); }

/* ---------- bracket ---------- */
.bracket-scroller { overflow-x: auto; padding: 8px 4px 24px; }
.bracket {
  display: flex;
  gap: 36px;
  min-width: max-content;
  padding: 4px 8px;
}
.bracket-col { display: flex; flex-direction: column; min-width: 232px; }
.bracket-col-title {
  margin: 0 0 16px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: center;
}
.bracket-col-title .bc-dates {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.bracket-slot {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  padding: 5px 0;
}
.bnode {
  position: relative;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  padding: 10px 12px;
  font-size: 12.5px;
  transition: border-color 150ms ease;
}
@media (hover: hover) { .bnode:hover { border-color: var(--hairline-strong); } }
.bnode.is-final { border-color: rgba(255, 199, 0, 0.5); }
.bnode-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
  font-variant-numeric: tabular-nums;
}
.bnode-team {
  display: grid;
  grid-template-columns: minmax(22px, auto) 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-weight: 700;
}
.bnode-team .flag-ph { font-size: 9px; height: 16px; min-width: 26px; }
.bnode-team .flag { font-size: 16px; line-height: 1; }
.bnode-team.placeholder { color: var(--text-2); font-weight: 600; font-size: 12px; }
.bnode-team.placeholder .flag { opacity: 0.45; filter: grayscale(1); }
.bnode-team .sc { font-weight: 850; font-stretch: 110%; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.bnode-team.winner { color: var(--accent); }
.bnode-times {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--hairline);
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.bnode-times .t-secondary { color: rgba(255, 199, 0, 0.7); }
.bnode-times .dot-sep { margin: 0 5px; }

/* connectors */
.bracket-col:not(:last-child) .bracket-slot::after {
  content: '';
  position: absolute;
  right: -20px;
  width: 19px;
  border: 0 solid var(--hairline-strong);
  pointer-events: none;
}
.bracket-col:not(:last-child) .bracket-slot:nth-of-type(odd)::after {
  top: 50%;
  height: 50%;
  border-top-width: 1px;
  border-right-width: 1px;
  border-top-right-radius: 8px;
}
.bracket-col:not(:last-child) .bracket-slot:nth-of-type(even)::after {
  bottom: 50%;
  height: 50%;
  border-bottom-width: 1px;
  border-right-width: 1px;
  border-bottom-right-radius: 8px;
}
.bracket-col:not(:first-child) .bracket-slot::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 50%;
  width: 17px;
  height: 1px;
  background: var(--hairline-strong);
  pointer-events: none;
}

.third-place-wrap { margin-top: 12px; }
.third-place-wrap .bnode { max-width: 264px; }

/* ---------- match detail modal ---------- */
.match-card[data-mn], .match-row[data-mn] { cursor: pointer; }

.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(4, 6, 4, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.modal-backdrop.is-open { opacity: 1; }

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: min(84vh, 720px);
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-2);
  box-shadow: 0 32px 80px -24px rgba(0, 0, 0, 0.8);
  padding: 20px 24px 26px;
  transform: translateY(10px) scale(0.97);
  transition: transform 220ms var(--ease-strong);
  scrollbar-width: thin;
}
.modal-backdrop.is-open .modal { transform: none; }

/* no visible scrollbar — wheel/trackpad/touch scrolling still works */
.modal { scrollbar-width: none; -ms-overflow-style: none; }
.modal::-webkit-scrollbar { display: none; }
.modal.is-resizing { transition: transform 220ms var(--ease-strong), height 300ms var(--ease-strong); }
@media (prefers-reduced-motion: reduce) {
  .modal, .modal.is-resizing, .modal-backdrop { transition: none; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
@media (hover: hover) { .modal-close:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.32); } }
.modal-close:active { transform: scale(0.94); }

.md-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 20px;
}

.md-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  margin-bottom: 8px;
}
.md-team { display: grid; justify-items: center; gap: 8px; text-align: center; min-width: 0; }
.md-team .flag { font-size: 46px; line-height: 1; }
.md-team .flag-ph { font-size: 12px; height: 26px; min-width: 42px; justify-self: center; }
.md-team .nm { font-weight: 800; font-size: 14.5px; line-height: 1.25; }
.md-mid { display: grid; justify-items: center; gap: 4px; min-width: 112px; padding-top: 2px; }
.md-big {
  font-stretch: 125%;
  font-weight: 900;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.md-big.dim { color: var(--text-3); font-size: 24px; padding-top: 9px; }
.md-min { font-size: 12px; font-weight: 800; color: var(--live); font-variant-numeric: tabular-nums; }
.md-ft { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ok); }
.md-up { font-size: 12px; font-weight: 750; color: var(--accent); font-variant-numeric: tabular-nums; }

.md-when {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}
.md-when .t-secondary { color: var(--accent); }
.md-when .dot-sep { color: var(--text-3); margin: 0 5px; }

/* timeline */
.md-timeline { padding: 14px 0 6px; }
.tl-row {
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  align-items: center;
  gap: 8px;
  padding: 3.5px 0;
  font-size: 12.5px;
  color: var(--text-2);
}
.tl-row.is-goal { color: var(--text); font-weight: 750; }
.tl-side.l { text-align: right; }
.tl-side.r { text-align: left; }
.tl-side small { color: var(--text-3); font-weight: 600; }
.tl-min {
  justify-self: center;
  min-width: 38px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 2px 6px;
  font-variant-numeric: tabular-nums;
}
.card-ico {
  display: inline-block;
  width: 8px;
  height: 11px;
  border-radius: 2px;
  vertical-align: -1px;
}
.card-ico.yc { background: var(--accent); }
.card-ico.rc { background: var(--live); }

/* stats */
.md-stats { padding: 14px 0 4px; border-top: 1px solid var(--hairline); margin-top: 12px; }
.md-timeline + .md-stats { margin-top: 8px; }
.md-poss {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 12px;
}
.md-poss .pv { font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.md-poss .pv:last-child { text-align: right; }
.poss-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
}
.poss-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px 0 0 999px;
  transition: width 500ms var(--ease-strong);
}
.md-poss-label {
  text-align: center;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 6px 0 12px;
}
.stat-row {
  display: grid;
  grid-template-columns: 28px 1fr 88px 1fr 28px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.stat-row .sv { font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stat-row .sv:first-child { text-align: left; }
.stat-row .sv:last-child { text-align: right; }
.stat-row .sl {
  text-align: center;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.sbar { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.sbar.l { transform: scaleX(-1); }
.sbar i { display: block; height: 100%; border-radius: 999px; transition: width 500ms var(--ease-strong); }
.sbar.l i { background: var(--accent); }
.sbar.r i { background: rgba(242, 245, 239, 0.45); }

/* lineups */
.md-section-title {
  margin: 18px 0 0;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: center;
}
.md-lineups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-top: 12px;
}
.lu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 12.5px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}
.lu-head .flag { font-size: 16px; }
.lu-head em {
  font-style: normal;
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.lu-player {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 3px 0;
}
.lu-j {
  flex: 0 0 auto;
  width: 19px;
  text-align: right;
  font-size: 10.5px;
  font-weight: 750;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* loading skeleton + note */
.md-loading { display: grid; gap: 10px; }
.skel {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.md-note { margin-top: 16px; text-align: center; font-size: 11.5px; color: var(--text-3); }

@media (max-width: 560px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal {
    width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    transform: translateY(32px);
  }
  .md-team .flag { font-size: 38px; }
  .md-big { font-size: 34px; }
}

/* ---------- favorite team picker ---------- */
.fav-modal { width: min(620px, 100%); }
.fav-title {
  margin: 4px 0 6px;
  font-stretch: 125%;
  font-weight: 850;
  font-size: 20px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.fav-sub { margin: 0 0 16px; color: var(--text-2); font-size: 12.5px; }
.fav-search {
  width: 100%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-chip);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 14px;
}
.fav-search::placeholder { color: var(--text-3); }
.fav-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.fav-tile {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.fav-tile[hidden] { display: none; }
.fav-tile .flag { font-size: 18px; line-height: 1; }
.fav-tile .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .fav-tile:hover { border-color: var(--hairline-strong); background: var(--surface-2); } }
.fav-tile:active { transform: scale(0.98); }
.fav-tile.is-selected {
  border-color: rgba(255, 199, 0, 0.55);
  background: var(--accent-dim);
  color: var(--accent);
}
.fav-empty { padding: 20px 0 8px; text-align: center; color: var(--text-3); font-size: 12.5px; }

/* ---------- timezone picker ---------- */
.tz-modal { width: min(460px, 100%); }
.tz-field { display: block; margin-bottom: 14px; }
.tz-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  font-stretch: 78%;
}
.tz-field > span em { font-style: normal; color: var(--text-3); font-weight: 600; letter-spacing: 0.08em; }

/* combobox — trigger + in-flow panel (search + option list) */
.cb-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-chip);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 650;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease;
}
@media (hover: hover) { .cb-trigger:hover { border-color: rgba(255, 255, 255, 0.3); } }
.tz-cb.is-open .cb-trigger { border-color: rgba(255, 199, 0, 0.45); }
.cb-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cb-value .cb-flag { margin-right: 8px; }
.cb-value .cb-sub, .cb-item .cb-sub { color: var(--text-2); font-weight: 550; }
.cb-value .cb-sub { margin-left: 6px; }
.cb-flag { font-size: 16px; line-height: 1; }
.cb-chev { color: var(--text-3); font-size: 10px; }
.cb-pop {
  margin-top: 6px;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  animation: cbIn 140ms var(--ease) both;
}
@keyframes cbIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .cb-pop { animation: none; } }
.cb-pop[hidden] { display: none; }
.cb-search {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.cb-search::placeholder { color: var(--text-3); }
.cb-list {
  max-height: 212px;
  overflow-y: auto;
  padding: 5px;
  scrollbar-width: thin;
}
.cb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 7px;
  padding: 8px 9px;
  font-size: 12.5px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.cb-item .cb-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cb-item .cb-text .cb-sub { margin-left: 6px; }
.cb-item.is-active { background: rgba(255, 255, 255, 0.07); }
@media (hover: hover) { .cb-item:hover { background: rgba(255, 255, 255, 0.07); } }
.cb-item.is-selected b { color: var(--accent); }
.cb-check { color: var(--accent); font-weight: 800; }
.cb-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 12px; }
.tz-done {
  border: 0;
  background: var(--accent);
  color: #161200;
  border-radius: 999px;
  padding: 8px 26px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 150ms var(--ease);
}
.tz-done:active { transform: scale(0.97); }
.fav-foot { display: flex; justify-content: center; margin-top: 16px; }
.fav-skip {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 150ms ease;
}
.fav-skip:hover { color: var(--text); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--hairline);
  padding: 28px 20px 44px;
  text-align: center;
  color: var(--text-3);
  font-size: 11.5px;
}
.footer p { margin: 4px 0; }
.footer strong { color: var(--text-2); font-weight: 700; }
#updatedAt { color: var(--text-3); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .match-row { grid-template-columns: 96px minmax(0, 1fr); }
  .mr-meta { display: none; }
  .datestrip { top: 99px; }
  .day-section { scroll-margin-top: 164px; }
}

@media (max-width: 680px) {
  .tz-help { display: none; }
  .topbar { gap: 10px; }
  .topbar-actions { gap: 8px; }
  .tz-control { gap: 6px; }
}

@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar-actions { gap: 6px; }
  .wordmark-text { font-size: 13px; white-space: nowrap; }
  .fav-btn { padding: 5px 9px; font-size: 11px; }
  .tz-edit { padding: 5px 9px; font-size: 10.5px; }
  .tz-toggle button { padding: 5px 8px; font-size: 10.5px; }
}

@media (max-width: 520px) {
  .hero-sub-dates { display: none; }
}

@media (max-width: 480px) {
  .mr-side .nm { display: none; }
  .mr-side .nm-code { display: inline; font-size: 13px; }
  .mr-side.placeholder .nm { display: inline; font-size: 11px; }
  .mr-side.winner .nm-code { color: var(--accent); }
  .tz-help { display: none; }
  .fav-btn .fav-btn-name { display: none; }
  .fav-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .mr-time .t-first { font-size: 12.5px; }
  .mr-time .t-second { font-size: 11px; }
  .match-row { grid-template-columns: 84px minmax(0, 1fr); gap: 10px; }
}

/* ---------- reduced motion (global fallback) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
