/* Sebesta's type, as on the store: DM Sans for text, labels and buttons
   (small, uppercase, widely tracked), Cormorant Garamond for display lines.
   Both are self-hosted woff2s, preloaded and cached for a year (layout.html),
   so after the first visit there's nothing to wait for. No italic file: the
   store uses roman only, and font-synthesis is off so nothing fakes one.
   Mobile first: one column, 16px+ inputs (iOS zooms below 16px), 44px+
   tap targets, a sticky action bar on the picker.

   Three themes: white (the default: Sebesta's palette, black accents), green
   (the golf edition) and dark. <html data-theme> comes from the "theme"
   cookie, so there's no flash. */
:root, :root[data-theme="white"] {
  --bg: #f7f6f3; --panel: #ffffff; --ink: #14130f; --dim: #6e6a62; --line: #e2dfd8;
  --rule: #c9c5bc; --accent: #14130f; --good: #4e6b00; --bad: #9b2c1f; --on: #f0eee8;
  color-scheme: light;
}
:root[data-theme="green"] {
  --bg: #15221b; --panel: #1b2b23; --ink: #ece9df; --dim: #9aab9f; --line: #2f4238;
  --rule: #ece9df; --accent: #e6c35c; --good: #93d3a2; --bad: #f08b7d; --on: #213529;
  color-scheme: dark;
}
:root[data-theme="dark"] {
  --bg: #111111; --panel: #191919; --ink: #ebe9e4; --dim: #8f8d88; --line: #2c2b29;
  --rule: #ebe9e4; --accent: #d9b45a; --good: #8fcf9c; --bad: #f08b7d; --on: #23211c;
  color-scheme: dark;
}
:root {
  --serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --label: "DM Sans", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-synthesis: none;
}

/* ?v=1 makes them immutable (staticCache): bump it if a font file changes. */
@font-face { font-family: "DM Sans"; src: url("/static/fonts/dm-sans.woff2?v=1") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/static/fonts/cormorant-garamond.woff2?v=1") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--label); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
h1 { font: 400 2.1rem/1.1 var(--serif); margin: 0.3rem 0 0.4rem; letter-spacing: 0; text-wrap: balance; }
h2 {
  font: 500 0.66rem/1 var(--label); text-transform: uppercase; letter-spacing: 0.2em;
  margin: 2rem 0 0.7rem; padding-top: 0.7rem; border-top: 1px solid var(--line);
}
section { margin-bottom: 1rem; }
.dim { color: var(--dim); }
.small { font-size: 0.8rem; }
.bad { color: var(--bad); }
.live { color: var(--bad); font: 500 0.66rem var(--label); letter-spacing: 0.18em; text-transform: uppercase; }
.hot { color: var(--accent); font-size: 0.8em; }
.err { border-left: 3px solid var(--bad); color: var(--bad); padding: 0.4rem 0.8rem; }

/* masthead */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 16px 0.65rem;
  border-bottom: 1px solid var(--line);
}
/* The sebesta wordmark with "Pool" set small underneath: a lockup, not a new logo. */
.brand { display: inline-flex; flex-direction: column; align-items: center; gap: 0.22rem; text-decoration: none; color: var(--ink); }
.brand svg { display: block; height: 1.1rem; width: auto; }
.brand span, .masthead .name span { font: 500 0.56rem/1 var(--label); text-transform: uppercase; letter-spacing: 0.42em; margin-right: -0.42em; }
.top nav { display: flex; gap: 1rem; align-items: center; font: 500 0.66rem var(--label);
  text-transform: uppercase; letter-spacing: 0.18em; }
.top nav a { text-decoration: none; color: var(--dim); padding: 0.4rem 0; }
.top nav a:hover { color: var(--ink); }
.top nav a[href="/me"] { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; }
#theme { min-height: 0; padding: 0.3rem 0; border: 0; color: var(--dim); }
#theme::before { content: "◐"; font-size: 1.05rem; }
main { max-width: 660px; margin: 0 auto; padding: 1.1rem 16px 7rem; }

