/* Golf Leaderboard — fresh design system */

/* ============ A11Y ============ */
:where(:focus-visible) {
  outline: 2px solid var(--copper-soft);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  .live-dot,
  .thru.live::before,
  .score.just-changed,
  .skel,
  .pos .pos-delta,
  .mp-strip .mp-chip,
  .modal-shade,
  .modal-card,
  .modal-shade.closing,
  .modal-shade.closing .modal-card,
  #lead-banner.show,
  #lead-banner.hide,
  .tab.active::after,
  #ptr-indicator.spinning svg { animation: none !important; }
  .lb-row,
  .lb-row.flip-move,
  .field-body,
  .field-head .fs-chevron,
  .mp-chip,
  .add-btn,
  .field-head .icon-btn,
  .refresh-ring .fg { transition: none !important; }
}

:root {
  --bg: #FEFAE0;
  --surface: #FEFAE0;
  --surface-2: #F6F0D2;
  --surface-3: #283618;            /* always-dark band surface (.tourn-head, .fav-banner) */
  --ink: #283618;
  --ink-2: #4a5429;
  --ink-3: #606C38;
  --ink-4: #8a948c;                /* very subtle hints */
  --line: rgba(40, 54, 24, 0.18);
  --line-2: rgba(40, 54, 24, 0.10);
  --line-strong: rgba(40, 54, 24, 0.32);

  --green: #BC6C25;
  --green-bright: #BC6C25;
  --green-deep: #283618;
  --green-tint: rgba(221, 161, 94, 0.22);
  --copper-soft: #BC6C25;          /* text-on-surface copper — see [data-theme=dark] override */
  --cedar: #606C38;                /* cedar green — see [data-theme=dark] override */
  --p1: #BC6C25;                   /* compare: player 1 (leader)  — see [data-theme=dark] */
  --p2: #283618;                   /* compare: player 2           — see [data-theme=dark] */
  --p3: #606C38;                   /* compare: player 3 (trailing) — see [data-theme=dark] */

  --red: #BC6C25;
  --red-tint: rgba(188, 108, 37, 0.14);

  --amber: #DDA15E;

  /* Editorial scorecard palette: eagle copper, birdie cedar, par ink, bogey porsche, double copper-ink */
  --eagle: #BC6C25;
  --birdie: #606C38;
  --bogey: #DDA15E;
  --double: #8a4d14;

  --radius: 14px;
  --radius-sm: 8px;

  --pad-y: 14px;
  --pad-x: 16px;

  --font-ui: "DM Sans", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #1c2611;
  --surface: #283618;
  --surface-2: #1c2611;
  --surface-3: #233014;            /* slightly darker band — between bg and surface */
  --ink: #FEFAE0;
  --ink-2: #e8bf8a;
  --ink-3: #DDA15E;
  --ink-4: #a08151;                /* muted porsche for very subtle hints */
  --line: rgba(254, 250, 224, 0.18);
  --line-2: rgba(254, 250, 224, 0.10);
  --line-strong: rgba(254, 250, 224, 0.32);
  --green-tint: rgba(221, 161, 94, 0.18);
  --red-tint: rgba(188, 108, 37, 0.22);
  --copper-soft: #d68b3f;          /* lighter copper for text-on-dark legibility */
  --cedar: #8a9a5a;                /* brighter cedar for legibility on dark */
  --p1: #d68b3f;                   /* compare: player 1 (leader) */
  --p2: #FEFAE0;                   /* compare: player 2 (cream) */
  --p3: #8a9a5a;                   /* compare: player 3 (trailing) */
  /* Scorecard palette shifts brighter on dark for legibility on ceylanite */
  --eagle:  #d68b3f;
  --birdie: #8a9a5a;
  --bogey:  #c08f50;
  --double: #b85a1f;
}

[data-density="compact"] {
  --pad-y: 9px;
  --pad-x: 13px;
}
[data-density="cozy"] {
  --pad-y: 14px;
  --pad-x: 16px;
}
[data-density="comfy"] {
  --pad-y: 18px;
  --pad-x: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Phone screen base */
.screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  /* FR-128: use `clip`, NOT `hidden`, and do NOT set -webkit-overflow-scrolling
     here. On iOS Safari a non-visible overflow (and the legacy touch-scrolling
     flag) on <body> makes it a scroll container, which detaches position:fixed
     children, so .bottom-nav floated to mid-screen while scrolling. `clip`
     prevents horizontal overflow without creating a scroll container. */
  overflow-x: clip;
}

/* ============ HEADER ============ */
.app-header {
  padding: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header .top {
  padding: 12px 18px 10px;
}

/* Tournament-head dark band (matches Design/Leaderboard.html §03 + Leaderboard Dark.html).
   Uses --surface-3 so the band is ceylanite in both themes (does not invert per theme). */
/* Tournament-head band — hardcoded #283618 ceylanite so it stays the same
   visible-dark tone in both themes (in dark mode this matches --surface for
   the rows; the band separates via its bottom border, not a colour shift). */
.tourn-head {
  background: #283618;
  color: #FEFAE0;
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--line);
}
.tourn-head .crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 10px;
}
.tourn-head .crumb .dot {
  width: 5px; height: 5px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
}
.tourn-head .event-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.02;
  letter-spacing: -0.012em;
  color: #FEFAE0;
  text-transform: none;
  -webkit-line-clamp: unset;
}
.tourn-head .event-title .em {
  font-style: italic;
  color: var(--amber);
  font-weight: 500;
}
.tourn-head .sub {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(232, 191, 138, 0.85);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tourn-head .sub b {
  font-weight: 600;
  color: #FEFAE0;
  font-family: var(--font-mono);
}
.tourn-head .sub .sep { opacity: 0.4; }

/* Metric toggle pill (Points / To Par) inside the dark band */
.metric-toggle-bar {
  display: flex;
  gap: 0;
  background: rgba(28, 38, 17, 0.6);
  padding: 4px;
  border-radius: 999px;
  margin-top: 14px;
}
.metric-toggle-bar > * {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(232, 191, 138, 0.7);
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.metric-toggle-bar > .active,
.metric-toggle-bar > .view-pill.active {
  background: var(--green);
  color: #FEFAE0;
}

/* Grade-row filter pills below the dark band */
.grade-row {
  display: flex;
  gap: 8px;
  padding: 14px 20px 12px;
  overflow-x: auto;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.grade-row::-webkit-scrollbar { display: none; }
/* Filter chips — Leaderboard.html §components "Filter Chips" (.chip-t) */
.grade-row .gpill {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.grade-row .gpill.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.grade-row .compare-btn {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper-soft);
  background: transparent;
  border: 0;
  padding: 7px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.grade-row .compare-btn.active {
  color: var(--bg);
  background: var(--green);
  border-radius: 999px;
  padding: 7px 14px;
}

/* Refresh strip — pale cedar-tinted bar */
.refresh-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 20px;
  background: rgba(96, 108, 56, 0.08);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.refresh-strip .countdown {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  letter-spacing: 0;
}
.refresh-strip .refresh-link {
  background: transparent;
  border: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 11px;
  padding: 10px 8px;
  margin: -10px -8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper-soft);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* Refresh row inside header (legacy — kept for any non-leaderboard callers) */
.refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.refresh-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.refresh-info .countdown {
  font-family: var(--font-mono);
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 0.04em;
}
.refresh-btn {
  background: var(--green);
  color: var(--bg);
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Search-on-leaderboard */
.lb-search {
  margin: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.lb-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
}
.lb-search input::placeholder { color: var(--ink-3); }
.lb-search .clear {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}

/* Field section (between favourites & main lists) */
.field-section {
  margin: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.field-head .left {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
/* FR-117 — the head is one lean 34px row in BOTH states: 15px ellipsized
   name + flex-grown meta on a single baseline. Only the chevron rotates. */
.field-head .title {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  font-weight: 500;
  display: block;
  max-width: 55%;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field-head .title .fs-chevron { vertical-align: -2px; }
/* FR-117 — collapse chevron; rotates when the section is expanded */
.field-head .fs-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-3);
  transition: transform 0.15s ease;
}
.field-head[aria-expanded="true"] .fs-chevron { transform: rotate(90deg); }
.field-head:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}
/* FR-117 — collapsed differs only by: no head underline, no role badge
   (the live summary owns the line; the badge returns on expand). */
.field-section.collapsed .field-head { border-bottom: none; }
/* FR-127 — the body animates open/closed via the 0fr grid-row trick;
   visibility keeps collapsed content out of the AT tree and hit-testing. */
.field-body {
  display: grid;
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 250ms cubic-bezier(.2,.7,.3,1), visibility 250ms;
}
.field-body > .fb-inner { overflow: hidden; min-height: 0; }
.field-section.collapsed .field-body {
  grid-template-rows: 0fr;
  visibility: hidden;
}
.field-section.collapsed .field-head .badge { display: none; }
.field-head .badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--green-tint);
  color: var(--green-deep);
  padding: 2px 6px;
  border-radius: 4px;
}
.field-head .badge.viewer {
  background: var(--surface-2);
  color: var(--ink-3);
}
.field-head .meta {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.field-head .actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.field-head .act-btn {
  font-size: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* Phase 51.1 — standardised field-head icon-btn row */
.field-head .icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: rgba(254, 250, 224, 0.05);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.field-head .icon-btn svg { width: 12px; height: 12px; }
.field-head .icon-btn.menu svg { width: 14px; height: 14px; }
.field-head .icon-btn:hover { color: var(--ink); border-color: rgba(254,250,224,0.25); }
/* Viewers do not see the Share icon */
.field-section[data-role="viewer"] .icon-btn.share,
.field-section[data-role="anon_viewer"] .icon-btn.share { display: none; }
.field-head .menu-wrap { position: relative; }
/* Phase 51.5 — hide toast */
.field-toast {
  margin: 8px 12px 0; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--copper-soft);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; position: relative; overflow: hidden;
}
.field-toast .l { display: flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-size: 11px; color: var(--ink); }
.field-toast .l .icon { width: 22px; height: 22px; border-radius: 50%; background: rgba(214,139,63,0.18); color: var(--copper-soft); display: grid; place-items: center; flex-shrink: 0; }
.field-toast .l .icon svg { width: 11px; height: 11px; }
.field-toast .l b { font-family: var(--font-serif); font-style: italic; font-weight: 500; font-size: 14px; color: var(--copper-soft); letter-spacing: -0.005em; }
.field-toast .undo { background: transparent; border: 0; font-family: var(--font-ui); font-weight: 600; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--copper-soft); cursor: pointer; flex-shrink: 0; }
.field-toast .timer { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--copper-soft); border-radius: 0 2px 0 0; animation: timer-deplete 6s linear forwards; }
@keyframes timer-deplete { from { width: 100%; } to { width: 0%; } }
/* Phase 51.6/51.7 — hidden fields banner */
.hidden-banner { margin: 0 12px 10px; border: 1px dashed var(--bogey); border-radius: 10px; overflow: hidden; }
.hidden-banner-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; background: none; border: none; cursor: pointer; font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.hidden-banner-toggle .l { display: flex; align-items: center; gap: 6px; }
.hidden-banner-toggle .l svg { width: 12px; height: 12px; color: var(--copper-soft); }
.hidden-banner-toggle .r { display: flex; align-items: center; gap: 4px; color: var(--copper-soft); font-size: 10px; }
.hidden-banner-toggle .r svg { width: 10px; height: 10px; transition: transform 140ms; }
.hidden-banner[aria-expanded="true"] .hidden-banner-toggle .r svg { transform: rotate(180deg); }
.hidden-expanded { border-top: 1px solid var(--line-2); }
.hidden-chip { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line-2); }
.hidden-chip:last-child { border-bottom: none; }
.hidden-chip .name { flex: 1; font-size: 12px; color: var(--ink); font-weight: 500; }
.hidden-chip .scope { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-family: var(--font-ui); }
.hidden-chip .unhide-btn { background: none; border: 1px solid var(--line); color: var(--copper-soft); font-family: var(--font-ui); font-size: 9px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; cursor: pointer; }
/* Phase 51.4 — overflow dropdown */
.dropdown {
  position: absolute; right: 0; top: 32px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 5px; min-width: 200px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6); z-index: 50;
}
.dropdown .item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: 5px;
  font-family: var(--font-ui); font-size: 11px;
  color: var(--ink); cursor: pointer;
}
.dropdown .item:hover { background: rgba(254,250,224,0.06); }
.dropdown .item svg { width: 13px; height: 13px; color: var(--ink-3); flex-shrink: 0; }
.dropdown .item.warn { color: var(--copper-soft); }
.dropdown .item.warn svg { color: var(--copper-soft); }
.dropdown .divider { height: 1px; background: var(--line-2); margin: 3px 2px; }
/* Phase 51.2 — live stripe */
.field-section.live { position: relative; border-color: rgba(214,139,63,0.45); }
.field-section.live::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--copper-soft); border-radius: 3px 0 0 3px;
}
.field-not-in {
  padding: 10px 14px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  border-top: 1px solid var(--line-2);
}
.field-not-in .lbl {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-3);
}
.field-not-in .name { color: var(--ink-2); }

