:root {
  --green: #14532d; --green2: #166534; --light: #dcfce7; --bg: #f4f6f3; --card: #fff;
  --ink: #111827; --muted: #6b7280; --red: #b91c1c; --gold: #ca8a04; --line: #e5e7eb;
  --tab-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); }
.top { position: sticky; top: 0; z-index: 5; background: var(--green); color: #fff;
  display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.brand { font-weight: 800; font-size: 18px; }
.course { font-size: 14px; opacity: .85; max-width: 55%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 560px; margin: 0 auto; padding: 12px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; background: #fff; border-top: 1px solid var(--line); z-index: 10; }
.tabs button { flex: 1; border: 0; background: none; font-size: 22px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; color: var(--muted); }
.tabs button span { font-size: 12px; font-weight: 600; }
.tabs button.active { color: var(--green); background: var(--light); }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 12px 0 6px; }
label.field { display: block; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=number], input:not([type]) {
  width: 100%; font-size: 17px; padding: 12px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: var(--ink); }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.btn { min-height: 48px; padding: 0 16px; border-radius: 12px; border: 0; font-size: 16px; font-weight: 700;
  background: var(--green); color: #fff; }
.btn.secondary { background: #e5e7eb; color: var(--ink); }
.btn.danger { background: #fee2e2; color: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; }
.icon-btn { width: 48px; height: 48px; border-radius: 12px; border: 0; background: #fee2e2; color: var(--red); font-size: 20px; flex: none; }
.seg { display: flex; background: #e5e7eb; border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--green); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.toggle { display: flex; justify-content: space-between; align-items: center; min-height: 48px; gap: 10px; }
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d1d5db; border-radius: 32px; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--green2); }
.switch input:checked + span::before { transform: translateX(24px); }
.money { width: 100px !important; text-align: right; }
.hint { font-size: 13px; color: var(--muted); }
.err { color: var(--red); font-size: 14px; }
details summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.holes-grid { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 6px 8px; align-items: center; }
.holes-grid .hdr { font-size: 12px; color: var(--muted); font-weight: 700; }
.mini-step { display: flex; align-items: center; gap: 4px; }
.mini-step button { width: 40px; height: 40px; border-radius: 10px; border: 0; background: #e5e7eb; font-size: 18px; font-weight: 700; }
.mini-step input { width: 52px !important; text-align: center; padding: 8px 4px !important; }

/* Score entry */
.holebar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.holebar .nav { width: 60px; height: 60px; border-radius: 14px; border: 0; background: var(--green); color: #fff; font-size: 26px; flex: none; }
.holebar .nav:disabled { opacity: .3; }
.holebar .mid { flex: 1; text-align: center; }
.holebar .num { font-size: 30px; font-weight: 800; }
.holebar .meta { color: var(--muted); font-size: 14px; }
.pwrap { background: #fff; border-radius: 14px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.pwrap .player { margin: 0; box-shadow: none; }
.pressrow { display: flex; gap: 8px; padding: 0 10px 10px 14px; }
.chip { flex: 1; min-height: 44px; border-radius: 12px; border: 2px solid #d1d5db; background: #fff; font-size: 15px; font-weight: 700; color: var(--muted); }
.chip.on { background: #fef3c7; border-color: var(--gold); color: #92400e; }
.tag.bank { background: var(--green); color: #fff; font-size: 13px; padding: 6px 10px; margin: 0; }
.bankerbar { width: 100%; min-height: 48px; margin-bottom: 8px; border: 2px dashed var(--green2); background: var(--light); color: var(--green); border-radius: 12px; font-size: 16px; }
.player { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 10px 10px 10px 14px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.player .who { flex: 1; min-width: 0; }
.player .name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .sub { font-size: 13px; color: var(--muted); }
.dots { color: var(--gold); letter-spacing: 1px; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 56px; height: 56px; border-radius: 14px; border: 0; font-size: 28px; font-weight: 700; background: #e5e7eb; color: var(--ink); }
.stepper button.plus { background: var(--green); color: #fff; }
.stepper .val { width: 52px; height: 56px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 26px; font-weight: 800; }
.stepper .val.unset { color: #9ca3af; border-style: dashed; }
.stepper .val.birdie { border-color: #dc2626; color: #dc2626; }
.stepper .val.eagle { background: #fde68a; border-color: #dc2626; color: #dc2626; }
.stepper .val.bogey { border-color: #2563eb; color: #2563eb; }
.stepper .val.dbl { background: #dbeafe; border-color: #1d4ed8; color: #1d4ed8; }
.holestatus { font-size: 14px; background: var(--light); color: var(--green); border-radius: 12px; padding: 10px 12px; margin: 4px 0 10px; }
.bigrow { display: flex; gap: 8px; }
.bigrow .btn { flex: 1; min-height: 56px; }

/* Scorecard */
.sc-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.sc { border-collapse: collapse; width: 100%; font-size: 14px; }
table.sc th, table.sc td { border: 1px solid var(--line); text-align: center; padding: 4px 1px; min-width: 27px; position: relative; }
table.sc th:first-child, table.sc td:first-child { text-align: left; padding-left: 6px; min-width: 58px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
table.sc tr.par td, table.sc tr.si td { color: var(--muted); font-size: 12px; background: #f9fafb; }
table.sc td.tot { font-weight: 800; background: #f3f4f6; }
table.sc td sup { position: absolute; top: 1px; right: 1px; font-size: 11px; font-weight: 900; color: var(--gold); line-height: 1; }
table.sc td.birdie { color: #dc2626; font-weight: 800; }
table.sc td.bogey { color: #2563eb; }
.totals-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.totals-table th, .totals-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.totals-table th:first-child, .totals-table td:first-child { text-align: left; }

/* Settle */
.pay { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.pay:last-child { border-bottom: 0; }
.pay b.amt { font-size: 20px; color: var(--green); }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.line { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.line:last-child { border-bottom: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: #fef3c7; color: #92400e; margin-left: 4px; }
.note { font-size: 13px; background: #fef3c7; color: #92400e; padding: 8px 10px; border-radius: 10px; margin-top: 8px; }

/* Banker / tee box */
.teehdr { font-size: 13px; font-weight: 700; color: var(--muted); margin: 2px 2px 6px; }
.plist .player { gap: 8px; padding: 8px 8px 8px 6px; }
.player .tee { width: 22px; height: 22px; flex: none; border-radius: 50%; background: #e5e7eb; color: var(--muted); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.player.isbanker { background: #f0fdf4; outline: 2px solid var(--green2); }
.player.isbanker .tee { background: var(--green); color: #fff; }
.pchip { width: 58px; height: 56px; flex: none; border-radius: 12px; border: 2px solid #d1d5db; background: #fff; font-size: 12px; font-weight: 800; color: var(--muted); line-height: 1.1; padding: 0; }
.pchip.on { background: #fef3c7; border-color: var(--gold); color: #92400e; }
.pchip.bank { font-size: 11px; border-style: dashed; border-color: var(--green2); color: var(--green); }
.pchip.bank.on { background: #fde68a; border-style: solid; border-color: var(--gold); color: #92400e; }
.plist .stepper { gap: 4px; }
.plist .stepper button { width: 50px; height: 56px; }
.plist .stepper .val { width: 44px; }
.plist .player .name { font-size: 16px; }
.plist .player .sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist.compact .player { padding: 6px 6px 6px 4px; margin-bottom: 6px; }
.plist.compact .stepper button, .plist.compact .pchip { height: 50px; }
.plist.compact .stepper button { width: 46px; font-size: 24px; }
.plist.compact .stepper .val { width: 42px; height: 50px; font-size: 22px; }
.plist.compact .pchip { width: 52px; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.chip.pick { min-height: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.chip.pick.on { background: var(--green); border-color: var(--green); color: #fff; }
.flipbtn { margin-bottom: 6px; }
.flipText { min-height: 26px; text-align: center; font-size: 17px; font-weight: 800; color: var(--green); }
.flipText.flash { animation: flash .9s ease-out; }
@keyframes flash { 0% { background: #fde68a; transform: scale(1.08); } 100% { background: transparent; transform: none; } }
.bankerbar .hint { font-size: 12px; }
.bpanel { padding: 12px; }
.bphdr { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.bline { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.bline > div:last-child { text-align: right; white-space: nowrap; font-weight: 700; }
.runhdr { font-size: 13px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.rungrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.runcell { background: #f9fafb; border-radius: 8px; padding: 6px; font-size: 13px; display: flex; flex-direction: column; align-items: center; }
.runcell span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
table.sc tr.bank td { font-size: 10px; color: var(--green); background: #f0fdf4; font-weight: 700; }
table.sc td sup.bp { color: #b45309; font-size: 9px; }
.bankerbar.pending { border-color: #b45309; background: #fffbeb; color: #92400e; padding: 10px; text-align: center; }
.linkbtn { border: 0; background: none; color: var(--green); text-decoration: underline; font-size: 12px; padding: 0; }
.puttprompt { border: 2px solid var(--gold); background: #fffbeb; }
.puttprompt h2 { font-size: 16px; }
.puttprompt.nudge { animation: flash 1s ease-out; border-color: var(--red); }

/* Snake */
.snk { width: 28px; height: 28px; vertical-align: middle; flex: none; }
.snk.tiny { width: 14px; height: 14px; }
.snk.dim { opacity: .35; filter: grayscale(1); }
.snakeind { font-size: 13px; color: var(--ink); margin-top: 2px; display: flex; align-items: center; justify-content: center; gap: 2px; }
.snakeind .snk { width: 22px; height: 22px; }
.whoRow { display: flex; align-items: center; gap: 4px; min-width: 0; }
.snkbtn { width: 38px; height: 34px; flex: none; border-radius: 10px; border: 2px solid #e5e7eb; background: #fff; padding: 0; display: flex; align-items: center; justify-content: center; }
.snkbtn .snk { opacity: .35; filter: grayscale(1); width: 26px; height: 26px; }
.snkbtn.on { border-color: var(--green2); background: #dcfce7; }
.snkbtn.on .snk { opacity: 1; filter: none; }
.snakepick { border: 2px solid var(--green2); background: #f0fdf4; }
table.sc tr.snkrow td { background: #f0fdf4; padding: 2px 1px; }
table.sc tr.snkrow td:first-child { font-size: 11px; }
table.sc tr.snkrow td.tot { font-size: 10px; color: var(--green); }
.snakepot { border: 2px solid var(--green2); }
.totals-table td .hint { font-size: 11px; font-weight: 400; }

/* History */
.tabs button { font-size: 20px; }
.tabs button span { font-size: 11px; }
.finishbtn { min-height: 56px; font-size: 17px; }
.savedcard { border: 2px solid var(--green2); background: #f0fdf4; }
.filters summary { min-height: 40px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; align-items: end; }
.fgrid label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.fgrid select, .fgrid input[type=date], .fgrid input[type=text] { width: 100%; min-height: 44px; font-size: 15px; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: var(--ink); }
.fgrid .btn { min-height: 44px; }
.roundrow { display: block; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; }
.rr-top, .rr-bot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rr-top b { font-size: 16px; }
.rr-bot { margin-top: 6px; font-size: 15px; }
.statcard .totals-table.mini { font-size: 13px; margin-top: 6px; }
.statcard .totals-table.mini th, .statcard .totals-table.mini td { padding: 4px; }
.statline { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin-top: 8px; color: var(--ink); }
.h2hgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.h2hgrid div { background: #f9fafb; border-radius: 10px; padding: 10px; text-align: center; }
.h2hgrid b { display: block; font-size: 22px; }
.h2hgrid span { font-size: 12px; color: var(--muted); }
.syncline { margin: 8px 4px 0; text-align: center; }
.readonly .stepper button, .readonly [data-act] { cursor: default; }
.h2hgrid b span { font-size: inherit; color: inherit; }
.h2hgrid b span.pos { color: var(--green); } .h2hgrid b span.neg { color: var(--red); }

/* ---------- Players / roster */
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cardhead h2 { margin: 0; }
.cardhead .linkbtn { font-size: 14px; font-weight: 700; min-height: 44px; padding: 0 2px; }
.prow { margin-bottom: 10px; }
.prow .pname { font-size: 17px; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcpbox { width: 70px; flex: none; }
.hcpbox input { text-align: center; font-weight: 700; }
.icon-btn.sm { width: 44px; background: #e5e7eb; color: var(--ink); font-size: 18px; font-weight: 700; }
.pmeta { margin: 4px 0 0 4px; }
.rsync { display: flex; align-items: center; gap: 8px; min-height: 40px; margin-top: 2px; color: var(--ink); font-size: 14px; }
.rsync input { width: 22px; height: 22px; accent-color: var(--green); }
.okc { color: var(--green2); font-weight: 700; }
.picker { margin: 4px 0 8px; }
input.search { width: 100%; min-height: 48px; border-radius: 12px; border: 2px solid #d1d5db; padding: 0 12px; font-size: 16px; margin-bottom: 8px; background: #fff; }
.picker .pick-grid { grid-template-columns: repeat(2, 1fr); }
.chip.pick .hint { font-weight: 600; }
.rlist { border-top: 1px solid var(--line); }
.rrow { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 6px 2px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 16px; color: var(--ink); }
.rrow .rn { display: flex; flex-direction: column; min-width: 0; }
.rrow .rn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .rh, .bighcp { display: flex; flex-direction: column; align-items: center; font-weight: 800; color: var(--green); font-size: 20px; min-width: 52px; }
.rrow .rh small, .bighcp small { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .05em; }
.bighcp { font-size: 30px; min-width: 70px; }
.phead h2 { font-size: 22px; }
.card.warn { background: #fffbeb; border: 1px solid #fcd34d; }
.card.warn code { font-size: 12px; word-break: break-all; }
.rnote { margin: 0 2px 10px; }
.subtabs button { font-size: 13px; padding: 0 2px; }
.linkbtn.pl { text-decoration: none; color: var(--ink); font-size: 16px; text-align: left; min-height: 32px; }
.field .row { margin-top: 4px; }
/* Courses */
.crow.on { background: #f0fdf4; }
.rrow .rh.sm { font-size: 18px; min-width: 28px; color: var(--muted); }
.tag.warnt { background: #fee2e2; color: #b91c1c; }
.warnbox { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.csel { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; margin-bottom: 6px; }
.csel .rn { display: flex; flex-direction: column; min-width: 0; }
.attrib { font-size: 11px; margin-top: 4px; }
.chgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chtab { width: 100%; border-collapse: collapse; }
.chtab th { font-size: 11px; color: var(--muted); text-align: left; padding: 2px; }
.chtab td { padding: 2px; }
.chtab select, .chtab input { width: 100%; min-height: 40px; font-size: 16px; border: 2px solid #d1d5db; border-radius: 8px; padding: 0 4px; background: #fff; }
.chtab .bad { border-color: var(--red); background: #fef2f2; }
.teerow { display: grid; grid-template-columns: 1.4fr .8fr 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.teerow input, .teerow select { min-height: 44px; width: 100%; font-size: 15px; border: 2px solid #d1d5db; border-radius: 8px; padding: 0 6px; background: #fff; min-width: 0; }
.chip.pick.tee { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; font-size: 14px; }
.chip.pick.tee small { font-size: 11px; font-weight: 600; opacity: .8; }
