:root {
  --ink: #101727;
  --muted: #5c6578;
  --paper: #fffaf0;
  --line: rgba(16, 23, 39, .12);
  --red: #e83f4f;
  --blue: #105bff;
  --green: #00a86b;
  --gold: #ffc83d;
  --orange: #ff7a1a;
  --aqua: #00bfd8;
  --shadow: 0 18px 48px rgba(16, 23, 39, .16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 200, 61, .28), transparent 24rem),
    radial-gradient(circle at 92% 4%, rgba(0, 191, 216, .2), transparent 28rem),
    linear-gradient(180deg, #fff9e8 0%, #f4fbff 42%, #fff8ee 100%);
}

a { color: inherit; text-decoration: none; }

.hero {
  min-height: 92vh;
  color: white;
  background:
    linear-gradient(135deg, rgba(14, 36, 93, .94), rgba(20, 142, 102, .76)),
    url("https://images.unsplash.com/photo-1431324155629-1a6deb1dec8d?auto=format&fit=crop&w=1800&q=80") center/cover;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -20% -10%;
  height: 36%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green), var(--aqua), var(--blue));
  transform: rotate(-2deg);
  opacity: .88;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 0 0 .22rem rgba(255, 255, 255, .22);
}

.nav-actions {
  display: flex;
  gap: .35rem;
  padding: .35rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, .12);
}

.language-switcher {
  display: flex;
  gap: .25rem;
  padding: .32rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  backdrop-filter: blur(12px);
}

.language-switcher button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  opacity: .72;
}

.language-switcher button.active {
  background: white;
  opacity: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}

.nav-actions a {
  padding: .55rem .9rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, .86);
  font-size: .9rem;
  font-weight: 700;
}

.nav-actions a:hover { background: rgba(255, 255, 255, .16); color: white; }

.hero-grid {
  position: relative;
  z-index: 2;
  min-height: calc(92vh - 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 27rem);
  gap: clamp(1rem, 5vw, 4rem);
  align-items: center;
  padding: 3rem clamp(1rem, 5vw, 5rem) 8rem;
}

.eyebrow {
  margin: 0 0 .55rem;
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .12em;
  font-weight: 900;
  color: var(--orange);
}

.hero .eyebrow { color: var(--gold); }

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  max-width: 58rem;
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 7.8rem);
  line-height: .9;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3.4rem);
  line-height: 1;
}

h3 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.hero-lede {
  max-width: 44rem;
  color: rgba(255, 255, 255, .86);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.65;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(8rem, 1fr));
  gap: .8rem;
  max-width: 48rem;
  margin-top: 2rem;
}

.metric, .match-spotlight, .stat-card, .group-card, .team-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow);
}

.metric {
  color: var(--ink);
  border-radius: .5rem;
  padding: 1rem;
}

.metric strong { display: block; font-size: 1.55rem; }
.metric span { color: var(--muted); font-size: .82rem; font-weight: 800; }

.match-spotlight {
  color: var(--ink);
  border-radius: .5rem;
  padding: 1.2rem;
}