/* Add-with-fields modal */
.modal-shade {
  position: fixed;
  /* Anchor to the top and size with the *visible* viewport so the flex-end
     bottom-sheet lands above iOS Safari's dynamic toolbar (FR-115). Using
     `inset: 0` pinned the bottom to the layout-viewport bottom (behind the
     toolbar), pushing each sheet's top — and its ✕ close button — off-screen.
     `vh` is the pre-dvh fallback; `dvh` tracks the live viewport on iOS 15.4+. */
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  background: rgba(28, 38, 17, 0.6);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: shade-in 100ms linear;
}
@keyframes shade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(40, 54, 24, 0.18);
  animation: card-up 140ms cubic-bezier(.2,.7,.3,1);
}
@keyframes card-up { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.005em;
  font-weight: 500;
}
.modal-card .sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.modal-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 6px;
  margin-bottom: 2px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
}
.check-row:last-of-type { border-bottom: none; }
.check-row.disabled { color: var(--ink-3); }
.check-row .box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--ink-2);
  border-radius: 5px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.check-row .box.checked {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.modal-card .save {
  margin-top: 14px;
  width: 100%;
  background: var(--green);
  color: var(--bg);
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.app-header .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.005em;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark.crest {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  position: relative;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.brand-mark.crest::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}
.brand-mark.crest span { display: block; transform: translateY(-1px); position: relative; z-index: 1; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); }

.header-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--green-tint);
  color: var(--green-deep);
  padding: 4px 7px;
  border-radius: 6px;
}

.event-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.event-title {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.012em;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--ink-2);
  align-items: center;
  margin-top: 4px;
}

.event-meta .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink-3);
  display: inline-block;
  flex-shrink: 0;
}

.view-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--line);
  border-radius: 6px;
  padding: 2px;
  vertical-align: middle;
}
.view-pill {
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.4;
}
.view-pill.active {
  background: var(--green);
  color: var(--bg);
}
a.view-pill {
  text-decoration: none;
  display: inline-block;
}
.grade-filter {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  background: var(--line);
  border-radius: 6px;
  padding: 2px;
  margin-top: 8px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-tint);
  color: var(--copper-soft);
  font-weight: 600;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@keyframes flash-copper {
  0% { color: var(--copper-soft); }
  100% { color: inherit; }
}
.score.just-changed { animation: flash-copper 250ms ease-out; }

/* ============ TABS / FILTERS ============ */
.tab-row {
  display: flex;
  gap: 22px;
  padding: 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-row::-webkit-scrollbar { display: none; }

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  padding: 12px 4px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  position: relative;
}
.tab .count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  background: rgba(96, 108, 56, 0.14);
  padding: 1px 5px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.tab.active {
  background: transparent;
  color: var(--ink);
  border: 0;
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--green);
}
.tab.active .count { color: var(--ink); opacity: 1; }

/* ============ LEADERBOARD ROW ============ */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 18px 8px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-transform: none;
  white-space: nowrap;
  gap: 12px;
}
.section-title > span:first-child { white-space: nowrap; }
.section-title .right {
  font-family: var(--font-ui);
  font-style: normal;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lb-list {
  background: var(--bg);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: var(--pad-y) var(--pad-x);
  border-bottom: 1px solid var(--line-2);
  position: relative;
}
.lb-row:last-child { border-bottom: none; }

.lb-row.fav::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--green);
  border-radius: 0 3px 3px 0;
}

.lb-row.leader {
  background: linear-gradient(90deg, rgba(188, 108, 37, 0.10), transparent 60%);
}
.lb-row.leader::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--green);
}
.lb-row.leader .pos,
.lb-row.leader .score {
  color: var(--copper-soft);
  font-style: italic;
}

