/* LKI Bowling: minimal, white, mobile first */
:root {
  color-scheme: only light;
  --font-body: 'Satoshi', 'Helvetica Neue', system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.625rem);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --ink: oklch(0.2 0 0);
  --ink-2: oklch(0.45 0 0);
  --ink-3: oklch(0.62 0 0);
  --line: oklch(0.2 0 0 / 0.1);
  --line-2: oklch(0.2 0 0 / 0.18);
  --wash: oklch(0.975 0 0);
  --bg: #fff;
  --accent: oklch(0.55 0.2 27);       /* bowling-pin red, used for circles and alerts */
  --accent-wash: oklch(0.55 0.2 27 / 0.08);
  --ok: oklch(0.52 0.12 150);
  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: var(--text-base); line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: var(--s4); top: var(--s2); background: var(--ink); color: #fff; padding: var(--s2) var(--s3); border-radius: 6px; z-index: 50; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s4);
  padding: calc(var(--s2) + env(safe-area-inset-top)) var(--s4) var(--s2);
  max-width: 100%;
}
.brand { font-weight: 700; letter-spacing: 0.08em; text-decoration: none; font-size: var(--text-sm); }
.nav { display: flex; gap: var(--s1); margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  text-decoration: none; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2);
  padding: 10px 10px; border-radius: 8px; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--wash); }
.nav a.nav-enter { color: var(--ink); font-weight: 700; }

main { max-width: 760px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s8); outline: none; }
.foot { max-width: 760px; margin: 0 auto; padding: 0 var(--s4) var(--s8); font-size: var(--text-sm); color: var(--ink-3); }
.foot a { color: var(--ink-3); }

.logo { position: fixed; right: max(var(--s3), env(safe-area-inset-right)); bottom: calc(var(--s3) + env(safe-area-inset-bottom)); z-index: 10; pointer-events: none; line-height: 0; background: rgba(255,255,255,0.94); padding: 4px 6px; border-radius: 8px; }
.logo img { width: 84px; height: auto; }
@media (min-width: 700px) { .logo img { width: 110px; } }

/* Type */
h1 { font-size: var(--text-xl); line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); margin: var(--s8) 0 var(--s3); font-weight: 700; }
h3 { font-size: var(--text-base); margin: var(--s6) 0 var(--s2); font-weight: 700; }
p { margin: 0 0 var(--s3); }
.muted { color: var(--ink-2); }
.small { font-size: var(--text-sm); }
.tiny { font-size: var(--text-xs); color: var(--ink-3); }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.head .sub { color: var(--ink-2); font-size: var(--text-sm); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5); border-radius: 999px; border: 1px solid var(--line-2);
  background: #fff; font-weight: 500; font-size: var(--text-sm); cursor: pointer; text-decoration: none;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: oklch(0.3 0 0); }
.btn.primary:disabled { background: var(--ink-3); border-color: var(--ink-3); cursor: not-allowed; }
.btn.danger { color: var(--accent); }
.btn.small { min-height: 36px; padding: 0 var(--s3); }
.btn.wide { width: 100%; }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.field { display: grid; gap: 6px; margin-bottom: var(--s4); }
.field label, .label { font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=search], select {
  width: 100%; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line-2); border-radius: 8px; background: #fff;
  font-size: 16px; transition: border-color 160ms var(--ease);
}
input:focus, select:focus { border-color: var(--ink); outline: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 999px; min-height: 38px; padding: 0 var(--s4); font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background 160ms var(--ease), color 160ms var(--ease); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.check { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); min-height: 44px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* Tables */
.tablewrap { overflow-x: auto; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: right; padding: 10px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 500; color: var(--ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td.l, th.l { text-align: left; }
td.name a { text-decoration: none; font-weight: 500; }
tr.click { cursor: pointer; }
tr.click:active td { background: var(--wash); }
tr.ineligible td { color: var(--ink-3); }
tr.cut td { border-bottom: 1px solid var(--ink); }
th button.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
th button.sort[aria-sort] { color: var(--ink); }
.seed { font-weight: 700; color: var(--ink); }
.tag { display: inline-block; font-size: var(--text-xs); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 500; }
.tag.red { color: var(--accent); border-color: currentColor; }
.tag.ok { color: var(--ok); border-color: currentColor; }

/* Cards / lists */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s3); background: #fff; }
.card .meta { font-size: var(--text-sm); color: var(--ink-2); margin-bottom: var(--s3); display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4) var(--s3); margin: var(--s4) 0 var(--s6); }
.kpi .v { font-size: var(--text-xl); font-weight: 700; line-height: 1.1; }
.kpi .k { font-size: var(--text-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: var(--s3); padding: 12px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); align-items: center; }
.empty { color: var(--ink-2); padding: var(--s6) 0; text-align: center; font-size: var(--text-sm); }
.notice { background: var(--wash); border-radius: var(--radius); padding: var(--s3) var(--s4); font-size: var(--text-sm); color: var(--ink-2); margin-bottom: var(--s4); }
.notice.red { background: var(--accent-wash); color: var(--accent); }
.tabs { display: flex; gap: var(--s1); flex-wrap: wrap; row-gap: 0; margin-bottom: var(--s5); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 8px; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; padding: 0 6px; margin-left: 4px; }

/* Login */
.gate { min-height: 70vh; display: grid; place-items: center; }
.gate form { width: min(320px, 100%); text-align: center; }
.gate h1 { margin-bottom: var(--s2); }
.gate p { color: var(--ink-2); font-size: var(--text-sm); margin-bottom: var(--s6); }
.err { color: var(--accent); font-size: var(--text-sm); min-height: 1.5em; margin: var(--s2) 0 0; }

/* Bowler picker */
.picker { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s3) 0 var(--s4); }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; min-height: 40px; padding: 0 14px; font-size: var(--text-sm); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease); }
.chip .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }

