/* FairwaySync — components. Big targets, high contrast, still by default. */

/* The [hidden] attribute must always win, even over components that set their
   own display (.btn, .pill, .notice, flex/grid rows). Without this, toggling
   `el.hidden = true` on such elements does nothing. */
[hidden] { display: none !important; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
}

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--pine-ink);
  background: linear-gradient(180deg, var(--accent-hi), var(--pine) 55%, var(--accent-lo));
  cursor: pointer;
  width: 100%;
  box-shadow: 0 6px 18px var(--glow), 0 2px 4px rgba(0, 0, 0, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: translateY(1px); filter: brightness(0.96); box-shadow: 0 2px 8px var(--glow), inset 0 2px 4px rgba(0, 0, 0, 0.25); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.btn.secondary {
  background: linear-gradient(180deg, var(--sec-hi), var(--sec-lo));
  color: var(--sec-ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  border: 1px solid var(--sand);
}
.btn.ghost {
  background: color-mix(in srgb, var(--pine) 7%, transparent);
  color: var(--pine);
  border: 1px solid color-mix(in srgb, var(--pine) 40%, transparent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn.ghost:hover { background: color-mix(in srgb, var(--pine) 14%, transparent); }
.btn.live {
  background: linear-gradient(180deg, var(--flag-hi), var(--flag) 55%, var(--flag-lo));
  color: var(--flag-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--flag) 35%, transparent), 0 2px 4px rgba(0, 0, 0, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.big { min-height: 76px; font-size: 24px; letter-spacing: 0.01em; border-radius: var(--radius-lg); }

/* --- Inputs ---------------------------------------------------------------- */
label { display: block; font-weight: 600; margin: 0 0 var(--space-1); color: var(--graphite); }
.field { margin-bottom: var(--space-3); }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  font-size: 18px;
  font-family: var(--font-body);
  color: var(--graphite);
  background: var(--field);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);   /* recessed, not raised */
}
input::placeholder { color: var(--fescue-dim); }
input:focus, select:focus, textarea:focus {
  border-color: var(--pine);
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 3px color-mix(in srgb, var(--pine) 18%, transparent);
}
textarea { min-height: 110px; padding: var(--space-2) var(--space-3); resize: vertical; line-height: 1.45; }

.code-input { font-family: var(--font-mono); letter-spacing: 0.35em; text-transform: uppercase; font-size: 24px; text-align: center; }

/* --- Cards / header -------------------------------------------------------- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--sand);
  margin-bottom: var(--space-3);
}
.masthead h1 { font-size: 28px; color: var(--pine); letter-spacing: 0.02em; }
.masthead .clock { font-family: var(--font-mono); color: var(--graphite-2); font-size: 15px; }

.card {
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo) 85%);
  border: 1px solid var(--sand);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}

.hint { color: var(--graphite-2); font-size: 15px; margin: var(--space-2) 0; }

/* Prominent code display (join code / host code). */
.codebox {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--field); border: 1px solid color-mix(in srgb, var(--pine) 30%, transparent); border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 18px color-mix(in srgb, var(--pine) 8%, transparent);
}
.codebox-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--graphite-2); }
.codebox-val { font-size: 30px; font-weight: 500; letter-spacing: 0.2em; color: var(--pine); }
.err { color: var(--flag); font-weight: 600; min-height: 1.2em; margin: var(--space-2) 0; }

/* --- The Grounds (scorecard directory) ------------------------------------- */
.scorecard { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-1);
  border-bottom: 1px solid var(--sand);   /* sand hairline rule, like a real card */
  min-height: var(--tap);
  cursor: pointer;
}
.row.off { cursor: default; }
/* An off-air row is NOT a disabled row: the pairing, the match status and the
   nine-hole chips are live information whether or not anyone is streaming.
   Only the flag icon dims — the "off air" badge already tells the story. */
.row.off .flagcol { opacity: 0.45; }
.row .flagcol { width: 30px; display: flex; justify-content: center; }
.row .slot { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--pine); }
.row .title { grid-column: 2; color: var(--graphite-2); font-size: 15px; }
.row .status { justify-self: end; text-align: right; }
.row .hole { grid-column: 3; justify-self: end; font-family: var(--font-mono); font-size: 14px; color: var(--graphite-2); }
.badge-live { color: var(--flag); font-weight: 700; font-size: 14px; letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 6px; }
.badge-off { color: var(--fescue); font-size: 14px; font-weight: 600; }
/* Marks a row from a session other than the one currently being played. */
.sess-tag {
  font-family: var(--font-body); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--graphite-2); background: var(--sand);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.watching { font-family: var(--font-mono); font-size: 14px; color: var(--graphite-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--flag); display: inline-block; }