.pos {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-weight: 500;
  text-align: center;
}
/* FR-123 — sticky my-players strip: favourites pinned above the fields */
#my-players-strip { position: sticky; top: 0; z-index: 40; }
.mp-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-2);
}
.mp-strip .lbl {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
}
.mp-strip .chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.mp-strip .chips::-webkit-scrollbar { display: none; }
.mp-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.mp-chip b { font-size: 13px; color: var(--copper-soft); font-variant-numeric: tabular-nums; }
.mp-chip .t { font-size: 10px; color: var(--ink-3); }
/* FR-124 — leader pace projection under the event meta line */
.pace-line {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.pace-line b { color: var(--copper-soft); font-weight: 600; }
.pace-line:empty { display: none; }
/* FR-127 — motion & interaction polish */
/* hover / press feedback */
.lb-row { transition: background-color 120ms ease; }
@media (hover: hover) {
  .lb-row:hover { background: rgba(254, 250, 224, 0.035); }
  .mp-chip:hover { border-color: var(--copper-soft); }
  .tab:hover { color: var(--ink-2); }
}
.lb-row:active { background: rgba(254, 250, 224, 0.06); }
.mp-chip, .add-btn, .field-head .icon-btn { transition: transform 100ms ease, border-color 120ms ease, color 120ms ease; }
.mp-chip:active, .add-btn:active, .field-head .icon-btn:active { transform: scale(0.94); }
.tab { transition: color 140ms ease; }
.tab.active::after { animation: tab-underline-in 200ms cubic-bezier(.2,.7,.3,1); transform-origin: left; }
@keyframes tab-underline-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* FLIP row reordering + marker entrance */
.lb-row.flip-move { transition: transform 450ms cubic-bezier(.2,.7,.3,1), background-color 120ms ease; }
.pos .pos-delta { animation: marker-pop 320ms cubic-bezier(.34,1.56,.64,1) backwards; }
@keyframes marker-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* skeleton loading */
.skel {
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-wrap { padding: 26px 22px; }
.skel-wrap .skel { margin-bottom: 9px; }
/* refresh countdown ring */
.refresh-ring { transform: rotate(-90deg); flex-shrink: 0; vertical-align: -4px; }
.refresh-ring .bg { stroke: var(--line-2); }
.refresh-ring .fg { stroke: var(--copper-soft); transition: stroke-dashoffset 1s linear; }
/* modal exit */
.modal-shade.closing { animation: shade-out 120ms ease forwards; }
.modal-shade.closing .modal-card { animation: card-down 120ms ease forwards; }
@keyframes shade-out { to { opacity: 0; } }
@keyframes card-down { to { transform: translateY(8px); opacity: 0; } }
/* my-players chip entrance stagger (first paint only — see body.lb-updated) */
.mp-strip .mp-chip { animation: chip-in 280ms cubic-bezier(.2,.7,.3,1) backwards; }
.mp-strip .mp-chip:nth-child(2) { animation-delay: 40ms; }
.mp-strip .mp-chip:nth-child(3) { animation-delay: 80ms; }
.mp-strip .mp-chip:nth-child(4) { animation-delay: 120ms; }
.mp-strip .mp-chip:nth-child(5) { animation-delay: 160ms; }
.mp-strip .mp-chip:nth-child(n+6) { animation-delay: 200ms; }
@keyframes chip-in { from { opacity: 0; transform: translateY(6px); } }
body.lb-updated .mp-strip .mp-chip { animation: none; }
/* lead banner slide in / fade out */
#lead-banner.show { animation: banner-in 260ms cubic-bezier(.2,.7,.3,1); }
#lead-banner.hide { animation: banner-out 400ms ease forwards; }
@keyframes banner-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes banner-out { to { opacity: 0; } }
/* pull-to-refresh indicator */
#ptr-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--copper-soft);
  z-index: 60;
  transform: translateY(-58px);
  transition: transform 150ms ease;
}
#ptr-indicator svg { width: 16px; height: 16px; transition: transform 150ms ease; }
#ptr-indicator.armed svg { transform: rotate(180deg); }
#ptr-indicator.spinning svg { animation: ptr-spin 700ms linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* FR-119 — position-movement markers, cleared by the next refresh rewrite */
.pos .pos-delta {
  display: block;
  font-size: 9px;
  line-height: 1;
  margin-top: 2px;
  letter-spacing: 0;
}
.pos .pos-delta.up { color: var(--green); }
.pos .pos-delta.down { color: var(--double); }
/* FR-119 — transient lead-change banner above the tab row */
#lead-banner {
  display: none;
  margin: 0 14px 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--green-tint);
  color: var(--green-deep);
  border: 1px solid var(--green);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#lead-banner.show { display: block; animation: shade-in 160ms ease; }
.pos.tied { color: var(--ink-3); font-size: 20px; }
.pos.tied::before {
  content: "T";
  font-style: italic;
  font-size: 14px;
  opacity: 0.7;
  margin-right: 1px;
}

.player-info { min-width: 0; }
.player-name {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  max-width: 100%;
}
.hcp {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.player-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
/* Status chips — Leaderboard.html §components "Status Chips" (.chip-t) */
.thru {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}
.thru.live {
  background: var(--green);
  color: #FEFAE0;
  border-color: var(--green);
}
.thru.live::before {
  content: "●";
  font-size: 0.8em;
  margin-right: 4px;
}
.thru.complete {
  background: #606C38;
  color: #FEFAE0;
  border-color: #606C38;
}
.thru-detail { color: var(--ink-3); }

.hole-mini {
  display: inline-flex;
  gap: 1px;
  align-items: center;
}
.hole-mini i {
  width: 4px; height: 6px;
  background: var(--line);
  border-radius: 1px;
  display: block;
}
.hole-mini i.done { background: var(--ink-2); }
.hole-mini i.live-hole { background: var(--red); }

.score-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.score {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-weight: 500;
}
.score.under { color: var(--ink); }
.score.even  { color: var(--copper-soft); }
.score.over  { color: var(--copper-soft); }

.score-chip {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}

.add-btn {
  background: transparent;
  border: 1px solid var(--copper-soft);
  color: var(--copper-soft);
  font-size: 16px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  margin-left: 6px;
}
.add-btn:hover { background: rgba(188, 108, 37, 0.12); }
/* FR-122 — 44px touch target without changing the visual 26px circle */
.add-btn { position: relative; }
.add-btn::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; }

/* ============ MY PLAYERS BANNER ============ */
.fav-banner {
  margin: 12px 14px 0;
  background: var(--surface-3);
  color: #FEFAE0;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  border: none;
  width: calc(100% - 28px);
  text-align: left;
}
.fav-banner > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fav-banner .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
  display: block;
  line-height: 1;
  white-space: nowrap;
}
.fav-banner .stat {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  display: block;
  white-space: nowrap;
}
.fav-banner .edit-hint {
  background: rgba(254, 250, 224, 0.12);
  border: none;
  color: #FEFAE0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 8px 8px 22px;
  z-index: 20;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
  background: none;
  border: none;
  font-family: var(--font-ui);
}
.nav-item.active { color: var(--copper-soft); }
.nav-item svg { width: 22px; height: 22px; }

/* ============ SEARCH SCREEN ============ */
/* Day-selector chips — click updates #events-list in place (FR-03a) */
.day-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.day-chips::-webkit-scrollbar { display: none; }
.day-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
}
.day-chip.active {
  background: var(--green);
  color: var(--bg);
  border-color: var(--green);
}
.events-empty {
  color: var(--ink-2);
  padding: 20px 0;
  font-size: 0.9em;
  text-align: center;
}

.collapsible-form {
  margin: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.collapsible-form summary {
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 500;
  user-select: none;
}
.collapsible-form summary::-webkit-details-marker { display: none; }
.collapsible-form summary .chevron {
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--ink-3);
}
.collapsible-form[open] summary .chevron { transform: rotate(90deg); }
.collapsible-form .form-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line-2);
}

.form-field { margin-top: 12px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
}
.form-input:focus { border-color: var(--copper-soft); }
.form-input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.form-input-group:focus-within { border-color: var(--copper-soft); }
.form-input-group input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
}
.form-input-group .suffix {
  padding: 10px 12px;
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
  border-left: 1px solid var(--line-2);
}
.btn-primary {
  width: 100%;
  margin-top: 14px;
  background: var(--green);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.event-card {
  margin: 10px 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: box-shadow 150ms, border-color 150ms;
}
.event-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); border-color: var(--ink-3); }
.event-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}
.event-card .name {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  display: block;
  margin-bottom: 4px;
}
.event-card .sub {
  font-size: 12px;
  color: var(--ink-3);
  display: block;
  line-height: 1.4;
}

.status-chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.status-chip.live { background: var(--red-tint); color: var(--copper-soft); display: flex; align-items: center; gap: 4px; }
.status-chip.done { background: var(--green-tint); color: var(--green-deep); }
.status-chip.upcoming { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* ============ SCORECARD MODAL ============ */
.sc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 16, 0.7);
  backdrop-filter: blur(2px);
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: shade-in 100ms linear;
}
.sc-modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  max-height: 92vh;
  max-height: 92dvh; /* FR-115: track visible viewport on iOS */
  overflow-y: auto;
  padding: 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
  animation: card-up 140ms cubic-bezier(.2,.7,.3,1);
}
.sc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.sc-modal-close {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
}

.score-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.score-summary .block {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.score-summary .block .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
}
.score-summary .block .val {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
  margin-top: 4px;
  color: var(--ink);
}
.score-summary .block .val.under { color: var(--copper-soft); }

