/* Concept: a family photo up top with a stage tag, a slim progress bar,
   a scorecard for guesses, handwritten notes from family. */
:root {
  --paper: #1f4a2e;          /* page background: hunter green */
  --chip: #f3f6ee;           /* light fills inside cards */
  --card: #fffef9;
  --ink: #17301f;
  --muted: #5f6f61;
  --club: #1f4a2e;
  --club-deep: #153522;
  --fairway: #8cc163;
  --rough: #5f9a4b;
  --putting: #b7dc85;
  --sand: #ecd9a2;
  --water: #8ec5dd;
  --flag: #d4443a;
  --navy: #1c2a4a;
  --line: #dfe5d6;
  --gold: #c99a3b;
  --display: "Young Serif", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --argyle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='48'%3E%3Crect width='36' height='48' fill='%23153522'/%3E%3Cpath d='M18 0 36 24 18 48 0 24z' fill='%232b6a3f'/%3E%3Cpath d='M0 0 36 48M36 0 0 48' stroke='%23f3e9c9' stroke-width='1' stroke-dasharray='3 3' opacity='.7'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rough); margin: 0 0 6px; }
.preview-banner { background: var(--navy); color: #e3e8f3; font-size: 13px; text-align: center; padding: 8px 16px; }

.argyle { height: 14px; background: var(--argyle); background-size: 18px 24px; }

/* ---------- Hero ---------- */
.hero, .band {
  padding-block: 24px 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.hero-in, .wrap { max-width: 620px; margin: 0 auto; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--club); color: #f3e9c9; border-radius: 999px;
  padding: 6px 14px 6px 8px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.pill .ball { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 40%, #dfe3da 75%); box-shadow: inset -1px -1px 0 rgba(0,0,0,.12); }
.hero h1, .band h1 { font-family: var(--display); font-weight: 400; color: var(--club); line-height: 1.02; letter-spacing: -.01em; margin: 16px 0 0; text-wrap: balance; }
.hero h1 { font-size: clamp(40px, 12vw, 64px); }
.hero h1 em { font-style: normal; color: var(--rough); }
.intro { margin: 12px 0 0; color: var(--muted); max-width: 32em; }

/* ---------- Family photo ---------- */
.photo {
  margin-top: 22px; border-radius: 22px; overflow: hidden; position: relative; aspect-ratio: 4 / 3; max-width: 100%;
  background: linear-gradient(160deg, #cfe3b8, #9ccb78); box-shadow: 0 2px 0 var(--club-deep);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .hole-tag {
  position: absolute; top: 12px; left: 12px; z-index: 1; background: var(--card); color: var(--club);
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px;
}
.photo-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--club); font-weight: 600; font-size: 14px; }
.tracker { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 4px; list-style: none; margin: 14px 0 0; padding: 0; }
.tracker li { height: 6px; border-radius: 3px; background: var(--line); }
.tracker li.done { background: var(--club); }
.tracker li.current { background: var(--fairway); }
@media (prefers-reduced-motion: no-preference) { .tracker li.current { animation: blink 2s ease-in-out infinite; } }

/* ---------- Status ---------- */
.status {
  display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 18px;
  padding: 14px 16px; margin-top: -14px; position: relative; border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(23,48,31,.08);
}
.status .emo { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 28px; }
.status .txt { min-width: 0; }
.status-now { font-family: var(--display); font-size: 24px; line-height: 1.15; margin: 0; color: var(--club); }
.status-sub { font-size: 14px; color: var(--muted); margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3fa35f; animation: blink 2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.tally { text-align: center; font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.tally b { color: var(--club); }

/* ---------- Sections ---------- */
.wrap {
  padding-block: 4px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.sec, .section-title { font-family: var(--display); font-weight: 400; font-size: 28px; color: var(--club); margin: 40px 0 4px; }
.sec-sub { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 14px; }

/* ---------- Play-by-play ---------- */
.update { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.update:first-child { padding-top: 0; }
.update:last-child { border-bottom: 0; padding-bottom: 0; }
.u-emo { width: 44px; height: 44px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 22px; }
.u-body { min-width: 0; }
.u-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.stage { font-weight: 700; color: var(--club); }
.u-time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.u-means { font-size: 13px; color: var(--muted); margin: 0; }
.msg-text { margin: 6px 0 0; white-space: pre-wrap; font-size: 16px; }
.u-body img { border-radius: 12px; margin-top: 10px; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.react {
  border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: 4px 10px;
  font-size: 15px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center;
  transition: transform .15s ease;
}
.react:hover { border-color: var(--fairway); }
.react:active { transform: scale(.9); }
.react.mine { background: #e1f0cf; border-color: var(--fairway); }
.react small { font-size: 12px; font-weight: 700; color: var(--club); }
.empty { color: var(--muted); text-align: center; padding: 8px 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--club); }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fairway); box-shadow: 0 0 0 3px #e1f0cf; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.btn {
  display: inline-block; border: 0; border-radius: 999px; padding: 13px 22px; cursor: pointer; text-decoration: none;
  background: var(--club); color: #f3e9c9; font-weight: 700; font-size: 16px;
  box-shadow: 0 3px 0 var(--club-deep); transition: transform .1s ease, box-shadow .1s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--club-deep); }
.btn:focus-visible, .react:focus-visible, .chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: transparent; color: var(--club); box-shadow: inset 0 0 0 2px var(--club); }
.btn.danger { background: transparent; color: var(--flag); box-shadow: inset 0 0 0 1px #e9c2bd; padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.note { font-size: 14px; font-weight: 600; color: var(--rough); margin: 8px 0 0; min-height: 1em; }

/* ---------- Scorecard ---------- */
.scorecard { margin-top: 18px; border: 2px solid var(--club); border-radius: 10px; overflow: hidden; font-variant-numeric: tabular-nums; }
.scorecard { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
.scorecard .r { display: contents; }
.scorecard .r > div { padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.scorecard .r > div:last-child { border-right: 0; text-align: right; }
.scorecard .r:last-child > div { border-bottom: 0; }
.scorecard .r.head > div { background: var(--club); color: #f3e9c9; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; border-color: var(--club-deep); }
.scorecard .r:nth-child(odd):not(.head) > div { background: #f6f9ef; }
.g-name { font-family: var(--hand); font-size: 22px; line-height: 1.1; overflow-wrap: break-word; }
.g-num { font-family: var(--mono); font-size: 12px; line-height: 1.4; color: var(--navy); white-space: nowrap; }
.winner { background: #fff6dc; border: 2px dashed var(--gold); border-radius: 14px; padding: 12px 14px; margin-bottom: 4px; }
.winner p { margin: 0; }
.winner b { font-family: var(--hand); font-size: 24px; color: var(--club); font-weight: 700; }
.badge { display: inline-block; font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--gold); color: #fff; padding: 2px 7px; border-radius: 999px; margin: 3px 4px 0 0; white-space: nowrap; }

/* ---------- Guestbook ---------- */
.notes { margin-top: 18px; display: grid; gap: 10px; }
.msg {
  background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px 10px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 29px, #e6edf5 29px 30px);
  background-position: 0 8px;
}
.msg:nth-child(odd) { transform: rotate(-.6deg); }
.msg:nth-child(even) { transform: rotate(.5deg); }
.msg p { font-family: var(--hand); font-size: 24px; line-height: 30px; margin: 0; white-space: pre-wrap; color: var(--navy); }
.msg .by { font-size: 13px; color: var(--muted); margin-top: 4px; }
.msg .by b { color: var(--club); }

/* ---------- Hole in one ---------- */
.announce {
  position: relative; overflow: hidden; text-align: center; margin-top: 22px;
  background: var(--club); color: #f3e9c9; border-radius: 22px; padding: 26px 18px 20px;
}
.announce .confetti { position: absolute; inset: 0; pointer-events: none; }
.announce .confetti i { position: absolute; top: -12px; width: 9px; height: 9px; border-radius: 50%; animation: fall 3.2s ease-in forwards; }
@keyframes fall { to { transform: translateY(520px) rotate(400deg); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .announce .confetti { display: none; } }
.announce .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--putting); margin: 0; }
.announce h2 { font-family: var(--display); font-weight: 400; font-size: clamp(38px, 11vw, 56px); line-height: 1.05; margin: 6px 0 4px; color: #fff; }
.announce .note-text { margin: 4px auto 0; max-width: 28em; color: #dbe8cf; }
.announce img { border-radius: 14px; margin: 0 auto 16px; max-height: 420px; width: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
@media (min-width: 520px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts div { background: var(--card); color: var(--ink); border-radius: 10px; padding: 8px 6px; }
.facts b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--club); white-space: nowrap; }
.facts span { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

footer {
  background: var(--argyle); background-size: 36px 48px; color: #f3e9c9; text-align: center;
  padding-block: 26px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
footer span { background: var(--club-deep); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }

/* ---------- Admin ---------- */
.band { padding-block: 24px 8px; }
.band .eyebrow { margin: 0; }
.band h1 { font-size: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-size: 15px; cursor: pointer; text-align: left; }
.chip small { display: block; font-size: 11px; color: var(--muted); }
.chip.on { background: var(--club); color: #f3e9c9; border-color: var(--club); }
.chip.on small { color: var(--putting); }
.admin-list .item { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-list .item > div { min-width: 0; }
.admin-list .item:last-child { border-bottom: 0; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--club); }

/* ---------- Reactions extras ---------- */
.react.add { color: var(--muted); font-weight: 700; padding: 4px 11px; }
.emoji-input { width: 54px; padding: 4px 8px; border-radius: 999px; font-size: 16px; border: 1.5px solid var(--fairway); }
.peek {
  position: absolute; z-index: 20; max-width: 260px; transform: translateY(-100%) scale(.96); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 13px; line-height: 1.35; padding: 7px 10px; border-radius: 10px;
  transition: opacity .15s ease, transform .15s ease;
}
.peek.show { opacity: 1; transform: translateY(-100%) scale(1); }
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(23,48,31,.45); display: grid; place-items: end center; padding: 16px; }
.sheet-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 18px; padding: 18px; display: grid; gap: 10px; margin-bottom: env(safe-area-inset-bottom, 0px); }
.sheet-title { font-family: var(--display); font-size: 22px; color: var(--club); margin: 0; }
.sheet .row { margin-top: 4px; }
.react { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* ---------- Quiet moment ---------- */
.quiet { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-top: 18px; }
.quiet-text { font-family: var(--display); font-size: 22px; line-height: 1.35; color: var(--club); margin: 0 0 8px; }
body.paused .reacts, body.paused .tally, body.paused .tracker, body.paused #photoWrap .hole-tag, body.paused .sec-sub { display: none; }

.chips.quick { gap: 6px; margin-bottom: 8px; }
.chip.small { font-size: 13px; padding: 7px 11px; border-radius: 12px; text-align: left; line-height: 1.3; }

/* ---------- Deep green page ---------- */
.hero h1 { color: #fff; } .hero h1 em { color: #b7dc85; }
.band h1 { color: #fff; }
.intro, .sec-sub, .tally { color: #c9d6cb; } .tally b { color: #fff; }
.sec, .section-title { color: #fff; }
.pill { background: #153522; }
.photo { box-shadow: none; }
.status { box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.card, .quiet { box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.announce { background: #153522; border: 2px solid var(--gold); }
.tracker li { background: rgba(255,255,255,.18); } .tracker li.done { background: #fff; } .tracker li.current { background: #b7dc85; }
.argyle { display: none; }
footer { background: #153522; } footer span { background: transparent; color: #c9d6cb; }
.preview-banner { background: #0f2418; }
.sheet { background: rgba(0,0,0,.5); }
.scorecard .r:nth-child(odd):not(.head) > div { background: #f6f8f2; }
.btn.secondary { background: #fff; }

.photo.portrait { aspect-ratio: 4 / 5; }
.photo.portrait img { object-position: center 20%; }

[hidden] { display: none !important; }

/* Photos: discourage saving */
img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }

.privacy { font-size: 13px; color: var(--muted); margin: 8px 0 0; padding: 8px 10px; background: var(--chip); border-radius: 10px; border-left: 3px solid var(--gold); }
.announce .privacy { background: rgba(255,255,255,.08); color: #dbe8cf; }
#updates > .privacy { margin: 0 0 14px; }

body.closed .wrap > section.card, body.closed .status, body.closed .tally, body.closed #intro, body.closed #msgForm, body.closed #liveHint, body.paused #liveHint, body.closed .sec, body.closed .sec-sub, body.closed #updates, body.closed #guesses, body.closed #winners, body.closed #messages { display: none; }
.confirm { background: #fff6dc; border: 2px dashed var(--gold); border-radius: 14px; padding: 14px; margin-top: 12px; }
.confirm p { margin: 0 0 6px; }
.confirm ul { margin: 6px 0 12px; padding-left: 18px; }

/* ---------- Posting page: white, so it never gets confused with the family page ---------- */
body.admin { background: #ffffff; }
body.admin .band h1 { color: var(--club); }
body.admin .section-title { color: var(--club); }
body.admin .card { border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(23,48,31,.05); }
body.admin .preview-banner { background: var(--navy); }
body.admin .btn.secondary { background: transparent; }
body.admin .chip { background: #fff; }
body.admin .chip.on { background: var(--club); }
body.admin .chips.quick .chip { background: var(--chip); border-color: var(--chip); }
body.admin .chips.quick .chip.on { background: var(--club); border-color: var(--club); }

.chip.pause-opt { width: 100%; border-radius: 14px; padding: 11px 14px; }
.chip.pause-opt b { display: block; font-weight: 700; margin-bottom: 2px; }
.chip.pause-opt small { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; }
.chip.pause-opt.on small { color: #dbe8cf; }

footer { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.parents-link { color: #9fb3a3; font-size: 12px; text-decoration: none; opacity: .8; }
.parents-link:hover { color: #fff; text-decoration: underline; }

/* ---------- Not found + product home ---------- */
body.not-found .wrap, .home .wrap { max-width: 520px; margin: 0 auto; padding-top: 56px; }
.nf-title { font-family: var(--display); font-weight: 400; font-size: 28px; color: var(--club); margin: 0 0 6px; }
