/* KimchiGolf — hand-written styles (no framework).
   Paper-and-fairway palette with a kimchi-red accent; follows the device's
   light/dark setting. Admin pages keep their own older layout (base_admin.html). */

:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --raised: #ffffff;
  --ink: #17231c;
  --muted: #5d6a61;
  --line: #ddd6c6;
  --line-soft: #ebe5d7;
  --green: #1d6a48;
  --green-strong: #14543a;
  --green-soft: #e2efe6;
  --on-green: #ffffff;
  --accent: #c8402a;
  --accent-soft: #fae5de;
  --chip: #f1ede2;
  --chip-hover: #e6efe6;
  --yes: #1d6a48;   --yes-soft: #e2efe6;
  --maybe: #8a6100; --maybe-soft: #f7ecc9;
  --no: #a8321f;    --no-soft: #fae5de;
  --shadow: 0 1px 2px rgba(23, 35, 28, .05), 0 6px 20px -12px rgba(23, 35, 28, .25);
  --radius: 16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1512;
    --surface: #171f1a;
    --raised: #1d2721;
    --ink: #e8efe9;
    --muted: #98a69d;
    --line: #2b382f;
    --line-soft: #222d26;
    --green: #58bf8e;
    --green-strong: #7fd3a8;
    --green-soft: #1b3126;
    --on-green: #08130d;
    --accent: #ff7a5c;
    --accent-soft: #3a2019;
    --chip: #202b24;
    --chip-hover: #26382d;
    --yes: #6fd0a0;   --yes-soft: #1b3126;
    --maybe: #e6bf55; --maybe-soft: #332a11;
    --no: #ff8a70;    --no-soft: #3a2019;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -14px rgba(0, 0, 0, .7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
h1, h2, p, ul, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
a { color: var(--green); }
small { font-size: .82em; color: var(--muted); font-weight: 400; }
.sep { color: var(--muted); opacity: .6; margin: 0 .15em; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 8px; padding-bottom: 120px; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar { border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; color: var(--green); }
.brand-flag { fill: var(--accent); }
.brand-name { font: 600 1.2rem/1 var(--serif); letter-spacing: -.01em; }
.brand-name b { font-weight: 600; color: var(--green); }
.topnav a { color: var(--muted); text-decoration: none; font-size: .9rem; padding: 8px 0 8px 16px; }
.topnav a:hover { color: var(--ink); }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero { padding: 28px 0 20px; }
.hero h1 { font: 600 clamp(1.9rem, 6vw, 2.9rem)/1.08 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.hero p { color: var(--muted); margin-top: 8px; max-width: 46ch; }
.eyebrow { font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--accent) !important; font-weight: 600; margin: 0 0 6px !important; }
.outing-note { font: italic 1.1rem/1.4 var(--serif); color: var(--ink) !important; }

/* ── Day strip ───────────────────────────────────────────────────────── */
.days {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76px, 1fr); gap: 8px;
  overflow-x: auto; padding: 4px 16px 12px; margin: 0 -16px;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }
.day { scroll-snap-align: start; cursor: pointer; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day-in {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 10px 6px 9px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.day-name { font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.day-num { font: 600 1.55rem/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.day-count { font-size: .72rem; color: var(--green); font-weight: 600; }
.day-empty .day-count { color: var(--muted); font-weight: 400; }
.day-empty .day-num { color: var(--muted); }
.day:hover .day-in { border-color: var(--green); }
.day input:checked + .day-in { background: var(--green); border-color: var(--green); color: var(--on-green); }
.day input:checked + .day-in .day-name,
.day input:checked + .day-in .day-num,
.day input:checked + .day-in .day-count { color: var(--on-green); }
.day input:focus-visible + .day-in { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Filters ─────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; padding: 4px 0 8px; }
.seg legend, .field > span, .pick legend {
  display: block; font-size: .74rem; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px; padding: 0;
}
.seg legend small, .field > span small, .pick legend small { text-transform: none; letter-spacing: 0; }
.seg-in { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 3px; max-width: 100%; }
.seg-in label { cursor: pointer; }
.seg-in input { position: absolute; opacity: 0; pointer-events: none; }
.seg-in span {
  display: block; padding: 7px 13px; border-radius: 9px; font-size: .9rem; font-weight: 500;
  color: var(--muted); white-space: nowrap; transition: background .15s, color .15s;
}
.seg-in input:checked + span { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg-in input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }

.more-filters { flex-basis: 100%; }
.more-filters summary {
  display: inline-block; cursor: pointer; color: var(--green); font-size: .9rem; font-weight: 600;
  padding: 6px 0; list-style: none;
}
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters summary::after { content: " +"; }
.more-filters[open] summary::after { content: " –"; }
.more-grid { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; padding: 10px 0 4px; }

.field { display: block; }
.field select, .field input[type="text"], .share-row input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-height: 42px; width: 100%;
}
.field select { width: auto; padding-right: 32px; }
.field select:focus, .field input:focus, .share-row input:focus { outline: 3px solid var(--green-soft); border-color: var(--green); }
.field-error { color: var(--no); font-size: .9rem; margin-top: 6px; }

.pick { flex-basis: 100%; }
.pick-in { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-in label { cursor: pointer; }
.pick-in input { position: absolute; opacity: 0; pointer-events: none; }
.pick-in span {
  display: block; padding: 7px 13px; border-radius: 999px; font-size: .9rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: all .15s;
}
.pick-in input:checked + span { background: var(--green-soft); border-color: var(--green); color: var(--green-strong); font-weight: 600; }
.pick-in input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn, .btn-quiet {
  font: 600 .95rem/1 var(--sans); border-radius: 12px; padding: 12px 16px; min-height: 44px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; transition: background .15s, border-color .15s, transform .1s;
}
.btn { background: var(--green); color: var(--on-green); border: 1px solid var(--green); }
.btn:hover { background: var(--green-strong); border-color: var(--green-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--green); border: 1px solid var(--line); }
.btn-quiet:hover { border-color: var(--green); }
.btn:active, .btn-quiet:active { transform: scale(.98); }
.btn:focus-visible, .btn-quiet:focus-visible, .chip:focus-visible, .direct-card:focus-visible, .vote-btn:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* ── Results ─────────────────────────────────────────────────────────── */
.results-wrap { position: relative; margin-top: 12px; }
.loading-bar {
  position: absolute; top: -8px; left: 0; right: 0; height: 3px; border-radius: 3px; overflow: hidden;
  display: none;
}
.loading-bar::after {
  content: ""; position: absolute; inset: 0; width: 40%; background: var(--green); border-radius: 3px;
  animation: slide 1s ease-in-out infinite;
}
.htmx-request .loading-bar, .htmx-request.loading-bar { display: block; }
.htmx-request #results { opacity: .55; transition: opacity .15s; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.results-count { color: var(--muted); font-size: .95rem; }
.results-count strong { color: var(--ink); font: 600 1.25rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.results-head .btn-quiet { min-height: 38px; padding: 9px 13px; font-size: .88rem; }
.results-note { color: var(--muted); font-size: .85rem; margin-top: 16px; text-align: center; }

.courses { display: grid; gap: 14px; }
@media (min-width: 880px) { .courses { grid-template-columns: 1fr 1fr; align-items: start; } }

.course {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.course-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.course h2, .vote-card h2 { font: 600 1.25rem/1.2 var(--serif); letter-spacing: -.01em; }
.course-meta { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.course-count {
  font: 600 .85rem/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--green-strong);
  background: var(--green-soft); border-radius: 999px; padding: 6px 10px; flex-shrink: 0;
}
.course-warn { background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: .86rem; margin-bottom: 12px; }
.course-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.course-foot a { text-decoration: none; font-weight: 600; }
.course-foot a:hover { text-decoration: underline; }

/* The tee sheet: every time is a button that opens the booking page */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 54px; padding: 7px 4px; border-radius: 12px; text-decoration: none;
  background: var(--chip); color: var(--ink); border: 1.5px solid transparent;
  transition: background .12s, border-color .12s, transform .1s;
}
.chip:hover { background: var(--chip-hover); border-color: var(--green); }
.chip:active { transform: scale(.96); }
.chip-time { font: 600 1rem/1.1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.chip-time small { font-size: .62em; font-weight: 600; margin-left: 2px; color: var(--muted); letter-spacing: .03em; }
.chip-sub { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1em; white-space: nowrap; }
.more-times { margin-top: 8px; }
.more-times summary { cursor: pointer; color: var(--green); font-size: .88rem; font-weight: 600; padding: 6px 0; list-style: none; }
.more-times summary::-webkit-details-marker { display: none; }
.more-times[open] summary { display: none; }

/* Picking mode (group outing) */
.picking .chip { border-style: dashed; border-color: var(--line); cursor: copy; }
.picking .chip:hover { border-color: var(--accent); background: var(--chip); }
.chip.chip-picked, .picking .chip.chip-picked { background: var(--accent); border: 1.5px solid var(--accent); color: #fff; }
.chip-picked .chip-time small, .chip-picked .chip-sub { color: rgba(255, 255, 255, .85); }

.outing-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--raised); border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px -18px rgba(0, 0, 0, .45);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
}
.outing-bar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.outing-bar p { font-size: .95rem; line-height: 1.25; }
.outing-bar p strong { font: 600 1.3rem/1 var(--serif); color: var(--accent); }
.outing-bar p small { display: block; }
.outing-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 520px) { .outing-bar .btn-quiet { display: none; } }

.sheet {
  border: 0; border-radius: 20px; padding: 22px; width: min(460px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}
.sheet::backdrop { background: rgba(10, 16, 12, .55); }
.sheet h2 { font: 600 1.5rem/1.15 var(--serif); }
.sheet form { display: grid; gap: 14px; }
.picked-list { list-style: none; display: grid; gap: 6px; max-height: 30vh; overflow: auto; }
.picked-list li { background: var(--chip); border-radius: 10px; padding: 8px 12px; font-size: .9rem; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ── Book direct ─────────────────────────────────────────────────────── */
.direct { margin-top: 40px; }
.direct h2 { font: 600 1.4rem/1.2 var(--serif); }
.section-note { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.direct-grid { display: grid; gap: 10px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.direct-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-soft); transition: border-color .15s;
}
.direct-card:hover { border-color: var(--green); }
.direct-card strong { display: block; font-weight: 600; font-size: .98rem; }
.direct-card small { display: block; }
.direct-card .arrow { color: var(--green); font-size: 1.1rem; }

/* ── Empty states ────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty svg { width: 44px; height: 44px; color: var(--green); opacity: .7; }
.empty-title { font: 600 1.2rem/1.3 var(--serif); margin-top: 8px; }
.empty-hint { color: var(--muted); font-size: .92rem; margin-top: 4px; }
#results > .empty-hint { text-align: center; padding: 40px 0; }

/* ── Outing page ─────────────────────────────────────────────────────── */
.share, .who { margin-bottom: 18px; max-width: 560px; }
.share-row { display: flex; gap: 8px; }
.share-row input { min-width: 0; flex: 1; font-size: .9rem; color: var(--muted); }
.votes { display: grid; gap: 14px; }
.vote-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.vote-gone { opacity: .82; }
.vote-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.vote-time { font: 600 1.7rem/1.1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.vote-time span { font: 500 .9rem/1 var(--sans); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.vote-card h2 { font-size: 1.05rem; margin-top: 4px; }
.vote-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vote-btn {
  font: 600 .92rem/1.1 var(--sans); min-height: 46px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid transparent; transition: filter .15s, transform .1s;
}
.vote-btn:hover { filter: brightness(.96); }
.vote-btn:active { transform: scale(.97); }
.vote-yes { background: var(--yes-soft); color: var(--yes); border-color: color-mix(in srgb, var(--yes) 35%, transparent); }
.vote-maybe { background: var(--maybe-soft); color: var(--maybe); border-color: color-mix(in srgb, var(--maybe) 35%, transparent); }
.vote-no { background: var(--no-soft); color: var(--no); border-color: color-mix(in srgb, var(--no) 35%, transparent); }
.tally-wrap { margin-top: 12px; }
.tally { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .86rem; }
.tally-pill { border-radius: 999px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.tally-yes { background: var(--yes-soft); color: var(--yes); }
.tally-maybe { background: var(--maybe-soft); color: var(--maybe); }
.tally-no { background: var(--no-soft); color: var(--no); }
.tally-names { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; margin-left: 4px; color: var(--muted); }
.voter::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--muted); }
.voter-yes::before { background: var(--yes); }
.voter-maybe::before { background: var(--maybe); }
.voter-no::before { background: var(--no); }

/* ── Footer ──────────────────────────────────────────────────────────── */
.sitefoot { display: flex; justify-content: space-between; gap: 12px; padding-top: 20px; padding-bottom: 28px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line-soft); }
.sitefoot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