/* Scorecard */
.scorecard {
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: clip;
}
.scorecard h3 {
  margin: 0;
  padding: 12px 16px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
}
.sc-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.scorecard table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.scorecard th, .scorecard td {
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid var(--line-2);
}
.scorecard th {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scorecard td.lbl-cell {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  font-weight: 600;
  padding-left: 14px;
}
.scorecard td.total-cell {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.02em;
  background: var(--surface-2);
}
/* Pre-Phase-38 score-cell classes — dead. The current scorecard renders
   results via <span class="marker {cls}"> instead (see _build_half_table
   in routes/scorecard.py and .sc-table .cell-marker.* below). Kept as a
   tombstone comment to flag that the legacy table renderer is gone. */

/* Score marker badges (Phase 21) */
.scorecard td .marker {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}
.scorecard td .marker.birdie { border-radius: 50%; background: var(--birdie); color: var(--bg); }
.scorecard td .marker.eagle  { border-radius: 50%; background: var(--eagle); color: var(--bg); }
.scorecard td .marker.bogey  { border: 1px solid var(--bogey); color: var(--bogey); background: transparent; }
.scorecard td .marker.double { border: 3px double var(--double); color: var(--double); background: transparent; }

/* Stableford per-hole points pills (when the scorecard route emits a POINTS row) */
.scorecard .pts-5,
.scorecard .pts-4 { background: var(--green); color: var(--bg); border-radius: 50%; }
.scorecard .pts-3 { background: var(--ink-3); color: var(--bg); border-radius: 50%; }
.scorecard .pts-2 { background: var(--surface-2); color: var(--ink); }
.scorecard .pts-1 { background: var(--surface-2); color: var(--ink); opacity: 0.55; border-radius: 4px; }
.scorecard .pts-0 { background: var(--ink); color: var(--amber); border-radius: 4px; }

/* ============================================================
   SCORECARD MODAL v2 (design.md §5.4) — hero band is locked
   ceylanite #283618 in BOTH themes; body cards are theme-aware.
   ============================================================ */
.sc-hero {
  background: #283618;
  color: #FEFAE0;
  padding: 16px 20px 22px;
  position: relative;
}
.sc-hero .topbar {
  display: flex; justify-content: space-between; align-items: center;
  /* FR-115: pin the back/✕ bar to the top of the scrolling card so the close
     control stays reachable even after the body scrolls. Negative margins
     cancel the hero's top+side padding so the bar spans full width and sticks
     flush to the card's top edge; the green bg keeps it opaque over body cards. */
  position: sticky;
  top: 0;
  z-index: 2;
  background: #283618;
  margin: -16px -20px 18px;
  padding: 16px 20px 0;
}
.sc-hero .back {
  background: transparent; border: 0;
  color: #e8bf8a;
  font-family: var(--font-ui);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 500; cursor: pointer; padding: 0;
  display: flex; align-items: center; gap: 6px;
}
.sc-hero .close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(254, 250, 224, 0.08);
  border: 1px solid rgba(254, 250, 224, 0.2);
  color: #FEFAE0; font-size: 14px; cursor: pointer;
  display: grid; place-items: center;
}
.sc-hero .crumb {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-ui);
  font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase;
  color: #DDA15E; margin-bottom: 10px;
}
.sc-hero .crumb .dot { width: 5px; height: 5px; background: #d68b3f; border-radius: 50%; flex-shrink: 0; }
.sc-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500; font-size: 38px; line-height: 1.0;
  letter-spacing: -0.015em; color: #FEFAE0;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.sc-hero h1 .hcp {
  font-family: var(--font-mono); font-weight: 500; font-size: 11px;
  background: rgba(254, 250, 224, 0.12); color: #FEFAE0;
  padding: 3px 8px; border-radius: 5px; letter-spacing: 0.06em;
}
.sc-hero .meta {
  margin-top: 8px;
  font-family: var(--font-ui); font-size: 12px;
  color: #e8bf8a; letter-spacing: 0.04em;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.sc-hero .meta .sep { opacity: 0.4; }
.sc-hero .meta .em {
  font-style: italic; color: #d68b3f;
  font-family: var(--font-display); font-size: 16px; font-weight: 500;
}
/* hero stat strip — inline columns, hairline separators, NOT boxed */
.sc-hero .stat-strip {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid rgba(254, 250, 224, 0.12);
}
.sc-hero .stat-item {
  padding: 0 14px;
  border-right: 1px solid rgba(254, 250, 224, 0.12);
}
.sc-hero .stat-item:first-child { padding-left: 0; }
.sc-hero .stat-item:last-child { padding-right: 0; border-right: 0; }
.sc-hero .stat-item .lbl {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: #DDA15E; font-weight: 600;
  display: flex; align-items: baseline; gap: 6px;
}
.sc-hero .stat-item .lbl .unit {
  font-size: 8px; letter-spacing: 0.16em; color: #a08151; font-weight: 500;
}
.sc-hero .stat-item .val {
  font-family: var(--font-display); font-weight: 500; font-size: 38px;
  line-height: 1; color: #FEFAE0; letter-spacing: -0.018em; margin-top: 6px;
}
.sc-hero .stat-item.primary .val {
  color: #d68b3f; font-style: italic; font-size: 44px;
}
.sc-hero .stat-item .delta {
  display: block; margin-top: 4px;
  font-family: var(--font-mono); font-size: 10px;
  color: #DDA15E; letter-spacing: 0.04em;
}
.sc-hero .share-row { display: flex; gap: 8px; margin-top: 16px; }
.sc-hero .share-row button {
  flex: 1;
  background: rgba(254, 250, 224, 0.1);
  border: 1px solid rgba(254, 250, 224, 0.18);
  color: #FEFAE0;
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 11px 16px; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.sc-hero .share-row button svg { width: 14px; height: 14px; }

/* body scroll container + shared card chrome */
.sc-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.sc-body .card {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  overflow: hidden;
}
.sc-body .card .card-head {
  padding: 14px 18px 12px;
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--line-2);
}
.sc-body .card .card-head .t {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 20px; color: var(--ink); letter-spacing: -0.005em;
}
.sc-body .card .card-head .meta {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3);
}
[data-theme="dark"] .sc-body .card { background: rgba(254, 250, 224, 0.03); }

/* 9b — score progression chart card */
.sc-body .chart-body { padding: 14px 16px 12px; }
.sc-body .chart-body svg { width: 100%; display: block; }
.sc-body .chart-body .legend {
  display: flex; gap: 14px; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line-2);
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
  align-items: center; flex-wrap: wrap;
}
.sc-body .chart-body .legend .l { display: flex; align-items: center; gap: 6px; }
.sc-body .chart-body .legend .l .d { width: 8px; height: 8px; border-radius: 50%; }
.sc-body .chart-body .legend .l .d.good { background: var(--copper-soft); }
.sc-body .chart-body .legend .l .d.neu { background: var(--ink); opacity: 0.6; }
.sc-body .chart-body .legend .l .d.bad { background: var(--cedar); }
.sc-body .chart-body .legend .arrow {
  margin-left: auto;
  font-family: var(--font-display); font-style: italic; font-size: 13px;
  color: var(--copper-soft); letter-spacing: 0; text-transform: none;
}

/* 9c — "the round, in shapes" stats card */
.sc-body .stats-card .card-body { padding: 6px 16px 14px; }
.sc-body .stats-row { display: grid; grid-template-columns: repeat(5, 1fr); }
.sc-body .stat-cell {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 4px; border-right: 1px solid var(--line-2);
}
.sc-body .stat-cell:last-child { border-right: 0; }
.sc-body .stat-cell .badge {
  width: 22px; height: 22px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--ink); position: relative; flex-shrink: 0;
}
.sc-body .stat-cell .badge.eagle { background: var(--green); color: var(--ink); border-radius: 50%; }
.sc-body .stat-cell .badge.eagle::after {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid var(--ink); border-radius: 50%;
}
.sc-body .stat-cell .badge.birdie { background: var(--copper-soft); color: var(--bg); border-radius: 50%; }
.sc-body .stat-cell .badge.par { background: rgba(40, 54, 24, 0.10); color: var(--ink); border-radius: 50%; }
.sc-body .stat-cell .badge.bogey { color: var(--ink); border: 1px solid var(--ink-2); border-radius: 4px; }
.sc-body .stat-cell .badge.double { background: var(--double); color: var(--ink); border-radius: 4px; }
[data-theme="dark"] .sc-body .stat-cell .badge.par { background: rgba(254, 250, 224, 0.12); }
.sc-body .stat-cell .val {
  font-family: var(--font-display); font-weight: 500; font-size: 26px;
  line-height: 1; color: var(--ink); letter-spacing: -0.012em;
}
.sc-body .stat-cell.zero .val { color: var(--ink-3); opacity: 0.45; }
.sc-body .stat-cell.zero .badge { opacity: 0.5; }
.sc-body .stats-aux {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line-2);
  font-family: var(--font-ui); font-size: 11px; color: var(--ink-3);
}
.sc-body .stats-aux .streak {
  flex: 1;
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 14px; color: var(--ink-2); letter-spacing: -0.005em;
}
.sc-body .stats-aux .streak b { color: var(--copper-soft); font-weight: 500; }
.sc-body .stats-aux .a { display: flex; align-items: baseline; gap: 6px; }
.sc-body .stats-aux .a .lbl {
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.sc-body .stats-aux .a .val {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 16px; color: var(--ink); letter-spacing: -0.005em;
}
.sc-body .stats-aux .a .val .delta {
  font-family: var(--font-mono); font-style: normal; font-size: 10px;
  color: var(--copper-soft); margin-left: 3px;
}

/* 9d — front/back nine table cards */
.sc-body .sc-card-9 .card-body { padding: 0; }
.sc-body .sc-table {
  width: 100%; border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono); font-size: 12px;
}
.sc-body .sc-table th, .sc-body .sc-table td {
  padding: 8px 4px; text-align: center;
  border-bottom: 1px solid var(--line-2);
}
.sc-body .sc-table th {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding-top: 12px; padding-bottom: 10px;
  background: rgba(40, 54, 24, 0.04);
}
[data-theme="dark"] .sc-body .sc-table th { background: rgba(254, 250, 224, 0.03); }
.sc-body .sc-table th:first-child { text-align: left; padding-left: 16px; }
.sc-body .sc-table td.lbl {
  text-align: left;
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; padding-left: 16px;
}
.sc-body .sc-table td.empty { color: var(--ink-3); opacity: 0.4; }
.sc-body .sc-table td.tot {
  font-family: var(--font-display); font-style: italic; font-size: 18px;
  color: var(--copper-soft); background: rgba(188, 108, 37, 0.08);
  font-weight: 500; letter-spacing: -0.01em;
}
.sc-body .sc-table tr:last-child td { border-bottom: 0; }
.sc-body .sc-table .cell-marker {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  margin: 0 auto; position: relative;
}
.sc-body .sc-table .cell-marker.eagle { background: var(--green); color: var(--ink); border-radius: 50%; }
.sc-body .sc-table .cell-marker.eagle::after {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid var(--ink); border-radius: 50%;
}
.sc-body .sc-table .cell-marker.birdie { background: var(--copper-soft); color: var(--bg); border-radius: 50%; }
.sc-body .sc-table .cell-marker.bogey { color: var(--ink); border: 1px solid var(--ink-2); border-radius: 4px; }
.sc-body .sc-table .cell-marker.double { background: var(--double); color: var(--ink); border-radius: 4px; }

