/* GolfScore. Light and dark themes from the same tokens; every text colour meets WCAG 2.2 AA on its background. */
:root {
  --bg: #f3f7f1; --card: #ffffff; --ink: #14200f; --muted: #4b5946; --line: #d9e3d4;
  --brand: #2d6a2d; --brand-ink: #ffffff; --link: #285f28; --head: #1d4a1d; --head-ink: #ffffff; --head-soft: #dcefd6;
  --danger: #b42318; --danger-ink: #ffffff; --focus: #b45309;
  --ok-bg: #e7f4ec; --ok-ink: #14532d; --warn-bg: #fff3d4; --warn-ink: #5e4100; --err-bg: #fde8e6; --err-ink: #8a1c12;
  --tag-bg: #e6efe2; --star: #8a5a00; --track: #d1e2cb;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d140b; --card: #172014; --ink: #e8f2e4; --muted: #acbea5; --line: #2a3826;
    --brand: #92d68c; --brand-ink: #0c260a; --link: #9fdc99; --head: #091208; --head-ink: #ffffff; --head-soft: #dcefd6;
    --danger: #ff8f80; --danger-ink: #2a0905; --focus: #f5c542;
    --ok-bg: #163a24; --ok-ink: #c8efd2; --warn-bg: #3a2e0c; --warn-ink: #ffe3a3; --err-bg: #3d1611; --err-ink: #ffd2cb;
    --tag-bg: #213020; --star: #f5c542; --track: #2e432b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--link); text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .6rem; }
h2 { font-size: 1.25rem; line-height: 1.25; margin: 1.2rem 0 .6rem; }
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
p { margin: 0 0 .8rem; }
:is(a, button, input, select, textarea, summary, label.btn, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 2000; }
.skip:focus { left: 8px; top: 8px; }
.visually-hidden, .sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; }
main:focus { outline: none; }

/* Header */
.site-header { background: var(--head); color: var(--head-ink); }
.site-header .hbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { color: var(--head-ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; padding: 8px 0; }
.brand span, .hero h1 span { margin-right: .3em; }
.nav-out { color: var(--head-soft); padding: 8px 0; }
.site-header .btn.small { background: var(--head-ink); color: var(--head); }
.menu { border-top: 1px solid rgba(255,255,255,.12); }
.menu-row { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.menu a { color: var(--head-soft); text-decoration: none; padding: 10px 0; display: inline-block; border-bottom: 3px solid transparent; min-height: 24px; }
.menu a:hover { color: var(--head-ink); }
.menu a.active { color: var(--head-ink); border-bottom-color: var(--head-soft); font-weight: 600; }

/* Blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }
.card.narrow { max-width: 560px; margin: 24px auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }
/* Two cards side by side (My Finds: found | added; Groups: yours | everyone's), stacked on phones. */
.cols-2 { align-items: start; margin-bottom: 16px; }
.cols-2 > .card { margin: 0; min-width: 0; }
.grid.two.tight { grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 .6rem; }
.center { text-align: center; }
.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); justify-content: space-between; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--tag-bg); color: var(--muted); vertical-align: middle; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.guess-tag { background: var(--err-bg); color: var(--err-ink); }
.more-added summary { cursor: pointer; font-weight: 600; color: var(--link); padding: 10px 0; min-height: 24px; }
.lm > span:last-child .tag { align-self: flex-start; margin: 2px 0; }
.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; font-weight: 700; color: var(--muted); margin: 0 0 .2rem; }
.found-badge { color: var(--ok-ink); background: var(--ok-bg); display: inline-block; padding: 4px 10px; border-radius: 8px; font-weight: 600; }
.stat strong { font-size: 2rem; }

/* Alerts */
.alert, .flash { padding: 12px 14px; border-radius: 8px; margin: 0 0 14px; }
.alert.ok, .flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert.error, .flash.error { background: var(--err-bg); color: var(--err-ink); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: var(--brand-ink); border: 2px solid var(--brand);
  border-radius: 10px; padding: 9px 16px; min-height: 44px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--link); }
