:root {
  --bg: #06100b;
  --panel: rgba(10, 21, 16, 0.92);
  --panel-strong: rgba(16, 28, 21, 0.96);
  --text: #f5f7f4;
  --muted: #b8c3bd;
  --green: #2fd66b;
  --purple: #8a5cff;
  --yellow: #ffd84d;
  --red: #ff6262;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(47, 214, 107, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(138, 92, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom left, rgba(255, 216, 77, 0.12), transparent 25%),
    radial-gradient(circle at bottom right, rgba(255, 98, 98, 0.11), transparent 25%),
    linear-gradient(180deg, #06100b 0%, #0d1712 60%, #06100b 100%);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  padding: 32px 18px 40px;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.card {
  background: linear-gradient(180deg, rgba(15, 25, 20, 0.96), rgba(7, 14, 10, 0.94));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.hero-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.tournament-logo {
  width: clamp(52px, 6vw, 84px);
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.25));
}

.hero h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.7rem);
  line-height: 1;
}

.hero .lede {
  display: none;
}

.hero.logged-in {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 18px 20px;
  gap: 16px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.header-actions .ghost-button {
  min-width: 132px;
}

.login-panel {
  border-radius: 20px;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(138, 92, 255, 0.2), rgba(47, 214, 107, 0.12)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 14px;
  align-content: start;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--yellow);
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.lede,
.toolbar-subline {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.login-panel {
  border-radius: 20px;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(138, 92, 255, 0.2), rgba(47, 214, 107, 0.12)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 14px;
  align-content: start;
}

.login-panel.logged-in {
  padding: 16px 20px;
  gap: 10px;
}

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

.player-button,
.primary-button,
.ghost-button,
.tab-button,
.subtab-button,
.group-card-header {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.player-button {
  padding: 14px 16px;
  font-weight: 700;
  color: #08110b;
  background: linear-gradient(135deg, var(--green), #91f5b2);
  box-shadow: 0 10px 28px rgba(47, 214, 107, 0.18);
}

.player-button:nth-child(2n) {
  background: linear-gradient(135deg, var(--purple), #c0abff);
  box-shadow: 0 10px 28px rgba(138, 92, 255, 0.18);
}

.player-button:nth-child(3n) {
  background: linear-gradient(135deg, var(--yellow), #ffeaa1);
  box-shadow: 0 10px 28px rgba(255, 216, 77, 0.16);
}

.player-button:nth-child(4n) {
  background: linear-gradient(135deg, var(--red), #ff9c9c);
  box-shadow: 0 10px 28px rgba(255, 98, 98, 0.16);
}

.player-button:hover,
.primary-button:hover,
.ghost-button:hover,
.tab-button:hover,
.subtab-button:hover,
.group-card-header:hover {
  transform: translateY(-1px);
}

.signed-in {
  margin: 0;
  color: var(--text);
}

.signed-in.muted {
  color: var(--muted);
}

.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost-button,
.primary-button {
  padding: 12px 18px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--green), var(--yellow));
  color: #08110b;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.app-shell {
  padding: 24px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.status {
  margin: 16px 0 0;
  min-height: 24px;
  color: var(--muted);
}

.status[data-kind='success'] {
  color: var(--green);
}

.status[data-kind='error'] {
  color: var(--red);
}

.top-tabs {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

.tab-bar,
.subtab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-button,
.subtab-button {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-button.is-active,
.subtab-button.is-active {
  color: #07110b;
  background: linear-gradient(135deg, var(--yellow), #fff0a8);
  box-shadow: 0 12px 28px rgba(255, 216, 77, 0.2);
}

.tab-panel,
.subtab-panel {
  display: none;
}

.tab-panel.is-active,
.subtab-panel.is-active {
  display: block;
}

.section-copy {
  color: var(--muted);
  line-height: 1.55;
}

.section-copy h3 {
  color: var(--text);
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.group-accordion {
  display: grid;
  gap: 14px;
}

.group-card {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.group-card-header {
  width: 100%;
  border-radius: 0;
  background: linear-gradient(145deg, rgba(47, 214, 107, 0.16), rgba(138, 92, 255, 0.16));
  color: var(--text);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.group-label {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 216, 77, 0.16);
  border: 1px solid rgba(255, 216, 77, 0.18);
  color: var(--yellow);
  font-weight: 800;
  white-space: nowrap;
}

.group-header-right {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.flag-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(8, 16, 12, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
}

.flag-chip span,
.flag-chip .team-name {
  display: none;
}

.caret {
  font-size: 1.15rem;
  color: var(--yellow);
  line-height: 1;
}

.group-card-panel {
  display: none;
  padding: 18px;
  gap: 16px;
}

.group-card-panel.is-open {
  display: grid;
}

.standings-box,
.matches-box,
.round-panel {
  display: grid;
  gap: 12px;
}

.standings-box h4,
.matches-box h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--yellow);
}

.standings-table,
.leaderboard-table {
  display: grid;
  gap: 8px;
}

.standings-row {
  display: grid;
  grid-template-columns: 36px minmax(180px, 1.6fr) repeat(8, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.standings-head {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  color: var(--yellow);
}

.standing-team {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.standing-flag {
  font-size: 1rem;
}

.standing-points {
  font-weight: 800;
  color: var(--green);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 120px 150px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-head {
  background: rgba(255, 255, 255, 0.06);
  color: var(--yellow);
  font-weight: 800;
}

.leaderboard-row.is-current {
  border-color: rgba(47, 214, 107, 0.38);
  background: linear-gradient(145deg, rgba(47, 214, 107, 0.12), rgba(138, 92, 255, 0.08));
}

.leaderboard-rank,
.leaderboard-points {
  color: var(--green);
  font-weight: 900;
}

.leaderboard-player {
  font-weight: 800;
}

.matches-list {
  display: grid;
  gap: 12px;
}

.match-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 98, 98, 0.07), rgba(138, 92, 255, 0.06)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  flex-wrap: wrap;
}

.match-schedule {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.match-kickoff,
.match-ground,
.match-round {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.86rem;
  line-height: 1.1;
}

.match-kickoff {
  color: var(--text);
  white-space: nowrap;
}

.match-ground {
  color: var(--muted);
}

.match-round {
  color: var(--green);
  white-space: nowrap;
}

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

.team-badge {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(8, 16, 12, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.team-flag {
  font-size: 1.2rem;
}

.team-name {
  font-weight: 700;
}

.versus {
  font-weight: 800;
  color: var(--yellow);
}

.score-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 160px;
  gap: 12px;
}

.score-box,
.points-box {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.official-box {
  background: rgba(138, 92, 255, 0.09);
}

.score-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
}

.score-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-inputs input {
  width: 70px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 16, 12, 0.96);
  color: var(--text);
  text-align: center;
}

.score-inputs input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.score-divider {
  color: var(--yellow);
  font-size: 1.2rem;
  font-weight: 800;
}

.points-value {
  font-size: 1.6rem;
  color: var(--green);
}

.match-helper {
  color: var(--muted);
  font-size: 0.88rem;
}

.round-summary {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.knockout-shell {
  display: grid;
  gap: 14px;
}

.subtab-panel {
  margin-top: 14px;
}

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

.knockout-team-selects {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.knockout-team-selects select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 16, 12, 0.96);
  color: var(--text);
}

.knockout-score-inputs {
  justify-content: flex-end;
}

.round-match-card input {
  width: 76px;
}

.panel-heading {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(47, 214, 107, 0.12), rgba(138, 92, 255, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
}

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

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .hero-copy {
    justify-content: flex-start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .standings-row {
    grid-template-columns: 36px minmax(180px, 1.6fr) repeat(4, minmax(0, 1fr));
  }

  .score-grid,
  .round-match-card {
    grid-template-columns: 1fr;
  }

  .knockout-score-inputs {
    justify-content: flex-start;
  }

  .match-teams {
    grid-template-columns: 1fr;
  }

  .versus {
    text-align: center;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px 12px 24px;
  }

  .hero,
  .app-shell {
    padding: 16px;
  }

  .hero {
    gap: 14px;
  }

  .hero-copy {
    gap: 10px;
  }

  .hero-brand {
    gap: 10px;
  }

  .hero h1 {
    font-size: clamp(1.25rem, 6vw, 1.8rem);
  }

  .tournament-logo {
    width: 44px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .ghost-button {
    min-width: 0;
    flex: 1 1 calc(50% - 10px);
    padding: 10px 12px;
    font-size: 0.9rem;
  }

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

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

  .standings-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .leaderboard-row {
    grid-template-columns: 42px minmax(0, 1fr) 72px 92px;
    gap: 8px;
    padding: 12px;
    font-size: 0.9rem;
  }

  .standings-row > :not(:nth-child(1)):not(:nth-child(2)) {
    display: none;
  }

  .group-card-header {
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .tab-button,
  .subtab-button,
  .player-button,
  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
