:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #eef4f0;
  --ink: #17211c;
  --muted: #64736c;
  --line: #dbe4df;
  --accent: #147a63;
  --accent-strong: #0e5c4a;
  --warn: #b35b10;
  --shadow: 0 12px 32px rgba(23, 33, 28, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary,
.filter {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover,
.filter:hover,
.filter.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--surface-soft);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input:focus {
  outline: 3px solid rgba(20, 122, 99, 0.18);
  border-color: var(--accent);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 5vw, 64px);
  background: #10241d;
  color: #fff;
}

.eyebrow {
  margin: 0 0 6px;
  color: #9ad9c5;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.member-box {
  width: min(420px, 100%);
}

.member-box label,
.player-form label,
.search span,
.tip-form span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.topbar .member-box label {
  color: #b7d3c9;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

main {
  padding: 22px clamp(18px, 5vw, 64px) 48px;
}

.toolbar,
.summary,
.content-grid,
.section-title {
  max-width: 1180px;
  margin-inline: auto;
}

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

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search {
  width: min(360px, 100%);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.summary article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.summary span {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
}

.summary p,
.hint,
.saved-state {
  color: var(--muted);
  margin-bottom: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.match-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.match-card {
  padding: 16px;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

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

.teams strong {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.teams strong:last-child {
  text-align: right;
}

.teams span {
  color: var(--muted);
}

.tip-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.tip-form input {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 900;
}

.saved-state {
  min-height: 22px;
  margin-top: 10px;
  font-size: 0.92rem;
}

.saved-state.is-saved {
  color: var(--accent-strong);
  font-weight: 700;
}

.saved-state.is-warn {
  color: var(--warn);
  font-weight: 700;
}

.panel {
  padding: 16px;
  position: sticky;
  top: 16px;
}

.leaderboard {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.player-form {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.panel-subtitle {
  margin-top: 8px;
}

.leader-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.leader-row.is-active {
  background: var(--surface-soft);
  margin-inline: -8px;
  padding-inline: 8px;
  border-radius: 8px;
}

.leader-row:last-child {
  border-bottom: 0;
}

.rank {
  color: var(--muted);
  font-weight: 800;
}

.points {
  color: var(--accent-strong);
  font-weight: 900;
}

.select-player {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.select-player:disabled {
  cursor: default;
  background: #dce8e2;
  color: var(--accent-strong);
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 860px) {
  .topbar,
  .toolbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

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

  .panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .member-row,
  .summary,
  .tip-form {
    grid-template-columns: 1fr;
  }

  .teams {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .teams strong:last-child {
    text-align: left;
  }
}