/* --- Flagstick (the one piece of motion) ----------------------------------- */
.flag-svg { width: 22px; height: 28px; display: block; }
.flag-svg .cloth { transform-origin: left center; animation: flutter 2s ease-in-out infinite; }
@keyframes flutter {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50%      { transform: skewY(-6deg) scaleX(0.94); }
}
@media (prefers-reduced-motion: reduce) {
  .flag-svg .cloth { animation: none; }
}

/* --- Watch screen ---------------------------------------------------------- */
.stage { position: fixed; inset: 0; background: #000; overflow: hidden; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay > * { pointer-events: auto; }
.chrome-tl { position: absolute; top: calc(env(safe-area-inset-top) + 12px); left: 12px; }
.chrome-tr { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 12px; display: flex; gap: 8px; align-items: center; }
.pill {
  background: rgba(6, 12, 9, 0.72);
  color: #F2F7F3;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  backdrop-filter: blur(6px);
}
.pill .mono { font-size: 14px; }
.iconbtn {
  width: var(--tap); height: var(--tap);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 12, 9, 0.72);
  color: #F2F7F3;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

/* Bottom rail of other live groups. */
.rail {
  position: absolute; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  display: flex; gap: 10px; overflow-x: auto;
  padding: 10px 12px; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.rail::-webkit-scrollbar { display: none; }
.railcard {
  flex: 0 0 auto; min-width: 132px; min-height: 60px;
  scroll-snap-align: start;
  background: rgba(6, 12, 9, 0.78);
  color: #F2F7F3;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
  cursor: pointer; backdrop-filter: blur(6px);
}
.railcard.active { border-color: var(--flag); }
.railcard .rl-slot { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.railcard .rl-meta { font-family: var(--font-mono); font-size: 12px; opacity: 0.85; }

.chrome-hidden .overlay { opacity: 0; transition: opacity 0.25s ease; }
.overlay { transition: opacity 0.25s ease; }

/* --- Broadcast screen ------------------------------------------------------ */
.preview-wrap { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #000; aspect-ratio: 16 / 9; margin-bottom: var(--space-3); }
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.hole-stepper { display: flex; align-items: center; gap: var(--space-3); }
.hole-stepper button {
  width: var(--tap); height: var(--tap); font-size: 26px; border-radius: var(--radius);
  border: 1px solid var(--sand); background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  color: var(--graphite); font-family: var(--font-mono); cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.hole-stepper .hole-val { font-family: var(--font-mono); font-size: 30px; min-width: 2ch; text-align: center; }

.notice {
  background: linear-gradient(180deg, color-mix(in srgb, var(--pine) 14%, transparent), color-mix(in srgb, var(--pine) 5%, transparent));
  border: 1px solid color-mix(in srgb, var(--pine) 35%, transparent);
  color: var(--graphite);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: var(--space-3);
  display: block;   /* inline <strong> must flow, not become flex columns */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.notice.warn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--flag) 16%, transparent), color-mix(in srgb, var(--flag) 6%, transparent));
  border-color: color-mix(in srgb, var(--flag) 40%, transparent);
}

.live-stats { display: flex; gap: var(--space-4); align-items: center; margin: var(--space-3) 0; }

/* The console's at-a-glance board: tidy recessed tiles instead of a loose
   flex row. Numbers carry the color — live gets the flag, attention (open
   tickets) gets it too. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: var(--space-2); }
.stat-grid .stat {
  background: var(--field);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-1);
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.07);
}
.stat-grid .stat .n { font-family: var(--font-mono); font-size: 24px; display: block; color: var(--pine); line-height: 1.2; }
.stat-grid .stat .l { font-size: 11px; color: var(--graphite-2); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-grid .stat.hot { border-color: color-mix(in srgb, var(--flag) 45%, transparent); }
.stat-grid .stat.hot .n { color: var(--flag); }
.stat-grid .stat.quiet .n { color: var(--graphite-2); }
.stat { text-align: center; }
.stat .n { font-family: var(--font-mono); font-size: 26px; display: block; }
.stat .l { font-size: 12px; color: var(--graphite-2); text-transform: uppercase; letter-spacing: 0.05em; }
.quality { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.quality .q-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--fescue); }
.quality.poor .q-dot { background: var(--flag); }
.quality.good .q-dot { background: var(--pine); box-shadow: 0 0 8px var(--glow); }

/* Toast / connection banners. */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  background: var(--graphite); color: var(--card-hi);
  padding: 12px 18px; border-radius: 999px;
  font-size: 15px; z-index: 50; box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}
.toast.warn { background: var(--flag); color: var(--flag-ink); }

/* Usage meter (LiveKit free-tier burn). */
.meter { height: 12px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: var(--fescue); border-radius: 999px; transition: width 0.3s ease; }
.meter-fill.warn { background: #d08a3c; }
.meter-fill.danger { background: var(--flag); }
.usage-row { display: flex; justify-content: space-between; gap: var(--space-2); padding: 4px 0; border-bottom: 1px solid var(--sand); font-size: 14px; }
.usage-row .mono { color: var(--graphite-2); }

/* --- New-version banner ---------------------------------------------------- */
.update-bar {
  position: fixed; z-index: 100;
  left: 12px; right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  max-width: 616px; margin: 0 auto;
  background: var(--pine); color: var(--card-hi);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), 0 0 20px var(--glow);
  padding: var(--space-2) var(--space-3);
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
}
.update-bar .ub-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.update-bar .ub-text strong { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.update-bar .ub-text span { font-size: 14px; opacity: 0.85; }
.update-bar .ub-actions { display: flex; gap: var(--space-2); flex: 0 0 auto; }
.update-bar .ub-btn {
  min-height: 48px; padding: 0 var(--space-3);
  border-radius: var(--radius); border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; cursor: pointer;
}
.update-bar .ub-later { background: transparent; color: var(--card-hi); border-color: rgba(4, 18, 12, 0.35); }
.update-bar .ub-now { background: var(--card-hi); color: var(--pine); }

.row-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.slot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
.slot-grid .slot-btn {
  min-height: var(--tap); border: 1px solid var(--sand);
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  color: var(--graphite);
  border-radius: var(--radius); font-family: var(--font-display); font-weight: 600; font-size: 17px; cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.slot-grid .slot-btn:hover { transform: translateY(-1px); }
.slot-grid .slot-btn.sel {
  background: linear-gradient(180deg, var(--accent-hi), var(--pine) 55%, var(--accent-lo));
  color: var(--pine-ink); border-color: transparent;
  box-shadow: 0 4px 14px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.slot-grid .slot-btn.taken { opacity: 0.4; cursor: not-allowed; }

.center { text-align: center; }
.stack > * + * { margin-top: var(--space-3); }
.muted { color: var(--graphite-2); }

/* --- Scoreboard: the two-team total banner --------------------------------- */
.teamboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-2);
  background:
    radial-gradient(80% 160% at 50% 0%, color-mix(in srgb, var(--pine) 16%, transparent), color-mix(in srgb, var(--pine) 2%, transparent) 60%, transparent),
    linear-gradient(180deg, var(--card-hi), var(--card-lo));
  color: var(--graphite);
  border: 1px solid color-mix(in srgb, var(--pine) 30%, transparent);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow), 0 0 30px color-mix(in srgb, var(--pine) 8%, transparent);
}
.teamboard .tb-team { display: flex; flex-direction: column; }
.teamboard .tb-team.b { text-align: right; align-items: flex-end; }
.teamboard .tb-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.01em; }
.teamboard .tb-pts { font-family: var(--font-mono); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.teamboard .tb-dash { font-family: var(--font-mono); font-size: 24px; opacity: 0.5; }
.teamboard .tb-lead .tb-pts { color: var(--pine); text-shadow: 0 0 16px var(--glow); }  /* the leader glows */
.tb-caption { text-align: center; font-size: 12px; color: var(--graphite-2); margin: -6px 0 var(--space-3); letter-spacing: 0.03em; text-transform: uppercase; }

/* Per-session breakdown under the total banner. */
.sessboard { margin-bottom: var(--space-3); }
.sess-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-1);
  border-bottom: 1px solid var(--sand);
}
.sess-row.active { background: color-mix(in srgb, var(--pine) 8%, transparent); border-radius: var(--radius); }
.sess-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--graphite); }
.sess-now { color: var(--fescue); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.sess-score { font-size: 16px; color: var(--pine); }
.sess-worth { font-size: 13px; color: var(--graphite-2); }

/* Per-group match status on the scorecard rows. */
.row .match { grid-column: 2; }
.match-status { font-family: var(--font-mono); font-size: 14px; color: var(--graphite); }
.match-status .lead-a { color: var(--pine); font-weight: 500; }
.match-status .lead-b { color: var(--fescue); font-weight: 600; }
.match-status .as { color: var(--graphite-2); }
.match-status .final-tag { color: var(--graphite-2); }

/* Watch-screen score pill (sits under the title pill). */
.chrome-tl .pill.pairpill { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; max-width: 78vw; }
.pairpill .pair-side { display: inline-flex; gap: 6px; align-items: baseline; }
.pairpill .pair-team { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.75; }
.pairpill .pair-vs { opacity: 0.6; }
.chrome-tl .pill.score { margin-top: 8px; display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chrome-tl .pill.score .mono { font-size: 14px; }
/* The match status is styled for the cream scorecard; on the dark video pill it
   needs light text or it's unreadable (especially in sunlight). */
.pill.score .match-status,
.pill.score .match-status .lead-a,
.pill.score .match-status .lead-b,
.pill.score .match-status .as,
.pill.score .match-status .final-tag { color: #F2F7F3; }
.pill.score .match-status .lead-a,
.pill.score .match-status .lead-b { font-weight: 700; }
.pill.score .match-status .as,
.pill.score .match-status .final-tag { opacity: 0.75; }
/* The event-wide total, set apart from this match's status. */
.mini-teams {
  display: inline-flex; gap: 6px; align-items: center;
  font-family: var(--font-mono); font-size: 13px;
  padding-left: 10px; margin-left: 2px;
  border-left: 1px solid rgba(242, 237, 225, 0.28);
  opacity: 0.9;
}

/* --- Broadcast: score-this-hole entry -------------------------------------- */
.score-entry {
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo) 85%);
  border: 1px solid var(--sand); border-radius: var(--radius-lg); padding: var(--space-3);
  box-shadow: var(--shadow);
}
.score-entry .se-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-2); }
.score-entry .se-title { font-family: var(--font-display); font-weight: 600; }
.score-entry .se-status { font-family: var(--font-mono); font-size: 15px; color: var(--pine); }
.score-btns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.score-btns .halve { grid-column: 1 / -1; }
.score-btn {
  min-height: var(--tap);
  border: 2px solid var(--sand);
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--graphite);
  cursor: pointer;
  padding: 0 var(--space-2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.score-btn.team-a { border-color: color-mix(in srgb, var(--pine) 50%, transparent); }
.score-btn.team-b { border-color: color-mix(in srgb, var(--fescue) 60%, transparent); }
.score-btn.picked {
  background: linear-gradient(180deg, var(--accent-hi), var(--pine) 55%, var(--accent-lo));
  color: var(--pine-ink); border-color: transparent;
  box-shadow: 0 4px 14px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.score-btn.team-b.picked {
  background: linear-gradient(180deg, var(--fescue-hi), var(--fescue) 60%, var(--fescue-lo));
  color: var(--pine-ink); border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--fescue) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.score-btn.halve.picked {
  background: linear-gradient(180deg, var(--halve-hi), var(--halve-lo));
  color: var(--pine-ink); border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.se-hint { font-size: 13px; color: var(--graphite-2); margin-top: var(--space-2); }

/* Host scoreboard mini-grid. */
.host-match { padding: var(--space-3) 0; border-bottom: 1px solid var(--sand); }
.host-match .hm-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.host-match .hm-slot { font-family: var(--font-display); font-weight: 700; color: var(--pine); }
.host-match .hm-status { font-family: var(--font-mono); font-size: 14px; }

/* Streaming on/off toggle + final. */
.hm-stream { display: flex; gap: var(--space-2); margin: var(--space-2) 0; flex-wrap: wrap; }
.hm-stream .toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 var(--space-3);
  border-radius: 999px; border: 1px solid var(--sand);
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  color: var(--graphite); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.hm-stream .toggle .dot2 { width: 10px; height: 10px; border-radius: 50%; background: var(--fescue); }
.hm-stream .toggle.on { border-color: var(--flag); color: var(--flag); box-shadow: 0 0 14px color-mix(in srgb, var(--flag) 20%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.hm-stream .toggle.on .dot2 { background: var(--flag); box-shadow: 0 0 8px color-mix(in srgb, var(--flag) 70%, transparent); }
.hm-stream .hm-final { width: auto; min-height: 48px; padding: 0 var(--space-3); font-size: 15px; }

/* 18-hole strip. */
/* Nine columns, so each nine lands on its own row. The wider row gap is doing
   real work: the two rows are two separate points, not one long card. */
.hole-strip { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); column-gap: 4px; row-gap: 14px; margin: var(--space-2) 0; }
.hcell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1; min-height: 40px; border: 1px solid var(--sand); border-radius: 8px;
  background: var(--field); cursor: pointer; padding: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}
.hcell .hn { font-family: var(--font-mono); font-size: 10px; color: var(--graphite-2); line-height: 1; }
.hcell .hr { font-family: var(--font-mono); font-size: 14px; font-weight: 500; line-height: 1.1; }
.hcell.a { background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo)); border-color: transparent; box-shadow: 0 0 10px color-mix(in srgb, var(--pine) 25%, transparent); }
.hcell.a .hn, .hcell.a .hr { color: var(--pine-ink); }
.hcell.b { background: linear-gradient(180deg, var(--fescue-hi), var(--fescue-lo)); border-color: transparent; }
.hcell.b .hn, .hcell.b .hr { color: var(--pine-ink); }
.hcell.h { background: var(--sand); box-shadow: none; }
.hcell.cur { outline: 3px solid var(--flag); outline-offset: 1px; }

.hm-entry { margin-top: var(--space-2); }
.hm-entry-label { display: block; font-weight: 600; margin-bottom: var(--space-1); }

/* --- Event format picker (create screen) --------------------------------- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 380px) { .field-row { grid-template-columns: 1fr; } }

.fmt-grid { display: grid; gap: var(--space-2); }
.fmt-opt {
  display: block; width: 100%; text-align: left;
  min-height: 56px; padding: var(--space-2) var(--space-3);
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  color: var(--graphite);
  border: 1px solid var(--sand); border-radius: 10px;
  font-family: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.fmt-opt[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--pine) 55%, transparent); background: color-mix(in srgb, var(--pine) 10%, transparent); color: var(--pine);
  box-shadow: 0 0 16px color-mix(in srgb, var(--pine) 12%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.fmt-opt .fmt-sub { display: block; font-weight: 400; font-size: 13px; color: var(--graphite-2); margin-top: 2px; }

/* --- Stroke-play scorecard + leaderboard --------------------------------- */
.lb { width: 100%; border-collapse: collapse; }
.lb th, .lb td { padding: var(--space-2); border-bottom: 1px solid var(--sand); text-align: left; }
.lb th { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--fescue); font-weight: 600; }
.lb td.num, .lb th.num { text-align: right; font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; }
.lb tr.me td { background: color-mix(in srgb, var(--pine) 8%, transparent); }

