/* Wolf - dark, dense, phone-first. Every field >= 16px (iOS zoom). No horizontal scroll, ever. */
:root {
  color-scheme: dark;
  --page: #0c1210;
  --surface: #151d19;
  --surface-2: #1d2824;
  --surface-3: #263430;
  --ink: #f4f7f5;
  --ink-2: #c0cbc5;
  --muted: #7f8d86;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #38b36f;
  --accent-ink: #6fd79a;
  --accent-dim: rgba(56, 179, 111, 0.18);
  --wolf: #e8a317;
  --wolf-dim: rgba(232, 163, 23, 0.18);
  --good: #38b36f;
  --warn: #e8a317;
  --danger: #e66767;
  --danger-dim: rgba(230, 103, 103, 0.18);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; padding: 0; background: var(--page); color: var(--ink); font: 16px/1.4 var(--font); overflow-x: hidden; }
body { min-height: 100vh; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.help { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 14px; margin-top: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---- gate ---- */
#gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; text-align: center; }
.gate-card h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: 0.08em; text-transform: uppercase; }
.gate-card p { color: var(--ink-2); margin: 0 0 18px; }

/* ---- shell ---- */
header.top { position: sticky; top: 0; z-index: 5; background: rgba(12, 18, 16, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; gap: 8px; padding: 10px 16px; max-width: 820px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; box-shadow: 0 0 10px var(--accent); }
nav.tabs { display: flex; gap: 2px; margin-left: 4px; }
nav.tabs a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; font-size: 15px; }
nav.tabs a.on { background: var(--surface-2); color: var(--ink); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
@media (max-width: 520px) { .who { display: none; } }
main { max-width: 820px; margin: 0 auto; padding: 14px 16px 24px; display: grid; gap: 12px; }
footer.stamp { color: var(--muted); font-size: 11px; text-align: center; padding: 10px 16px 32px; }

/* ---- buttons ---- */
.btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); border-radius: 10px; padding: 9px 14px; cursor: pointer; white-space: nowrap; font-size: 16px; line-height: 1.2; }
.btn:hover { border-color: rgba(255, 255, 255, 0.25); }
.btn.primary { background: var(--accent); border-color: transparent; color: #06140b; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: rgba(230, 103, 103, 0.4); }
.btn.sm { padding: 6px 10px; font-size: 14px; }
.btn.big { padding: 13px 18px; font-size: 17px; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; width: 100%; }
.seg button { background: transparent; border: 0; padding: 10px 6px; color: var(--ink-2); cursor: pointer; font-size: 15px; flex: 1; border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--surface-3); color: var(--ink); font-weight: 700; }
.seg button.on.wolf { background: var(--wolf-dim); color: var(--wolf); }
.seg button.on.good { background: var(--accent-dim); color: var(--accent-ink); }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 45%; border-bottom: 1px solid var(--border); }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card > header h2 { margin: 0; font-size: 17px; font-weight: 700; }
.card > header .note { color: var(--muted); font-size: 13px; }
.card > header .spacer { flex: 1; }
.card.warn { border-color: rgba(232, 163, 23, 0.6); background: rgba(232, 163, 23, 0.08); }
.card.err { border-color: rgba(230, 103, 103, 0.5); }
h3 { margin: 12px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stack { display: grid; gap: 10px; }
.field { display: grid; gap: 4px; }
.field label { color: var(--muted); font-size: 13px; }
.field input, .field select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; color: var(--ink); width: 100%; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 999px; background: var(--accent-dim); color: var(--accent-ink); vertical-align: middle; white-space: nowrap; }
.badge.wolf { background: var(--wolf-dim); color: var(--wolf); }
.badge.bag { background: #3a2f56; color: #c9b6ff; }
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.bad { background: var(--danger-dim); color: #f0a0a0; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--surface-3); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); }
.toast.err { border-color: var(--danger); color: #f0a0a0; }

/* ---- games list ---- */
.game-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); text-decoration: none; color: var(--ink); }
.game-row:first-of-type { border-top: 0; }
.game-row .d { font-weight: 700; white-space: nowrap; }
.game-row .s { color: var(--muted); font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- standings strip ---- */
.standings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.st { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 6px; text-align: center; position: relative; }
.st.wolf { border-color: var(--wolf); }
.st .n { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.st .p { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.st .m { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st .m.pos { color: var(--accent-ink); }
.st .m.neg { color: #f0a0a0; }
.st .tags { display: flex; gap: 3px; justify-content: center; margin-top: 3px; min-height: 16px; flex-wrap: wrap; }
.st .tags span { font-size: 10px; padding: 1px 5px; }

/* ---- hole chips ---- */
.holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.holes a { display: block; text-align: center; padding: 7px 0; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); text-decoration: none; font-size: 14px; font-variant-numeric: tabular-nums; }
.holes a.done { background: var(--accent-dim); color: var(--accent-ink); border-color: transparent; }
.holes a.part { background: var(--wolf-dim); color: var(--wolf); border-color: transparent; }
.holes a.cur { outline: 2px solid var(--ink); outline-offset: -1px; color: var(--ink); font-weight: 800; }

/* ---- hole card ---- */
.hole-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hole-head .big { font-size: 30px; font-weight: 800; line-height: 1; }
.hole-head .meta { color: var(--ink-2); font-size: 14px; }
.order { display: grid; gap: 4px; }
.order .o { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.order .o.wolf { background: var(--wolf-dim); }
.order .o .i { width: 18px; color: var(--muted); font-size: 13px; text-align: center; }
.order .o .nm { flex: 1; font-weight: 600; }
.order .o .st { background: transparent; border: 0; padding: 0; font-size: 12px; color: var(--muted); }
.dots { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.scores { display: grid; gap: 6px; }
.sc { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.sc.wolf { background: var(--wolf-dim); }
.sc .nm { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sc .nm small { color: var(--muted); font-weight: 500; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); font-size: 22px; cursor: pointer; }
.stepper button:active { background: var(--surface-3); }
.stepper input { width: 52px; height: 44px; text-align: center; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: transparent; color: var(--ink); font-size: 20px; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--surface-3); }
.result { border-radius: 10px; padding: 10px 12px; background: var(--surface-2); font-weight: 600; }
.result.wolf { background: var(--wolf-dim); color: var(--wolf); }
.result.others { background: var(--accent-dim); color: var(--accent-ink); }
.result small { display: block; color: var(--ink-2); font-weight: 500; font-size: 13px; margin-top: 2px; }

/* ---- scorecard table ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.tbl th, .tbl td { padding: 6px 2px; text-align: center; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl th.l, .tbl td.l { text-align: left; }
.tbl td.w { color: var(--wolf); }
.tbl td .pt { display: block; font-size: 11px; color: var(--muted); line-height: 1; margin-top: 2px; }
.tbl td .pt.pos { color: var(--accent-ink); }
.tbl td .pt.neg { color: #f0a0a0; }
.tbl tr.tot td { font-weight: 800; border-top: 2px solid var(--border); }
.tbl td.birdie { color: var(--accent-ink); font-weight: 700; }
.tbl td.lone { text-decoration: underline; }
.pays { display: grid; gap: 4px; }
.pay { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.pay b { color: var(--accent-ink); }
.list { display: grid; gap: 4px; font-size: 14px; }
.list .li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }

/* ---- players / course editors ---- */
.prow { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.prow:first-child { border-top: 0; }
.prow .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crow { display: grid; grid-template-columns: 36px 1fr 1fr 1fr; gap: 6px; align-items: center; padding: 4px 0; }
.crow .h { color: var(--muted); font-size: 13px; text-align: center; }
.crow input, .crow select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 6px; color: var(--ink); width: 100%; text-align: center; }
.sched { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.sched .s { background: var(--surface-2); border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 13px; }
.sched .s b { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.sched .s.p3 { border: 1px solid var(--wolf); }
.rot { display: grid; gap: 4px; }
.rot .r { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.rot .r .nm { flex: 1; font-weight: 600; }
details summary { cursor: pointer; color: var(--ink-2); }
details .rules { color: var(--ink-2); font-size: 14px; line-height: 1.5; }
details .rules li { margin: 4px 0; }
