:root {
  color-scheme: dark;
  --bg: #080d18;
  --panel: #0f1829;
  --panel-strong: #152133;
  --panel-card: #0d1827;
  --panel-card-header: #162540;
  --ink: #e8eeff;
  --muted: #5c6b87;
  --line: #1c2b44;
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-glow: rgba(16, 185, 129, 0.18);
  --gold: #f4b942;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 60px;
  background: rgba(8, 13, 24, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
}

.logo-pilot {
  color: var(--accent);
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* ── Step nav ────────────────────────────────────────────────────────────── */

.step-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.step-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.step-item.is-active {
  color: var(--accent);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.step-item.is-active .step-badge {
  background: var(--accent);
  color: white;
}

.step-divider {
  width: 18px;
  height: 1px;
  background: var(--line);
  flex-shrink: 0;
}

/* ── Header right group ──────────────────────────────────────────────────── */

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Download button ─────────────────────────────────────────────────────── */

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.download-button svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.download-button:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}

.download-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Language control ────────────────────────────────────────────────────── */

.language-control {
  display: flex;
  align-items: center;
}

.language-control select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* ── Hero section ────────────────────────────────────────────────────────── */

.hero-section {
  background: linear-gradient(140deg, #0f2040 0%, #0d1a30 45%, #080d18 100%);
  border-bottom: 1px solid var(--line);
  padding: clamp(32px, 5vw, 60px) clamp(16px, 4vw, 40px);
}

.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 40px;
  align-items: center;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.hero-copy {
  max-width: 680px;
}

.hero-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-trophy-img {
  width: clamp(220px, 28vw, 380px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 48px rgba(16, 185, 129, 0.18));
  pointer-events: none;
  user-select: none;
}

.trophy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(244, 185, 66, 0.14);
  color: var(--gold);
  margin-bottom: 16px;
  border: 1px solid rgba(244, 185, 66, 0.2);
}

.trophy-icon svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.hero-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 4.5vw, 3.1rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.hero-subtitle {
  margin: 0 0 24px;
  font-size: clamp(0.92rem, 2vw, 1.05rem);
  line-height: 1.65;
  color: rgba(232, 238, 255, 0.6);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Stats bar ───────────────────────────────────────────────────────────── */

.stats-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  gap: 3px;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.primary-button,
.secondary-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 11px 22px;
  box-shadow: 0 0 24px var(--accent-glow);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(16, 185, 129, 0.38);
}

.outline-button {
  background: transparent;
  color: var(--ink);
  padding: 10px 20px;
  border: 1px solid rgba(232, 238, 255, 0.18);
}

.outline-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.secondary-button {
  background: var(--gold);
  color: #2d250e;
  padding: 10px 18px;
}

.secondary-button:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.primary-button:disabled,
.secondary-button:disabled,
.outline-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
  box-shadow: none;
}

/* ── Calendar banner ─────────────────────────────────────────────────────── */

.calendar-banner {
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-banner-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.calendar-icon-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  border-radius: 10px;
  color: var(--accent);
}

.calendar-icon-wrap svg {
  width: 20px;
  height: 20px;
}

.calendar-copy {
  flex: 1;
  min-width: 0;
}

.calendar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 2px;
}

.calendar-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.calendar-download-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.calendar-download-btn svg {
  width: 14px;
  height: 14px;
}

.calendar-download-btn:hover {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 600px) {
  .calendar-banner-inner {
    padding: 14px 16px;
    gap: 12px;
  }
  .calendar-copy .calendar-desc {
    display: none;
  }
}

/* ── Main tab bar ────────────────────────────────────────────────────────── */

.main-tab-bar {
  position: sticky;
  top: 60px;
  z-index: 90;
  background: rgba(8, 13, 24, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.main-tabs-inner {
  display: flex;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

.main-tab {
  flex: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 14px 18px 12px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.main-tab:hover {
  color: var(--ink);
}

.main-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

/* ── Tab panels ──────────────────────────────────────────────────────────── */

.tab-panel {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) clamp(16px, 4vw, 40px) 40px;
}

.is-hidden {
  display: none !important;
}

/* ── Timezone note ───────────────────────────────────────────────────────── */

.timezone-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Groups grid ─────────────────────────────────────────────────────────── */

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

/* ── Group card ──────────────────────────────────────────────────────────── */

.group-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.group-card:hover {
  border-color: rgba(16, 185, 129, 0.22);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.group-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--panel-card-header);
  border-bottom: 1px solid var(--line);
}

.group-card h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
}

.group-card header small {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.team-list,
.match-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 7px 14px;
  border-top: 1px solid rgba(28, 43, 68, 0.8);
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--ink);
}

.flag {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--line);
  overflow: hidden;
  object-fit: cover;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.flag-england {
  background: #ffffff;
}
.flag-england::before,
.flag-england::after {
  content: "";
  position: absolute;
  background: #c8102e;
}
.flag-england::before {
  left: 0;
  right: 0;
  top: 9px;
  height: 6px;
}
.flag-england::after {
  top: 0;
  bottom: 0;
  left: 9px;
  width: 6px;
}

