:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --ink: #19221c;
  --muted: #647067;
  --line: #d9ded5;
  --panel: #ffffff;
  --accent: #176f52;
  --accent-strong: #0f513c;
  --amber: #c98619;
  --red: #b94e48;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.tool {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(32, 45, 34, 0.08);
}

.mast {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.entry { margin-top: 24px; }

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 16px;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 111, 82, 0.16);
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

button:hover { background: var(--accent-strong); }
button:disabled { cursor: wait; opacity: 0.75; }

.status {
  min-height: 24px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.status.error {
  color: var(--red);
  font-weight: 700;
}

.results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.player-list { margin-top: 28px; }

.winner {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.winner h2 {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.player {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--accent-strong);
  font-weight: 800;
}

.metric strong { font-size: 30px; }

.details {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.birdie { border-top: 5px solid var(--accent); }
.par { border-top: 5px solid var(--amber); }
.bogey { border-top: 5px solid var(--red); }

.player-list h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: right;
  white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; }

thead th {
  background: #eef2ed;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

tbody th {
  font-size: 15px;
  font-weight: 700;
}

tbody th small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

.winner-score { font-weight: 900; }
.winner-score.birdies { background: rgba(23, 111, 82, 0.14); color: var(--accent-strong); }
.winner-score.pars { background: rgba(201, 134, 25, 0.16); color: #7a4b08; }
.winner-score.bogeys { background: rgba(185, 78, 72, 0.14); color: #82312d; }

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 980px);
    padding: 20px 0;
  }

  .tool { padding: 18px; }
  .mast, .input-row, .results { grid-template-columns: 1fr; }
  .mast { display: block; }
  h1 { font-size: 28px; }
}
