:root {
  --bg: #f3f5f1;
  --card: #ffffff;
  --ink: #17221b;
  --muted: #66736b;
  --line: #dfe5dd;
  --brand: #1f5f3a;
  --brand-ink: #ffffff;
  --chip: #eef2ec;
  --accent: #c98a12;
  --good: #1f7a44;
  --bad: #b23a2e;
  --birdie: #d14b3c;
  --bogey: #2f5d9e;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1511;
    --card: #18211b;
    --ink: #e8efe9;
    --muted: #93a198;
    --line: #2a362e;
    --brand: #3f9a62;
    --chip: #222d25;
    --good: #57c27f;
    --bad: #ef7a6c;
    --birdie: #ff7d6e;
    --bogey: #7ea7e6;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 16px) env(safe-area-inset-left);
}
main { max-width: 560px; margin: 0 auto; padding: 0 14px; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); padding: 10px 0 8px;
}
.top h1 { flex: 1; font-size: 17px; margin: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .side { min-width: 74px; }
.top .side:last-child { text-align: right; }
.big-title { font-size: 30px; margin: 18px 0 6px; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.link { color: var(--brand); font-weight: 600; padding: 6px 2px; }
.btn {
  display: block; width: 100%; padding: 15px; border-radius: var(--radius);
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 17px;
}
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.danger { background: transparent; color: var(--bad); }
.btn + .btn { margin-top: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row .btn + .btn { margin-top: 0; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin: 12px 0; border: 1px solid var(--line); }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=date], input[type=number] {
  width: 100%; font: inherit; font-size: 18px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 10px 12px; min-width: 48px; border-radius: 10px; background: var(--chip);
  font-weight: 600; font-size: 15px; text-align: center;
}
.chip.on { background: var(--brand); color: var(--brand-ink); }
.chip.pen.on { background: var(--bad); }
.chip.holed { border: 2px solid var(--brand); }
.chip.holed.on { border-color: transparent; }
.chips.clubs .chip { flex: 1 0 calc(25% - 6px); }
.chips.grid3 .chip { flex: 1 0 calc(33.33% - 6px); }

.hole-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hole-num { font-size: 34px; font-weight: 800; line-height: 1; }
.hole-num small { font-size: 15px; color: var(--muted); font-weight: 600; }
.total { text-align: right; font-size: 13px; color: var(--muted); }
.total b { font-size: 22px; color: var(--ink); display: block; }

.shots { list-style: none; margin: 0; padding: 0; }
.shots li {
  display: flex; gap: 10px; align-items: center; padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.shots li:last-child { border-bottom: 0; }
.shots li.editing { background: var(--chip); border-radius: 8px; }
.shots .n {
  width: 26px; height: 26px; border-radius: 50%; background: var(--chip);
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
}
.shots .t { flex: 1; }
.shots .t .s { font-size: 13px; color: var(--muted); }
.tag { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--bad); color: #fff; }

.done { text-align: center; padding: 18px 10px; }
.done .sc { font-size: 44px; font-weight: 800; line-height: 1.1; }
.done .nm { font-size: 18px; font-weight: 700; color: var(--brand); }

.holenav { display: flex; justify-content: space-between; margin: 6px 0 20px; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.list-item:last-child { border-bottom: 0; }
.list-item .t { flex: 1; }
.list-item .t b { display: block; }
.score-pill { font-weight: 800; font-size: 20px; text-align: right; }
.score-pill small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

table.sc { width: 100%; border-collapse: collapse; font-size: 15px; text-align: center; }
table.sc th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 2px; }
table.sc td { padding: 7px 2px; border-top: 1px solid var(--line); }
table.sc tr.sub td { font-weight: 800; background: var(--chip); }
table.sc tr.click { cursor: pointer; }
.s { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 4px; font-weight: 700; }
.s.eagle { border-radius: 50%; box-shadow: 0 0 0 2px var(--birdie), 0 0 0 4px var(--card), 0 0 0 6px var(--birdie); }
.s.birdie { border-radius: 50%; box-shadow: 0 0 0 2px var(--birdie); }
.s.bogey { box-shadow: 0 0 0 2px var(--bogey); }
.s.dbl { box-shadow: 0 0 0 2px var(--bogey), 0 0 0 4px var(--card), 0 0 0 6px var(--bogey); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--chip); border-radius: 12px; padding: 12px; }
.tile .v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.tile .l { font-size: 12px; color: var(--muted); }
.hero { text-align: center; padding: 8px 0 4px; }
.hero .v { font-size: 56px; font-weight: 800; line-height: 1; }
.hero .l { color: var(--muted); }

.sg-row { display: grid; grid-template-columns: 96px 1fr 52px; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.sg-bar { position: relative; height: 14px; background: var(--chip); border-radius: 7px; }
.sg-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }
.sg-bar i { position: absolute; top: 0; bottom: 0; border-radius: 7px; }
.sg-row .num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); } .neg { color: var(--bad); }
table.sc.tight { font-size: 13px; }