.sp-player { border-bottom: 1px solid var(--sand); padding: var(--space-2) 0; }
.sp-player:last-child { border-bottom: 0; }
.sp-name { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.sp-name .n { font-weight: 700; color: var(--pine); }
.sp-name .t { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; }
/* The host can rename a player right on the card — the dashed underline and
   pencil are what say "this is editable", so don't strip them. Saves on blur. */
.sp-name .sp-rename {
  flex: 1; min-width: 0;
  font: inherit; font-weight: 700; font-size: 16px; color: var(--pine);
  background: transparent no-repeat right center / 13px 13px
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23888888' d='M3 17.25V21h3.75L17.8 9.94l-3.75-3.75L3 17.25zM20.7 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/></svg>");
  border: 0; border-radius: 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--pine) 45%, transparent);
  padding: 2px 20px 2px 0; margin: 0;
}
.sp-name .sp-rename:focus {
  outline: none; background-image: none;
  border-bottom: 1px solid var(--pine);
}
/* The stroke rail: every count is its own big themed button, scrolling
   sideways — no page-long stacks, no +/- pecking. 56px targets (gloves),
   mono digits, the picked number lit in the accent gradient. Tapping the lit
   number again clears the hole. */
.sp-picker {
  display: flex; gap: 6px; overflow-x: auto; margin-top: var(--space-2);
  padding: 4px 2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sp-picker::-webkit-scrollbar { display: none; }
.sp-num {
  flex: 0 0 auto; min-width: 56px; min-height: 56px;
  border: 1px solid var(--sand); border-radius: 10px;
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo)); color: var(--graphite);
  font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 500; cursor: pointer; scroll-snap-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.sp-num.sel {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  color: var(--pine-ink); border-color: transparent;
  box-shadow: 0 0 14px color-mix(in srgb, var(--pine) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* --- Highlight clips ------------------------------------------------------ */
/* The reel sits under a group's row: one thumbnail per clip, scrolling
   left-to-right, snapping so a half-clip never sits at the edge. */
/* A quiet scorecard annotation above the strip: "HIGHLIGHTS · 3 ———". The
   trailing hairline continues the card's ruled look instead of boxing the
   reel in. */
.reel-head {
  /* Start at the content column, in line with the group name and pairing —
     not under the flag-icon gutter. */
  grid-column: 2 / -1;
  display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-2);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fescue);
  white-space: nowrap;
}
.reel-head::after { content: ''; flex: 1; border-top: 1px solid var(--sand); }