.btn.big { font-size: 1.1rem; padding: 12px 22px; min-height: 52px; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .92rem; }
.btn.wide { width: 100%; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.linkish { background: none; border: 0; padding: 4px 0; min-height: 24px; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--danger); }
form { margin: 0; }

/* Forms */
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 750; font-size: 1.1rem; margin-bottom: 8px; padding: 0; }
.field { margin: 0 0 14px; }
.field > label, .field > .label { display: block; font-weight: 650; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=file], select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--muted);
  border-radius: 8px; background: var(--card); color: var(--ink); }
input[type=file] { padding: 8px; }
textarea { resize: vertical; }
.check label { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.check input { width: 22px; height: 22px; margin-top: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.preview { display: block; max-height: 280px; width: auto; border-radius: 10px; margin-top: 10px; }
.inline-form .field { max-width: 420px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

/* Home */
.hero { padding: 16px 0 8px; }
.hero h1 { font-size: 2.2rem; }
.hero .how-card { margin: 12px 0 16px; }
.lead { font-size: 1.3rem; font-weight: 600; }
.steps { padding-left: 1.3rem; margin: 0 0 1rem; }
.steps li { margin-bottom: .6rem; }

/* Lists */
.lm-list { list-style: none; padding: 0; margin: 0 0 .8rem; }
.lm-list li + li { border-top: 1px solid var(--line); }
.lm { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.lm:hover strong { text-decoration: underline; }
.lm > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.lm img, .noimg { width: 72px; height: 72px; flex: 0 0 72px; object-fit: cover; border-radius: 8px; background: var(--tag-bg); }
.noimg { display: inline-flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.lm .meta { color: var(--muted); font-size: .9rem; }
.lm-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.lm-pick > .lm { flex: 1 1 240px; min-width: 0; }
.lm-pick > .btn { margin-left: auto; flex: none; }   /* "Show on map" stays on the right, even when it wraps under a long name (Tom, 2026-11-25) */

/* Page parts */
.cover { margin: 0 0 16px; }
.cover img { width: 100%; max-height: 72vh; object-fit: contain; border-radius: var(--radius); background: #000; display: block; }
.facts { display: grid; gap: 4px 16px; grid-template-columns: 1fr; margin: 12px 0 0; }
@media (min-width: 640px) { .facts { grid-template-columns: 1fr 1fr; } }
.facts dt { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0 0 8px; }
.gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gallery li { display: flex; flex-direction: column; gap: 4px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }

.site-footer { margin-top: 24px; color: var(--ink); }   /* the shared footer fades its own text */
.site-footer a { color: var(--ink); }
@media print { .site-header, .site-footer, .actions, .btn { display: none !important; } body { background: #fff; } .card { border: 0; } }

/* Dashboard (admins) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 14px; }
.tile { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .lbl { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile .num { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .num.good { color: var(--ok-ink); }
.tile .num.bad { color: var(--danger); }
.tile .sub { font-size: .85rem; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 0 16px; border-radius: 6px; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data caption { text-align: left; font-weight: 700; padding: 6px 0; }
table.data th, table.data td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data tbody th { font-weight: 600; }
table.data .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Cards that open and close (app.js) */
.card-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 24px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; line-height: inherit; text-align: left; cursor: pointer; }
.card-toggle::after { content: ''; flex: none; margin-left: auto; margin-right: 4px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .75; }
.card-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.card-toggle:hover { color: var(--link); }
.card.collapsed > h1, .card.collapsed > h2 { margin-bottom: 0; }
@media (prefers-reduced-motion: no-preference) { .card-toggle::after { transition: transform .15s; } }
@media print { .card-body[hidden] { display: block !important; } .card-toggle::after { display: none; } }
.search-row input[type=search] { flex: 1 1 240px; width: auto; font: inherit; font-size: 16px; padding: 8px 12px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); }
.review h3, .card-body > h3 { font-size: 1.05rem; margin: 14px 0 6px; }



/* ── Lists and tiles ─────────────────────────────────────────────────────────── */
input[type=search], input[type=url], input[type=date], input[type=number] { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); }
.grid.three { grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.grid.two.tight-cols { gap: 0 14px; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; min-height: 24px; }
.check-inline input { width: 20px; height: 20px; }
h3 { font-size: 1.05rem; margin: 14px 0 6px; }
.lead-small { font-size: 1.15rem; margin: 0 0 .4rem; }
.facts.three { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.chips { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 28px; background: var(--tag-bg); color: var(--ink); border-radius: 99px; padding: 2px 12px; font-size: .92rem; text-decoration: none; }
a.chip:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.hero-search { max-width: 560px; margin: 0 0 12px; }
.filters select { width: auto; }
.spread { justify-content: space-between; }
/* A lone button, not a card (cards fold; a single button has nothing to fold). */
.actions-bar { margin: 0 0 16px; }
/* A card heading with a link in it keeps the link; its fold button sits beside it, named for the heading. */
.has-side-toggle { display: flex; align-items: center; gap: 10px; }
.card-toggle.card-toggle-side { width: auto; min-width: 32px; min-height: 32px; margin-left: auto; justify-content: center; flex: none; }
.card-toggle.card-toggle-side::after { margin: 0; }
input[type=time] { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); }
.status { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .85rem; font-weight: 700; background: var(--tag-bg); color: var(--ink); }
.status.reading { background: var(--ok-bg); color: var(--ok-ink); }
.status.next { background: var(--warn-bg); color: var(--warn-ink); }
.status.dropped { background: var(--err-bg); color: var(--err-ink); }
.data { width: 100%; border-collapse: collapse; }



/* ── GolfScore ───────────────────────────────────────────────────────────── */
:root { --ace: #6d28d9; --ace-ink: #fff; --eagle: #b45309; --eagle-ink: #fff; --birdie-bg: #dcfce7; --birdie: #14532d; --par-bg: transparent; --bogey-bg: #fde8e6; --bogey: #8a1c12; --double-bg: #8a1c12; --double-ink: #fff; }
@media (prefers-color-scheme: dark) { :root { --ace: #c4b5fd; --ace-ink: #1e0a4a; --eagle: #fbbf24; --eagle-ink: #2a1a00; --birdie-bg: #163a24; --birdie: #c8efd2; --bogey-bg: #3d1611; --bogey: #ffd2cb; --double-bg: #ffb4a8; --double-ink: #2a0905; } }
.check-row { display: flex; gap: 10px; align-items: center; min-height: 32px; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; min-height: 32px; }
.check-inline input { width: 22px; height: 22px; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.inline-fields .field { margin: 0 0 8px; flex: 1 1 10rem; } .inline-fields .narrow-field { flex: 0 1 7rem; }
.player-edit .linkish { margin-bottom: 14px; }
input[type=number], input[type=date] { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); }
.list-links li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.list-links li .btn { margin-left: auto; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 0 8px; border-radius: 99px; background: var(--tag-bg); color: var(--ink); }
.link-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-box code { background: var(--tag-bg); padding: 6px 10px; border-radius: 8px; font-size: .9rem; overflow-wrap: anywhere; flex: 1 1 18rem; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.grid.two.tight-cols { gap: 0 14px; }

/* The round's header and tabs */
.round-head { margin: 0 0 10px; }
.round-name { margin: 0 0 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); }

/* Scoring a hole: big, thumb-sized */
.scoring { padding: 14px; }
.hole-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.hole-nav { min-width: 52px; min-height: 52px; font-size: 1.8rem; line-height: 1; padding: 0; }
.hole-title { flex: 1; text-align: center; }
.hole-title h1 { margin: 0; font-size: 1.9rem; } .hole-title .of { font-size: 1rem; color: var(--muted); font-weight: 600; }
.hole-title p { margin: 2px 0 0; font-weight: 700; color: var(--muted); }
.prows { list-style: none; padding: 0; margin: 0; }
.prow { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "info score" "name name" "stats stats"; gap: 4px 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.pinfo { grid-area: info; display: flex; flex-direction: column; min-width: 0; }
.pname { font-weight: 800; font-size: 1.15rem; overflow-wrap: anywhere; }
.ptot { color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.pscore { grid-area: score; display: flex; align-items: center; gap: 6px; }
.step { width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--brand); background: var(--card); color: var(--link); font: 800 1.9rem/1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.step:active { background: var(--tag-bg); }
.strokes { width: 64px !important; height: 56px; text-align: center; font: 800 1.8rem/1 system-ui, sans-serif !important; padding: 0 !important; border-radius: 12px !important; -moz-appearance: textfield; }
.strokes::-webkit-outer-spin-button, .strokes::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.strokes.sc-ace { background: var(--ace); color: var(--ace-ink); } .strokes.sc-eagle { background: var(--eagle); color: var(--eagle-ink); }
.strokes.sc-birdie { background: var(--birdie-bg); color: var(--birdie); } .strokes.sc-bogey { background: var(--bogey-bg); color: var(--bogey); }
.strokes.sc-double { background: var(--double-bg); color: var(--double-ink); }
.sname { grid-area: name; font-size: .9rem; font-weight: 700; color: var(--muted); text-align: right; min-height: 1.2em; }
.pstats { grid-area: stats; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: .92rem; }
.pstats .putts { width: 4.5rem; padding: 6px 8px; display: inline-block; margin-left: 4px; }
.prow.saving .ptot::after { content: ' · saving…'; }
.prow.unsaved .ptot::after { content: ' · not saved yet'; color: var(--danger); font-weight: 700; }
.hole-go { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.hole-go .btn.big { flex: 1 1 12rem; }
.hole-chips { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.hole-chips a { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; }
.hole-chips a.done { background: var(--tag-bg); }
.hole-chips a.cur { border: 2px solid var(--brand); color: var(--link); }

/* The leaderboard */
.board { list-style: none; padding: 0; margin: 0 0 14px; }
.board li { display: grid; grid-template-columns: 2rem 1fr auto; grid-template-areas: "pos who vs" "pos thru thru"; gap: 0 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.board li:first-child { border-top: 0; }
.board .pos { grid-area: pos; font-weight: 800; color: var(--muted); font-size: 1.1rem; }
.board .who { grid-area: who; font-weight: 800; font-size: 1.1rem; overflow-wrap: anywhere; }
.board .vs { grid-area: vs; font-weight: 900; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.board .vs.under { color: var(--birdie); } .board .vs.over { color: var(--bogey); }
.board .thru { grid-area: thru; color: var(--muted); font-size: .9rem; }

/* The card */
.card-wrap { position: relative; }
table.scorecard { min-width: 100%; }
table.scorecard td, table.scorecard th { padding: 5px 8px; }
.sc { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; border-radius: 6px; font-weight: 700; }
.sc.ace { background: var(--ace); color: var(--ace-ink); border-radius: 99px; } .sc.eagle { background: var(--eagle); color: var(--eagle-ink); border-radius: 99px; }
.sc.birdie { background: var(--birdie-bg); color: var(--birdie); border-radius: 99px; } .sc.bogey { background: var(--bogey-bg); color: var(--bogey); }
.sc.double { background: var(--double-bg); color: var(--double-ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 10px; }
table.holes-edit input { width: 5.5rem; padding: 6px 8px; }
.inline-all { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-all label { margin: 0; }
@media (max-width: 380px) { .step { width: 48px; height: 48px; } .strokes { width: 56px !important; } }
@media print { .tabs, .hole-go, .holes, .step { display: none !important; } }
.after-box { margin-top: 10px; }
.inline-all .all-par { max-width: 6rem; }
fieldset { min-width: 0; }   /* a fieldset otherwise grows to fit a wide table (the course editor on a phone) */