/* inputs */
input, select, button { font: inherit; color: inherit; }
input, select {
  width: 100%; min-height: 44px; padding: 0.5rem 0.7rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: 0; font: 16px var(--label);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0.5rem 0.9rem; background: transparent; border: 1px solid var(--rule); border-radius: 0;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 500 0.69rem var(--label); text-transform: uppercase; letter-spacing: 0.2em;
}
button:disabled { opacity: 0.35; cursor: default; }
.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.primary:hover { color: var(--bg); }
button.link { border: 0; padding: 0; min-height: 0; text-decoration: underline; text-transform: none; letter-spacing: 0; font: 400 0.9rem var(--label); }
.btn { margin-top: 0.7rem; width: 100%; min-height: 54px; } /* the store's full-width CTA height */
.inputline { display: flex; gap: 0.5rem; margin: 0.6rem 0; }
.inputline input { flex: 1; min-width: 0; }
.prompt label { display: block; margin: 1.1rem 0 0.5rem; font: 500 0.66rem var(--label); text-transform: uppercase; letter-spacing: 0.2em; color: var(--dim); }
.stack input { margin-bottom: 0.4rem; }
.stack button { margin-top: 0.8rem; width: 100%; min-height: 54px; }
.end { margin-top: 2rem; text-align: right; }

/* front page */
.hero { padding-top: 9vh; }
.masthead { text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1.2rem 0 0.9rem; margin-bottom: 1.2rem; }
.masthead .name { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; margin: 0.3rem 0 0.2rem; }
.masthead .name svg { display: block; width: min(62vw, 15rem); height: auto; }
.masthead .name span { font-size: 0.8rem; letter-spacing: 0.6em; margin-right: -0.6em; }
.masthead .line { font: 500 0.62rem var(--label); text-transform: uppercase; letter-spacing: 0.18em; color: var(--dim);
  display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.6rem; }
.deck { font: 300 1.3rem/1.45 var(--serif); color: var(--dim); text-align: center; margin: 0 0 1.2rem; text-wrap: balance; }

/* lists & boards */
.list, .board, .field { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.list li span { font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.board li { border-bottom: 1px solid var(--line); }
.board li.me { background: var(--on); }
.row { display: flex; gap: 0.8rem; align-items: baseline; padding: 0.65rem 0.3rem; cursor: pointer; list-style: none; }
.row::-webkit-details-marker { display: none; }
.rk { width: 2.6rem; color: var(--dim); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.num { text-align: right; font-family: var(--label); font-variant-numeric: tabular-nums; }
details[open] > .row .who { color: var(--accent); }
details .lu { margin: 0 0 0.7rem 3.4rem; width: calc(100% - 3.4rem); }

/* box-score tables */
table { border-collapse: collapse; width: 100%; }
td, th { padding: 0.42rem 0.3rem; vertical-align: baseline; }
th { text-align: left; font: 500 0.6rem var(--label); text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--dim); border-bottom: 1px solid var(--rule); }
th.num { text-align: right; }
.lu td, .stats td { border-bottom: 1px solid var(--line); }
.lu td.small, .stats td .small { font-family: var(--label); font-variant-numeric: tabular-nums; }
.lu tr.drop { opacity: 0.5; text-decoration: line-through; }
.lu td:first-child { width: 55%; }
.stats td:first-child { width: 2rem; font: 0.8rem var(--label); }
.total { display: flex; justify-content: space-between; margin: 0.6rem 0.3rem; font-family: var(--label); }
.total b { font: 500 1.6rem/1 var(--serif); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0.5rem 0; }
.kv dt { color: var(--dim); font: 500 0.62rem/2.1 var(--label); text-transform: uppercase; letter-spacing: 0.18em; }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* chips: sort keys, picked golfers */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.chips a, .chip {
  min-height: 34px; padding: 0.25rem 0.6rem; border: 1px solid var(--line); border-radius: 0;
  text-decoration: none; display: inline-flex; align-items: center;
  font: 500 0.62rem var(--label); text-transform: uppercase; letter-spacing: 0.16em;
}
.chips a.on { border-color: var(--rule); background: var(--ink); color: var(--bg); }
.chip { text-transform: none; letter-spacing: 0; font: 500 0.8rem var(--label); }
.sort { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.2rem; }
.sort::-webkit-scrollbar { display: none; }

/* picker */
#q { margin: 0.6rem 0; }
.field li { border-bottom: 1px solid var(--line); }
.g {
  width: 100%; border: 0; border-left: 3px solid transparent; border-radius: 0; text-align: left;
  display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem; padding: 0.55rem 0.4rem;
  min-height: 56px; font: 500 0.95rem var(--label); text-transform: none; letter-spacing: 0;
}
.g .meta { grid-column: 1 / -1; font: 400 0.74rem var(--label); color: var(--dim); font-variant-numeric: tabular-nums; }
.g .sal { font: 500 0.88rem var(--label); font-variant-numeric: tabular-nums; }
.field li.on .g { background: var(--on); border-left-color: var(--accent); }
.field li.on .nm::before { content: "✓ "; color: var(--accent); }
.field li.auto .nm::before { content: "≈ "; }
.field li.off .g { opacity: 0.35; }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--panel);
  border-top: 1px solid var(--line); padding: 0.6rem 16px calc(0.6rem + env(safe-area-inset-bottom));
}
.bar > * { max-width: 628px; margin-left: auto; margin-right: auto; }
.bar .line { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; align-items: baseline; font-family: var(--label); font-variant-numeric: tabular-nums; }
.bar .line b { font: 500 1.35rem/1 var(--serif); }
.bar .chips { margin: 0.4rem auto; min-height: 0; }
.bar .chips:empty { display: none; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.modes button { padding: 0.5rem 0.3rem; }
.modes button.on { background: var(--ink); color: var(--bg); }
.chip.auto { border-style: dashed; }
#sync { margin-left: auto; }
#msg { margin: 0.4rem auto 0; white-space: pre-wrap; min-height: 1.2em; color: var(--dim); }
#msg:empty { display: none; }
/* Taps respond on touch-down, with no 300ms double-tap-zoom delay. */
button, a, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.g:active { background: var(--on); }

/* simulation banner, buzz */
.sim { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 0.45rem 0;
  font: 500 0.62rem/1.7 var(--label); text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); }