.reel {
  grid-column: 2 / -1;
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-1) 2px 6px;   /* room for the thumbnails' shadows */
  margin: 0 -2px;
}
.reel::-webkit-scrollbar { height: 0; }

.reel-item {
  position: relative;
  flex: 0 0 auto;
  width: 128px; height: 80px;
  scroll-snap-align: start;
  border: 1px solid var(--sand);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  padding: 0; cursor: pointer;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--graphite) 12%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.reel-item:hover { transform: translateY(-2px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--graphite) 18%, transparent); }
.reel-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* The play chip says "this is a video" without waiting for a tap. */
.reel-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 14, 11, 0.55); color: #fff;
  font-size: 12px; padding-left: 2px;
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.reel-noposter {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 20px; color: var(--pine);
}
.reel-tag {
  position: absolute; left: 6px; bottom: 6px;
  background: var(--pine); color: var(--pine-ink);
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Recorder + player sheet. Full-bleed on a phone; the panel keeps the video
   from stretching on a wide screen. */
.clip-sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 10, 8, 0.9);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-3);
}
.clip-panel {
  width: 100%; max-width: 520px;
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo)); border-radius: 14px;
  border: 1px solid var(--sand);
  box-shadow: var(--shadow);
  padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.clip-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); color: var(--pine); }