/* Handicap sheet */
.sheet { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s3) var(--s3); margin: var(--s3) 0 var(--s4); background: #fff; }
.sheet-grid { display: grid; align-items: stretch; row-gap: 0; }
.sheet-grid .hd { font-size: var(--text-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; padding-bottom: var(--s2); }
.sheet-grid .hd.l { text-align: left; }
.sheet-grid .nm { font-weight: 700; display: flex; align-items: center; min-height: 56px; font-size: var(--text-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 4px; }
.sheet-grid .nm .avg { font-weight: 400; color: var(--ink-3); font-size: var(--text-xs); margin-left: 6px; }
.hc { display: flex; align-items: center; justify-content: center; min-height: 56px; position: relative; font-weight: 700; font-size: var(--text-lg); margin: 0 6px; }
.hc.blank::after { content: ''; width: 28px; flex: none; height: 2px; background: var(--ink-3); border-radius: 2px; }
.hc.block::after { content: ''; width: 22px; height: 22px; background: var(--ink); border-radius: 3px; }
.hc.even { font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); }
.hc.top { border-top: 2px solid var(--ink); }
.hc.bot { border-bottom: 2px solid var(--ink); }
.hc.won { color: var(--accent); }
.sc { display: flex; align-items: center; justify-content: center; min-height: 56px; }
.sc input { background: #f3f3f1 !important; color: #111 !important; -webkit-text-fill-color: #111; caret-color: #111; width: 68px; text-align: center; font-weight: 700; font-size: 18px; padding: 0; min-height: 44px; }
.ring { display: inline-grid; place-items: center; min-width: 52px; height: 44px; border-radius: 999px; font-weight: 700; font-size: var(--text-lg); padding: 0 8px; transition: box-shadow 200ms var(--ease); }
.ring.w1 { box-shadow: 0 0 0 2px var(--accent); }
.ring.w2 { box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px #fff, 0 0 0 7px var(--accent); }
.sc input.w1 { border: 2px solid var(--accent); border-radius: 999px; }
.sc input.w2 { border: 2px solid var(--accent); border-radius: 999px; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.sheet .foot-note { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--s3); }
.tie { background: var(--accent-wash); border-radius: 8px; padding: var(--s3); margin-top: var(--s3); font-size: var(--text-sm); }
.tie .row { margin-top: var(--s2); }
.sheet.compact { padding: var(--s2) var(--s3); margin: 0; border: 0; }
.sheet.compact .nm, .sheet.compact .hc, .sheet.compact .sc { min-height: 44px; }
.sheet.compact .hc { font-size: var(--text-base); }
.sheet.compact .ring { height: 36px; min-width: 46px; font-size: var(--text-base); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease), transform 200ms var(--ease); z-index: 60; max-width: calc(100% - 140px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Skeleton */
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--wash), oklch(0.94 0 0), var(--wash)); background-size: 200% 100%; animation: sh 1.2s linear infinite; margin: 14px 0; }
@keyframes sh { to { background-position: -200% 0; } }
.fade { animation: fade 260ms var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

dialog { border: 0; border-radius: 14px; padding: var(--s6); width: min(420px, calc(100% - 32px)); box-shadow: 0 20px 60px oklch(0.2 0 0 / 0.2); }
dialog::backdrop { background: oklch(0.2 0 0 / 0.35); }

/* Keep light colors even when the phone is in dark mode */
html, body { background: #fff; color: #111; }
input, select, textarea { background-color: #fff; color: #111; -webkit-text-fill-color: #111; }
input::placeholder { color: #999; -webkit-text-fill-color: #999; }
