/* ==========================================================================
   Leo's World Cup Dashboard — broadcast dark theme
   ========================================================================== */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg-0: #060b16;
  --bg-1: #0a1322;
  --bg-2: #101c31;
  --bg-3: #182742;

  /* ink */
  --ink-hi: #f2f6fc;
  --ink-mid: #aebdd6;
  --ink-low: #6d7e9e;

  /* favorite-team accent — overridden by JS per selected team */
  --team: #f7c948;
  --team-rgb: 247, 201, 72;

  /* hairlines */
  --line: rgba(159, 172, 196, 0.14);
  --line-strong: rgba(159, 172, 196, 0.28);

  /* accents */
  --gold: #f7c948;
  --gold-soft: rgba(247, 201, 72, 0.12);
  --blue: #4d7cf3;
  --red: #e5484d;
  --red-soft: rgba(229, 72, 77, 0.14);
  --green: #34b96f;
  --green-soft: rgba(52, 185, 111, 0.12);

  /* effects */
  --glow-gold: 0 0 0 1px rgba(247, 201, 72, 0.35), 0 0 24px rgba(247, 201, 72, 0.1);
  --glow-live: 0 0 0 1px rgba(229, 72, 77, 0.45), 0 0 20px rgba(229, 72, 77, 0.12);

  /* shape */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;

  --font: "Archivo", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-width: 320px;
  /* clip, not hidden: hidden makes body a scroll container and kills the sticky toolbar */
  overflow-x: clip;
  color: var(--ink-hi);
  background: var(--bg-0);
  font-family: var(--font);
  line-height: 1.45;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: var(--ink-hi);
}

/* native dropdown popups ignore the page theme on Windows — force dark options */
select option {
  background: var(--bg-1);
  color: var(--ink-hi);
}

img {
  display: block;
}

/* ==========================================================================
   Cinematic backdrop (image + optional video + scrim — degrades to solid navy)
   ========================================================================== */

.stage-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-0);
}

.stage-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./assets/stadium-hero.jpg") center top / cover no-repeat;
}

.stage-backdrop video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.stage-backdrop video.is-playing {
  opacity: 1;
}

.stage-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(6, 11, 22, 0.28) 0%,
    rgba(6, 11, 22, 0.5) 42vh,
    rgba(6, 11, 22, 0.88) 85vh,
    rgba(6, 11, 22, 0.92) 120vh
  );
}

/* ==========================================================================
   Shared text + layout primitives
   ========================================================================== */

.eyebrow {
  color: var(--ink-low);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.band-inner,
.masthead-inner,
.hero-inner,
.toolbar-inner,
.content {
  width: min(1280px, 100% - 40px);
  margin-inline: auto;
}

/* ==========================================================================
   Masthead
   ========================================================================== */

.masthead {
  padding: 52px 0 28px;
}

.masthead-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.masthead .eyebrow {
  color: var(--team);
  margin-bottom: 6px;
}

.masthead h1 {
  font-size: clamp(34px, 4.6vw, 56px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 28px rgba(6, 11, 22, 0.75);
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  backdrop-filter: blur(8px);
}

.field:focus-within {
  border-color: var(--line-strong);
}

.field-icon {
  color: var(--team);
  font-size: 13px;
}

.field select,
.field input {
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
}

.field select {
  cursor: pointer;
  max-width: 170px;
}

.field-search input {
  width: 210px;
}

.field input::placeholder {
  color: var(--ink-low);
}

.command-bar button {
  height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 180ms ease, background 180ms ease;
}

.command-bar button:hover {
  border-color: var(--team);
  background: rgba(var(--team-rgb), 0.08);
}

.command-bar button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.command-bar button.is-error {
  border-color: rgba(229, 72, 77, 0.6);
}

/* ==========================================================================
   Ticker band (Match Pulse)
   ========================================================================== */

.ticker-band {
  background: rgba(6, 11, 22, 0.55);
  border-block: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.ticker-band .band-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}

.ticker-cap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 12px 0;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: livePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-items {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent);
}

.pulse-items::-webkit-scrollbar {
  display: none;
}

.pulse-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 13px;
}