.sim a { color: var(--accent); }
.buzz { margin: 0.8rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--line); padding: 0.2rem 0 0.3rem; }
.buzz summary { cursor: pointer; padding: 0.5rem 0; font: 500 0.62rem var(--label); text-transform: uppercase; letter-spacing: 0.18em; }
.buzz summary a { margin-left: 0.4rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.buzz ol { margin: 0.1rem 0 0.4rem; padding-left: 1.4rem; }
.buzz li::marker { font: 500 0.8rem var(--label); color: var(--dim); }
.buzz li button { border: 0; padding: 0.3rem 0; min-height: 40px; text-align: left; width: 100%;
  display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; justify-content: flex-start; white-space: normal;
  font: 500 0.95rem var(--label); text-transform: none; letter-spacing: 0; }
.buzz li button .small { font-family: var(--label); font-weight: 400; }
.buzz li button.on .nm { color: var(--accent); }
.buzz li button.on .nm::before { content: "✓ "; }
.why { margin: 0 0 0.3rem; font: 300 1.1rem/1.4 var(--serif); }
.mood { font: 500 0.78rem var(--label); font-variant-numeric: tabular-nums; }
.mood.positive { color: var(--good); }
.mood.negative { color: var(--bad); }
.mood.mixed, .mood.neutral { color: var(--dim); }
.heads { margin: 0.2rem 0 0.8rem; padding-left: 1.2rem; color: var(--dim); }
.buzzpage .row { flex-wrap: wrap; }

@media (min-width: 700px) {
  main { padding-top: 1.6rem; }
  h1 { font-size: 2.6rem; }
}
.members li { align-items: center; }
.members form { margin: 0; }
.members button.link { font: 500 0.62rem var(--label); text-transform: uppercase; letter-spacing: 0.16em; text-decoration: none; min-height: 36px; }

/* This week / Season */
.tabs { display: flex; gap: 0; margin: 1rem 0 0.4rem; border-bottom: 1px solid var(--rule); }
.tabs button { border: 0; border-bottom: 1px solid transparent; margin-bottom: -1px; padding: 0.5rem 0.9rem 0.45rem 0; min-height: 40px; color: var(--dim); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button + button { padding-left: 0.9rem; }
