:root {
  --bg: #f6f7f3;
  --ink: #17201a;
  --muted: #687064;
  --line: #dfe4d9;
  --card: #ffffff;
  --accent: #0c6b4f;
  --accent-2: #e6452e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(246, 247, 243, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar-greeting {
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  line-height: 1.2;
}
.topbar-participant {
  color: var(--accent);
  font-weight: 800;
}
nav { display: flex; gap: 10px; font-size: 14px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.shell { width: min(960px, 100%); margin: 0 auto; padding: 22px 16px 48px; }
.hero {
  min-height: 72vh;
  display: grid;
  align-content: center;
  gap: 18px;
}
.hero h1, .page-head h1, .card h1 { margin: 0; font-size: clamp(34px, 8vw, 68px); line-height: 1; }
.hero p { max-width: 560px; color: var(--muted); font-size: 18px; }
.page-intro {
  margin: 8px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.eyebrow { margin: 0 0 8px; color: var(--accent-2); font-weight: 800; text-transform: uppercase; font-size: 12px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 12px 0 26px;
}
.page-head--compact {
  margin: 0 0 18px;
}
.page-head--compact h1 {
  font-size: clamp(24px, 5vw, 36px);
}
h2 { margin: 28px 0 12px; font-size: 18px; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 750;
  cursor: pointer;
}
.button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.list { display: grid; gap: 10px; }
.item, .card, .table-card, .empty, .message {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 14px 16px;
}
.item span { font-weight: 750; }
.item small, .empty { color: var(--muted); }
.match-row--red {
  background: #f9e7e4;
  border-color: #df9184;
}
.match-row--green {
  background: #e2f1e8;
  border-color: #9ac8ad;
}
.match-row--red small,
.match-row--green small {
  color: #32443a;
}
.match-section--red {
  border-color: #df9184;
}
.match-section--red > summary {
  background: #f9e7e4;
}
.match-section--green {
  border-color: #9ac8ad;
}
.match-section--green > summary {
  background: #e2f1e8;
}
.link-row { align-items: start; }
.link-row code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}
.card { padding: 18px; }
.card.danger { border-color: #df9184; }
.errorlist {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #fff4f2;
  border: 1px solid #df9184;
  border-radius: 8px;
  color: #7a2519;
}
.score-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
}
.score-form label, .form p { display: grid; gap: 8px; font-weight: 750; }
.score-form input, .score-form select, .form input, .form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: white;
}
.score-form .button, .score-form .wide { grid-column: 1 / -1; }
.inline-form { margin: -4px 0 12px; }
.section-note { color: var(--muted); margin: -6px 0 10px; }
.section-action { margin: 0 0 12px; }
.table-card { overflow-x: auto; overflow-y: hidden; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.leaderboard-table {
  min-width: max-content;
  border-spacing: 0;
}
.leaderboard-table th,
.leaderboard-table td {
  background: white;
}
.leaderboard-table .match-points {
  text-align: center;
  white-space: nowrap;
  min-width: 52px;
}
.leaderboard-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
}
.leaderboard-table thead .sticky-col {
  z-index: 3;
}
.leaderboard-table .sticky-col-1 {
  left: 0;
  min-width: 54px;
}
.leaderboard-table .sticky-col-2 {
  left: 54px;
  min-width: 180px;
}
.leaderboard-table tbody .sticky-col-1,
.leaderboard-table tbody .sticky-col-2 {
  box-shadow: 8px 0 0 white;
}
.leaderboard-table tbody .sticky-col-2 {
  box-shadow: 8px 0 0 white, 9px 0 0 var(--line);
}
.empty { padding: 18px; }
.message { padding: 12px 14px; margin-bottom: 14px; }
.message.success { border-color: #9ac8ad; }
.message.error { border-color: #df9184; }
.result-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 18px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
}
.result-banner span { font-weight: 800; text-transform: uppercase; font-size: 12px; }
.result-banner strong { font-size: 34px; line-height: 1; }
.result-banner.muted { background: #39423b; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 700;
}
.match-section {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}
.match-section summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
}
.match-section--red {
  border-color: #df9184;
}
.match-section--red > summary {
  background: #f9e7e4;
}
.match-section--green {
  border-color: #9ac8ad;
}
.match-section--green > summary {
  background: #e2f1e8;
}
.match-section .list { padding: 0 10px 10px; }
.bonus-groups {
  display: grid;
  gap: 16px;
  padding: 0 10px 10px;
}
.bonus-group h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.bonus-group-list {
  padding: 0;
}
.overview-list {
  padding: 0 12px 12px;
}
.overview-match {
  padding: 14px 4px 16px;
}
.overview-match + .overview-match {
  border-top: 1px solid var(--line);
}
.overview-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}
.overview-head strong {
  display: block;
  font-size: 16px;
}
.overview-head small {
  color: var(--muted);
}
.overview-state {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef3ee;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}
.overview-predictions {
  margin-top: 12px;
  overflow: auto;
}
.overview-predictions table {
  border: 1px solid var(--line);
  border-radius: 8px;
}
.overview-note {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .topbar { align-items: start; }
  .topbar-meta { justify-content: flex-end; }
  nav { flex-wrap: wrap; justify-content: flex-end; }
  .page-head { align-items: start; flex-direction: column; }
  .item { align-items: start; flex-direction: column; }
  .score-form { grid-template-columns: 1fr; }
  .overview-head { flex-direction: column; }
}
