/* JMRC — clubhouse leaderboard: green score band up top, match rows below, big buttons for scoring in a cart. */
:root {
  --bg: #F2F5F1; --surface: #FFFFFF; --ink: #14211A; --muted: #5C6A62; --line: #D8E0D7;
  --green: #1D5E3E; --green-soft: #E2EEE5; --warn: #9A5B00; --warn-soft: #FBF0DA; --bad: #A12A20; --bad-soft: #FBEBEB;
  --half: #7D8882; --under: #B3261E; --over: #1E4E9C;
  --a: var(--aL, #1E4E9C); --a-soft: var(--aLs, #E2EAF6); --b: var(--bL, #B8322A); --b-soft: var(--bLs, #F7E3E0);
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1511; --surface: #16201A; --ink: #E6EDE8; --muted: #98A69D; --line: #2A3830;
    --green: #5DBB8A; --green-soft: #1B3026; --warn: #E8B45C; --warn-soft: #33270F; --bad: #F08A80; --bad-soft: #3A1C19;
    --half: #8F9A93; --under: #F08A80; --over: #8CB0F0;
    --a: var(--aD, #86A9EE); --a-soft: var(--aDs, #1A2741); --b: var(--bD, #EE8279); --b-soft: var(--bDs, #3A1D1B);
    color-scheme: dark;
  }
}
* { 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.45 var(--body); padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: .01em; }
h2 { font-size: 1.45rem; text-transform: uppercase; font-weight: 700; }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
a { color: var(--green); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.num, .pts, .big, .sc, .hb, .val { font-variant-numeric: tabular-nums; }

/* ----- band ----- */
.band { background: #1D5E3E; color: #fff; padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
.band-in { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.cup-name { text-align: center; font-family: var(--display); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: .9rem; opacity: .9; }
.score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 6px; }
.tot { display: flex; flex-direction: column; min-width: 0; }
.tot.B { align-items: flex-end; text-align: right; }
.tn { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; margin: 0 6px; vertical-align: 0; }
.tot.A .dot { background: var(--aL, #1E4E9C); margin-left: 0; }
.tot.B .dot { background: var(--bL, #B8322A); margin-right: 0; }
.pts { font-family: var(--display); font-weight: 800; font-size: 3.4rem; line-height: 1; }
.mid { text-align: center; font-size: .82rem; opacity: .9; }
.mid b { display: block; font-family: var(--display); font-size: 1.2rem; }
.proj { text-align: center; font-size: .82rem; opacity: .85; }
.champ { text-align: center; font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: #fff; color: #1D5E3E; border-radius: 6px; padding: 4px 10px; align-self: center; }
.mainnav { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.mainnav a { color: #fff; text-decoration: none; border: 1.5px solid rgba(255,255,255,.45); border-radius: 999px; padding: 6px 16px; font-weight: 700; font-size: .92rem; }
.mainnav a[aria-current="true"] { background: #fff; color: #1D5E3E; border-color: #fff; }
.whobox { display: flex; justify-content: center; gap: 10px; align-items: center; font-size: .88rem; opacity: .95; flex-wrap: wrap; }
.whobox .link { color: #fff; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--green); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

/* ----- status ----- */
.status { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); padding: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.status .link { font-size: .82rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.status.off .pulse { background: var(--warn); }
.status.waiting { background: var(--warn-soft); color: var(--ink); }
.status b { color: var(--warn); }
@media (prefers-reduced-motion: no-preference) { .status.ok .pulse { animation: pulse 2.4s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: .35; } }

/* ----- layout ----- */
.view { max-width: 760px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.note { color: var(--muted); font-size: .9rem; margin: 0; }
.note.center { text-align: center; }
.warnbox { background: var(--warn-soft); color: var(--ink); padding: 8px 12px; border-radius: 8px; }
.empty { background: var(--surface); border: 1.5px dashed var(--line); border-radius: 12px; padding: 28px 20px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty p { margin: 0; color: var(--muted); max-width: 42ch; }
.cta { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; background: var(--green-soft); color: var(--green); border: 1.5px solid var(--green); border-radius: 10px; padding: 12px; font-weight: 600; text-decoration: none; width: 100%; }
.back { font-weight: 700; text-decoration: none; align-self: flex-start; }

/* ----- buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 700; text-decoration: none; color: var(--ink); min-height: 40px; }
.btn.primary { background: #1D5E3E; border-color: #1D5E3E; color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.quiet { border-color: transparent; color: var(--muted); background: transparent; }
.btn.sm { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.btn.wide { width: 100%; min-height: 48px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-btns.spread { justify-content: space-between; }

/* ----- leaderboard ----- */
.round { display: flex; flex-direction: column; gap: 8px; }
.round-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.fmt { color: var(--muted); font-size: .88rem; }
.glabel { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 0 -2px; }
.mrow { position: relative; display: grid; grid-template-columns: 1fr minmax(96px, auto) 1fr; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; text-decoration: none; color: var(--ink); }
.mrow:hover { border-color: var(--muted); }
.lock { position: absolute; top: 2px; right: 6px; font-size: .7rem; }
.side { display: flex; flex-direction: column; min-width: 0; font-weight: 600; line-height: 1.25; }
.side span { overflow-wrap: anywhere; }
.side.A { color: var(--a); }
.side.B { color: var(--b); text-align: right; }
.side.lead { font-weight: 800; }
.side.lead::after { content: ""; display: block; height: 3px; width: 28px; margin-top: 4px; background: currentColor; border-radius: 2px; }
.side.B.lead::after { margin-left: auto; }
.tbd { color: var(--muted); font-style: italic; font-weight: 400; }
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; }
.big { font-family: var(--display); font-weight: 800; font-size: 1.35rem; line-height: 1.1; }
.big.xl { font-size: 2.1rem; }
.big.A, .res.A, b.A { color: var(--a); } .big.B, .res.B, b.B { color: var(--b); } .big.H, .res.H, b.H { color: var(--half); }
.sub { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pill { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; border-radius: 4px; padding: 1px 6px; margin-top: 2px; }
.pill.final { background: var(--ink); color: var(--bg); }
.pill.live { background: var(--green-soft); color: var(--green); }

/* ----- match ----- */
.mhead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.card-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table.sc { border-collapse: collapse; font-size: .86rem; min-width: 100%; }
.sc th, .sc td { padding: 5px 6px; text-align: center; border-right: 1px solid var(--line); white-space: nowrap; }
.sc th:first-child, .sc td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); max-width: 120px; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.sc thead th { background: var(--green-soft); color: var(--green); font-family: var(--display); font-weight: 700; }
.sc tr.par td { color: var(--muted); }
.sc td.ct { font-weight: 800; background: var(--bg); }
.sc tr.rA td:first-child { color: var(--a); font-weight: 700; } .sc tr.rB td:first-child { color: var(--b); font-weight: 700; }
.sc td.under { color: var(--under); font-weight: 800; } .sc td.over { color: var(--over); }
.res { font-weight: 800; } .res.dim { opacity: .35; }
.sc tr.result td { border-top: 2px solid var(--line); }
.drives-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ds { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.ds.A { border-top: 3px solid var(--a); } .ds.B { border-top: 3px solid var(--b); }
.ds .warn { color: var(--warn); font-weight: 700; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.hist li { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.when { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ----- entry ----- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 700; text-decoration: none; color: var(--ink); background: var(--surface); font-size: .9rem; }
.chip[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.hb { border: 1.5px solid var(--line); background: var(--surface); border-radius: 6px; padding: 7px 0; font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.hb.done { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.hb.part { border-color: var(--warn); border-style: dashed; }
.hb[aria-current="true"] { outline: 3px solid var(--ink); outline-offset: 1px; }
.entry { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.entry-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hole { font-family: var(--display); font-size: 1.8rem; font-weight: 800; }
.par { color: var(--muted); font-weight: 700; }
.nav { display: flex; gap: 6px; }
.nav button { width: 48px; height: 44px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 1.4rem; font-weight: 800; }
.mtitle { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 4px; font-weight: 700; font-size: .92rem; }
.mtitle i { color: var(--muted); font-weight: 400; }
.mst { font-family: var(--display); font-weight: 800; }
.mst.A { color: var(--a); } .mst.B { color: var(--b); }
.mst small { font-family: var(--body); font-weight: 600; color: var(--muted); font-size: .75rem; }
.prow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); }
.who.A, .who.B { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.prow .who.A { color: var(--a); } .prow .who.B { color: var(--b); }
.step { display: flex; align-items: center; gap: 6px; }
.step button { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg); font-size: 1.5rem; font-weight: 800; line-height: 1; }
.step .val { width: 58px; height: 48px; border-radius: 10px; background: var(--surface); font-family: var(--display); font-size: 1.8rem; }
.step .val.empty { color: var(--muted); font-size: 1rem; font-family: var(--body); font-weight: 600; }
.drow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0 6px; }
.dl { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }
.dbtn { border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; }
.drow.A .dbtn[aria-pressed="true"] { background: var(--a); border-color: var(--a); color: var(--surface); }
.drow.B .dbtn[aria-pressed="true"] { background: var(--b); border-color: var(--b); color: var(--surface); }
.dbtn small { opacity: .8; font-weight: 600; }
.dwarn { width: 100%; font-size: .82rem; color: var(--warn); font-weight: 700; }
.verdict { font-size: .9rem; color: var(--muted); padding-top: 4px; }
.entry-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.entry-foot .btn { min-height: 48px; padding: 8px 22px; }

/* ----- admin ----- */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.tabs a { white-space: nowrap; padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; }
.tabs a[aria-current="true"] { background: var(--ink); color: var(--bg); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.grow { flex: 1; } .field.narrow { max-width: 220px; }
.field label, .gcard b { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.field small { color: var(--muted); font-size: .8rem; }
input, select { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--bg); min-width: 0; width: 100%; min-height: 42px; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); }
input[type="file"] { padding: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: .92rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.team-col { display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--a); padding-top: 10px; }
.team-col.B { border-top-color: var(--b); }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.prow2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pinfo { min-width: 0; overflow-wrap: anywhere; }
.pact { display: flex; gap: 6px; align-items: center; }
.pact select { width: auto; min-width: 140px; }
.tag { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-radius: 4px; padding: 1px 6px; background: var(--bg); color: var(--muted); }
.tag.admin { background: var(--ink); color: var(--bg); } .tag.ok { background: var(--green-soft); color: var(--green); } .tag.warn { background: var(--warn-soft); color: var(--warn); }
.person-form { border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.person-form h3 { margin: 0; }
.pins { background: var(--warn-soft); border-radius: 10px; padding: 12px; }
.pins h3 { margin-top: 0; color: var(--ink); }
.pins pre { font-size: 1.05rem; margin: 0 0 10px; white-space: pre-wrap; font-variant-numeric: tabular-nums; }
.course { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.pars { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.pars label { display: flex; flex-direction: column; }
.pars small { text-align: center; color: var(--muted); font-size: .7rem; }
.pars input { text-align: center; padding: 6px 0; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.gcard { display: flex; flex-direction: column; gap: 6px; background: var(--bg); border-radius: 8px; padding: 8px; }
.pm { display: grid; grid-template-columns: auto auto 1fr auto 1fr auto; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.pm .n { font-family: var(--display); font-weight: 800; color: var(--muted); width: 1.2em; }
.pm .gsel { width: auto; }
.pm .vs { color: var(--muted); font-size: .85rem; }
.pm .stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pm select.A { border-color: var(--a); } .pm select.B { border-color: var(--b); }
.x { border: 0; background: none; color: var(--muted); font-size: 1.4rem; padding: 2px 8px; }
@media (max-width: 620px) {
  .pm { grid-template-columns: auto 1fr auto; }
  .pm .gsel { grid-column: 2; justify-self: start; }
  .pm .stack.A, .pm .stack.B { grid-column: 2; }
  .pm .vs { display: none; }
  .pm .x { grid-column: 3; grid-row: 1; }
}
.lockrow { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; }
.lockrow a { font-weight: 700; text-decoration: none; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.lockrow a i { color: var(--muted); font-weight: 400; }
.lockrow select { grid-column: 1 / -1; }

/* ----- overlays ----- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 32px); z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.warn { background: var(--warn-soft); color: var(--ink); border: 1.5px solid var(--warn); }
.saved { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); background: var(--green-soft); color: var(--green); font-weight: 800; padding: 4px 10px; border-radius: 6px; margin: 0; z-index: 30; }
.sheet { position: fixed; inset: 0; background: rgba(8, 15, 11, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet-in { position: relative; background: var(--surface); width: 100%; max-width: 420px; border-radius: 18px 18px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet-in { border-radius: 18px; } }
.sheet-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 1.8rem; color: var(--muted); }
.pin-dots { display: flex; gap: 14px; margin: 8px 0 2px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pin-err { min-height: 1.4em; color: var(--bad); font-weight: 600; text-align: center; margin: 0; font-size: .9rem; }
.keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.keys button { height: 60px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-size: 1.6rem; font-weight: 700; }
