* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: #fff;
  color: #111;
  line-height: 1.6;
  min-height: 100vh;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

header {
  margin-bottom: 3rem;
  text-align: center;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.subtitle {
  color: #666;
  font-size: 0.85rem;
}

.section {
  margin-bottom: 3rem;
}

.section h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  color: #111;
  text-align: center;
}

/* Ticker */
.ticker {
  border-bottom: 1px solid #111;
  padding: 0.5rem 1.5rem;
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 0.8rem;
}

.ticker.hidden {
  display: none;
}

.ticker-match {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ticker-match .live-dot {
  width: 6px;
  height: 6px;
  background: #d00;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Leaderboard */
.leaderboard-row {
  display: grid;
  grid-template-columns: 2rem 1fr 4rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-row .rank {
  font-weight: 700;
  color: #999;
}

.leaderboard-row .rank.gold { color: #111; }
.leaderboard-row .rank.silver { color: #444; }
.leaderboard-row .rank.bronze { color: #666; }

.leaderboard-row .name {
  font-weight: 400;
}

.leaderboard-row .points {
  text-align: right;
  font-weight: 700;
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 2rem 1fr 4rem;
  padding: 0.4rem 0;
  font-size: 0.75rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #111;
  margin-bottom: 0.25rem;
}

/* Fixtures */
.fixture-card {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.fixture-card:last-child {
  border-bottom: none;
}

.fixture-card .team {
  font-weight: 400;
}

.fixture-card .team:first-child {
  text-align: right;
}

.fixture-card .score {
  font-weight: 700;
  min-width: 3rem;
  text-align: center;
}

/* Top performers */
.performer-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #eee;
}

.performer-row:last-child {
  border-bottom: none;
}

.performer-row .pts {
  font-weight: 700;
}

#top-performers h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin: 1.5rem 0 0.5rem;
}

/* Predictions */
.search-container {
  margin-bottom: 1rem;
}

#player-select {
  width: 100%;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #111;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

#player-select:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
}

.prediction-group {
  margin-bottom: 1.5rem;
}

.prediction-group h3 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prediction-match {
  display: grid;
  grid-template-columns: 3rem 1fr auto 1fr 3rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #eee;
}

.prediction-match:last-child {
  border-bottom: none;
}

.prediction-match .team {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prediction-match > .team:nth-child(2) {
  text-align: right;
}

.prediction-match.correct .pred-score {
  color: #111;
}

.prediction-match.wrong {
  color: #999;
}

.prediction-match .pred-score {
  font-weight: 700;
  min-width: 3rem;
  text-align: center;
  white-space: nowrap;
}

.prediction-match .actual-slot {
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
}

.prediction-match .actual-score {
  font-size: 0.75rem;
  color: #999;
}

@media (max-width: 600px) {
  .prediction-match {
    grid-template-columns: 2.25rem 1fr auto 1fr 2.25rem;
    gap: 0.35rem;
    font-size: 0.8rem;
  }

  .prediction-match .pred-score {
    min-width: 2.5rem;
  }

  .prediction-match .actual-score {
    font-size: 0.7rem;
  }
}

.no-data {
  color: #999;
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
}

/* Nav */
.nav {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  padding: 1rem;
}

.burger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}

.burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #111;
}

.nav-menu {
  display: none;
  list-style: none;
  background: #fff;
  border: 1px solid #111;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  min-width: 140px;
}

.nav-menu.open {
  display: block;
}

.nav-menu li a {
  display: block;
  padding: 0.4rem 1rem;
  color: #111;
  text-decoration: none;
  font-size: 0.85rem;
}

.nav-menu li a:hover {
  background: #f5f5f5;
}

/* Fixtures page wider layout */
.page-fixtures main {
  max-width: 100%;
  padding: 3rem 2rem;
}

/* Bracket tree */
.bracket-tree {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  padding-bottom: 1rem;
}

.bracket-col {
  flex: 0 0 85vw;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 0 0.5rem;
  padding-top: 1.5rem;
  min-height: 300px;
  position: relative;
}

.bracket-col-label {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  text-align: center;
}

.bracket-match {
  border: 1px solid #eee;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
}

.bracket-match.empty {
  color: #ccc;
  border-color: #f5f5f5;
}

.bm-team {
  display: block;
}

.bm-score {
  display: block;
  font-weight: 700;
  font-size: 0.7rem;
  color: #666;
}

/* Groups snap scroll (mobile default) */
.groups-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1rem;
}

.groups-scroll::-webkit-scrollbar {
  height: 4px;
}

.groups-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
}

.group-card {
  flex: 0 0 280px;
  scroll-snap-align: start;
  border: 1px solid #eee;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.group-card .group-table {
  flex: none;
}

.group-card h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.group-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin-bottom: 1rem;
}

.group-table th {
  text-align: center;
  padding: 0.25rem 0.3rem;
  border-bottom: 1px solid #111;
  font-weight: 700;
}

.group-table td {
  text-align: center;
  padding: 0.25rem 0.3rem;
  border-bottom: 1px solid #eee;
}

.group-table .team-name {
  text-align: left;
  font-weight: 500;
}

.flag {
  vertical-align: middle;
  margin-right: 0.3rem;
}

.group-fixtures {
  border-top: 1px solid #ddd;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

.group-fixture {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  align-content: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  font-size: 0.75rem;
}

.group-fixture span:first-child {
  text-align: right;
}

.gf-score {
  font-weight: 700;
  text-align: center;
  min-width: 2rem;
}

.group-fixture.upcoming {
  color: #999;
}

/* Rulebook */
.rulebook-content h2 {
  margin-top: 2rem;
}

.rulebook-content h2:first-child {
  margin-top: 0;
}

.rulebook-content p {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.rulebook-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.rulebook-content li {
  margin-bottom: 0.4rem;
}

.rulebook-content h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.points-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}

.points-table th,
.points-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.points-table th {
  font-weight: 600;
  background: #f7f7f7;
}

.points-table td:not(:first-child),
.points-table th:not(:first-child) {
  text-align: right;
}

.rulebook-content .footnote {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}

/* Desktop layout */
@media (min-width: 900px) {
  .bracket-tree {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.25rem;
    overflow: visible;
    scroll-snap-type: none;
  }

  .bracket-col {
    flex: unset;
    height: 600px;
    padding: 0 0.25rem;
    padding-top: 1.5rem;
  }

  .groups-scroll {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 1fr;
    gap: 0.75rem;
    overflow: visible;
    scroll-snap-type: none;
  }

  .group-card {
    flex: unset;
  }
}

/* Mobile */
@media (max-width: 600px) {
  main {
    padding: 2rem 1rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  .group-card {
    flex: 0 0 85vw;
  }

  .page-fixtures main {
    padding: 2rem 1rem;
  }
}
