:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --ink: #172018;
  --muted: #657067;
  --line: #d9ded8;
  --panel: #ffffff;
  --accent: #0f7c66;
  --accent-strong: #095846;
  --warn: #8a4b05;
  --danger: #a32929;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 244, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  font-size: 0.92rem;
}

.nav a {
  text-decoration: none;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 96px;
}

.hero,
.section-heading,
.match-detail {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 6vw, 3.7rem);
  line-height: 1;
}

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

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.panel,
.action,
.match-row,
.result-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel {
  margin-bottom: 20px;
  padding: clamp(18px, 4vw, 28px);
}

.narrow {
  max-width: 520px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.source-option div {
  display: grid;
  gap: 4px;
}

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

.action {
  display: grid;
  gap: 6px;
  padding: 20px;
  text-decoration: none;
}

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

.form {
  display: grid;
  gap: 14px;
}

.form-grid p,
.form p {
  display: grid;
  gap: 6px;
  margin: 0;
}

.field-help {
  color: var(--muted);
  font-size: 0.9rem;
}

.errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
}

label {
  display: grid;
  gap: 6px;
  font-weight: 650;
}

input,
button,
.button {
  min-height: 42px;
  border-radius: 6px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
}

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

.message {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
}

.message-error {
  border-color: #efb4b4;
  color: var(--danger);
}

.message-warning {
  border-color: #e7c58b;
  color: var(--warn);
}

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

.match-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.match-row.locked {
  background: #f0f2ef;
}

.match-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
}

.match-meta span {
  color: var(--accent-strong);
  font-weight: 750;
}

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

.teams label {
  grid-template-columns: 1fr 76px;
  align-items: center;
}

.teams input,
.result-form input {
  text-align: center;
}

.row-status {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding: 12px 0;
  background: linear-gradient(rgba(247, 247, 244, 0), var(--bg) 24%);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.score-final {
  margin: 18px 0 0;
  font-size: 3rem;
  font-weight: 850;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.result-row h2 {
  margin-bottom: 4px;
}

.suggestion {
  margin-bottom: 0;
  color: var(--accent-strong);
  font-weight: 700;
}

.result-form {
  display: grid;
  grid-template-columns: 72px auto 72px minmax(130px, auto) auto;
  gap: 8px;
  align-items: center;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.check input {
  width: 18px;
  min-height: 18px;
}

@media (max-width: 780px) {
  .topbar,
  .section-heading,
  .hero,
  .match-detail {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .match-row,
  .result-row,
  .source-option {
    grid-template-columns: 1fr;
  }

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

  .result-form {
    grid-template-columns: 72px auto 72px;
  }

  .result-form .check,
  .result-form button {
    grid-column: 1 / -1;
  }
}
