:root {
  --bg: #f3efe7;
  --surface: #fffdf8;
  --ink: #17251f;
  --muted: #68736d;
  --green: #1b5d45;
  --green-dark: #123f30;
  --lime: #c8ef65;
  --line: #d8d6ce;
  --danger: #b43b32;
  --shadow: 0 14px 30px rgba(23, 37, 31, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { max-width: 760px; margin: 0 auto; padding: 26px 16px 50px; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(2.6rem, 13vw, 4.6rem); letter-spacing: -.07em; line-height: .9; }
h2 { font-size: 1.25rem; margin-bottom: 0; }
small, .muted { color: var(--muted); }

.hero {
  background: var(--green);
  color: white;
  border-radius: 28px;
  padding: 28px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.hero p { color: #d7e6dd; margin-bottom: 18px; }
.hero h1 { cursor: pointer; user-select: none; }
.admin-header h1 { cursor: default; }

.eyebrow, .section-heading > span {
  display: block;
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow { color: var(--lime); margin-bottom: 8px; }

.button, .nav-button {
  display: inline-block;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  color: white;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary, .nav-button, .primary { background: var(--green); }
.hero .primary { background: var(--lime); color: var(--green-dark); }
.button.secondary, .secondary { background: #dce5db; color: var(--green-dark); }

.text-link {
  display: inline-block;
  margin-top: 14px;
  border: 0;
  padding: 0;
  color: var(--green);
  background: transparent;
  font: inherit;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}

.hero .text-link { color: white; }
.hidden { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(23, 37, 31, .04);
}

.section-heading { margin: 28px 4px 12px; }
.section-heading > span { color: var(--green); margin-bottom: 3px; }

.match-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.match-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.match-card small { color: var(--green); display: block; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 9px; }
.match-card strong { display: block; font-size: 1.05rem; }
.match-card span { display: block; color: var(--muted); font-size: .8rem; margin: 4px 0; }

.public-match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 14px 0; }
.public-match:first-child { border-top: 0; padding-top: 0; }
.public-match b { display: block; font-size: .9rem; }
.public-match small { font-size: .72rem; }
.public-match > div:last-of-type { text-align: right; }
.public-match > strong { font-size: 1.1rem; white-space: nowrap; }
.public-match em { grid-column: 1 / -1; color: var(--danger); font-size: .75rem; font-style: normal; }

.score-card { padding: 20px; }
.team-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 850; }
.team-title small { text-transform: uppercase; font-size: .67rem; letter-spacing: .08em; }
.roster { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.player { border: 1px dashed #9eb1a5; border-radius: 11px; padding: 9px 11px; color: var(--muted); background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.player.selected { border-style: solid; border-color: var(--green); background: #e6f0e9; color: var(--green-dark); }
.player b { margin-left: 8px; color: var(--danger); }
.score { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; text-align: center; }
.score button { height: 62px; border: 0; border-radius: 14px; color: white; background: var(--green); font-size: 2rem; cursor: pointer; }
.score output { font-size: 3.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.divider { margin: 21px 0; border-top: 1px solid var(--line); }
.choices { display: flex; flex-wrap: wrap; gap: 9px; }
.choices label { padding: 9px 11px; border-radius: 10px; background: #eaf0e9; font-weight: 650; }

.actions { display: grid; gap: 9px; margin: 14px 0 4px; }
.actions.three { grid-template-columns: 1fr 1fr 1.25fr; }
.actions .button { width: 100%; }
#message { min-height: 1.4em; text-align: center; color: var(--green); }

.history article { display: grid; grid-template-columns: 1fr auto; gap: 5px; border-top: 1px solid var(--line); padding: 13px 0; align-items: center; }
.history article:first-child { border-top: 0; padding-top: 0; }
.history article small { display: block; margin-top: 3px; font-size: .73rem; }
.history article strong { font-size: 1.08rem; }
.history em { color: var(--danger); font-size: .74rem; font-style: normal; }
.row-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.row-actions button { border: 0; border-radius: 9px; padding: 7px 10px; font: inherit; font-size: .78rem; font-weight: 750; cursor: pointer; }
.edit { color: white; background: var(--green); }
.remove { color: var(--danger); background: transparent; border: 1px solid #d49b94 !important; }

.login-card { max-width: 440px; margin: 0 auto; }
.login-card label { display: block; font-weight: 800; margin-bottom: 7px; }
.login-card input, .filter select { width: 100%; border: 1px solid #aab6ad; border-radius: 10px; padding: 11px; background: white; font: inherit; }
.login-card .button { margin-top: 13px; width: 100%; }
.error { color: var(--danger); margin: 10px 0 0; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { margin: 0; padding: 14px; }
.stat-card span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { display: block; margin: 9px 0 3px; font-size: 1.05rem; }
.stat-card b { color: var(--green); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: .88rem; }
th, td { padding: 10px 7px; border-top: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.filter { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.filter select { flex: 1; }

footer { margin-top: 34px; color: var(--muted); text-align: center; font-size: .82rem; }

@media (max-width: 430px) {
  main { padding: 16px 12px 40px; }
  .hero { border-radius: 22px; padding: 25px 20px; }
  .actions.three { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}
