@font-face { font-family: "Barlow"; src: url("fonts/Barlow-Regular.ttf"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-Medium.ttf"); font-weight: 500; font-display: swap; }

:root {
  --page: #f8f8f6;
  --ink: #1f2328;
  --muted: #6a7078;
  --rule: #dfe0dc;
  --soft: #eeeeea;
  --hint: #fbf0c9;
  --danger: #c8372d;
  --moved: #b4602a;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0 auto;
  max-width: 1040px;
  padding: 28px clamp(16px, 3vw, 32px) 56px;
  color: var(--ink);
  font: 400 17px/1.5 "Barlow", system-ui, sans-serif;
}

.top { margin-bottom: 22px; }
.mark { margin: 0; font-size: 30px; font-weight: 500; line-height: 1.2; }
.intro { margin: 2px 0 0; color: var(--muted); font-size: 18px; }

.hole-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 24px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.hole-head h2 { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.2; }
#hole-name:focus { outline: none; }
.tally { display: flex; gap: 24px; margin: 0; }
.tally div { text-align: right; }
.tally dt { color: var(--muted); font-size: 14px; line-height: 1.2; }
.tally dd { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tally-strokes dd { color: var(--danger); }
.tally-strokes dd.clear { color: var(--ink); }

.board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; margin-top: 18px; align-items: start; }

.course { margin: 0; }
#course { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 6px; image-rendering: pixelated; touch-action: manipulation; }
figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; }

.net { display: block; width: 100%; height: auto; }
.net .edge { fill: none; stroke-linecap: round; pointer-events: none; }
.net .hit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; pointer-events: stroke; }
.net .node { fill: var(--page); stroke: var(--ink); stroke-width: 1.5; }
.net .node-label { fill: var(--ink); font: 500 16px "Barlow", sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.net .pip { stroke: var(--ink); stroke-width: 1; cursor: pointer; }
.net .pip-hit { fill: transparent; cursor: pointer; }
.net .chip-bg { fill: var(--page); cursor: pointer; }
.net .chip { fill: var(--ink); font: 500 14px "Barlow", sans-serif; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; pointer-events: none; }
.net .selected-halo { fill: none; stroke: #e8d48a; stroke-linecap: round; pointer-events: none; }
.net .changed { fill: var(--danger); stroke: var(--page); stroke-width: 1.5; pointer-events: none; }
:root { --up: #3b6ea8; --down: #b4602a; }
.pos { color: var(--up); font-weight: 500; }
.neg { color: var(--down); font-weight: 500; }

.coach { min-height: 28px; margin: 0 0 12px; font-size: 18px; font-weight: 500; line-height: 1.3; }
.coach:empty { display: none; }
.sliders { display: grid; gap: 12px; }
.group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; padding: 0 6px; font-size: 15px; font-weight: 500; color: var(--muted); }
.line-tag { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 13px; line-height: 1; }
.slider-row { display: grid; grid-template-columns: 108px minmax(0, 1fr) 36px 28px; align-items: center; gap: 8px; padding: 1px 6px; border-radius: 4px; }
.slider-row label { display: flex; align-items: baseline; gap: 8px; }
.slider-letter { width: 14px; flex: none; font-weight: 500; }
.slider-name { color: var(--muted); font-size: 14px; white-space: nowrap; }
.slider-row output { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.slider-row.changed output, .slider-row.changed .slider-letter { color: var(--moved); }
.slider-row.active { background: var(--soft); }
.slider-row.hint { background: var(--hint); }
.explain { min-height: 44px; margin: 12px 0 0; padding: 0 6px; color: var(--muted); font-size: 15px; line-height: 1.35; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; height: 26px; margin: 0; background: none; cursor: grab; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: #c9cbc6; }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: #c9cbc6; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: var(--ink); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--ink); }
.slider-row.changed input::-webkit-slider-thumb { background: var(--moved); }
.slider-row.changed input::-moz-range-thumb { background: var(--moved); }
input[type="range"]:disabled { cursor: default; }

button {
  min-height: 38px; padding: 6px 14px;
  border: 0; border-radius: 6px;
  background: var(--ink); color: #fff;
  font: 500 15px "Barlow", sans-serif; cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }
button.quiet { padding: 6px 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
button.undo { width: 28px; min-height: 26px; padding: 0; background: none; color: var(--muted); font-size: 17px; font-weight: 400; }
button.undo:disabled { visibility: hidden; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.editor-actions { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }

summary { font-size: 16px; font-weight: 500; cursor: pointer; }
.net-details svg { max-width: 560px; margin-top: 8px; }

.result:empty { display: none; }
.result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.result h3 { margin: 0; font-size: 24px; font-weight: 500; line-height: 1.2; }
.result > p { margin: 2px 0 10px; }
#back { margin-bottom: 10px; }
.runs { display: grid; margin: 0 0 12px; padding: 0; list-style: none; }
.runs li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--rule); }
.runs li:first-child { border-top: 0; }
.runs strong { font-weight: 500; min-width: 128px; }
.runs .run-text { flex: 1 1 180px; color: var(--muted); font-size: 15px; }
.preview-note { font-weight: 500; }

.card { margin-top: 32px; }
.card-scroll { overflow-x: auto; }
table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 4px; border-bottom: 1px solid var(--rule); text-align: center; }
th:first-child { width: 110px; padding-left: 0; text-align: left; font-weight: 500; }
thead th { color: var(--muted); font-weight: 500; }
thead a { display: block; color: inherit; text-decoration: none; }
thead a:hover { text-decoration: underline; }
.now { background: var(--soft); }
td.under { font-weight: 500; }
td.over { color: var(--danger); }
td.missed { color: var(--muted); }
.card-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.notes { margin-top: 18px; max-width: 68ch; color: var(--muted); }
.notes summary { color: var(--ink); }
.notes p { margin: 8px 0; }
.notes a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#share-status { white-space: pre-line; }

.load-error { padding: 16px; background: var(--soft); border-left: 3px solid var(--danger); }

@media (max-width: 860px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .tally { width: 100%; justify-content: space-between; }
  .tally div { text-align: left; }
}