.clip-x { width: auto; min-height: 44px; padding: 0 var(--space-3); }
.clip-stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; }
.clip-stage video { width: 100%; max-height: 56vh; display: block; background: #000; }
.clip-timer {
  position: absolute; top: 8px; right: 8px;
  background: var(--flag); color: #fff;
  padding: 2px 8px; border-radius: 6px; font-size: 14px;
}
#clipRecord.recording { background: var(--graphite); }

/* Delete affordance on the host's own clips. */
.reel-del {
  position: absolute; top: 4px; right: 4px;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 999px;
  background: rgba(46, 46, 44, 0.85); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}

/* --- Nine-hole segments ---------------------------------------------------
   Each nine is a point, so each gets its own chip: which side holds it, and
   whether it's locked in (the nine is over) or still in play. */
.seg-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.seg {
  font-size: 12px; line-height: 1.4;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--sand); background: var(--card); color: var(--graphite);
}
.seg b { font-family: var(--font-mono, monospace); font-weight: 500; opacity: 0.7; margin-right: 3px; }
.seg-a { border-color: var(--pine); color: var(--pine); }
.seg-b { border-color: var(--flag); color: var(--flag); }
.seg-as, .seg-none { color: var(--fescue); }
.seg-locked { background: color-mix(in srgb, var(--pine) 10%, transparent); font-weight: 600; }