/* 9e — totals strip (locked ceylanite, both themes) */
.sc-body .totals-strip {
  background: #283618;
  border-radius: 12px;
  padding: 16px 18px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
  align-items: center;
}
.sc-body .totals-strip .t { text-align: center; }
.sc-body .totals-strip .t .lbl {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: #DDA15E; font-weight: 600;
}
.sc-body .totals-strip .t .val {
  font-family: var(--font-display); font-weight: 500; font-size: 28px;
  line-height: 1; color: #FEFAE0; margin-top: 5px; letter-spacing: -0.012em;
}
.sc-body .totals-strip .t.primary .val {
  color: #d68b3f; font-style: italic; font-size: 34px;
}
.sc-body .totals-strip .t .sub {
  font-family: var(--font-mono); font-size: 10px;
  color: #a08151; display: block; margin-top: 2px;
}

/* 9f — legend card */
.sc-body .legend-card {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.04em; color: var(--ink-3);
  padding: 12px 16px 14px;
  display: flex; gap: 12px; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
}
.sc-body .legend-card .l { display: flex; align-items: center; gap: 6px; }
.sc-body .legend-card .l i {
  width: 14px; height: 14px; display: inline-block; position: relative;
}
.sc-body .legend-card .l i.eagle { background: var(--green); border-radius: 50%; }
.sc-body .legend-card .l i.eagle::after {
  content: ""; position: absolute; inset: 2px;
  border: 1px solid var(--ink); border-radius: 50%;
}
.sc-body .legend-card .l i.birdie { background: var(--copper-soft); border-radius: 50%; }
.sc-body .legend-card .l i.par { background: rgba(40, 54, 24, 0.18); border-radius: 50%; }
.sc-body .legend-card .l i.bogey { border: 1px solid var(--ink-2); border-radius: 3px; }
.sc-body .legend-card .l i.double { background: var(--double); border-radius: 3px; }
[data-theme="dark"] .sc-body .legend-card .l i.par { background: rgba(254, 250, 224, 0.18); }

/* Score progression chart (Phase 21) */
.sc-chart {
  margin: 14px 14px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 10px;
}
.sc-chart h3 {
  margin: 0 0 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
}
.sc-chart svg { width: 100%; display: block; }

/* Adjust scorecard margin when inside modal */
.sc-body .scorecard { margin: 14px 14px 0; }
.sc-body .legend { padding-left: 28px; }

/* Empty state */
.empty {
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

/* Legend */
.legend {
  display: flex;
  gap: 12px;
  padding: 8px 16px 14px;
  font-size: 10px;
  color: var(--ink-3);
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i {
  width: 8px; height: 8px; border-radius: 2px; background: var(--line);
  flex-shrink: 0;
}
.legend i.b { background: var(--birdie); border-radius: 50%; }
.legend i.p { background: var(--ink-2); }
.legend i.bo { background: transparent; border: 1px solid var(--bogey); border-radius: 2px; }
.legend i.e { background: var(--eagle); border-radius: 50%; }
.legend i.dbl { background: transparent; border: 1.5px double var(--double); border-radius: 2px; }

/* Pagination */
.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px;
  background: var(--surface);
  border-top: 1px solid var(--line-2);
}
.page-btn {
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
}
.page-btn.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.page-btn.disabled { color: var(--ink-3); pointer-events: none; }

/* FR-09: sticky infinite-scroll page bar — a no-JS fallback (real page links)
   and a live indicator whose active number JS moves to the batch in view.
   Floats just above the bottom nav as a horizontally-scrollable pill. */
.lb-sentinel { height: 1px; width: 100%; }
.lb-pager {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  z-index: 18;                 /* above content, below #cmp-go (1500) and modals */
  display: none;               /* FR-09 rev: hidden on page 1; JS adds .is-paged once
                                  the user scrolls past the first batch. No-JS users get
                                  the always-visible bar back via the <noscript> override. */
  gap: 6px;
  max-width: min(92vw, 460px);
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.lb-pager::-webkit-scrollbar { display: none; }
.lb-pager .page-btn { flex: 0 0 auto; }
/* FR-09 rev: reveal only once JS marks a non-first batch in view, and never while
   comparing (the floating Compare (N) action owns that spot). */
body:not(.compare-mode) .lb-pager.is-paged { display: flex; }
/* Avoid clashing with the floating Compare (N) action in the same spot. */
body.compare-mode .lb-pager { display: none; }

/* Compare players (FR-91) — toggle sits in the event-meta pills row */
#cmp-toggle.active {
  background: var(--green);
  color: var(--bg);
}
#cmp-hint {
  font-size: 11px;
  color: var(--ink-3);
  align-self: center;
}
/* Selection indicator: a circle to the RIGHT of the score. Hidden (and out of
   the grid) until compare mode, when the row grid gains a 4th column for it. */
.cmp-check { display: none; }
body.compare-mode .lb-row {
  grid-template-columns: 36px 1fr auto 22px;
  cursor: pointer;
}
body.compare-mode .cmp-check {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  justify-self: end;
}
.lb-row.cmp-selected {
  background: rgba(221, 161, 94, 0.18);
}
.lb-row.cmp-selected .cmp-check {
  background: var(--green);
  border-color: var(--green);
  position: relative;
}
.lb-row.cmp-selected .cmp-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
#cmp-go {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 1500;
  background: var(--green);
  color: var(--bg);
  border: none;
  border-radius: 22px;
  padding: 12px 26px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(40, 54, 24, 0.22);
}
/* ============================================================
   COMPARE MODAL v2 (design.md §5.4b) — hero locked ceylanite in
   BOTH themes; body cards theme-aware. Reuses .sc-hero / .sc-body
   chrome; .cmp-* selectors layer the compare-specific pieces.
   ============================================================ */
