/* GolfScanner — palette shared with the Kangaroo Cup app (fairway green, flag gold, scorecard cream). */
:root {
  --green: #1f6b3a;
  --green-dark: #154a28;
  --green-soft: #e3efe5;
  --gold: #f2c230;
  --gold-soft: #fbf0c9;
  --cream: #faf7ee;
  --card: #ffffff;
  --text: #22291f;
  --muted: #6b7566;
  --rule: #e2ddcd;
  --flag: #b4471b;
  --flag-soft: #f8e3d8;
  --amber: #8a6400;
  --grey-soft: #eeebe1;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--text); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; text-wrap: balance; }
a { color: var(--green); }
[hidden] { display: none !important; }
button, input, select { font: inherit; }

/* Header */
.top { background: var(--green); color: var(--cream); position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.top-in { max-width: 860px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: bold; font-size: 1.2rem; letter-spacing: .3px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand span b { color: var(--gold); font-weight: bold; }
.who { font-size: .8rem; opacity: .85; text-align: right; }

main { max-width: 860px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }

/* Bottom tab bar (app-style) */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--rule);
  display: flex; justify-content: center; padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.tabs-in { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; max-width: 560px; }
.tab { background: none; border: 0; color: var(--muted); display: grid; justify-items: center; gap: 2px; padding: 6px 4px; font-size: .74rem; font-weight: 600; cursor: pointer; border-radius: 10px; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--green); background: var(--green-soft); }
.tab .badge { background: var(--flag); color: #fff; border-radius: 9px; padding: 0 6px; font-size: .68rem; margin-left: 2px; }

/* Cards and forms */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; }
.card h2 { font-size: 1.35rem; color: var(--green-dark); }
.lead { color: var(--muted); margin: 0; }
.field { display: grid; gap: 6px; }
.field > label, .lab { font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 640px) { .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; } }
@media (max-width: 639px) { .grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], select {
  width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--cream); color: var(--text); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.code-input { font: 600 1.6rem var(--mono); letter-spacing: .3em; text-align: center; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--cream); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { text-align: center; padding: 9px 4px; cursor: pointer; font-weight: 600; border-left: 1px solid var(--rule); }
.seg label:first-of-type { border-left: 0; }
.seg input:checked + label { background: var(--green); color: var(--cream); }
.seg input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: -3px; }
input[type=range] { width: 100%; accent-color: var(--green); }
.range-out { font: 600 1rem var(--mono); color: var(--text); text-transform: none; letter-spacing: 0; }
.hint { font-size: .84rem; color: var(--muted); margin: 0; }
.btn { border: 1px solid var(--green); background: var(--green); color: var(--cream); padding: 11px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; color: var(--green); }
.btn.gold { background: var(--gold); border-color: var(--gold-dark, #c89f1e); color: var(--text); }
.btn.small { padding: 6px 10px; font-size: .86rem; }
.btn.danger { background: transparent; border-color: var(--flag); color: var(--flag); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.msg { padding: 10px 12px; border-radius: 10px; background: var(--grey-soft); font-size: .9rem; margin: 0; }
.msg.err { background: var(--flag-soft); }
.msg.ok { background: var(--green-soft); }

/* Results */
.summary { display: grid; gap: 8px; }
.summary .q { font-family: var(--serif); font-size: 1.35rem; margin: 0; color: var(--green-dark); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .88rem; }
.progress { height: 6px; background: var(--grey-soft); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--gold); transition: width .3s; }
.newbox { background: var(--flag-soft); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.newbox b { color: var(--flag); }

.course { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.chead { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.cname { font-size: 1.15rem; color: var(--green-dark); }
.cmeta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .84rem; color: var(--muted); }
.num { font-family: var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.pill { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--gold-soft); color: var(--amber); }
.pill.grey { background: var(--grey-soft); color: var(--muted); }
.pill.flag { background: var(--flag-soft); color: var(--flag); }
.cbody { padding: 12px 16px 14px; display: grid; gap: 10px; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.slot { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; display: grid; font-variant-numeric: tabular-nums; }
.slot .t { font: 600 1rem var(--mono); }
.slot .p { font-size: .8rem; color: var(--muted); }
.slot .p b { color: var(--text); }
.slot.tw { border-color: var(--gold); background: var(--gold-soft); }
.slot.new { border-color: var(--flag); background: var(--flag-soft); }
.cfoot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: .84rem; color: var(--muted); }
.book { font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--gold); color: var(--green-dark); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--green); font-weight: 600; cursor: pointer; font-size: .86rem; }
.checking { color: var(--muted); font-size: .9rem; display: flex; gap: 8px; align-items: center; }
.spin { width: 14px; height: 14px; border: 2px solid var(--rule); border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } .progress i { transition: none; } }

details.others { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
details.others summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.tablewrap { overflow-x: auto; border-top: 1px solid var(--rule); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
td, th { text-align: left; padding: 8px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); align-items: center; }

/* Saved searches list */
.slist { display: grid; gap: 10px; }
.sitem { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.sitem .t1 { font-family: var(--serif); font-weight: bold; color: var(--green-dark); }
.sitem .t2 { font-size: .84rem; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); display: inline-block; margin-right: 6px; }
.dot.on { background: var(--flag); }

/* Admin list */
.people { display: grid; gap: 8px; }
.person { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.person .nm { font-weight: 600; }
.person .em { font-size: .84rem; color: var(--muted); word-break: break-all; }

.empty { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 22px; display: grid; gap: 8px; background: var(--card); }
.empty h3 { color: var(--green-dark); }
.foot { text-align: center; font-size: .76rem; color: var(--muted); }
#v-search, #v-searches { display: grid; gap: 16px; }

/* Install prompt: deliberately loud until the app is on the home screen */
.card.install { background: var(--flag-soft); border: 2px solid var(--flag); }
.card.install h2 { color: var(--flag); font-weight: bold; }
.install-how { margin: 0; color: var(--flag); font-weight: 700; font-size: 1.02rem; }
.install-how .step { display: block; margin-top: 4px; }
.btn.install-btn { background: var(--flag); border-color: var(--flag); color: #fff; }