.label {
  display: inline-block;
  margin-bottom: .85rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.spot-teams { display: grid; gap: .55rem; }
.spot-team { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-weight: 900; font-size: 1.1rem; }
.spot-meta { margin-top: 1rem; color: var(--muted); font-size: .9rem; line-height: 1.45; }

main { position: relative; z-index: 3; }

.ad-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: -3.4rem auto 2rem;
  padding: 1rem 1.2rem;
  border-radius: .5rem;
  color: white;
  background: linear-gradient(90deg, #e83f4f, #ff7a1a 45%, #105bff);
  box-shadow: var(--shadow);
}

.adsense-wrap {
  width: min(1180px, calc(100% - 2rem));
  min-height: 5.8rem;
  margin: -3.4rem auto 2rem;
  padding: .75rem;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.adsense-wrap.inline-ad {
  margin: 0 auto 2rem;
  box-shadow: 0 12px 30px rgba(16, 23, 39, .1);
}

.adsense-wrap ins {
  min-height: 5rem;
}

.ad-band div { display: grid; gap: .18rem; }
.ad-band span { color: rgba(255, 255, 255, .84); }

.ad-cta {
  flex: 0 0 auto;
  padding: .7rem 1rem;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.section {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 4.5rem 0;
}

.section.bright {
  width: 100%;
  margin: 0;
  padding-inline: max(1rem, calc((100% - 1280px) / 2));
  background: linear-gradient(135deg, rgba(255, 200, 61, .42), rgba(0, 191, 216, .2));
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  max-width: 38rem;
}

.segmented button {
  border: 0;
  border-radius: 999px;
  padding: .55rem .75rem;
  background: white;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}

.segmented button.active {
  color: white;
  background: var(--blue);
  box-shadow: none;
}

.groups-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 25rem);
  gap: 1rem;
  align-items: start;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.group-card, .team-panel, .stat-card {
  border-radius: .5rem;
  padding: 1rem;
}

.group-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .8rem;
}

.group-card header strong { font-size: 1.15rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}

th, td {
  padding: .54rem .35rem;
  text-align: right;
  border-bottom: 1px solid rgba(16, 23, 39, .08);
}

th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; }

.team-cell {
  display: flex;
  align-items: center;
  gap: .45rem;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.matches-list { display: grid; gap: .55rem; margin-top: .8rem; }

.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .55rem;
  padding: .65rem;
  border-radius: .45rem;
  background: #f7f9fd;
}

.match-row > span:last-child { text-align: right; }
.score { min-width: 3.7rem; text-align: center; font-weight: 950; color: var(--blue); }

.team-panel { position: sticky; top: 1rem; }
.empty-state { color: var(--muted); line-height: 1.55; }

.profile-head {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1rem;
}

.profile-flag { font-size: 2.7rem; }
.profile-name { font-size: 1.4rem; font-weight: 950; }
.profile-meta { color: var(--muted); font-size: .9rem; }

.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin: 1rem 0; }
.mini { padding: .75rem; border-radius: .45rem; background: #f7f9fd; }
.mini strong { display: block; font-size: 1.35rem; }
.mini span { color: var(--muted); font-size: .78rem; font-weight: 800; }

.player-tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.player-tags span { padding: .45rem .6rem; border-radius: 999px; background: rgba(255, 200, 61, .28); font-size: .82rem; font-weight: 800; }

.bracket {
  display: grid;
  grid-template-columns: repeat(5, minmax(13rem, 1fr));
  gap: .85rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}

.match-archive {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: .5rem;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(16, 23, 39, .1);
}

.archive-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}

.archive-head h3 { margin: 0; }
.archive-head p { margin: .25rem 0 0; color: var(--muted); font-size: .9rem; }
.archive-head strong {
  display: inline-flex;
  align-items: center;
  padding: .45rem .7rem;
  border-radius: 999px;
  color: white;
  background: var(--blue);
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
  max-height: 26rem;
  overflow: auto;
  padding-right: .25rem;
}

.archive-match {
  display: grid;
  gap: .45rem;
  padding: .8rem;
  border-radius: .5rem;
  background: #f7f9fd;
  border: 1px solid rgba(16, 23, 39, .08);
}