/* A match someone else is already running. Not disabled — a host whose phone
   died can't hand theirs back, so taking over must always be possible. */
.slot-btn.claim-taken { border-color: var(--flag); color: var(--flag); background: var(--card); }
.slot-btn.claim-stale { border-style: dashed; color: var(--fescue); }


/* --- "How it works" steps (landing page + join screen) ---------------------- */
.sect { margin-top: var(--space-5); }
.sect > h2 { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--pine);
  border-bottom: 2px solid var(--sand); padding-bottom: var(--space-1); }
.steps { counter-reset: step; margin-top: var(--space-3); display: grid; gap: var(--space-2); }
.step { display: flex; gap: var(--space-3); align-items: flex-start;
  background: linear-gradient(180deg, var(--card-hi, var(--card)), var(--card-lo, var(--card)) 85%);
  border: 1px solid var(--sand); border-radius: 14px; padding: var(--space-3);
  box-shadow: var(--shadow); }
.step .n { counter-increment: step; font-family: var(--font-mono); font-weight: 500; font-size: 15px;
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: linear-gradient(180deg, var(--accent-hi, var(--pine)), var(--accent-lo, var(--pine)));
  color: var(--pine-ink);
  box-shadow: 0 0 12px var(--glow, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center; }
.step .n::before { content: counter(step); }
.step h3 { font-family: var(--font-display); font-size: 16px; color: var(--pine); }
.step p { font-size: 13.5px; color: var(--graphite-2); line-height: 1.5; margin-top: 2px; }
.step .mono-code { font-family: var(--font-mono); background: var(--sand); border-radius: 6px; padding: 1px 6px; }

/* --- Sub-tabs (league page) ---------------------------------------------- */
/* A segmented control under the header: My round / Standings / Run. Same
   visual language as .fmt-opt so "selected" reads the same app-wide. */
.tabbar { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); }
.tabbar button {
  flex: 1; min-height: 48px; padding: var(--space-1) var(--space-2);
  background: linear-gradient(180deg, var(--card-hi), var(--card-lo));
  color: var(--graphite);
  border: 1px solid var(--sand); border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.tabbar button[aria-pressed="true"] {
  color: var(--pine);
  border-color: color-mix(in srgb, var(--pine) 55%, transparent);
  background: color-mix(in srgb, var(--pine) 10%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--pine) 12%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* --- Hole-by-hole scorecard peek (Grounds rows) --------------------------- */
/* A quiet annotation-style toggle in the content column, matching .reel-head,
   unfolding a real card: holes across, one mono row per player/team. */
.sc-toggle {
  grid-column: 2 / -1; justify-self: start;
  display: inline-flex; align-items: center;
  min-height: 32px; margin-top: var(--space-1); padding: 0;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fescue);
}
/* Two panes, zero overlap: the names are a static column OUTSIDE the scroll
   pane, and only the numbers scroll beside them — so no cell ever needs a
   background, and nothing punches a box out of the page backdrop. Row
   heights are locked so the two panes stay in step. */
.sc-wrap { grid-column: 2 / -1; display: flex; align-items: flex-start; cursor: default; }
.sc-names { flex: 0 0 auto; max-width: 96px; }
/* The names table must NOT inherit the numbers table's min-width: 100% —
   it sizes to its names; the scroll pane takes the rest. */
.sc.sc-names { width: auto; min-width: 0; }
.sc-scroll { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sc-scroll::-webkit-scrollbar { display: none; }
.sc {
  width: max-content; min-width: 100%;
  border-collapse: separate; border-spacing: 0; margin-top: 2px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.sc th, .sc td {
  border-bottom: 1px solid var(--sand); padding: 3px 4px;
  height: 20px; line-height: 20px; box-sizing: content-box;
  text-align: center; font-size: 12px; font-weight: 400; color: var(--graphite);
  min-width: 24px; white-space: nowrap;
}
.sc th { font-size: 10px; letter-spacing: 0.06em; color: var(--fescue); font-weight: 500; }
.sc .pn {
  text-align: left; font-family: var(--font-body); font-weight: 600;
  max-width: 88px; min-width: 40px; overflow: hidden; text-overflow: ellipsis;
  padding-left: 0; padding-right: 8px;
}
.sc td.sc-seg { font-weight: 500; color: var(--graphite-2); }
.sc td.sc-tot { font-weight: 700; color: var(--pine); }

/* --- "Around the event" (host page) --------------------------------------- */
/* Match play: one line per match, the host's own tagged quietly. */
.eb-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--space-2); padding: var(--space-2) 0;
  border-bottom: 1px solid var(--sand);
}
.eb-row:last-child { border-bottom: 0; }
.eb-row .eb-slot { font-weight: 700; color: var(--pine); white-space: nowrap; }
.eb-row.me .eb-slot::after { content: " · you"; font-weight: 400; font-size: 12px; color: var(--fescue); }
.eb-row .eb-status { text-align: right; }
/* Per-group scorecard peeks under the host's leaderboard. */
.eb-peek { margin-top: var(--space-2); }
.eb-peek .sc-toggle { margin-top: 0; }
