:root {
  --felt: #173f27;
  --felt-2: #1b4a2e;
  --felt-deep: #0e2a18;
  --card: #fbf8ef;
  --card-2: #f3eedf;
  --ink: #15301f;
  --muted: #6c7d70;
  --line: #e2dccb;
  --green: #2c8a4b;
  --green-soft: #dcefdf;
  --flag: #e2533b;
  --gold: #e7b52c;
  --gold-soft: #fbefc6;
  --radius: 20px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 12px 30px -12px rgba(5, 20, 10, 0.55);
  --display: "Fraunces", Georgia, serif;
  --body: "DM Sans", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--felt);
  /* Mowed-lawn stripes with a soft vignette. */
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(120, 200, 120, 0.18), transparent 60%),
    repeating-linear-gradient(100deg, var(--felt) 0 70px, var(--felt-2) 70px 140px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 560px;
  margin: 0 auto;
  overflow-x: clip; /* the hole slide must not open a sideways scroll */
  padding:
    max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.35; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.card > h2 { margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- brand ---------- */
.brand { position: relative; text-align: center; color: var(--card); padding: 28px 0 24px; }
.brand .help-btn { position: absolute; top: 12px; right: 0; }
.brand svg { width: 92px; height: 92px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35)); }
.brand h1 { font-size: 3rem; font-weight: 800; line-height: 1; margin-top: 6px; }
.brand h1 em { font-weight: 600; color: var(--gold); }
.brand p { margin: 10px 0 0; opacity: 0.8; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 14px;
  background: var(--card-2); color: var(--ink);
  font-weight: 700; text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.primary { background: var(--green); color: #fff; box-shadow: 0 6px 16px -6px rgba(20, 90, 45, 0.8); }
.btn.flag { background: var(--flag); color: #fff; }
.btn.ghost { background: transparent; border: 2px solid var(--line); }
.btn.big { width: 100%; min-height: 58px; font-size: 1.1rem; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 50px; padding: 0 14px;
  border: 2px solid var(--line); border-radius: 14px;
  background: #fff; font-size: 1.05rem;
}
.input:focus { outline: none; border-color: var(--green); }

.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

.code-input {
  text-transform: uppercase; letter-spacing: 0.35em; text-align: center;
  font-family: var(--display); font-weight: 800; font-size: 1.4rem;
}
.code-input::placeholder { letter-spacing: 0.2em; color: #c9c3b1; }

.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; font-weight: 500; }
.switch input {
  appearance: none; width: 52px; height: 32px; border-radius: 99px; flex: none;
  background: var(--line); position: relative; transition: background 0.2s; cursor: pointer;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a, .list .item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 2px; color: inherit; text-decoration: none;
}
.list b { font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 1.8rem; }
.score-col { white-space: nowrap; }
.score-col .to-par { font-size: 1rem; }
.list .item a { display: inline; padding: 0; }
.list .item a.pill { display: inline-block; padding: 3px 9px; margin-left: 6px; }
.ace-badge {
  display: inline-block; padding: 1px 7px; border-radius: 99px; vertical-align: 2px;
  background: var(--gold); color: var(--ink); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
#home-recent .btn { margin-top: 8px; }
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  background: var(--green-soft); color: var(--green);
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.06em;
}

/* ---------- new game ---------- */
.courses { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.course-chip {
  display: inline-flex; align-items: center; gap: 2px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.course-chip button { border: 0; background: none; padding: 8px 4px 8px 12px; text-align: left; }
.course-chip button small { display: block; color: var(--muted); font-size: 0.75rem; }
.course-chip .x { padding: 8px 10px; color: var(--muted); font-size: 1.1rem; }
.course-chip.on { border-color: var(--green); background: var(--green-soft); }

.stepper { display: inline-flex; align-items: center; background: var(--card-2); border-radius: 14px; }
.stepper button { width: 44px; height: 44px; border: 0; background: none; font-size: 1.4rem; font-weight: 700; }
.stepper output { min-width: 2.5ch; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.25rem; }

.pars { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin: 12px 0; }
.par-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 58px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
  transition: transform 0.08s ease;
}
.par-cell:active { transform: scale(0.94); }
.par-cell small { font-size: 0.7rem; color: var(--muted); }
.par-cell b { font-family: var(--display); font-size: 1.3rem; line-height: 1.1; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- game header ---------- */
.topbar { display: flex; align-items: center; gap: 10px; color: var(--card); margin-bottom: 14px; }
.topbar .title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 0.8rem; opacity: 0.75; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.12); color: var(--card);
  text-decoration: none; font-size: 1.3rem;
}
.topbar .help-btn { width: 28px; margin-left: -4px; background: none; font-family: var(--display); font-weight: 800; }
.brand .help-btn { font-family: var(--display); font-weight: 800; }
.guide-btn { margin-bottom: 14px; }
.code-btn {
  border: 0; border-radius: 12px; padding: 8px 12px; flex: none;
  background: var(--card); color: var(--ink);
  font-family: var(--display); font-weight: 800; letter-spacing: 0.15em;
}
.live { width: 8px; height: 8px; border-radius: 50%; background: #9aa69c; display: inline-block; }
.live.on { background: #6fe08f; box-shadow: 0 0 0 3px rgba(111, 224, 143, 0.25); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, 0.22); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tabs button { border: 0; border-radius: 10px; min-height: 40px; background: none; color: var(--card); font-weight: 700; opacity: 0.75; }
.tabs button.on { background: var(--card); color: var(--ink); opacity: 1; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--line); border-radius: 12px; padding: 3px; margin: 8px 0 4px; }
.seg button { border: 0; border-radius: 9px; min-height: 34px; background: none; color: var(--muted); font-weight: 700; }
.seg button.on { background: var(--card); color: var(--ink); }

/* ---------- hole view ---------- */
.hole-hero { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; text-align: center; padding: 18px 12px 14px; }
.hole-hero .nav { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--card-2); font-size: 1.6rem; }
.hole-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.hole-num { font-family: var(--display); font-weight: 800; font-size: 4.2rem; line-height: 0.95; }
.hole-of { font-size: 0.85rem; color: var(--muted); }
.par-row { grid-column: 1 / -1; display: flex; justify-content: center; margin-top: 12px; }
.par-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 99px;
  background: var(--green-soft); color: var(--green); font-weight: 700;
}
.par-tag span { padding: 4px 10px; }
.par-tag button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: #fff; color: var(--green); font-weight: 800; }
.slide-next { animation: slide-in 0.22s ease-out backwards; --from: 28px; }
.slide-prev { animation: slide-in 0.22s ease-out backwards; --from: -28px; }
@keyframes slide-in { from { transform: translateX(var(--from)); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
/* Beats the global reduced-motion kill below: a fade in place. */
@media (prefers-reduced-motion: reduce) {
  .slide-next, .slide-prev { animation: fade-in 0.15s ease-out backwards !important; }
}
.hole-money { grid-column: 1 / -1; margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
.hole-money b { color: var(--ink); }
.hole-money .pot { display: inline-block; font-variant-numeric: tabular-nums; }
.pot.bump { animation: pulse 0.28s ease-out; }

.strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { display: none; }
.dot {
  flex: none; width: 38px; height: 38px; border-radius: 50%; scroll-snap-align: center;
  border: 2px solid rgba(255, 255, 255, 0.25); background: transparent; color: var(--card);
  font-weight: 700; font-size: 0.9rem;
}
.dot.done { background: rgba(255, 255, 255, 0.16); border-color: transparent; }
.dot.on { background: var(--card); color: var(--ink); border-color: var(--gold); }

.chaos-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border-radius: 16px;
  background: var(--gold); color: var(--ink); font-weight: 700; box-shadow: var(--shadow);
}
.chaos-tag {
  flex: none; font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase;
  background: var(--ink); color: var(--gold); padding: 3px 8px; border-radius: 6px;
}

.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.player { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; border-left: 6px solid var(--c); }
.p-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-family: var(--display); font-size: 1.1rem;
}
.p-info { flex: 1; min-width: 0; }
.p-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.p-handle { font-weight: 500; font-size: 0.8rem; color: var(--muted); margin-left: 6px; text-decoration: none; }
a.p-handle:hover { text-decoration: underline; }
.p-name em { font-style: normal; font-size: 0.7rem; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; }
.p-meta { font-size: 0.82rem; color: var(--muted); }
.p-meta a { color: inherit; }
.p-score {
  width: 50px; height: 50px; flex: none; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 1.6rem;
  border-radius: 14px; background: var(--card-2); color: var(--muted);
}
.p-score.set { background: var(--ink); color: var(--card); }
.p-score.under { background: var(--flag); color: #fff; border-radius: 50%; }
.p-score.ace { background: var(--gold); color: var(--ink); border-radius: 50%; }
.p-score.pulse { animation: pulse 0.25s ease-out backwards; }
/* Another device changed this score. A color fade, so it stays on under reduced motion. */
.flash { animation: flash 0.9s ease-out; }
@keyframes flash { from { outline: 3px solid var(--gold); outline-offset: 1px; } to { outline: 3px solid transparent; outline-offset: 1px; } }
@media (prefers-reduced-motion: reduce) {
  .flash { animation: flash 0.9s ease-out !important; }
}
@keyframes pulse { 40% { transform: scale(1.18); } }
.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.chip {
  height: 46px; border: 0; border-radius: 12px; background: var(--card-2);
  font-family: var(--display); font-weight: 800; font-size: 1.15rem;
  transition: transform 0.08s ease, background 0.12s ease;
}
.chip:active { transform: scale(0.92); }
.chip.on { background: var(--green); color: #fff; }
.chip.more { color: var(--muted); }

.empty { text-align: center; padding: 28px 20px; }
.empty p { margin: 6px 0 16px; }
.next-wrap { margin-top: 14px; }
.next-wrap .nudge { animation: nudge 0.28s ease-in-out; }
@keyframes nudge { 30% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }

/* Live reactions: a bar under the hole view, and the floats it sends to everyone. */
.reactions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.react {
  border: 0; border-radius: 999px; background: var(--felt-2); color: var(--card);
  font: 600 1.4rem/1 var(--body); padding: 8px 12px; transition: transform 0.08s ease;
}
.react.heckle { font-size: 0.9rem; padding: 10px 14px; }
.react:active { transform: scale(0.9); }
.reaction-float {
  position: fixed; bottom: 80px; z-index: 60; pointer-events: none;
  display: grid; justify-items: center; gap: 2px; text-align: center;
  animation: float-up 2.6s ease-out forwards;
}
.reaction-float b { font-size: 3rem; line-height: 1; }
.reaction-float.heckle b {
  font: 800 1.3rem/1.1 var(--display); background: var(--flag); color: #fff;
  padding: 8px 12px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.reaction-float span { font-weight: 700; font-size: 0.8rem; color: var(--card); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.reaction-float .host-tag { font-style: normal; background: var(--gold); color: var(--ink); text-shadow: none; padding: 1px 6px; border-radius: 999px; }
@keyframes float-up {
  from { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { transform: translateY(-40px) scale(1); opacity: 1; }
  to { transform: translateY(-60vh) scale(1); opacity: 0; }
}
@keyframes fade-in-out { 15%, 70% { opacity: 1; } from, to { opacity: 0; } }
/* Beats the global reduced-motion kill below: a fade in place. */
@media (prefers-reduced-motion: reduce) {
  .reaction-float { animation: fade-in-out 2.6s ease forwards !important; }
}

/* ---------- scorecard ---------- */
.board .rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.board .rank-row + .rank-row { border-top: 1px solid var(--line); }
.rank { width: 30px; text-align: center; font-family: var(--display); font-weight: 800; color: var(--muted); }
.rank-row.first .rank { color: var(--gold); }
.to-par { font-family: var(--display); font-weight: 800; font-size: 1.4rem; min-width: 3ch; text-align: right; }
.to-par.under { color: var(--flag); }
.net { font-variant-numeric: tabular-nums; }
.net.up { color: var(--green); }
.net.down { color: var(--flag); }
.settle .list .item { justify-content: flex-start; }
.winner {
  text-align: center; background: linear-gradient(160deg, var(--gold-soft), var(--card));
  padding: 26px 20px;
}
.winner .trophy { font-size: 2.6rem; }
.winner h2 { font-size: 1.7rem; margin-top: 4px; }
.callouts { display: grid; gap: 12px; }
.callout { display: flex; align-items: center; gap: 12px; }
.callout > span { font-size: 1.8rem; }
.callout.record { background: var(--gold-soft); border-radius: 12px; padding: 8px 10px; margin: 0 -10px; }
.callout.worst b { color: var(--flag); }
.awards { display: grid; gap: 14px; }
.award { display: flex; align-items: flex-start; gap: 12px; }
.award > span { font-size: 1.8rem; line-height: 1.2; }
.award.flip-in { animation: flip-in 0.3s ease-out backwards; }
@keyframes flip-in { from { transform: perspective(600px) rotateY(90deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .award.flip-in { animation: fade-in 0.3s ease-out backwards !important; }
}
.award .caption { font-family: var(--display); font-style: italic; margin-top: 2px; }

.sc-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.sc { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; min-width: 100%; }
.sc th, .sc td { padding: 0; text-align: center; height: 40px; min-width: 36px; font-size: 0.95rem; }
.sc thead th { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.sc tr.par td, .sc tr.par th { color: var(--muted); border-bottom: 2px solid var(--line); }
.sc th.name {
  position: sticky; left: -20px; z-index: 1; background: var(--card); text-align: left;
  padding: 0 10px 0 0; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; box-shadow: 8px 0 8px -8px rgba(0, 0, 0, 0.18);
}
.sc tbody th.name { color: var(--ink); }
.sc tbody th.name::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.sc td.cell button {
  width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; font-weight: 700;
}
.sc td.cell.cur { background: rgba(231, 181, 44, 0.16); }
.sc td.cell .under { background: var(--flag); color: #fff; border-radius: 50%; }
.sc td.cell .ace { background: var(--gold); border-radius: 50%; }
.sc td.cell .over { box-shadow: inset 0 0 0 1.5px var(--ink); }
.sc td.cell .over2 { box-shadow: inset 0 0 0 1.5px var(--ink), inset 0 0 0 3px var(--card), inset 0 0 0 4.5px var(--ink); }
.sc td.cell .none { color: #cdc6b3; }
.sc .tot { font-family: var(--display); font-weight: 800; padding: 0 6px 0 10px; }
.sc th.name.teamed { border-left: 3px solid var(--t); padding-left: 5px; }
.sc tr.team-row th, .sc tr.team-row td { border-top: 1px dashed var(--line); }
.sc tr.team-row th.name { color: var(--muted); font-style: italic; }
.sc tr.team-row td.cell span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; font-weight: 700; }
.sc tr.skins-row th, .sc tr.skins-row td { border-top: 1px dashed var(--line); color: var(--muted); }
.sc tr.skins-row td.cell .won { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 99px; background: var(--c); color: #fff; font-weight: 700; font-size: 0.8rem; }
.t-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; vertical-align: 1px;
  border: 1px solid var(--t); color: var(--t); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
}
.t-pick { width: auto; min-width: 9em; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 0.8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 5px; border-radius: 50%; }

/* ---------- join banner ---------- */
.join-card { border: 2px dashed var(--green); background: var(--green-soft); }

/* ---------- sheet (dialog) ---------- */
#sheet {
  width: min(560px, 100vw); max-width: 100vw; max-height: 88dvh;
  margin: auto auto 0; padding: 0; border: 0;
  border-radius: 24px 24px 0 0; background: var(--card); color: var(--ink);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.35);
}
#sheet[open] { animation: rise 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
#sheet::backdrop { background: rgba(6, 22, 12, 0.55); backdrop-filter: blur(2px); }
.sheet-body { padding: 10px 20px max(24px, env(safe-area-inset-bottom)); }
.grabber { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 10px auto 6px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-section { padding: 16px 0; border-top: 1px solid var(--line); }
.sheet-section h3 { font-size: 1rem; margin-bottom: 10px; }
.p-edit { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.p-edit .input { min-height: 42px; font-size: 0.95rem; }
.p-edit .dot-c { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- user guide (dialog) ---------- */
#guide {
  width: min(440px, calc(100vw - 32px)); max-height: 88dvh;
  padding: 0; border: 0; border-radius: var(--radius);
  background: var(--card); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
#guide[open] { animation: rise 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
#guide::backdrop { background: rgba(6, 22, 12, 0.55); backdrop-filter: blur(2px); }
.guide-body { padding: 16px 20px 18px; }
.guide-page { text-align: center; min-height: 230px; padding: 8px 4px 0; }
.guide-icon { font-size: 3rem; line-height: 1; margin-bottom: 10px; font-family: var(--display); font-weight: 800; color: var(--green); }
.guide-page h3 { font-size: 1.3rem; margin-bottom: 8px; }
.guide-page p { margin: 0; line-height: 1.5; }
.guide-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 8px; margin-top: 12px; }
.guide-nav .btn { min-width: 84px; white-space: nowrap; }
.guide-dots { order: -1; flex-basis: 100%; display: flex; justify-content: center; gap: 2px; }
.guide-dots button { width: 14px; height: 14px; padding: 0; border: 0; background: none; display: grid; place-items: center; }
.guide-dots button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.guide-dots button[aria-current="step"]::after { background: var(--green); transform: scale(1.3); }
.stack { display: grid; gap: 10px; }

@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- toast & confetti ---------- */
#toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--card); padding: 12px 18px; border-radius: 14px;
  font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 60; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); } }

.loading { text-align: center; color: var(--card); padding: 80px 0; opacity: 0.8; }
.ball { width: 22px; height: 22px; border-radius: 50%; background: #fff; margin: 0 auto 14px; animation: roll 0.9s ease-in-out infinite alternate; box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.08); }
@keyframes roll { from { transform: translateX(-30px); } to { transform: translateX(30px); } }

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

.btn.on-felt { background: rgba(255, 255, 255, 0.12); color: var(--card); }
.strip { position: relative; }
.sheet-head + .sheet-section { border-top: 0; }
.brand .tagline { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 1.3rem; color: var(--gold); opacity: 1; margin-top: 8px; }
.brand .tagline + p { margin-top: 6px; }
.sc td.avg.under { color: var(--flag); font-weight: 700; }
.sc td.avg.over { font-weight: 700; }
.sc td.avg.none { color: #cdc6b3; }

/* ---------- hole in one ---------- */
.ace-burst {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  display: grid; place-content: center; gap: 6px; text-align: center; padding: 24px;
  background: radial-gradient(circle, rgba(14, 42, 24, 0.75), rgba(14, 42, 24, 0.35) 70%);
  animation: ace-fade 2.8s ease forwards;
}
.ace-burst b {
  font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 13vw, 5.5rem); line-height: 1;
  color: var(--gold); text-shadow: 0 4px 0 var(--felt-deep), 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: ace-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.ace-burst span { font-family: var(--display); font-style: italic; font-weight: 600; font-size: clamp(1.4rem, 6vw, 2.4rem); color: var(--card); }
@keyframes ace-pop { from { transform: scale(0.3); opacity: 0; } }
@keyframes ace-fade { 80% { opacity: 1; } to { opacity: 0; } }

/* ---------- join QR ---------- */
/* Black on white with the quiet zone baked into the SVG, sized for a phone held at arm's length. */
.qr { width: min(100%, 360px); margin: 8px auto 0; padding: 0; background: #fff; border-radius: 12px; overflow: hidden; }
.qr svg { display: block; width: 100%; height: auto; shape-rendering: crispEdges; }
.qr-caption { text-align: center; margin: 14px 0 4px; }
.qr-caption .code-btn { display: inline-block; margin-bottom: 6px; }

/* ---------- share card ---------- */
.btn.share-card { margin-bottom: 14px; }
.vs { text-align: center; }
.vs-names a { color: inherit; }
.vs-names { display: flex; justify-content: center; align-items: baseline; gap: 10px; font-weight: 600; }
.vs-record { font-family: var(--display); font-size: 3.4rem; line-height: 1.1; margin: 6px 0; }

/* ---------- admin sticky toasts ---------- */
#trolls {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 55;
  display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.troll {
  background: var(--flag); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); overflow-wrap: anywhere;
}
.troll.new { animation: drop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes drop { from { transform: translateY(-60px) rotate(-3deg); opacity: 0; } }