.cmp-hero h1 { display: block; font-size: 30px; }
.cmp-hero h1 .em { font-style: italic; color: #d68b3f; }
.cmp-hero .sub {
  margin-top: 8px;
  font-family: var(--font-ui); font-size: 11px;
  color: #e8bf8a; letter-spacing: 0.04em;
}
.cmp-hero .sub .sep { opacity: 0.4; margin: 0 6px; }
.cmp-hero .sub .em {
  font-style: italic; color: #d68b3f;
  font-family: var(--font-display); font-size: 14px; font-weight: 500;
}
.cmp-hero .sub b { color: #FEFAE0; font-family: var(--font-mono); font-weight: 500; }

/* player heads strip — flush row, hairline separators */
.cmp-heads {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid rgba(254, 250, 224, 0.12);
  display: grid; gap: 0;
}
.cmp-heads.two { grid-template-columns: 1fr 1fr; }
.cmp-heads.three { grid-template-columns: 1fr 1fr 1fr; }
.cmp-head {
  padding: 0 12px; min-width: 0;
  border: 0; border-right: 1px solid rgba(254, 250, 224, 0.12);
  background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.cmp-head:first-child { padding-left: 0; }
.cmp-head:last-child { padding-right: 0; border-right: 0; }
.cmp-head .name {
  font-family: var(--font-display); font-weight: 500; font-size: 16px;
  line-height: 1.1; color: #FEFAE0; letter-spacing: -0.005em;
  display: flex; align-items: baseline; gap: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmp-head .swatch {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; align-self: center;
}
.cmp-head.p1 .swatch { background: #d68b3f; }
.cmp-head.p2 .swatch { background: #FEFAE0; }
.cmp-head.p3 .swatch { background: #8a9a5a; }
.cmp-head .hcp {
  font-family: var(--font-mono); font-size: 9px; color: #DDA15E;
  background: rgba(254, 250, 224, 0.1); padding: 1px 4px;
  border-radius: 3px; font-weight: 500; letter-spacing: 0.02em;
}
.cmp-head .score {
  font-family: var(--font-display); font-weight: 500; font-size: 36px;
  line-height: 1; margin-top: 8px; letter-spacing: -0.018em; color: #FEFAE0;
}
.cmp-head.p1 .score { color: #d68b3f; font-style: italic; }
.cmp-heads.three .score { font-size: 28px; }
.cmp-head .score.wd { font-style: italic; font-size: 22px; color: #a08151; }
.cmp-head .delta {
  display: block; margin-top: 3px;
  font-family: var(--font-mono); font-size: 10px;
  color: #DDA15E; letter-spacing: 0.02em;
}
.cmp-head .head-meta {
  margin-top: 4px;
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: #DDA15E; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmp-heads.three .head-meta { font-size: 8px; letter-spacing: 0.12em; }

/* gap headline card — the editorial sentence */
.sc-body .gap-card .card-body { padding: 14px 18px 16px; }
.sc-body .gap-grid {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.sc-body .gap-grid .l {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.sc-body .gap-grid .v {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 22px; color: var(--copper-soft); letter-spacing: -0.01em;
}
.sc-body .gap-strip {
  margin-top: 10px;
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 14px; color: var(--ink-2); line-height: 1.5; letter-spacing: -0.005em;
}
.sc-body .gap-strip b { color: var(--copper-soft); font-weight: 500; }

/* overlay chart — multi-line; reuses .chart-body, swaps the legend chips */
.sc-body .chart-body .cmp-legend .l .d {
  width: 16px; height: 2px; border-radius: 0;
}
.sc-body .chart-body .cmp-legend .l.p1 .d { background: var(--p1); }
.sc-body .chart-body .cmp-legend .l.p2 .d { background: var(--p2); }
.sc-body .chart-body .cmp-legend .l.p3 .d {
  background: none; height: 0; border-top: 2px dashed var(--p3);
}

/* "By result" card — five count columns per player */
.sc-body .cmp-stats-card .card-body { padding: 10px 14px 12px; }
.sc-body .cmp-stats-row {
  display: grid;
  grid-template-columns: 1fr repeat(5, 30px);
  gap: 4px 8px; align-items: center;
  font-family: var(--font-mono); font-size: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--line-2);
}
.sc-body .cmp-stats-row:last-child { border-bottom: 0; }
.sc-body .cmp-stats-row.head { padding-top: 0; padding-bottom: 8px; }
.sc-body .cmp-stats-row.head .h { display: flex; justify-content: center; }
.sc-body .cmp-stats-row .p-name {
  font-family: var(--font-display); font-weight: 500; font-size: 14px;
  color: var(--ink); letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 6px; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sc-body .cmp-stats-row .p-name .sw {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.sc-body .cmp-stats-row .p-name.p1 .sw { background: var(--p1); }
.sc-body .cmp-stats-row .p-name.p2 .sw { background: var(--p2); }
.sc-body .cmp-stats-row .p-name.p3 .sw { background: var(--p3); }
.sc-body .cmp-stats-row .col { text-align: center; color: var(--ink-2); }
.sc-body .cmp-stats-row .col.zero { color: var(--ink-3); opacity: 0.4; }
.sc-body .cmp-stats-row .col.lead { color: var(--copper-soft); font-weight: 600; }
.sc-body .cmp-stats-row .badge {
  width: 18px; height: 18px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  color: var(--ink); position: relative;
}
.sc-body .cmp-stats-row .badge.eagle { background: var(--green); color: var(--ink); border-radius: 50%; }
.sc-body .cmp-stats-row .badge.eagle::after {
  content: ""; position: absolute; inset: 2px;
  border: 1px solid var(--ink); border-radius: 50%;
}
.sc-body .cmp-stats-row .badge.birdie { background: var(--copper-soft); color: var(--bg); border-radius: 50%; }
.sc-body .cmp-stats-row .badge.par { background: rgba(40, 54, 24, 0.10); color: var(--ink); border-radius: 50%; }
.sc-body .cmp-stats-row .badge.bogey { color: var(--ink); border: 1px solid var(--ink-2); border-radius: 4px; }
.sc-body .cmp-stats-row .badge.double { background: var(--double); color: var(--ink); border-radius: 4px; }
[data-theme="dark"] .sc-body .cmp-stats-row .badge.par { background: rgba(254, 250, 224, 0.12); }

/* hole-by-hole compare table */
.sc-body .cmp-table-card .card-body { padding: 0; }
.sc-body .cmp-note {
  padding: 9px 16px;
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  background: rgba(40, 54, 24, 0.04);
  border-bottom: 1px solid var(--line-2);
}
[data-theme="dark"] .sc-body .cmp-note { background: rgba(254, 250, 224, 0.03); }
.sc-body .cmp-note b { color: var(--ink-2); font-weight: 600; }
.sc-body .cmp-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-mono); font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sc-body .cmp-table th, .sc-body .cmp-table td {
  padding: 7px 4px; text-align: center;
  border-bottom: 1px solid var(--line-2);
}
.sc-body .cmp-table th {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding: 10px 4px; background: rgba(40, 54, 24, 0.04);
}
[data-theme="dark"] .sc-body .cmp-table th { background: rgba(254, 250, 224, 0.03); }
.sc-body .cmp-table th:first-child { text-align: left; padding-left: 16px; }
.sc-body .cmp-table th .sw {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 3px;
}
.sc-body .cmp-table td.hole {
  text-align: left; font-family: var(--font-ui); font-size: 11px;
  font-weight: 600; color: var(--ink-2); padding-left: 16px; letter-spacing: 0.02em;
}
.sc-body .cmp-table td.par { color: var(--ink-3); }
.sc-body .cmp-table td.empty { color: var(--ink-3); opacity: 0.4; }
.sc-body .cmp-table tbody tr:last-child td { border-bottom: 0; }
.sc-body .cmp-table .player-col { position: relative; }
.sc-body .cmp-table .player-col.lead::before {
  content: ""; position: absolute; inset: 4px 8px;
  background: rgba(188, 108, 37, 0.14); border-radius: 4px; z-index: 0;
}
[data-theme="dark"] .sc-body .cmp-table .player-col.lead::before {
  background: rgba(214, 139, 63, 0.12);
}
.sc-body .cmp-table .player-col span { position: relative; z-index: 1; }
.sc-body .cmp-table .marker {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  position: relative; z-index: 1;
}
.sc-body .cmp-table .marker.eagle { background: var(--green); color: var(--ink); border-radius: 50%; }
.sc-body .cmp-table .marker.eagle::after {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid var(--ink); border-radius: 50%;
}
.sc-body .cmp-table .marker.birdie { background: var(--copper-soft); color: var(--bg); border-radius: 50%; }
.sc-body .cmp-table .marker.bogey { color: var(--ink); border: 1px solid var(--ink-2); border-radius: 4px; }
.sc-body .cmp-table .marker.double { background: var(--double); color: var(--ink); border-radius: 4px; }
.sc-body .cmp-table .nine-split td {
  padding: 5px 4px; font-family: var(--font-ui); font-size: 8px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-4); font-weight: 600; background: rgba(40, 54, 24, 0.04);
}
[data-theme="dark"] .sc-body .cmp-table .nine-split td { background: rgba(254, 250, 224, 0.03); }
.sc-body .cmp-table tfoot td {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 16px; color: var(--copper-soft);
  padding: 10px 4px; background: rgba(188, 108, 37, 0.06);
  letter-spacing: -0.01em; border-top: 1px solid var(--line-2); border-bottom: 0;
}
.sc-body .cmp-table tfoot td.lbl {
  font-family: var(--font-ui); font-style: normal; font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; text-align: left; padding-left: 16px;
}
.sc-body .cmp-table tfoot td.par-tot {
  font-family: var(--font-mono); font-style: normal;
  font-size: 11px; color: var(--ink-3);
}

/* Phase 51.3 — insights toggle row */
.insights-toggle {
  padding: 8px 12px; display: flex; align-items: center; justify-content: space-between;
  background: rgba(254,250,224,0.03); border-bottom: 1px solid var(--line-2);
  font-family: var(--font-ui); font-size: 9px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 600; cursor: pointer;
}
.insights-toggle .l { display: flex; align-items: center; gap: 5px; }
.insights-toggle .l svg { width: 9px; height: 9px; color: var(--copper-soft); transition: transform 120ms; }
.insights-toggle.open .l svg { transform: rotate(90deg); }
.insights-toggle .r { color: var(--copper-soft); }
.insights { background: rgba(214,139,63,0.04); border-bottom: 1px solid var(--line-2); }
/* Field insights (FR-92) */
.field-insights {
  border-top: 1px solid var(--line-2);
  font-size: 0.85em;
}
.field-insights > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 14px;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-insights > summary::-webkit-details-marker { display: none; }
.field-insights > summary::before {
  content: "▸";
  font-size: 0.9em;
  transition: transform 120ms;
}
.field-insights[open] > summary::before { transform: rotate(90deg); }
.fi-grid { padding: 0 14px 12px; }
.fi-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-2);
}
.fi-row:last-child { border-bottom: none; }
.fi-row span { color: var(--ink-3); }
.fi-row b { color: var(--ink); font-weight: 600; text-align: right; }
.fi-score {
  font-family: var(--font-mono);
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}

/* Share scorecard button (FR-93) */
.sc-share {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
}
.sc-share:hover { background: rgba(255,255,255,0.16); }

/* ============================================================
   FIELDS MODALS v3 (design.md §5.7, Designhandoff-v3/Field Modals*.html)
   - 5.7a My Fields index (this CSS block + .my-head-actions + .group-head + .field-row + .empty-fields)
   - 5.7b Field Detail (added in later sub-tasks 49.11b-h)
   Each fragment renders its own .m-head; the wrapper #fields-modal-body
   in helpers.get_nav_modals_html() carries no chrome of its own.
   ============================================================ */
.m-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line-2);
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  /* FR-115: pin the fields-modal header (incl. ✕) to the top of the
     #fields-modal-body scroll container so it stays reachable when scrolled. */
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}
.m-head .h-l { min-width: 0; }
.m-head .crumb {
  font-family: var(--font-ui);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--copper-soft); font-weight: 500;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 0; padding: 0; cursor: pointer;
}
.m-head .crumb svg { width: 12px; height: 12px; }
.m-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500; font-size: 32px; line-height: 1.0;
  letter-spacing: -0.012em; color: var(--ink);
}
.m-head h1 .em { font-style: italic; color: var(--copper-soft); }
.m-head .sub {
  margin-top: 6px;
  font-family: var(--font-ui); font-size: 12px; color: var(--ink-2);
}
.m-head .close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(254, 250, 224, 0.08);
  border: 1px solid var(--line);
  color: var(--ink); font-size: 14px;
  display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
[data-theme="dark"] .m-head .close { background: rgba(254, 250, 224, 0.08); }
:root .m-head .close { background: rgba(40, 54, 24, 0.06); }

/* Scrollable body of the fields modal — the fragment owns this wrapper */
.m-body { flex: 1; overflow-y: auto; }
.m-body::-webkit-scrollbar { width: 6px; }
.m-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

/* My Fields index (49.11a) */
.my-head-actions {
  padding: 14px 22px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line-2);
  gap: 12px;
}
.my-head-actions .lbl {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.my-head-actions .lbl .ct {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface-2); color: var(--ink);
  padding: 1px 5px; border-radius: 3px; margin-left: 5px;
  letter-spacing: 0.04em;
}
[data-theme="dark"] .my-head-actions .lbl .ct { background: rgba(254, 250, 224, 0.08); }
.new-btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--green); color: var(--bg);
  border: 0; padding: 9px 16px; border-radius: 999px;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.new-btn svg { width: 12px; height: 12px; }

.group-head {
  padding: 20px 22px 8px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.group-head .t {
  font-family: var(--font-display); font-style: italic;
  font-weight: 500; font-size: 22px;
  color: var(--ink); letter-spacing: -0.005em;
}
.group-head .c {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer; position: relative;
  color: var(--ink); text-decoration: none;
  background: transparent; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; font: inherit;
}
.field-row:last-child { border-bottom: 0; }
.field-row:hover { background: var(--surface-2); }
[data-theme="dark"] .field-row:hover { background: rgba(254, 250, 224, 0.03); }
.field-row .info { min-width: 0; }
.field-row .name {
  font-family: var(--font-display); font-weight: 500; font-size: 22px;
  line-height: 1.1; color: var(--ink); letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.field-row .name .badge {
  font-family: var(--font-ui); font-size: 9px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
}
.field-row .name .badge.owner    { background: var(--green); color: var(--bg); }
.field-row .name .badge.coowner  { background: var(--green-tint); color: var(--copper-soft); }
.field-row .name .badge.viewer   { background: var(--surface-2); color: var(--ink-2); }
[data-theme="dark"] .field-row .name .badge.viewer { background: rgba(254,250,224,0.1); }
.field-row .meta {
  margin-top: 4px;
  font-family: var(--font-ui); font-size: 12px; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.field-row .meta .dot {
  width: 3px; height: 3px; background: var(--ink-3);
  border-radius: 50%; opacity: 0.6; flex-shrink: 0;
}
.field-row .meta .live {
  color: var(--copper-soft); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.field-row .meta .live::before {
  content: "●"; font-size: 8px;
  animation: pulse 1.6s ease-in-out infinite;
}
.field-row .arrow {
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--copper-soft);
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}

.empty-fields {
  padding: 28px 22px; margin: 14px 22px;
  background: rgba(221, 161, 94, 0.10);
  border: 1px dashed var(--amber);
  border-radius: 10px;
  text-align: center;
}
.empty-fields .glyph {
  font-family: var(--font-display); font-style: italic;
  font-size: 32px; color: var(--copper-soft); line-height: 1;
}
.empty-fields .t {
  font-family: var(--font-display); font-style: italic;
  font-size: 20px; color: var(--ink);
  margin-top: 4px; letter-spacing: -0.005em;
}
.empty-fields .s {
  font-family: var(--font-ui); font-size: 12px;
  color: var(--ink-2); margin-top: 4px;
}
.empty-fields .cta {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--green); color: var(--bg);
  padding: 9px 16px; border-radius: 999px;
  text-decoration: none; border: 0; cursor: pointer;
}

/* Field Detail (49.11b) — locked dark ceylanite summary band in both themes */
.fd-summary {
  padding: 16px 22px 18px;
  background: #283618;
  color: #FEFAE0;
  border-bottom: 1px solid var(--line-2);
}
.fd-summary .role-line {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.fd-summary .role-line .badge {
  font-family: var(--font-ui); font-size: 9px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
}
.fd-summary .role-line .badge.owner   { background: var(--green); color: #FEFAE0; }
.fd-summary .role-line .badge.coowner { background: rgba(221, 161, 94, 0.22); color: #d68b3f; }
.fd-summary .role-line .badge.viewer  { background: rgba(254,250,224,0.10); color: #e8bf8a; }
.fd-summary .role-line .ts {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: #DDA15E; font-weight: 600;
}
.fd-summary .stats {
  margin-top: 12px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(254,250,224,0.12);
}
.fd-summary .stats .s {
  padding: 0 12px;
  border-right: 1px solid rgba(254,250,224,0.12);
  min-width: 0;
}
.fd-summary .stats .s:first-child { padding-left: 0; }
.fd-summary .stats .s:last-child  { padding-right: 0; border-right: 0; }
.fd-summary .stats .s .lbl {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: #DDA15E; font-weight: 600;
}
.fd-summary .stats .s .val {
  font-family: var(--font-display); font-weight: 500; font-size: 26px;
  line-height: 1; color: #FEFAE0; margin-top: 6px;
  letter-spacing: -0.012em;
}
.fd-summary .stats .s .val.copper {
  color: #d68b3f; font-style: italic; font-size: 30px;
}
.fd-summary .stats .s .val.muted { color: rgba(254,250,224,0.45); }
.fd-summary .stats .s .delta {
  display: block; margin-top: 4px;
  font-family: var(--font-mono); font-size: 10px;
  color: #DDA15E; letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Field Detail section heads (49.11c onward) */
.fd-section { padding: 18px 22px 0; }
.fd-section + .fd-section { padding-top: 22px; }
.fd-section .sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
  gap: 12px;
}
.fd-section .sec-head .t {
  font-family: var(--font-display); font-style: italic;
  font-weight: 500; font-size: 20px;
  color: var(--ink); letter-spacing: -0.005em;
}
.fd-section .sec-head .a {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.fd-section .sec-head .a.act {
  color: var(--copper-soft);
  background: transparent; border: 0; cursor: pointer;
  padding: 0; display: flex; align-items: center; gap: 4px;
}

/* Scope card (49.11c) */
.scope-row {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
[data-theme="dark"] .scope-row { background: rgba(254,250,224,0.04); }
.scope-row .l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scope-row .l .lbl {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.scope-row .l .v {
  font-family: var(--font-display); font-style: italic;
  font-weight: 500; font-size: 18px;
  color: var(--ink); letter-spacing: -0.005em;
}
.scope-row .l .v b {
  font-family: var(--font-ui); font-style: normal;
  font-size: 12px; color: var(--copper-soft);
  font-weight: 600; margin-left: 4px;
}
.scope-row .edit {
  font-family: var(--font-ui); font-weight: 600; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--copper-soft);
  background: transparent; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}

/* Scope edit form — appears when "Change" toggled (49.11c) */
.scope-edit-form {
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
}
[data-theme="dark"] .scope-edit-form { background: rgba(254,250,224,0.04); }
.scope-edit-form label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; cursor: pointer;
  font-family: var(--font-ui); font-size: 13px;
  color: var(--ink);
}
.scope-edit-form textarea {
  width: 100%; box-sizing: border-box;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}
.scope-edit-form button.save {
  margin-top: 10px;
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--green); color: var(--bg);
  border: 0; padding: 8px 16px; border-radius: 999px;
  cursor: pointer;
}

/* Following / linked event card (49.11c) */
.event-row {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto;
  gap: 10px; align-items: center;
}
[data-theme="dark"] .event-row { background: rgba(254,250,224,0.04); }
.event-row .info { min-width: 0; }
.event-row .info .lbl {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.event-row .info .lbl .live {
  font-family: var(--font-ui); font-size: 9px; font-weight: 700;
  color: var(--copper-soft); letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(188,108,37,0.18);
  padding: 1px 6px; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 3px;
}
.event-row .info .lbl .live::before {
  content: "●"; font-size: 7px;
}
.event-row .info .v {
  font-family: var(--font-display); font-weight: 500;
  font-size: 18px; line-height: 1.1;
  color: var(--ink); margin-top: 4px;
  letter-spacing: -0.005em;
}
.event-row .info .v .em { font-style: italic; color: var(--copper-soft); }
.event-row .info .meta {
  margin-top: 2px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.02em;
}
.event-row .change {
  font-family: var(--font-ui); font-weight: 600; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--copper-soft);
  background: transparent; border: 0; cursor: pointer;
  align-self: flex-start;
  padding: 4px 0; text-align: right;
  text-decoration: none;
  white-space: nowrap;
}

/* Following card collapsed (no linked event) state */
.event-row.empty {
  grid-template-columns: 1fr;
  text-align: center;
  padding: 18px 14px;
  cursor: pointer;
}
.event-row.empty .cta {
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--copper-soft); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Event picker form — appears when "Change event" toggled (49.11c) */
.event-picker-form {
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
[data-theme="dark"] .event-picker-form { background: rgba(254,250,224,0.04); }
.event-picker-form .row {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.event-picker-form input[type=text],
.event-picker-form input[type=date] {
  flex: 1; min-width: 90px;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-ui); font-size: 12px;
}
.event-picker-form button.search {
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--green); color: var(--bg);
  border: 0; padding: 8px 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}
.event-picker-form .comp-list { margin-top: 4px; }
.event-picker-form .comp-list a {
  display: block; padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink); text-decoration: none;
}
.event-picker-form .comp-list a:last-child { border-bottom: 0; }
.event-picker-form .comp-list .n {
  font-family: var(--font-display); font-weight: 500; font-size: 16px;
  color: var(--ink); letter-spacing: -0.005em;
}
.event-picker-form .comp-list .n .em { font-style: italic; color: var(--copper-soft); }
.event-picker-form .comp-list .m {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.02em;
}

/* Field Detail — Players list (49.11d) */
.fd-players {
  margin-top: 8px;
  border-top: 1px solid var(--line-2);
}
.player-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.player-row:last-child { border-bottom: 0; }
.player-row .num {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); text-align: center; letter-spacing: 0.04em;
}
.player-row .info { min-width: 0; }
.player-row .name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 17px; line-height: 1.1;
  color: var(--ink); letter-spacing: -0.005em;
  display: flex; align-items: baseline; gap: 6px;
  flex-wrap: wrap;
}
.player-row .name .hcp {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-2); background: var(--surface-2);
  padding: 1px 4px; border-radius: 3px;
  font-weight: 500; letter-spacing: 0.02em;
}
[data-theme="dark"] .player-row .name .hcp { background: rgba(254, 250, 224, 0.1); }
.player-row .status {
  margin-top: 2px;
  font-family: var(--font-ui); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.02em;
}
.player-row .status .live { color: var(--copper-soft); font-weight: 600; }
.player-row .status .live::before {
  content: "● "; animation: pulse 1.6s ease-in-out infinite;
}
.player-row .score {
  font-family: var(--font-display); font-weight: 500; font-size: 22px;
  color: var(--ink); line-height: 1; letter-spacing: -0.01em;
  text-align: right;
}
.player-row .score.live { color: var(--copper-soft); font-style: italic; }
.player-row .score.muted { color: var(--ink-3); }
.player-row .score.wd { font-style: italic; color: var(--ink-3); font-size: 16px; }
.player-row .remove {
  background: transparent; border: 0;
  color: var(--ink-3);
  width: 26px; height: 26px;
  font-size: 14px;
  display: grid; place-items: center;
  cursor: pointer;
  opacity: 0.6; transition: opacity .15s, color .15s;
  padding: 0;
}
.player-row .remove:hover { opacity: 1; color: var(--copper-soft); }

/* Wrap the remove form so it lays out as a grid cell, not a block */
.player-row form.remove-form { display: contents; }

/* Unified add-player input (49.11e) */
.add-player {
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 6px 8px 6px 14px;
  display: flex; align-items: center; gap: 8px;
}
[data-theme="dark"] .add-player { background: rgba(254,250,224,0.04); }
.add-player .icon {
  width: 16px; height: 16px;
  color: var(--ink-3);
  flex-shrink: 0;
}
.add-player input {
  flex: 1; min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 8px 0;
}
.add-player input::placeholder { color: var(--ink-3); opacity: 0.75; }
.add-player .add-submit {
  background: var(--green);
  color: var(--bg);
  border: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.add-player .add-submit:disabled {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
}
.add-hint {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.5;
}
.add-hint b { color: var(--ink-2); font-weight: 600; }
.add-results {
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}
[data-theme="dark"] .add-results { background: rgba(254,250,224,0.04); }
.add-results:empty { display: none; }
.add-results .result {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.add-results .result:last-child { border-bottom: 0; }
.add-results .result:hover { background: rgba(188, 108, 37, 0.08); }
.add-results .result .add-tag {
  font-family: var(--font-ui); font-size: 9px;
  font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper-soft);
}
.add-results .result.already {
  color: var(--ink-3); cursor: default;
}
.add-results .result.already:hover { background: transparent; }
.add-results .result.already .add-tag {
  color: var(--ink-3); opacity: 0.6;
}
.add-results .empty {
  padding: 12px 14px;
  font-family: var(--font-ui); font-size: 12px;
  color: var(--ink-3); font-style: italic;
}

/* Members + Invite rows (49.11f / 49.11g) */
.member-row, .invite-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  align-items: center;
}
.member-row:last-child, .invite-row:last-child { border-bottom: 0; }
.member-row .info, .invite-row .info { min-width: 0; }
.member-row .name, .invite-row .name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 16px; color: var(--ink);
  letter-spacing: -0.005em;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.member-row .name .badge {
  font-family: var(--font-ui); font-size: 8px;
  font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--surface-2); color: var(--ink-2);
  padding: 2px 6px; border-radius: 4px;
}
[data-theme="dark"] .member-row .name .badge { background: rgba(254,250,224,0.1); }
.member-row .name .badge.owner   { background: var(--green); color: var(--bg); }
.member-row .name .badge.coowner { background: var(--green-tint); color: var(--copper-soft); }
.member-row .meta, .invite-row .meta {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); margin-top: 2px;
  letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-row .role-pick {
  font-family: var(--font-ui); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.member-row .role-pick:hover { color: var(--ink); border-color: var(--ink-3); }
.member-row form.remove-form, .invite-row form.remove-form { display: contents; }
.member-row .remove, .invite-row .remove {
  font-family: var(--font-ui); font-weight: 600;
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: transparent; border: 0;
  cursor: pointer;
  padding: 4px 0;
}
.member-row .remove:hover, .invite-row .remove:hover { color: var(--copper-soft); }

/* Invite-create form — appears when "+ Invite" toggle is opened */
.invite-create-form {
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; gap: 8px; align-items: center;
}
[data-theme="dark"] .invite-create-form { background: rgba(254,250,224,0.04); }
.invite-create-form select {
  flex: 1; min-width: 0;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-ui); font-size: 13px;
}
.invite-create-form button {
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--green); color: var(--bg);
  border: 0; padding: 8px 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}

/* Invite-row mono URL + italic role label (49.11g) */
.invite-row .name {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-2); letter-spacing: 0;
}
.invite-row .name b {
  font-family: var(--font-display); font-style: italic;
  font-weight: 500; font-size: 14px;
  color: var(--ink); letter-spacing: 0;
  margin-right: 6px;
}
.invite-row .copy {
  font-family: var(--font-ui); font-weight: 600; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--copper-soft);
  background: transparent; border: 0; cursor: pointer;
  padding: 4px 0;
}
.invite-row .copy:hover { color: var(--green); }
.create-invite {
  margin-top: 10px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--ink-2);
  padding: 10px;
  border-radius: 8px;
  font-family: var(--font-ui); font-size: 11px;
  font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.create-invite:hover { border-color: var(--copper-soft); color: var(--copper-soft); }
.create-invite svg { width: 12px; height: 12px; }

/* Danger zone (49.11h) */
.danger {
  margin: 24px 22px 0;
  padding: 14px 0 24px;
  border-top: 1px dashed var(--line-2);
  display: flex; justify-content: space-between; align-items: center;
}
.danger .name {
  font-family: var(--font-display); font-style: italic;
  font-size: 14px; color: var(--ink-3);
  letter-spacing: -0.005em;
}
.danger button, .danger summary {
  font-family: var(--font-ui); font-weight: 600;
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--double);
  color: var(--double);
  padding: 8px 12px; border-radius: 6px;
  cursor: pointer;
  list-style: none;
}
.danger button:hover, .danger summary:hover {
  background: var(--double); color: var(--bg);
}
.danger details { margin: 0; }
.danger-confirm {
  margin: 12px 22px 24px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--double);
  border-radius: 8px;
  text-align: center;
}
[data-theme="dark"] .danger-confirm { background: rgba(184, 90, 31, 0.10); }
.danger-confirm .copy {
  font-family: var(--font-ui); font-size: 12px;
  color: var(--ink-2); margin-bottom: 12px;
  line-height: 1.5;
}
.danger-confirm form {
  display: flex; gap: 8px; justify-content: center;
}
.danger-confirm button.delete {
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--double); color: var(--bg);
  border: 0; padding: 9px 16px; border-radius: 999px;
  cursor: pointer;
}
.danger-confirm button.cancel {
  font-family: var(--font-ui); font-weight: 600; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-3);
  padding: 9px 16px; border-radius: 999px;
  cursor: pointer;
}

/* Hidden fields collapsible at the bottom of the index */
.hidden-fields-toggle {
  margin: 14px 22px 22px;
}
.hidden-fields-toggle summary {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); cursor: pointer;
  list-style: none; padding: 8px 0;
}
.hidden-fields-toggle summary::-webkit-details-marker { display: none; }
.hidden-fields-toggle summary::before {
  content: "▸"; display: inline-block;
  margin-right: 6px; transition: transform 120ms;
}
.hidden-fields-toggle[open] summary::before { transform: rotate(90deg); }

/* Phase 51.10 — field empty state */
.empty-card {
  margin: 8px 12px 0; padding: 18px 14px;
  background: rgba(221,161,94,0.10); border: 1px dashed var(--bogey);
  border-radius: 10px; text-align: center;
}
.empty-card .glyph { font-family: var(--font-serif); font-style: italic; font-size: 24px; color: var(--copper-soft); }
.empty-card .t { font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--ink); margin-top: 4px; letter-spacing: -0.005em; }
.empty-card .s { font-family: var(--font-ui); font-size: 10px; color: var(--ink-2); margin-top: 3px; }
