/* Taps & Strokes — light, high-contrast, one-handed. */
:root {
  --ink: #102117;
  --green: #0b4f32;
  --green-dark: #062e1d;
  --paper: #f4f1e4;
  --card: #ffffff;
  --line: #102117;
  --muted-bg: #e7efe4;
  --gold: #e2b000;
  --danger: #7a1c1c;
  --win: #e5f6d4;
  --tap: 56px;
  --stroke: 72px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  touch-action: manipulation;
  background: #d5e0d2;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
}

html, body, button, input {
  touch-action: manipulation;
}

body {
  color-scheme: light;
}

#app {
  height: 100%;
  height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

input {
  font: inherit;
  user-select: text;
  -webkit-user-select: text;
}

h1, h2, h3, p, ul, ol { margin: 0; }

h1 { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 20px; font-weight: 800; }

button:focus-visible,
input:focus-visible,
.sheet:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.btn-primary:focus-visible,
.stroke-btn:focus-visible,
.is-on:focus-visible {
  outline-color: #ffe14a;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen {
  height: 100%;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  overflow: hidden;
}

.scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.brand { padding: 14px 16px 4px; }
.brand-mark {
  height: 8px;
  width: 104px;
  border-radius: 999px;
  background: var(--green);
  margin-bottom: 10px;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 68px;
  width: 36px;
  border-radius: 999px;
  background: var(--gold);
}
.lede { margin-top: 6px; max-width: 36ch; }

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 12px;
}