.pulse-card + .pulse-card {
  border-left: 1px solid var(--line);
}

.pulse-card strong {
  font-weight: 600;
  color: var(--ink-mid);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pulse-card.is-live strong {
  color: var(--ink-hi);
}

.pulse-card.is-favorite strong {
  color: var(--team);
}

.pulse-empty {
  padding: 10px 0;
  color: var(--ink-low);
  font-size: 13px;
}

/* ==========================================================================
   Hero band — favorite team composition
   ========================================================================== */

.hero-band {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-band::before {
  content: "";
  position: absolute;
  inset: -22%;
  z-index: 0;
  background: var(--hero-flag, none) center / cover no-repeat;
  filter: blur(70px) saturate(1.15);
  opacity: 0.15;
}

.hero-band::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(55% 45% at 10% -8%, rgba(255, 255, 255, 0.08), transparent 60%),
    radial-gradient(55% 45% at 90% -8%, rgba(255, 255, 255, 0.055), transparent 60%),
    linear-gradient(180deg, transparent 50%, rgba(5, 10, 22, 0.5));
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.7fr);
  grid-template-areas:
    "identity feature"
    "strip strip";
  gap: 28px 40px;
  padding-block: 40px 32px;
}

.hero-identity {
  grid-area: identity;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-identity img {
  width: 104px;
  height: 70px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  box-shadow: 0 0 0 1px rgba(var(--team-rgb), 0.35), 0 0 24px rgba(var(--team-rgb), 0.12);
}

.hero-identity h2 {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-transform: uppercase;
}

.pick-team-btn {
  margin-top: 14px;
  padding: 11px 20px;
  background: var(--team);
  border: 0;
  border-radius: var(--r-2);
  color: #131c2e;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(var(--team-rgb), 0.35);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.pick-team-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(var(--team-rgb), 0.45);
}

.hero-group-line {
  margin-top: 6px;
  color: var(--team);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* feature scoreboard */

.hero-feature {
  grid-area: feature;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 18px 22px;
  background: rgba(6, 11, 22, 0.42);
  border-radius: var(--r-3);
  backdrop-filter: blur(10px);
}

.feature-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--team);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.feature-eyebrow.is-live {
  color: var(--red);
}

.hero-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.hero-team {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
}

.hero-team img {
  width: 46px;
  height: 31px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hero-team strong {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-center {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.hero-num {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-num span {
  color: var(--ink-low);
  font-size: 0.55em;
}

.hero-num--time {
  font-size: clamp(34px, 5vw, 52px);
}

.hero-countdown {
  color: var(--team);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

.hero-meta {
  color: var(--ink-mid);
  font-size: 12.5px;
  text-align: center;
}

.hero-meta b {
  color: var(--ink-hi);
  font-weight: 700;
}

/* fixture strip */

.hero-strip {
  grid-area: strip;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.strip-item {
  display: grid;
  gap: 5px;
  padding: 4px 20px;
}

.strip-item + .strip-item {
  border-left: 1px solid var(--line);
}

.strip-item:first-child {
  padding-left: 0;
}

.strip-date {
  color: var(--ink-low);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.strip-item strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.strip-item .chip {
  justify-self: start;
}

.strip-item.is-live strong {
  color: var(--ink-hi);
}

/* ==========================================================================
   Sticky toolbar (tabs + filters)
   ========================================================================== */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 26, 45, 0.92);
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(14px);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 8px;
}

.tabs {
  display: flex;
  gap: 4px;
}

.tabs button {
  height: 44px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: #ccd8ec;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 transparent;
  transition: color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.tabs button:hover {
  color: #ffffff;
}

.tabs button.is-active {
  color: #ffffff;
  background: rgba(var(--team-rgb), 0.1);
  box-shadow: inset 0 -3px 0 var(--team);
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body:not([data-tab="matches"]) .toolbar-filters {
  display: none;
}

.segmented {
  display: flex;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  overflow: hidden;
}

.segmented button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #ccd8ec;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: color 180ms ease, background 180ms ease;
}

.segmented button:hover {
  color: #ffffff;
}

.segmented button.is-active {
  color: var(--team);
  background: #1f3050;
}

/* ==========================================================================
   Status chips (one system everywhere)
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-1);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chip--live {
  background: var(--red);
  color: #fff;
}

.chip--live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.chip--ft {
  border: 1px solid var(--line-strong);
  color: var(--ink-mid);
}

.chip--time {
  background: rgba(159, 172, 196, 0.14);
  color: var(--ink-hi);
}

/* ==========================================================================
   Content + views
   ========================================================================== */

.content {
  padding-block: 24px 56px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: viewIn 240ms ease-out;
}

.empty {
  padding: 18px;
  color: var(--ink-mid);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  font-size: 14px;
}

/* ==========================================================================
   Matches view
   ========================================================================== */

.front-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: start;
}

.view-head {
  margin-bottom: 14px;
  color: var(--ink-mid);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.news-rail {
  position: sticky;
  top: 74px;
}

.news-list {
  display: grid;
  gap: 6px;
}

.news-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(16, 28, 49, 0.4);
  border-radius: var(--r-2);
  color: inherit;
  text-decoration: none;
  transition: background 180ms ease;
}

.news-item:hover {
  background: rgba(24, 39, 66, 0.75);
}

.news-item strong {
  color: var(--ink-hi);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.news-meta {
  color: var(--ink-low);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.news-tag {
  margin-right: 7px;
  color: var(--team);
}

.news-empty {
  color: var(--ink-low);
  font-size: 13px;
}

.match-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.match-card {
  display: grid;
  gap: 13px;
  padding: 16px;
  background: rgba(24, 38, 63, 0.62);
  border-radius: var(--r-3);
  transition: background 180ms ease;
}

.match-card:hover {
  background: rgba(32, 49, 79, 0.8);
}

.match-card.is-favorite {
  box-shadow: inset 2px 0 0 var(--team);
}

.match-card.is-live {
  box-shadow: inset 2px 0 0 var(--red);
}

.match-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-low);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.team-line {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.team-line strong {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-line:last-child {
  direction: rtl;
  text-align: right;
}

.team-line:last-child strong {
  direction: ltr;
}

.team-line img,
.group-card img {
  width: 32px;
  height: 21px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.flag-placeholder {
  width: 32px;
  height: 21px;
  background: var(--bg-3);
  border-radius: 3px;
}

.score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.score span {
  color: var(--ink-low);
  font-size: 15px;
}

.score--upcoming {
  color: var(--ink-low);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  flex-wrap: wrap;
  color: var(--ink-low);
  font-size: 12px;
}

.match-meta b {
  color: var(--ink-mid);
  font-weight: 600;
}

.scorers {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-mid);
  font-size: 12px;
}

.highlights-link {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.highlights-link:hover {
  text-decoration: underline;
}

.strip-foot {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Groups view
   ========================================================================== */

.group-tables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px 28px;
}

.group-card h3 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-mid);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.group-card.is-favorite h3 {
  color: var(--team);
  border-bottom-color: rgba(var(--team-rgb), 0.4);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 8px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

thead th {
  border-top: 0;
  color: var(--ink-low);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

td {
  color: var(--ink-mid);
  font-size: 13px;
}

td strong {
  color: var(--ink-hi);
  font-weight: 600;
}

td:last-child strong {
  font-weight: 800;
}

th:first-child,
td:first-child {
  text-align: left;
}

td:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.is-favorite-row {
  background: rgba(var(--team-rgb), 0.12);
  box-shadow: inset 2px 0 0 var(--team);
}

/* ==========================================================================
   Bracket — tournament board
   ========================================================================== */

.bracket-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--ink-mid);
  font-size: 12px;
  font-weight: 700;
}

.bracket-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bracket-legend .key {
  width: 20px;
  height: 3px;
  border-radius: 99px;
}

.key-advance {
  background: var(--ink-mid);
}

.key-eliminated {
  background: var(--ink-low);
  opacity: 0.5;
}

.key-favorite {
  background: var(--team);
}

.legend-note {
  color: var(--ink-low);
}

.bracket-grid {
  position: relative;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
}

.bracket-grid::-webkit-scrollbar {
  height: 8px;
}

.bracket-grid::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 99px;
}

.bracket-board {
  --gap: 36px;
  --col-w: clamp(216px, 62vw, 256px);
  --slot-h: 96px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: auto 1fr;
  grid-auto-columns: var(--col-w);
  column-gap: var(--gap);
  min-height: calc(16 * var(--slot-h) + 44px);
  width: max-content;
  padding: 2px;
}

.round-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  color: var(--ink-mid);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.round-head em {
  color: var(--ink-low);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.round-body {
  display: flex;
  flex-direction: column;
}

.round-finals {
  position: relative;
}

.slot {
  --conn-out: rgba(159, 172, 196, 0.18);
  --conn-in: rgba(159, 172, 196, 0.18);
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  padding: 6px 0;
}

.slot--decided {
  --conn-out: rgba(159, 172, 196, 0.4);
}

.slot--fav-out {
  --conn-out: var(--team);
}

.slot--fav-in {
  --conn-in: var(--team);
}

/* outgoing elbow: vertical half + horizontal turn drawn inside the column gap */
[data-feeds] .slot::after {
  content: "";
  position: absolute;
  right: calc(var(--gap) / -2);
  width: calc(var(--gap) / 2);
  height: 50%;
}

[data-feeds] .slot:nth-child(odd)::after {
  top: 50%;
  border-top: 2px solid var(--conn-out);
  border-right: 2px solid var(--conn-out);
  border-radius: 0 var(--r-2) 0 0;
}

[data-feeds] .slot:nth-child(even)::after {
  bottom: 50%;
  border-bottom: 2px solid var(--conn-out);
  border-right: 2px solid var(--conn-out);
  border-radius: 0 0 var(--r-2) 0;
}

/* incoming stub meets the elbows at the gap midpoint */
[data-receives] .slot::before {
  content: "";
  position: absolute;
  left: calc(var(--gap) / -2 - 1px);
  width: calc(var(--gap) / 2 + 1px);
  top: calc(50% - 1px);
  border-top: 2px solid var(--conn-in);
}

/* loose fallback: unparseable feed order → simple stubs, never wrong elbows */
.bracket-board--loose [data-receives] .slot::before {
  display: none;
}

.bracket-board--loose [data-feeds] .slot:nth-child(odd)::after,
.bracket-board--loose [data-feeds] .slot:nth-child(even)::after {
  top: 50%;
  bottom: auto;
  height: 0;
  border: 0;
  border-top: 2px solid var(--conn-out);
  border-radius: 0;
}

/* match block */

.bm {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 9px 11px;
  background: linear-gradient(180deg, #1d2e50, #16253f);
  border: 1px solid rgba(174, 189, 214, 0.22);
  border-radius: var(--r-3);
  transition: border-color 180ms ease, transform 180ms ease;
}

.bm:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.bm-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-low);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bm-meta .chip {
  padding: 1px 6px;
  font-size: 10px;
}

.bm-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.bm-row img {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.bm-row .flag-placeholder {
  width: 24px;
  height: 16px;
  border-radius: 2px;
}

.bm-row strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-score {
  min-width: 16px;
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bm-row.is-winner strong {
  color: #fff;
  font-weight: 700;
}

.bm-row.is-winner .bm-score {
  color: var(--gold);
}

.bm-row.is-loser {
  opacity: 0.45;
}

.bm-row.is-tbd strong {
  color: var(--ink-low);
  font-weight: 500;
}

.bm.is-live {
  border-color: rgba(229, 72, 77, 0.55);
}

.bm.is-fav {
  border-color: rgba(var(--team-rgb), 0.5);
  box-shadow: 0 0 0 1px rgba(var(--team-rgb), 0.35), 0 0 24px rgba(var(--team-rgb), 0.1);
}

.bm.is-fav.is-live {
  animation: favBreath 3.2s ease-in-out infinite;
}

.bm--final {
  border-color: rgba(247, 201, 72, 0.35);
}

.bm--final .bm-score {
  font-size: 17px;
}

/* bronze final sits outside the tree, pinned to the finals column foot */

.bronze {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
}

.bronze h4 {
  color: var(--ink-low);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ==========================================================================
   Highlights player modal + footer
   ========================================================================== */

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.video-modal[hidden] {
  display: none;
}

.video-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.84);
  backdrop-filter: blur(6px);
}

.video-frame {
  position: relative;
  width: min(960px, 100%);
}

.video-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.video-bar button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--ink-hi);
  font-size: 15px;
  cursor: pointer;
}

.video-bar button:hover {
  border-color: var(--line-strong);
}

.video-player {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: var(--r-3);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.video-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-loading {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--ink-mid);
  font-size: 14px;
}

.site-foot {
  padding: 28px 0 44px;
  color: var(--ink-low);
  font-size: 12px;
  text-align: center;
}

.site-foot p {
  width: min(1280px, 100% - 40px);
  margin-inline: auto;
}

/* ==========================================================================
   Motion
   ========================================================================== */

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(229, 72, 77, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(229, 72, 77, 0);
  }
}

@keyframes scoreFlash {
  0% {
    background-color: rgba(247, 201, 72, 0.26);
  }
  100% {
    background-color: transparent;
  }
}

.score-flash {
  animation: scoreFlash 1s ease-out 1;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes favBreath {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(var(--team-rgb), 0.22), 0 0 16px rgba(var(--team-rgb), 0.08);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(var(--team-rgb), 0.45), 0 0 26px rgba(var(--team-rgb), 0.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .masthead {
    padding-top: 32px;
  }

  .masthead-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .command-bar .field-team,
  .command-bar .field-search {
    flex: 1 1 160px;
  }

  .field-search input {
    width: 100%;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "identity"
      "feature"
      "strip";
    gap: 24px;
  }

  .front-grid {
    grid-template-columns: 1fr;
  }

  .news-rail {
    position: static;
  }
}

@media (max-width: 560px) {
  .band-inner,
  .masthead-inner,
  .hero-inner,
  .toolbar-inner,
  .content {
    width: min(1280px, 100% - 24px);
  }

  .masthead {
    padding: 24px 0 18px;
  }

  .ticker-band .band-inner {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .ticker-cap {
    padding-right: 10px;
  }

  .ticker-cap strong {
    display: none;
  }

  .hero-identity img {
    width: 78px;
    height: 52px;
  }

  .hero-feature {
    padding: 14px;
  }

  .hero-score {
    gap: 10px;
  }

  .hero-team strong {
    font-size: 12px;
    white-space: normal;
    overflow: visible;
    line-height: 1.25;
  }

  .hero-num--time {
    font-size: 30px;
  }

  .hero-strip {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 calc(100% - 20px), transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 20px), transparent);
  }

  .hero-strip::-webkit-scrollbar {
    display: none;
  }

  .strip-item {
    flex: 0 0 auto;
    min-width: 190px;
    padding: 4px 16px;
  }

  .toolbar-inner {
    gap: 8px;
  }

  .tabs {
    width: 100%;
  }

  .tabs button {
    flex: 1;
    padding: 0;
  }

  .toolbar-filters {
    width: 100%;
    padding-bottom: 8px;
  }

  .segmented {
    flex: 1 1 100%;
  }

  .segmented button {
    flex: 1;
    height: 42px;
    padding: 0 6px;
  }

  .match-list,
  .group-tables {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 8px 5px;
    font-size: 12px;
  }

  .bracket-board {
    --gap: 28px;
    --slot-h: 92px;
  }
}
