/* Playing Partners. Flat by rule: solid fills, 1px lines, no gradients, glows or shadows. */

:root {
  --paper: #f5f7f4;
  --card: #ffffff;
  --ink: #17231c;
  --soft: #5a665f;
  --line: #d3dad4;
  --green: #1e6b46;
  --green-ink: #ffffff;
  --tint: #e2efe6;
  --gold: #b07d00;
  --red: #b3261e;
  --focus: #0b57d0;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101612;
    --card: #18201b;
    --ink: #e9efea;
    --soft: #9aa69e;
    --line: #2e3a33;
    --green: #58b983;
    --green-ink: #0c1a12;
    --tint: #1f3329;
    --gold: #e0b341;
    --red: #f2867e;
    --focus: #8ab4f8;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.bar-in {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bar h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; background: var(--card); padding: 2px; }
.seg button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
  color: var(--soft);
  white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); }

#app { flex: 1; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 32px; }

/* ---------- Day strip and tee time fields ---------- */

.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 0 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  min-width: 0;
}
.day .dow { font-size: 12px; font-weight: 600; color: var(--soft); }
.day .dom { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.day[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.day[aria-pressed="true"] .dow { color: var(--green-ink); }

.fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.fields .wide { grid-column: 1 / -1; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--soft); }
input[type="text"], input[type="tel"], input[type="password"], input[type="search"],
input[type="time"], input[type="date"], input[type="file"], textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 5px;
  padding: 10px 12px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  -webkit-appearance: none;
  appearance: none;
}
input[type="time"], input[type="date"] { height: 50px; font-variant-numeric: tabular-nums; }
input[type="time"] { font-size: 20px; font-weight: 700; }
input[type="file"] { padding: 9px 10px; font-size: 14px; }
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--soft); opacity: 0.75; }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }

/* ---------- Results and player rows ---------- */

.when { margin-top: 22px; font-size: 22px; line-height: 1.2; font-weight: 750; letter-spacing: -0.015em; }

.group { margin-top: 18px; }
.group h3, .group summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--soft);
  margin-bottom: 8px;
}
.group summary { cursor: pointer; padding: 6px 0; margin-bottom: 2px; }
.count {
  display: inline-block;
  min-width: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--card);
}

.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }

.who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 11px 0 11px 14px;
  border: 0;
  background: transparent;
  text-align: left;
}
.name { font-size: 16px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 13px; color: var(--soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star { color: var(--gold); }

/* Handicap sits in a box, the way it does on a scorecard. */
.hcp {
  flex: none;
  width: 50px;
  padding: 3px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nophone { flex: none; font-size: 12px; color: var(--soft); }

.starbtn {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--soft);
}
.starbtn[aria-pressed="true"] { color: var(--gold); }

.empty { color: var(--soft); font-size: 15px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; }
.empty p + p { margin-top: 12px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tally { font-size: 13px; color: var(--soft); margin: 0 0 8px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--soft); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.primary:hover { border-color: var(--ink); }
.btn.small { min-height: 36px; padding: 0 14px; flex: none; }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: 0.5; cursor: default; }

.linkish { border: 0; background: transparent; padding: 6px 0; color: var(--green); font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; }
.chip:hover { border-color: var(--soft); }

/* ---------- Players view ---------- */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input { margin-top: 0; flex: 1; }
.tools { display: flex; gap: 8px; margin-top: 16px; }

/* ---------- Dialog sheets ---------- */

dialog {
  width: min(560px, 100vw);
  max-width: 100vw;
  max-height: min(100dvh, 860px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
dialog[open] { display: flex; }
dialog::backdrop { background: rgba(10, 20, 14, 0.55); }
dialog form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; font-weight: 700; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .primary { margin-left: auto; min-width: 140px; }

@media (max-width: 600px) {
  dialog { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .sheet-head { padding-top: calc(12px + env(safe-area-inset-top)); }
}

.pair { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 400; color: var(--ink); }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--green); flex: none; }

.avail { border: 0; margin: 0; padding: 0; min-width: 0; }
.avail legend { padding: 0; font-size: 13px; font-weight: 600; color: var(--soft); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.hint { font-size: 13px; color: var(--soft); margin-top: 8px; }

/* The availability grid: a small scorecard, days down the side, time of day across. */
.grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--card); }
.grid th, .grid td { border: 1px solid var(--line); padding: 0; }
.grid thead td { border: 0; background: var(--paper); width: 64px; }
.grid .head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}
.grid .head small { font-size: 11px; font-weight: 400; color: var(--soft); }
.grid .cell { display: block; width: 100%; height: 44px; border: 0; background: transparent; font-size: 18px; font-weight: 700; color: var(--green); }
.grid .cell[aria-pressed="true"] { background: var(--tint); }
.grid .cell[aria-pressed="true"]::after { content: "\2713"; }

.error { color: var(--red); font-size: 14px; font-weight: 600; }
.lede { font-size: 15px; color: var(--soft); }
.lede em { font-style: normal; font-weight: 600; color: var(--ink); }

.sample, .warnings { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.sample { border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.sample li { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; }
.sample li:first-child { border-top: 0; }
.sample .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.warnings { margin-top: 10px; color: var(--red); }
.warnings li + li { margin-top: 4px; }

/* ---------- Gate ---------- */

.gate { flex: 1; width: 100%; max-width: 380px; margin: 0 auto; padding: 18vh 20px 32px; }
.gate h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.gate .lede { margin-top: 6px; }
.gate form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }

/* ---------- Footer, toast ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 20px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.foot a, .foot .linkish { color: var(--soft); font-size: 13px; font-weight: 500; padding: 4px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  z-index: 20;
}

/* ---------- Privacy page ---------- */

.prose { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 32px 20px; }
.prose h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.prose h2 { font-size: 17px; margin-top: 26px; }
.prose p { margin-top: 10px; }
.prose .back { display: inline-block; margin-bottom: 18px; font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .day, .seg button { transition: border-color 0.12s, background-color 0.12s; }
}