.archive-match.played {
  background: linear-gradient(180deg, #fff, #eef9f4);
  border-color: rgba(0, 168, 107, .22);
}

.archive-stage {
  color: var(--orange);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.archive-date, .archive-venue {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.archive-scoreline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: .5rem;
  align-items: center;
  font-weight: 850;
}

.archive-scoreline strong {
  min-width: 3.3rem;
  text-align: center;
  color: var(--blue);
  font-size: 1.05rem;
}

.archive-scoreline span:last-child { text-align: right; }
.archive-scoreline .winner { color: var(--green); }

.round { display: grid; align-content: start; gap: .75rem; min-width: 13rem; }
.round h3 { margin-bottom: .1rem; }

.tie {
  padding: .8rem;
  border-radius: .5rem;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(16, 23, 39, .1);
}

.tie-id { color: var(--orange); font-size: .72rem; font-weight: 950; }
.tie-meta { margin-top: .2rem; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.tie-team { display: flex; justify-content: space-between; gap: .5rem; margin-top: .4rem; font-weight: 850; }
.tie-team.winner { color: var(--green); }
.tie-score { min-width: 1.4rem; text-align: right; color: var(--blue); }

.source-note, .visitor-pill {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.stats-board {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
}

.stat-card.wide { grid-row: span 2; }
.records-card { grid-column: span 2; }

.ranking-list { display: grid; gap: .55rem; }
.scorer-board { display: grid; gap: .55rem; }
.scorer-leader {
  position: relative;
  min-height: 15rem;
  display: grid;
  grid-template-columns: 44% 1fr;
  overflow: hidden;
  border-radius: .5rem;
  color: white;
  background: linear-gradient(135deg, #ffffff 0 42%, #d80424 42% 68%, #0d64a7 68%);
}
.scorer-leader img {
  width: 100%;
  height: 100%;
  min-height: 15rem;
  object-fit: cover;
  object-position: top center;
  background: #e8edf4;
}
.scorer-leader-info {
  display: grid;
  align-content: end;
  gap: .35rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.2));
}
.scorer-badge {
  justify-self: start;
  display: inline-grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  font-size: 1.5rem;
}
.scorer-leader-goals {
  font-size: 3rem;
  line-height: 1;
  font-weight: 950;
}
.scorer-leader-name { font-size: 1.2rem; font-weight: 950; }
.scorer-leader-team { opacity: .88; font-weight: 800; }
.scorer-mini {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .55rem;
  border-radius: .45rem;
  background: #f7f9fd;
}
.scorer-mini img {
  width: 3rem;
  height: 3rem;
  border-radius: .35rem;
  object-fit: cover;
  background: #dde4ee;
}
.scorer-mini strong:last-child { color: var(--blue); font-size: 1.15rem; }
.rank-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .6rem;
  border-radius: .45rem;
  background: #f7f9fd;
}
.rank-row small { color: var(--muted); display: block; margin-top: .15rem; }
.rank-row strong:last-child { color: var(--blue); }

.records-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.record-tile {
  position: relative;
  overflow: hidden;
  min-height: 8rem;
  padding: 1rem;
  border-radius: .5rem;
  color: white;
  background: linear-gradient(135deg, #105bff, #00a86b);
}

.record-tile:nth-child(2) { background: linear-gradient(135deg, #e83f4f, #ff7a1a); }
.record-tile:nth-child(3) { background: linear-gradient(135deg, #13204a, #8a1b4c); }
.record-tile:nth-child(4) { background: linear-gradient(135deg, #00bfd8, #105bff); }

.record-tile::after {
  content: "★";
  position: absolute;
  right: .55rem;
  bottom: -.8rem;
  font-size: 5.5rem;
  color: rgba(255,255,255,.16);
}

.record-tile span {
  display: block;
  margin-bottom: .35rem;
  opacity: .82;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.record-tile strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
}

.record-tile small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: .45rem;
  color: rgba(255,255,255,.86);
}

.champion-section {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: clamp(1rem, 5vw, 4rem);
  align-items: center;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 4rem;
  padding: clamp(1rem, 5vw, 4rem);
  border-radius: .5rem;
  color: white;
  background: linear-gradient(135deg, #13204a, #8a1b4c 50%, #ff7a1a);
  overflow: hidden;
}

.cup-wrap { position: relative; display: grid; place-items: center; min-height: 18rem; }
.cup-image {
  position: relative;
  z-index: 1;
  display: block;
  width: min(13rem, 70vw);
  max-height: 18rem;
  object-fit: contain;
  filter: drop-shadow(0 1.2rem 1.4rem rgba(0, 0, 0, .38));
  animation: floatCup 2.8s ease-in-out infinite;
}
.cup { position: relative; width: 9rem; height: 13rem; animation: floatCup 2.8s ease-in-out infinite; }
.cup-bowl {
  position: absolute;
  inset: 0 1rem auto;
  height: 7.7rem;
  border-radius: 0 0 4.4rem 4.4rem;
  background: linear-gradient(120deg, #fff6a5, #ffc83d 48%, #a66a00);
  box-shadow: inset -1rem -.6rem 1.6rem rgba(107, 68, 0, .25);
}
.cup-bowl::before, .cup-bowl::after {
  content: "";
  position: absolute;
  top: 1.1rem;
  width: 3rem;
  height: 4.7rem;
  border: .65rem solid #ffc83d;
  border-radius: 50%;
}
.cup-bowl::before { left: -2.45rem; border-right: 0; }
.cup-bowl::after { right: -2.45rem; border-left: 0; }
.cup-stem {
  position: absolute;
  top: 7.3rem;
  left: 3.55rem;
  width: 1.9rem;
  height: 3rem;
  background: linear-gradient(90deg, #b97900, #ffe58b, #b97900);
}
.cup-base {
  position: absolute;
  left: 1.7rem;
  bottom: .8rem;
  width: 5.6rem;
  height: 1.5rem;
  border-radius: 999px 999px .35rem .35rem;
  background: linear-gradient(90deg, #8b5b00, #ffd45d, #8b5b00);
}

.confetti {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, #ffc83d 0 .16rem, transparent .18rem) 0 0/2.4rem 2.4rem,
    radial-gradient(circle, #00bfd8 0 .14rem, transparent .16rem) 1rem 1.4rem/2.8rem 2.8rem,
    radial-gradient(circle, #e83f4f 0 .14rem, transparent .16rem) .6rem 2rem/2.2rem 2.2rem;
  animation: confettiDrift 7s linear infinite;
  opacity: .85;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(1rem, 4vw, 4rem);
  color: var(--muted);
  font-size: .88rem;
}

.back-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 14px 32px rgba(16, 23, 39, .28);
  font-size: 1.35rem;
  font-weight: 950;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(.75rem);
  transition: opacity .2s ease, transform .2s ease;
}

.back-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-top:hover { filter: brightness(1.06); }

code {
  padding: .15rem .3rem;
  border-radius: .25rem;
  background: rgba(16, 23, 39, .08);
}

@keyframes floatCup {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-.75rem) rotate(1deg); }
}

@keyframes confettiDrift {
  from { background-position: 0 0, 1rem 1.4rem, .6rem 2rem; }
  to { background-position: 0 9rem, 1rem 10.4rem, .6rem 11rem; }
}

@media (max-width: 980px) {
  .hero-grid, .groups-layout, .champion-section { grid-template-columns: 1fr; }
  .hero-metrics, .groups-grid, .stats-board { grid-template-columns: 1fr 1fr; }
  .archive-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-panel { position: static; }
}

@media (max-width: 680px) {
  .topbar, .section-head, .ad-band, footer { align-items: stretch; flex-direction: column; }
  .nav-actions { overflow-x: auto; border-radius: .5rem; }
  .language-switcher { align-self: flex-start; border-radius: .5rem; flex-wrap: wrap; }
  .hero-grid { padding-top: 2rem; }
  .hero-metrics, .groups-grid, .stats-board, .mini-grid { grid-template-columns: 1fr; }
  .archive-head { align-items: stretch; flex-direction: column; }
  .archive-list { grid-template-columns: 1fr; max-height: 34rem; }
  .records-card { grid-column: auto; }
  .records-board { grid-template-columns: 1fr; }
  .scorer-leader { grid-template-columns: 1fr; background: linear-gradient(135deg, #d80424, #0d64a7); }
  .scorer-leader img { height: 13rem; min-height: 13rem; }
  .ad-band { margin-top: -2rem; }
  .adsense-wrap { margin-top: -2rem; }
  .cup-image { width: min(11rem, 72vw); }
  .back-top {
    width: 2.8rem;
    height: 2.8rem;
    right: .75rem;
    bottom: .75rem;
  }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5), th:nth-child(6), td:nth-child(6) { display: none; }
}
