/* Slow Horses Golf Society: forest green, old gold and parchment, after the club flyer. */
:root {
  --green-950: #0e1f14;
  --green-900: #16301f;
  --green-700: #22472d;
  --green-500: #3a6b47;
  --green-100: #dde8d6;
  --parchment: #efe6cf;
  --paper: #fbf7ec;
  --ink: #1b1d17;
  --muted: #6a6754;
  --gold: #c79a2e;
  --gold-deep: #9c7417;
  --gold-soft: #f3e3b3;
  --line: #ddd1b3;
  --red: #a63a28;
  --red-soft: #f4dcd3;
  --radius: 12px;
  --display: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --serif: 'Bitter', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--muted); }

#app { max-width: 680px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

/* ---- Header & tabs ---- */
.top {
  background: var(--green-900);
  border-bottom: 3px solid var(--gold);
  color: var(--paper);
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 44px; width: auto; filter: invert(1); }
.brand b { display: block; font: 600 22px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.brand small { display: block; font: 500 11px/1 var(--display); letter-spacing: .28em; text-transform: uppercase; color: var(--gold); margin-top: 4px; }
.who { border: 1px solid rgba(255,255,255,.25); background: transparent; color: var(--paper); border-radius: 10px; padding: 5px 10px; text-align: right; font-size: 12px; line-height: 1.25; }
.who b { display: block; font-size: 15px; }
.who[aria-current] { border-color: var(--gold); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--green-900); border-top: 3px solid var(--gold);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs div { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs button {
  border: 0; background: none; padding: 8px 2px 7px; color: #a9b9a8;
  font: 500 11px var(--display); letter-spacing: .08em; text-transform: uppercase;
  display: grid; gap: 3px; justify-items: center;
}
.tabs svg { width: 22px; height: 22px; }
.tabs button[aria-current] { color: var(--gold); }

main { padding: 14px 12px 8px; display: grid; gap: 14px; }

/* ---- Cards ---- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card > h2, .sect {
  font: 600 14px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--green-700);
  margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.card > h2 small { font: 400 13px var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted); }
.hero {
  background: var(--green-900) linear-gradient(160deg, var(--green-700), var(--green-950));
  color: var(--paper); border: 0; border-bottom: 3px solid var(--gold);
}
.hero .kicker { font: 500 12px var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.hero h1 { font: 600 28px/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; margin-top: 2px; }
.hero p { color: #cbd6c6; font-size: 14px; margin-top: 4px; }
.hero .row { margin-top: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: grid; gap: 10px; }
.banner { display: flex; gap: 12px; align-items: center; background: var(--gold-soft); border: 1px solid #e2c77a; border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.banner .ball { flex: none; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6cf, var(--gold) 55%, var(--gold-deep)); box-shadow: inset 0 -2px 3px rgba(0,0,0,.25); }

/* ---- Buttons ---- */
.btn {
  border: 1px solid var(--line); background: var(--paper); border-radius: 10px;
  padding: 10px 14px; font-weight: 600; font-size: 15px; min-height: 44px;
}
.btn.primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold-deep); color: #22190a; }
.btn.danger { color: var(--red); border-color: #dfb3a6; }
.btn.small { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.35); color: var(--paper); }
.btn:disabled { opacity: .5; }
.link { border: 0; background: none; padding: 4px 0; color: var(--green-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 14px; min-height: 36px; }
.chip.me { border-color: var(--green-500); background: var(--green-100); }
.chip small { color: var(--muted); margin-left: 4px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e3d8bc; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 8px 4px; font: 500 13px var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--green-700); color: #fff; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { font: 500 12px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; }
th.c, td.c { text-align: center; }
td.pos { width: 32px; color: var(--muted); }
tr.tap { cursor: pointer; }
tr.is-me td { background: #eef3e6; }
b.big { font: 600 20px var(--display); }
.medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 600 13px var(--display); background: #e6dcc2; color: var(--ink); }
.medal.p1 { background: var(--gold); }
.medal.p2 { background: #cdd1cf; }
.medal.p3 { background: #d6a473; }
.tag { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 600; background: #e6dcc2; color: var(--ink); white-space: nowrap; }
.tag.down { background: var(--green-100); color: var(--green-700); }
.tag.up { background: var(--red-soft); color: var(--red); }
.tag.gold { background: var(--gold-soft); color: #6a4f0a; }
.tag.dark { background: var(--green-700); color: #fff; }
.scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.owes { color: var(--red); font-weight: 600; }
.credit { color: var(--green-700); font-weight: 600; }

/* ---- Groups ---- */
.group { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.group h3 { font: 600 14px var(--display); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }

/* ---- Forms ---- */
label.field, .field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; border: 1px solid #cbbd98; border-radius: 10px; padding: 11px 12px; background: #fff; font-size: 16px; min-height: 46px;
}
textarea { min-height: 160px; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid rgba(199,154,46,.6); outline-offset: 1px; }
.nines { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nines label { border: 1px solid #cbbd98; border-radius: 12px; padding: 10px; background: #fff; display: block; cursor: pointer; position: relative; }
.nines input { position: absolute; opacity: 0; }
.nines b { display: block; font: 600 16px var(--display); letter-spacing: .04em; text-transform: uppercase; }
.nines span { font-size: 13px; color: var(--muted); }
.nines label:has(input:checked) { border-color: var(--green-700); background: var(--green-100); box-shadow: inset 0 0 0 1px var(--green-700); }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--ink); font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--green-700); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- Gate / login ---- */
.gate { min-height: 100dvh; display: grid; align-content: center; gap: 18px; padding: 24px 18px; margin-bottom: -76px; }
.gate .logo { display: flex; justify-content: center; align-items: center; gap: 18px; }
.gate .logo img.crest { height: 118px; }
.gate .logo img.lockup { height: 132px; }
.gate .tagline { text-align: center; font: 500 13px var(--display); letter-spacing: .22em; text-transform: uppercase; color: var(--green-700); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.names .btn { text-align: left; font-weight: 500; }
.err { color: var(--red); font-size: 14px; font-weight: 600; }

/* ---- Scoring ---- */
.scorebar { position: sticky; top: 0; z-index: 4; background: var(--green-900); border-bottom: 3px solid var(--gold); color: var(--paper); padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
.scorebar .spread b { font: 600 18px var(--display); letter-spacing: .08em; text-transform: uppercase; }
.scorebar .btn { min-height: 38px; padding: 6px 12px; }
.sync { font-size: 12px; color: #b5c3b2; }
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; margin-top: 10px; }
.holes button { border: 1px solid rgba(255,255,255,.3); background: transparent; color: var(--paper); border-radius: 8px; padding: 6px 0; font: 600 15px var(--display); }
.holes button.done { background: rgba(255,255,255,.16); }
.holes button[aria-current] { background: var(--gold); border-color: var(--gold); color: #22190a; }
.holeinfo { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.holeinfo div { padding: 4px; }
.holeinfo div + div { border-left: 1px solid var(--line); }
.holeinfo b { display: block; font: 600 30px var(--display); color: var(--green-900); }
.holeinfo span { font: 500 12px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.prow { display: grid; grid-template-columns: 1fr auto 52px; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; padding-bottom: 0; }
.prow:first-of-type { padding-top: 0; }
.pinfo b { display: block; font-size: 17px; }
.pinfo span { font-size: 13px; color: var(--muted); }
.pinfo .shots { color: var(--green-700); font-weight: 600; }
.pinfo .links { display: flex; gap: 12px; flex-wrap: wrap; }
.pinfo .link { font-size: 13px; padding: 2px 0; }
.stepper { display: grid; grid-template-columns: 52px 50px 52px; align-items: center; text-align: center; }
.stepper button { height: 52px; border-radius: 50%; border: 1px solid #cbbd98; background: #fff; font-size: 26px; line-height: 1; font-weight: 500; }
.stepper button:active { background: var(--green-100); }
.stepper output { font: 600 32px var(--display); }
.stepper output.empty { color: #bdb49a; }
.stepper output.pu { font: 600 14px var(--sans); color: var(--muted); }
.ppts { text-align: center; border-radius: 10px; padding: 6px 0; background: #ece3cb; }
.ppts b { display: block; font: 600 22px/1.1 var(--display); }
.ppts small { font-size: 11px; color: var(--muted); }
.ppts.good { background: var(--green-100); }
.ppts.great { background: var(--gold-soft); }
.ppts.none { background: transparent; border: 1px dashed #cbbd98; }
.cardgrid td, .cardgrid th { padding: 7px 3px; text-align: center; font-size: 14px; }
.cardgrid td:first-child, .cardgrid th:first-child { text-align: left; white-space: nowrap; padding-left: 0; }
.cardgrid td.tot { font-weight: 700; }
.cardgrid sub { font-size: 10px; color: var(--green-700); vertical-align: baseline; margin-left: 1px; }
.nav2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.taxrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.taxrow:last-child { border-bottom: 0; }
.taxrow .stepper { grid-template-columns: 42px 36px 42px; }
.taxrow .stepper button { height: 42px; font-size: 22px; }
.taxrow .stepper output { font-size: 22px; }

/* ---- Events & rules ---- */
.poster { width: 100%; border-radius: var(--radius); display: block; border: 1px solid var(--line); }
.details { white-space: pre-line; font-size: 15px; }
.details a { color: var(--green-700); word-break: break-all; }
.prose { display: grid; gap: 8px; font-size: 15px; }
.prose ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.bank { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 15px; }
.bank dt { color: var(--muted); }
.bank dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; }
.stat b { display: block; font: 600 22px var(--display); color: var(--green-900); }
.stat span { font: 500 11px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ---- Sheet ---- */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(14,31,20,.55); display: grid; align-items: end; }
.sheet {
  background: var(--parchment); border-radius: 18px 18px 0 0; border-top: 3px solid var(--gold); width: 100%; max-width: 680px; margin: 0 auto;
  max-height: 90dvh; overflow-y: auto; padding: 16px 14px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px;
}
.sheet > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet > header h2 { font: 600 22px var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--green-900); }
.sheet > header button { border: 0; background: #e0d4b4; border-radius: 50%; width: 36px; height: 36px; font-size: 18px; flex: none; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--green-950); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details table { margin-top: 4px; }

@media (min-width: 520px) { .names { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 360px) { .brand small { display: none; } .brand b { font-size: 19px; } }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