.flag-scotland {
  background: #0065bd;
}
.flag-scotland::before,
.flag-scotland::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 9px;
  width: 32px;
  height: 6px;
  background: #ffffff;
}
.flag-scotland::before {
  transform: rotate(45deg);
}
.flag-scotland::after {
  transform: rotate(-45deg);
}

.team-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.group-schedule {
  border-top: 1px solid var(--line);
  padding: 10px 14px 12px;
}

.group-schedule h4 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.group-schedule ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-row {
  display: grid;
  gap: 2px;
  font-size: 0.74rem;
  line-height: 1.35;
}

.match-id {
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.schedule-teams {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 800;
  color: var(--ink);
}

.schedule-teams .flag {
  width: 17px;
  height: 17px;
}

.schedule-teams .flag-england::before {
  top: 6px;
  height: 5px;
}
.schedule-teams .flag-england::after {
  left: 6px;
  width: 5px;
}
.schedule-teams .flag-scotland::before,
.schedule-teams .flag-scotland::after {
  left: -3px;
  top: 6px;
  width: 23px;
  height: 5px;
}

.schedule-time {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

/* ── Simulated group card ─────────────────────────────────────────────────── */

.standings-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.77rem;
}

.standings-mini-table td {
  padding: 6px 8px;
  border-top: 1px solid rgba(28, 43, 68, 0.8);
  text-align: right;
  white-space: nowrap;
  color: var(--ink);
}

.standings-mini-table td:first-child {
  text-align: left;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  width: 18px;
  padding-right: 4px;
}

.standings-mini-table td:nth-child(2) {
  text-align: left;
  min-width: 0;
}

.standings-mini-table td:last-child {
  font-weight: 800;
}

.standings-mini-table .qualified-row td {
  background: rgba(16, 185, 129, 0.07);
}

.standings-mini-table .qualified-row td:last-child {
  color: var(--accent);
}

.standings-mini-table .eliminated-row td {
  color: var(--muted);
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.group-match-results {
  border-top: 1px solid var(--line);
  padding: 10px 14px 12px;
}

.group-match-results h4 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.group-match-results ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.match-result-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 0.74rem;
  line-height: 1.4;
}

.match-result-teams {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
}

.match-result-teams .flag {
  width: 15px;
  height: 15px;
}

.match-result-teams .flag-england::before {
  top: 5px;
  height: 5px;
}
.match-result-teams .flag-england::after {
  left: 5px;
  width: 5px;
}
.match-result-teams .flag-scotland::before,
.match-result-teams .flag-scotland::after {
  left: -2px;
  top: 5px;
  width: 19px;
  height: 5px;
}

.match-result-score {
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

/* ── Eyebrow label ───────────────────────────────────────────────────────── */

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── Bracket toolbar ─────────────────────────────────────────────────────── */

.bracket-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.bracket-toolbar h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
  font-weight: 800;
  color: var(--ink);
}

/* ── Champion banner ─────────────────────────────────────────────────────── */

.champion-banner {
  margin-bottom: 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0c2d1e, #0f1829);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--ink);
  padding: 17px 22px;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 0 32px rgba(16, 185, 129, 0.1);
}

/* ── Bracket ─────────────────────────────────────────────────────────────── */

.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
}

.bracket {
  display: grid;
  grid-template-columns: repeat(5, 230px);
  gap: 24px;
  min-width: 1270px;
}

.bracket-column {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: visible;
}

.bracket-column h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  border-radius: 8px;
  background: var(--panel-card-header);
  color: var(--accent);
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid var(--line);
}

.bracket-match {
  position: relative;
  z-index: 0;
  grid-row: var(--start-row) / span 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-card);
  overflow: visible;
}

.bracket-column-body {
  display: grid;
  grid-template-rows: repeat(32, 60px);
  min-height: 1920px;
  overflow: visible;
}

.bracket-match.has-next::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 24px;
  height: 2px;
  background: var(--line);
}

.advance-label {
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  padding: 4px 10px 6px;
  font-size: 0.63rem;
  font-weight: 800;
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  overflow: hidden;
}

.match-meta span {
  white-space: nowrap;
}

.match-date {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-team {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 10px;
  border-top: 1px solid rgba(28, 43, 68, 0.5);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink);
}

.match-team:first-of-type {
  border-top: 0;
}

.match-team.winner {
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}

.match-team.loser,
.match-team.placeholder {
  color: var(--muted);
}

.match-team.loser .flag,
.match-team.placeholder .flag {
  filter: grayscale(1);
  opacity: 0.4;
}

.score {
  font-variant-numeric: tabular-nums;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  padding: 20px clamp(16px, 4vw, 40px) 32px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .groups-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-right {
    display: none;
  }
}

@media (max-width: 740px) {
  .step-nav {
    display: none;
  }

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

@media (max-width: 500px) {
  .groups-grid {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    gap: 8px;
  }

  .stat-chip {
    min-width: 72px;
    padding: 9px 12px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .bracket-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
