:root {
  color-scheme: dark light;
  --bg: #0f1419;
  --surface: #1a222d;
  --surface-2: #232d3b;
  --border: #2f3d4f;
  --text: #e8eef5;
  --muted: #8fa3b8;
  --accent: #3ddc97;
  --accent-dim: #2a9d6c;
  --warn: #f4b942;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --surface: #fff;
    --surface-2: #eef2f7;
    --border: #d0dae6;
    --text: #1a2332;
    --muted: #5c6b7d;
    --accent: #0d8f5c;
    --accent-dim: #0a6b45;
    --warn: #b8860b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent-dim);
}

a:hover {
  color: var(--accent);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.brand-mark {
  font-size: 1.75rem;
  line-height: 1;
}

.site-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 36rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field select {
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  min-width: 7rem;
}

.btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.primary {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

main {
  padding: 1rem 1.5rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}

.status {
  min-height: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: #e85d5d;
}

.panel {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
}

tbody tr:last-child td {
  border-bottom: none;
}

.leaderboard tbody tr {
  cursor: pointer;
}

.leaderboard tbody tr:hover {
  background: var(--surface-2);
}

.leaderboard tbody tr:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.scorecard-panel .scorecard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.scorecard-team {
  margin: 0 0 1rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent-dim);
}

@media (prefers-color-scheme: light) {
  .scorecard-team {
    color: var(--accent-dim);
  }
}

.stroke-birdie {
  color: var(--accent);
  font-weight: 600;
}

.stroke-bogey {
  color: var(--warn);
}

.site-footer {
  padding: 1rem 1.5rem 2rem;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 960px;
  margin: 0 auto;
}

.site-footer code {
  font-family: var(--mono);
  font-size: 0.85em;
}

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