:root {
  color-scheme: dark;
  --bg: #131419;
  --bg-2: #0e0f13;
  --panel: rgba(31, 33, 41, 0.72);
  --panel-solid: #1b1d24;
  --ink: #f4f1e9;
  --muted: #9b958a;
  --gold: #e9bd66;
  --gold-soft: rgba(233, 189, 102, 0.18);
  --line: rgba(214, 196, 160, 0.16);
  --line-strong: rgba(255, 246, 222, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(233, 189, 102, 0.16), transparent 34%),
    radial-gradient(circle at 50% 0%, rgba(233, 189, 102, 0.06), transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 0.96;
  letter-spacing: -0.01em;
}

.time-control {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

.time-control label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.time-control select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-solid);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 28px;
}

/* ---------- bracket ---------- */
.board-section {
  display: grid;
  place-items: center;
  padding: 10px 0 22px;
}

.board-shell {
  position: relative;
  width: min(100%, 820px);
  aspect-ratio: 1;
  margin: 0 auto;
}

.connector-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.connector-layer path {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.connector-layer path.is-strong {
  stroke: var(--line-strong);
  stroke-width: 2.6;
}

.connector-layer .node-dot {
  fill: rgba(214, 196, 160, 0.4);
}

.bracket-nodes {
  position: absolute;
  inset: 0;
}

.badge {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(38px, 5.6vw, 50px);
  height: clamp(38px, 5.6vw, 50px);
  translate: -50% -50%;
  border-radius: 50%;
  overflow: hidden;
  background: #20222a;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.16),
    0 6px 16px rgba(0, 0, 0, 0.45);
  z-index: 3;
  transition: scale 0.15s ease, box-shadow 0.15s ease;
}

.badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge:hover {
  scale: 1.12;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1.5px var(--gold),
    0 10px 22px rgba(0, 0, 0, 0.55);
  z-index: 6;
}

.badge.is-winner {
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px var(--gold),
    0 0 18px rgba(233, 189, 102, 0.55);
  z-index: 4;
}

.badge.is-selected {
  scale: 1.18;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px var(--gold),
    0 0 22px rgba(233, 189, 102, 0.8);
  z-index: 7;
}

/* tap-to-reveal caption — shown on mobile when a flag is tapped */
.flag-caption {
  display: none;
  margin: 4px auto 0;
  max-width: 92%;
  padding: 10px 14px;
  border: 1px solid rgba(233, 189, 102, 0.35);
  border-radius: 12px;
  background: rgba(233, 189, 102, 0.08);
  text-align: center;
}

.flag-caption .cap-teams {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 800;
}

.flag-caption .mini-flag {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.flag-caption .vs {
  color: var(--muted);
  font-weight: 700;
}

.flag-caption .cap-time {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.badge-label {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 72px;
  translate: -50% -50%;
  display: grid;
  gap: 1px;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

.bl-name {
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.bl-time {
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ---------- centerpiece trophy ---------- */
.centerpiece {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  translate: -50% -50%;
  width: 22%;
  aspect-ratio: 1;
  z-index: 2;
}

.trophy-glow {
  position: absolute;
  inset: -60%;
  background: radial-gradient(circle, rgba(233, 189, 102, 0.45) 0%, rgba(233, 189, 102, 0.12) 34%, transparent 60%);
  filter: blur(6px);
  pointer-events: none;
}

.trophy {
  position: relative;
  width: auto;
  height: clamp(120px, 19vmin, 178px);
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.65));
}

.round-pill {
  position: relative;
  margin-top: 4px;
  padding: 3px 12px;
  border: 1px solid rgba(233, 189, 102, 0.4);
  border-radius: 999px;
  background: rgba(233, 189, 102, 0.1);
  color: var(--gold);
  font-size: clamp(9px, 1.4vw, 12px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- schedule ---------- */
.schedule-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.schedule-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.schedule-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.schedule-row:nth-child(odd) {
  border-right: 1px solid var(--border);
}

.schedule-row.is-done {
  opacity: 0.55;
}

.date-pill {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.matchup {
  min-width: 0;
}

.matchup strong {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-size: 14px;
}

.matchup .mini-flag {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.matchup .vs {
  color: var(--muted);
  font-weight: 700;
}

.matchup span.meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.row-time {
  justify-self: end;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-align: right;
}

/* ---------- ads / footer ---------- */
.site-footer {
  display: flex;
  justify-content: flex-start;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 28px 28px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 16px 8px;
  }

  .layout {
    padding: 0 16px 20px;
  }

  /* Keep the iconic 32-flag ring on phones, but drop the per-flag text labels
     (country names + times live in the cards below) and shrink the flags so the
     whole circle fits the screen width. */
  .board-section {
    padding: 4px 0 14px;
  }

  .board-shell {
    width: 100%; /* keeps the 1:1 aspect-ratio from the base rule */
  }

  .badge {
    width: clamp(20px, 6.2vw, 27px);
    height: clamp(20px, 6.2vw, 27px);
  }

  .badge-label {
    display: none;
  }

  /* trophy stays absolutely centered in the ring (base rule); shrink it so it
     reads clearly smaller than the flag ring (the base 120px min is too big here) */
  .centerpiece {
    width: 30%;
  }

  .trophy-glow {
    inset: -36%;
  }

  .trophy {
    width: auto;
    height: clamp(72px, 22vw, 92px);
  }

  /* "ROUND OF 32" pill would overflow the narrow centerpiece on phones */
  .round-pill {
    display: none;
  }

  /* show the tap-to-reveal caption (only once a flag is tapped) */
  .badge {
    cursor: pointer;
  }

  .flag-caption:not([hidden]) {
    display: block;
  }

  /* one card per match */
  .schedule-list {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .schedule-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "date . time"
      "match match match";
    column-gap: 10px;
    row-gap: 8px;
    min-width: 0;
    min-height: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
  }

  .schedule-row:nth-child(odd) {
    border-right: 1px solid var(--border);
  }

  .date-pill {
    grid-area: date;
  }

  .row-time {
    grid-area: time;
    font-size: 14px;
    white-space: normal;
    max-width: 40vw;
  }

  .matchup {
    grid-area: match;
    min-width: 0;
  }

  .matchup strong {
    flex-wrap: wrap;
    font-size: 15px;
  }

  .matchup span.meta {
    white-space: normal;
  }

  .panel-head {
    padding: 14px 16px;
  }

  .site-footer {
    flex-direction: column;
    padding: 6px 16px 22px;
  }
}

@media (max-width: 380px) {
  .matchup strong {
    font-size: 13.5px;
  }

  .row-time {
    font-size: 13px;
  }
}