.player-list { margin-top: 4px; }
.player-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.player-edit input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}
.player-edit input::placeholder { color: #3e5146; opacity: 1; }

.btn {
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
}
.btn-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green-dark);
}
.btn-big { min-height: 64px; font-size: 22px; }
.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff;
}
.btn.is-on {
  background: var(--green);
  color: #fff;
  border-color: var(--green-dark);
}
.btn:disabled {
  background: #e4e7df;
  color: #3d4f44;
  border-color: #6d7d72;
}
.btn-primary:disabled {
  background: #d5e5da;
  color: #1a3d2c;
  border-color: #1a3d2c;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

.remove-player {
  width: 56px;
  min-width: 56px;
  height: 56px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.stepper-inline { justify-content: flex-end; }
.btn-step {
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  font-size: 36px;
  line-height: 1;
}
.mega {
  font-size: 72px;
  line-height: 0.95;
  font-weight: 800;
  min-width: 108px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.step-value {
  min-width: 40px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.preset-row { display: flex; gap: 8px; margin-top: 12px; }
.preset-row .btn { flex: 1; font-size: 28px; min-height: 64px; }

.set-all, .par-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 64px;
}
.par-row { border-top: 2px solid #d7e0d4; }
.set-all-label, .par-label { font-weight: 800; font-size: 18px; }
.mixed { font-weight: 800; margin: 4px 0 0; }

.dock {
  flex: none;
  background: var(--paper);
  border-top: 3px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dock > .btn { width: 100%; }
.dock-row, .dock.dock-row { flex-direction: row; }
.dock-row > .btn, .dock.dock-row > .btn { width: auto; flex: 1; }

.topbar { flex: none; }
.top-actions { display: flex; gap: 8px; padding: 8px 12px 0; }
.top-actions .btn { flex: 1; }
.hole-title {
  font-size: 40px;
  text-align: center;
  padding: 6px 12px 0;
}
.par-line {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  padding-bottom: 4px;
}
.par-line-live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 8px;
}
.par-mini {
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
  background: var(--paper);
  color: var(--ink);
}
.par-mini-value {
  min-width: 32px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.topbar .sync { text-align: center; padding: 0 12px 8px; }

.player-row {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  margin: 0 12px 10px;
  padding: 10px;
}
.hole-list { padding-top: 8px; padding-bottom: 8px; }
.name-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 12px;
}
.pname { font-size: 22px; overflow-wrap: anywhere; }
.running { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stroke-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.stroke-btn {
  flex: none;
  width: var(--stroke);
  height: var(--stroke);
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  border-radius: 18px;
  border: 3px solid var(--green-dark);
  background: var(--green);
  color: #fff;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}
.stroke-btn:disabled {
  background: #d5ddd6;
  color: #24382d;
  border-color: #6d7d72;
}
.stroke-count {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 64px;
}

.rank-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.rank-row.winner {
  background: var(--win);
  border-width: 3px;
}
.rank-badge {
  min-width: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 22px;
  font-weight: 800;
}
.rank-name { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.rank-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.trophy { font-size: 28px; line-height: 1; }
.vs { font-size: 18px; }

.table-wrap {
  overflow-x: auto;
  margin: 0 12px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}
th, td {
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid #d7e0d4;
  background: #fff;
  min-width: 48px;
  font-size: 16px;
}
tbody th, thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  min-width: 112px;
  max-width: 160px;
  box-shadow: 3px 0 0 var(--line);
}
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e7f0e2;
  font-size: 16px;
}
thead th:first-child { z-index: 3; }
.par-table-row th, .par-table-row td { background: #f7f3d8; }
td.hole-best {
  background: #c8ead6;
  box-shadow: inset 0 0 0 2px var(--green-dark);
  font-weight: 800;
}
.awards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 12px 12px;
}
.award {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.award-title { font-weight: 800; font-size: 18px; margin: 0; }
.award-who { font-weight: 800; margin: 4px 0 0; }
.award p { margin: 4px 0 0; }

.sync {
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}
.sync:empty { display: none; }

.hist-title { font-size: 28px; padding: 12px 16px 4px; }
.section-title { margin: 4px 12px 0; }
.round-card h3 { margin-bottom: 4px; }
.round-players { list-style: none; padding: 0; margin: 8px 0; }
.round-players li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-weight: 800;
}
.winner-line { font-weight: 800; }
.selectable {
  user-select: text;
  -webkit-user-select: text;
  background: #fff;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.card > .btn { width: 100%; margin-top: 8px; }
.stat-card { border-top: 2px solid #d7e0d4; margin-top: 10px; padding-top: 8px; }
.stat-label { margin-top: 6px; font-weight: 800; }
.hole-avgs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0 2px;
  touch-action: pan-x pan-y;
}
.hole-chip {
  flex: none;
  min-width: 56px;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-align: center;
  padding: 6px;
  font-size: 14px;
  font-weight: 800;
}
.hole-chip b { display: block; font-size: 18px; }

.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  text-align: center;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 33, 23, 0.66);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: min(640px, 100%);
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.sheet h2 { font-size: 26px; margin-bottom: 8px; }
.sheet p { margin-bottom: 8px; }
.sheet .btn { width: 100%; margin-top: 8px; }

body.sheet-open .scroll { overflow: hidden; }

.round-title {
  text-align: center;
  font-weight: 800;
  padding: 4px 12px 0;
}
.share-live-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 8px 12px;
  background: var(--green);
  color: #fff;
  min-height: 64px;
  font-size: 20px;
}
.sheet-full {
  width: min(640px, 100%);
  height: 100%;
  max-height: 100dvh;
  overflow: auto;
  border-radius: 0;
  border-bottom: 2px solid var(--line);
}
.backdrop:has(.sheet-full) { align-items: stretch; }
.qr-box {
  width: 280px;
  height: 280px;
  margin: 12px auto;
  background: #fff;
}
.qr-box svg { display: block; width: 280px; height: 280px; }
.link-text { font-size: 16px; word-break: break-all; }
.viewer-banner {
  background: var(--green);
  color: #fff;
  text-align: center;
  font-weight: 800;
  padding: 10px 12px;
}
.live-status { text-align: center; font-weight: 800; padding: 6px 12px; }
.me-badge {
  display: inline-block;
  margin-left: 8px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 14px;
  font-weight: 800;
}
.claim-btn { width: 100%; margin-top: 8px; }
.pname .me-badge { vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled) { transform: none; }
}
