/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* 8-point spacing grid */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 48px;
  --s6: 64px;

  /* Legacy aliases so existing JS works unchanged */
  --space-1: var(--s1);
  --space-2: var(--s2);
  --space-3: var(--s3);
  --space-4: var(--s4);

  /* Border radii — nothing above 18px keeps surfaces crisp */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Type scale — 15 px base, 8 steps */
  --text-xs:   0.6875rem;  /* 11 px */
  --text-sm:   0.8125rem;  /* 13 px */
  --text-base: 0.9375rem;  /* 15 px */
  --text-lg:   1.0625rem;  /* 17 px */
  --text-xl:   1.375rem;   /* 22 px */
  --text-2xl:  1.75rem;    /* 28 px */
  --text-3xl:  clamp(2.25rem, 6vw, 3.5rem);

  /* Fonts */
  --font-display: system-ui, -apple-system, 'Segoe UI Variable Display',
                  'Segoe UI', sans-serif;
  --font-body:    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Consolas', 'Menlo', monospace;

  /* — Dark palette — */
  --bg:            #09090e;
  --surface:       #111118;
  --surface-raised: #16161f;
  --surface-high:  #1c1c29;

  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --border-focus:  rgba(79, 142, 247, 0.55);

  --text:   #eeeef5;
  --text-2: rgba(238, 238, 245, 0.55);
  --text-3: rgba(238, 238, 245, 0.28);

  --accent:        #4f8ef7;
  --accent-strong: #3b7cf5;
  --accent-dim:    rgba(79, 142, 247, 0.14);

  --success:     #22c55e;
  --success-dim: rgba(34, 197, 94, 0.12);
  --danger:      #ef4444;
  --danger-dim:  rgba(239, 68, 68, 0.12);
  --warn:        #f59e0b;
  --warn-dim:    rgba(245, 158, 11, 0.12);

  /* Dynamic team colors — overridden at runtime by applyCompetitionTheme */
  --team-a-color:   #D71920;
  --team-b-color:   #0E4BEF;
  --leader-neutral: rgba(255, 255, 255, 0.92);

  /* Legacy color aliases (some components reference the old names) */
  --line:            var(--border);
  --line-strong:     var(--border-strong);
  --surface-soft:    var(--surface-raised);
  --surface-muted:   var(--surface-high);
  --surface-strong:  var(--surface-high);
  --ink:             var(--text);
  --ink-soft:        var(--text-2);
  --ink-faint:       var(--text-3);
  --navy:            var(--text);
  --navy-2:          var(--text);
  --primary:         var(--accent);
  --primary-strong:  var(--accent-strong);
  --secondary:       var(--success);
  --secondary-soft:  var(--success-dim);
  --danger-soft:     var(--danger-dim);
  --success-soft:    var(--success-dim);
  --warning:         var(--warn);
  --warning-soft:    var(--warn-dim);
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.55);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.65);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-high); border-radius: 999px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { font-family: var(--font-display); }

h1 {
  font-size: var(--text-3xl);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.04em;
  color: var(--text);
}

h2 {
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
}

.small {
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: 1.5;
}

/* Eyebrow — compact data label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s1);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.eyebrow::before {
  content: '';
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  appearance: none;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 140ms ease, transform 100ms ease, background 140ms ease, color 140ms ease;
}

button:hover { opacity: 0.86; }
button:active { transform: scale(0.97); opacity: 1; }

button:disabled, button.disabled {
  opacity: 0.32;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
button.secondary:hover { background: var(--surface-high); opacity: 1; }

button.ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
button.ghost:hover { background: var(--surface-raised); color: var(--text); opacity: 1; }

button.danger-btn {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.22);
}
button.danger-btn:hover { background: rgba(239, 68, 68, 0.2); opacity: 1; }

button.small-btn, button.mini-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: var(--text-xs);
}

.btn-resume {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  font-weight: 600;
  min-width: 90px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-resume:hover, .btn-resume:focus-visible {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.btn-delete-card {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  font-weight: 600;
  min-width: 90px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-delete-card:hover, .btn-delete-card:focus-visible {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.full { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  padding: 0 14px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea {
  min-height: 120px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder { color: var(--text-3); }

input[type="color"] {
  padding: 4px;
  min-height: 44px;
  cursor: pointer;
  background: var(--surface-raised);
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.panel::after { display: none; }

.card-soft, .auth-panel, .action-card,
.create-form-panel, .create-preview,
.tournaments-panel, .scorer-access-panel,
.scorer-standalone-panel {
  padding: var(--s3);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.stack { display: flex; flex-direction: column; }
.tight { gap: var(--s2); }
.gap-16 { gap: var(--s2); }
.gap-20 { gap: 20px; }
.top-gap { margin-top: var(--s3); }

.grid-2, .grid-3, .overview-grid, .team-rosters-grid,
.claim-form, .create-grid, .home-cards, .group-grid,
.pairing-meta-fields, .score-match-picker-row, .top-actions,
.tournament-row-card, .scorekeeper-bottom-actions {
  display: grid;
  gap: var(--s2);
}

.grid-2, .grid-3, .overview-grid, .team-rosters-grid,
.claim-form, .create-grid, .home-cards, .group-grid,
.pairing-meta-fields, .score-match-picker-row, .top-actions,
.tournament-row-card, .scorekeeper-bottom-actions {
  grid-template-columns: 1fr;
}

/* ============================================================
   SCREEN SHELL
   ============================================================ */
.screen-shell {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--s4) var(--s2) calc(88px + env(safe-area-inset-bottom, 0px));
}

.auth-screen {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s3);
}

.auth-form-shell { max-width: 600px; }

/* Password field with show/hide toggle */
.pw-field {
  position: relative;
  display: flex;
  align-items: stretch;
}
.pw-field input {
  flex: 1;
  padding-right: 60px;
}
.pw-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  padding: 0 14px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s, background 0.15s;
}
.pw-toggle:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.pw-hint {
  margin-top: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.ggid-shell      { max-width: 720px; }
.landing-shell   { max-width: 1080px; }
.home-shell      { max-width: 900px; }
.create-shell    { max-width: 1240px; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-hero {
  display: grid;
  gap: var(--s4);
  padding: clamp(24px, 4vw, 44px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.landing-brand { align-items: start; }
.landing-panel { max-width: 440px; margin-left: auto; }
.landing-panel-head { margin-bottom: var(--s3); }

.landing-feature-grid {
  display: grid;
  gap: var(--s1);
  margin-top: var(--s3);
}

.landing-feature {
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.landing-feature strong {
  display: block;
  margin-bottom: 3px;
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 700;
}

.landing-feature span {
  display: block;
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ============================================================
   BRAND MARK (golf logo SVG composition)
   ============================================================ */
.brand-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s2);
  align-items: start;
}
.brand-auth { margin-bottom: var(--s1); }

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #163f80 0%, #0f2d59 52%, #0b1930 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.up-one-mark > * { position: absolute; }

.up-one-mark-sky {
  inset: 0;
  background: radial-gradient(circle at 24% 20%, rgba(255,255,255,0.28), transparent 32%);
}

.up-one-mark-fairway {
  left: 9px; right: 7px; bottom: 6px; height: 20px;
  border-radius: 13px 13px 9px 9px;
  background: linear-gradient(180deg, #2ab374 0%, #137a4a 100%);
  transform: perspective(80px) rotateX(38deg);
  transform-origin: bottom;
}

.up-one-mark-hole {
  width: 8px; height: 8px;
  border-radius: 999px; background: #081321;
  left: 50%; margin-left: -4px; bottom: 14px;
}

.up-one-mark-stick {
  width: 2px; height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8fbff 0%, #c8d6ee 100%);
  left: 50%; margin-left: -1px; bottom: 17px;
}

.up-one-mark-flag {
  width: 15px; height: 11px;
  left: 50%; bottom: 29px; margin-left: 1px;
  background: linear-gradient(180deg, #f5c651 0%, #d59b1d 100%);
  clip-path: polygon(0 0, 100% 14%, 72% 52%, 100% 100%, 0 84%);
}

.up-one-mark-ball {
  width: 10px; height: 10px;
  border-radius: 999px;
  right: 9px; bottom: 9px;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f2f7ff 60%, #dbe5f5 100%);
}

.up-one-mark-one {
  left: 9px; top: 8px;
  color: rgba(255, 255, 255, 0.96);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.brand-head p, .create-header p, .action-card p {
  margin-top: var(--s1);
  color: var(--text-2);
  line-height: 1.55;
  font-size: var(--text-sm);
}

/* ============================================================
   NAVIGATION HELPERS
   ============================================================ */
.helper-links, .top-actions, .tournament-row-actions,
.code-meta, .score-actions-row, .scorekeeper-bottom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.helper-links {
  justify-content: center;
  margin-top: var(--s2);
  font-size: var(--text-sm);
  color: var(--text-3);
}
.helper-links a { color: var(--text-2); }
.helper-links a:hover { color: var(--text); text-decoration: none; }
.helper-links span { color: var(--text-3); }

.or-divider {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: var(--s3) 0;
  color: var(--text-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* ============================================================
   ALERTS / INLINE NOTICES
   ============================================================ */
.alert {
  margin-top: var(--s2);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: var(--text-sm);
  font-weight: 700;
}
.alert.success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.22);
}
.alert.error {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.22);
}

/* ============================================================
   TOP HERO / DASHBOARD HEADER
   ============================================================ */
.top-hero, .create-header, .hero-points,
.tournaments-panel, .round-section,
.scorer-access-panel, .scorer-standalone-panel {
  padding: var(--s3);
}

.top-hero, .create-header {
  display: grid;
  gap: var(--s2);
  align-items: start;
}

.top-hero { background: var(--surface); }

.commissioner-hero .brand-mark { width: 60px; height: 60px; }

/* ============================================================
   HOME / DASHBOARD
   ============================================================ */
.home-cards { margin-top: var(--s3); }
.home-cards-simple { max-width: 100%; }

.action-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  background: var(--surface-raised);
  border-color: var(--border);
  padding: var(--s3) var(--s4);
}
.action-card.accent { border-color: rgba(79, 142, 247, 0.22); }

.card-copy { max-width: 56ch; }
.card-actions { margin-top: 0; flex-shrink: 0; }

.dashboard-meta, .tournament-card-meta, .tournament-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--s2);
}

.dashboard-pill, .meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.dashboard-pill.subtle, .meta-chip.subtle { color: var(--text-3); }

.tournaments-panel { margin-top: var(--s3); }

.section-head, .round-card-head, .pairing-meta, .header-topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.section-head { margin-bottom: var(--s2); }

.tournament-list, .round-builder-list, .preview-rounds,
.match-list, .codes-list, .pairingsHolder, .group-matchups {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

/* Tournament row card */
.tournament-row {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  transition: border-color 140ms ease, background 140ms ease;
}
.tournament-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-high);
}

.tournament-row-left { display: flex; flex-direction: column; gap: 4px; }
.tournament-row-right { display: flex; align-items: center; gap: 8px; }

/* Points pills */
.pill-score {
  min-width: 42px;
  text-align: center;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: var(--text-sm);
}

.team-a { --tone-color: var(--team-a-color); }
.team-b { --tone-color: var(--team-b-color); }
.neutral { --tone-color: var(--text-2); }

.pill-score.team-a, .pill-score.team-b {
  background: color-mix(in srgb, var(--tone-color) 16%, var(--surface));
  color: var(--tone-color);
  border: 1px solid color-mix(in srgb, var(--tone-color) 26%, var(--surface));
}
.pill-score.neutral {
  background: var(--surface-raised);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}

/* Empty state */
.empty-state {
  padding: var(--s3);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text-3);
  text-align: center;
  font-size: var(--text-sm);
}
.empty-state.small { padding: var(--s2); font-size: var(--text-xs); }

/* ============================================================
   TOURNAMENT BUILDER (CREATE / EDIT)
   ============================================================ */
.create-grid { margin-top: var(--s3); }
.create-form-panel, .create-preview { align-self: start; }
.create-form-panel { background: var(--surface); }
.create-preview {
  position: sticky;
  top: var(--s2);
  background: var(--surface-raised);
}
.create-header-copy { max-width: 54ch; }

.preview-stack { display: grid; gap: var(--s2); margin-top: var(--s2); }

.preview-stat, .preview-row, .overview-stat,
.roster-box, .code-row, .group-row, .round-builder-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.preview-stat, .overview-stat { padding: var(--s2); }
.preview-stat span, .overview-stat span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.preview-stat strong, .overview-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
  color: var(--text);
}

.preview-row, .round-builder-card, .group-row, .code-row { padding: var(--s2); }
.round-builder-card { background: var(--surface-raised); }

.pairing-meta-fields { width: 100%; }
.compact-head { margin-bottom: 10px; }

.roster-editor { display: flex; flex-direction: column; gap: 8px; }

.roster-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.roster-row.team-a {
  border-color: color-mix(in srgb, var(--team-a-color) 45%, var(--border));
}
.roster-row.team-b {
  border-color: color-mix(in srgb, var(--team-b-color) 45%, var(--border));
}
.roster-row.team-a input:focus {
  border-color: color-mix(in srgb, var(--team-a-color) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--team-a-color) 20%, transparent);
}
.roster-row.team-b input:focus {
  border-color: color-mix(in srgb, var(--team-b-color) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--team-b-color) 20%, transparent);
}

.roster-player-input { min-height: 40px; }

.roster-add-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s;
  letter-spacing: 0.02em;
}
.roster-add-inline:hover, .roster-add-inline:focus-visible { opacity: 1; outline: none; }
.roster-add-inline.team-a {
  border-color: color-mix(in srgb, var(--team-a-color) 55%, transparent);
  color: color-mix(in srgb, var(--team-a-color) 90%, white);
}
.roster-add-inline.team-b {
  border-color: color-mix(in srgb, var(--team-b-color) 55%, transparent);
  color: color-mix(in srgb, var(--team-b-color) 90%, white);
}

.roster-remove-btn {
  width: 36px; min-width: 36px; min-height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.inline-notice {
  margin-top: var(--s2);
  min-height: 20px;
  font-size: var(--text-sm);
  font-weight: 700;
}
.inline-notice.success { color: var(--success); }
.inline-notice.error   { color: var(--danger); }

/* ============================================================
   TOURNAMENT VIEW — HEADER
   ============================================================ */
.tournament-screen {
  max-width: none;
  width: 100%;
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

.tournament-header-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.tournament-title-row {
  padding: var(--s2) 0;
  margin-bottom: var(--s3);
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg);
}
.header-title-wrap.left-title { text-align: left; }

.tournament-screen .hero-points,
.tournament-screen .tournament-tabs,
.tournament-screen .stack,
.tournament-screen .tournament-main,
.tournament-screen .panel { width: 100%; }

.hamburger-btn {
  width: 44px; height: 44px; min-height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 1rem;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--surface-high); opacity: 1; }

/* ============================================================
   HERO POINTS BOARD
   ============================================================ */
.hero-points {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-xl);
}

.full-width-points, .ryder-hero, .single-strip { /* modifiers — no extra style needed */ }

.points-topline {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--s1);
}
.points-topline h1 {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  color: var(--text);
  text-align: center;
}
.points-sub {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.points-teamline strong:last-child { text-align: right; }

.points-teamline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: var(--s2);
  font-size: var(--text-sm);
}
.points-teamline .team-a { font-weight: 900; color: var(--team-a-color); }
.points-teamline .team-b { font-weight: 900; color: var(--team-b-color); text-align: right; }

/* Team nameplates in hero */
.team-line-emphasis { align-items: center; gap: 8px; }
.team-nameplate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: min(100%, 200px);
  padding: 0 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone-color, var(--accent)) 14%, var(--surface-raised));
  color: var(--tone-color, var(--text));
  border: 1px solid color-mix(in srgb, var(--tone-color, var(--accent)) 24%, var(--border));
  font-size: var(--text-sm);
  font-weight: 800;
}
.team-nameplate.align-end { justify-self: end; }

/* Meta cards under the strip */
.points-hero-meta {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: var(--s2);
}
.points-meta-card {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}
.points-meta-card span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-3);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.points-meta-card strong { color: var(--text); font-size: var(--text-lg); }
.points-meta-card.live { border-color: rgba(79, 142, 247, 0.22); }
.points-meta-card.center { text-align: center; }

/* The Ryder Cup bar strip */
.ryder-points-board {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface-high);
}

.points-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  min-height: 80px;
}

.points-segment {
  border-inline: 1px solid rgba(0, 0, 0, 0.22);
  background: var(--surface-high);
  transition: background 300ms ease;
}
.points-segment.team-a.filled { background: var(--team-a-color); }
.points-segment.team-b.filled { background: var(--team-b-color); }
.points-segment.neutral,
.points-segment.neutral.filled { background: rgba(255, 255, 255, 0.07); }

.ryder-center-line {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(50% - 2px);
  width: 4px;
  background: var(--bg);
}

.ryder-total {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  font-size: clamp(2.25rem, 11vw, 4.25rem);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.55);
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
.ryder-total.left { left: 14px; }
.ryder-total.right { right: 14px; }

.points-sub { margin-top: var(--s2); text-align: center; }

/* Live outlook card — colored text when a team leads, grey border always */
.points-meta-card.lead-a {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--team-a-color) 12%, var(--surface-raised));
}
.points-meta-card.lead-b {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--team-b-color) 12%, var(--surface-raised));
}
.points-meta-card.lead-a strong { color: var(--team-a-color); }
.points-meta-card.lead-b strong { color: var(--team-b-color); }
.hero-outlook { margin-bottom: var(--s2); }

/* Champion banner */
.champion-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  margin-bottom: var(--s2);
  border: 2px solid;
}
.champion-banner.lead-a {
  background: color-mix(in srgb, var(--team-a-color) 18%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--team-a-color) 55%, transparent);
  color: var(--team-a-color);
}
.champion-banner.lead-b {
  background: color-mix(in srgb, var(--team-b-color) 18%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--team-b-color) 55%, transparent);
  color: var(--team-b-color);
}

/* Hole winner dots */
.hole-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.hole-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  flex-shrink: 0;
}
.hole-dot.dot-future {
  background: var(--surface-high);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.hole-dot.dot-a { background: var(--team-a-color); color: #fff; }
.hole-dot.dot-b { background: var(--team-b-color); color: #fff; }
.hole-dot.dot-tie { background: rgba(255,255,255,0.1); color: var(--text-2); border: 1px solid var(--border); }
.hole-dot.dot-void { background: transparent; color: var(--text-3); font-size: 0.55rem; opacity: 0.4; border: 1px dashed var(--border); }

/* Live update pulse animation */
.is-live-update .ryder-points-board {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
  animation: live-pulse 600ms ease-out;
}

@keyframes live-pulse {
  0%   { outline-color: var(--accent); }
  100% { outline-color: transparent; }
}

/* ============================================================
   TOURNAMENT TABS
   ============================================================ */
.tournament-main { margin-top: 0; }

.tournament-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.tournament-tab {
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-2);
  border: 0;
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  transition: background 140ms ease, color 140ms ease;
}
.tournament-tab.active {
  background: var(--surface-high);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.tournament-tab:hover:not(.active) { color: var(--text); opacity: 1; }

/* Round select dropdown */
.compact-select { padding: 0; border: 0; background: transparent; }
.compact-select select, .session-picker {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-weight: 700;
  color: var(--text);
}

.results-round-select {
  overflow: visible;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 76px;
  z-index: 20;
  background: var(--bg);
  padding-block: var(--s2);
}
.results-round-select select {
  min-height: 50px;
  text-align: center;
  font-size: 1rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0 40px 0 16px;
  width: 100%;
  max-width: 480px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
}

/* ============================================================
   ROUND SECTION
   ============================================================ */
.round-section { background: var(--surface); }

.round-toggle {
  width: 100%; padding: 0;
  background: transparent; color: inherit;
  border: 0; border-radius: 0;
  display: flex; justify-content: center;
  align-items: center; gap: var(--s2);
  box-shadow: none; min-height: 0;
  position: relative;
}
.round-toggle:hover { transform: none; box-shadow: none; opacity: 1; }
.round-toggle strong { font-size: 1.05rem; color: var(--text); }
.round-toggle-copy { display: flex; flex-direction: column; gap: 3px; text-align: center; align-items: center; }
.round-toggle-icon { color: var(--text-3); font-size: 1.1rem; flex-shrink: 0; position: absolute; right: 0; }

.match-list { gap: 18px; margin-top: var(--s3); }

/* ============================================================
   MATCH CARDS — the core visual unit
   Every design decision exists to surface the score first.
   ============================================================ */
.match-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.match-summary {
  display: grid;
  grid-template-columns: 1fr;
}

.match-side {
  position: relative;
  overflow: hidden;
  color: #fff;
  min-height: 88px;
  display: flex;
  align-items: center;
}
.match-side::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent 55%);
  pointer-events: none;
}
.match-side.side-a:not(.is-trailing), .match-side.side-b:not(.is-trailing) {
  background: var(--tone-color, var(--surface-high));
}
.match-side.is-trailing {
  background: color-mix(in srgb, var(--tone-color) 14%, var(--surface));
}

.side-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: var(--s2);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
}

.align-right { text-align: left; }

/* Center column — score display */
.match-center {
  padding: var(--s3) var(--s2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.match-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.75);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* The score — this is the thing people look at first */
.match-result {
  font-size: clamp(2.5rem, 13vw, 4rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--text);
}
.match-result.team-a, .match-result.team-b { color: var(--tone-color); }
.match-result.neutral { color: var(--text); }
.match-result.split   { color: var(--text); }

/* Progress bar */
.match-progress-track {
  height: 3px;
  width: 72%;
  background: var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
}
.match-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--tone-color, var(--accent));
  transition: width 360ms ease;
  border-radius: 999px;
}

.match-status-text { color: rgba(255,255,255,0.75); font-weight: 700; font-size: var(--text-xs); }
.match-mini-points { color: rgba(255,255,255,0.85); font-weight: 700; font-size: var(--text-xs); }

.match-telemetry { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.match-telemetry-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-high);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.match-telemetry-pill.subtle { color: rgba(255,255,255,0.85); }

.match-state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone-color, var(--text)) 13%, var(--surface-raised));
  color: var(--tone-color, var(--text));
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Expand details button */
.match-details-toggle {
  width: 100%; min-height: 46px;
  border-radius: 0;
  background: var(--surface);
  color: var(--text-2);
  border-top: 1px solid var(--border);
  box-shadow: none;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.match-details-toggle:hover { background: var(--surface-raised); color: var(--text); opacity: 1; transform: none; }
.match-details-sheet { padding: 0 16px 16px; }

/* ============================================================
   SCORE TABLES — green felt aesthetic kept, dark-adapted
   ============================================================ */
.score-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}
.score-table-wrap.themed {
  padding: 8px;
  background: linear-gradient(180deg, #0e5e40 0%, #0b4e35 100%);
}

.score-table, .scorecard-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
}

.score-table th, .score-table td {
  padding: 12px 10px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  text-align: center;
  background: #0d1c15;
  color: rgba(255, 255, 255, 0.85);
}
.score-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #094330;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 800;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scorecard-table tbody th {
  background: #0d1c15;
  min-width: 130px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.78);
}
.scorecard-table tbody th.team-a,
.scorecard-table tbody th.team-b {
  border-left: 3px solid var(--tone-color);
  background: color-mix(in srgb, var(--tone-color) 8%, #0d1c15);
}

.par-row th, .par-row td {
  background: #0f5437 !important;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 800;
}

.status-cell { font-weight: 900; color: rgba(255, 255, 255, 0.6); }
.status-cell.a, .status-cell.b { color: #fff; background: var(--tone-color, #333); }
.status-cell.tie { background: rgba(255, 255, 255, 0.04); }

.total-cell { background: #083526 !important; color: #6ee7b7; font-weight: 900; }

.sc-sep {
  background: #072d1e !important;
  border-left: 2px solid rgba(255, 255, 255, 0.15) !important;
  color: #6ee7b7;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: var(--text-sm);
}
.sc-sep:empty { color: transparent; }

/* Score badges (birdie circle, bogey square, etc.) */
.score-badge {
  min-width: 42px; min-height: 42px;
  display: inline-grid; place-items: center;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
}
.score-badge .shape-score { font-weight: 900; font-size: var(--text-base); }
.score-badge.none, .score-badge.empty { border-color: rgba(255,255,255,0.05); }
.score-badge.circle        { border: 2px solid rgba(255,255,255,0.8); border-radius: 999px; }
.score-badge.double-circle { border: 2px solid rgba(255,255,255,0.8); border-radius: 999px;
                              outline: 2px solid rgba(255,255,255,0.8); outline-offset: 3px; }
.score-badge.square        { border: 2px solid rgba(255,255,255,0.8); border-radius: 3px; }
.score-badge.double-square { border: 2px solid rgba(255,255,255,0.8); border-radius: 3px;
                              outline: 2px solid rgba(255,255,255,0.8); outline-offset: 3px; }
.score-badge.triple-square { border: 2px solid rgba(255,255,255,0.8); border-radius: 3px;
                              outline: 3px double rgba(255,255,255,0.8); outline-offset: 3px; }
.score-badge.empty { color: var(--text-3); }

/* ============================================================
   SCOREKEEPER ENTRY SCREEN
   ============================================================ */
.scorer-screen-shell    { max-width: 700px; }
.scorer-standalone-shell { max-width: 860px; }
.scorekeeper-bottom-actions { margin-top: var(--s3); }

.scorekeeper-pill {
  min-height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-weight: 800;
  font-size: var(--text-sm);
  padding: 0 14px;
}

.golf-entry-shell {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s2);
}

.hole-nav-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 10px;
  background: var(--surface-high);
  border: 1px solid var(--border-strong);
}

.hole-nav-center { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.hole-nav-center strong { font-size: 1.2rem; color: var(--text); }
.hole-nav-center span   { color: var(--text-3); font-size: var(--text-xs); }

.hole-nav-btn { min-height: 40px; padding: 0 14px; }

.gg-score-list { display: flex; flex-direction: column; gap: 10px; margin-top: var(--s2); }

.gg-score-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  border-left: 3px solid color-mix(in srgb, var(--tone-color, var(--accent)) 60%, transparent);
}

.gg-score-name { font-weight: 700; color: var(--text); font-size: var(--text-sm); }

.gg-score-input {
  min-height: 56px; padding: 0;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  background: var(--surface-high);
  border-color: var(--border-strong);
  color: var(--text);
}

.score-actions-row { justify-content: flex-end; margin-top: var(--s2); }

.save-green-btn { background: #16a34a; color: #fff; }
.save-green-btn:hover { background: #15803d; opacity: 1; }

/* Scorer claim / access box */
.access-box {
  display: grid;
  gap: var(--s2);
  align-items: center;
  padding: var(--s2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.code-display {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 7vw, 2rem);
  letter-spacing: 0.18em;
  font-weight: 900;
  color: var(--text);
}
.code-display.mini {
  font-size: 0.875rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-high);
  border: 1px solid var(--border-strong);
  letter-spacing: 0.14em;
}

.code-row { display: grid; gap: var(--s2); padding: 16px; border-radius: var(--radius-md); }

/* Score intro / context banner */
.scorer-access-panel, .scorer-standalone-panel {
  background: var(--surface);
  border-color: var(--border);
}

.score-intro-banner {
  display: grid; gap: 3px;
  margin-bottom: var(--s2); padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}
.score-intro-banner strong { color: var(--text); font-size: var(--text-sm); }
.score-intro-banner span   { color: var(--text-2); font-size: var(--text-sm); }

/* Group scorer title row */
.group-title { color: var(--text-2); font-size: var(--text-sm); font-weight: 700; }
.group-only { align-items: center; }

/* ============================================================
   ROSTER / CODE DISPLAY
   ============================================================ */
.roster-box.team-a, .roster-box.team-b { overflow: hidden; }

.roster-head {
  margin: calc(var(--s2) * -1) calc(var(--s2) * -1) var(--s2);
  padding: 11px 16px;
  color: #fff;
  font-weight: 800;
  font-size: var(--text-sm);
}
.roster-head.team-a, .color-dot.team-a { background: var(--team-a-color); }
.roster-head.team-b, .color-dot.team-b { background: var(--team-b-color); }

.color-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}

.roster-list { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.roster-list span { font-size: var(--text-sm); color: var(--text-2); }

/* ============================================================
   SECURITY SETTINGS
   ============================================================ */
.security-grid { display: grid; gap: var(--s2); grid-template-columns: 1fr; }

.security-card {
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}
.security-card p { margin-top: 8px; color: var(--text-2); line-height: 1.55; font-size: var(--text-sm); }

.security-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--s2); }

.security-secret-box {
  display: grid; gap: 10px;
  margin-top: var(--s2); padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-high);
}
.security-secret-box strong { display: block; margin-bottom: 3px; color: var(--text); }
.security-secret-box span   { color: var(--text-2); font-size: var(--text-sm); }
.tiny-break { overflow-wrap: anywhere; }

/* ============================================================
   SLIDE MENU
   ============================================================ */
.menu-scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 30;
}

.slide-menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(300px, 86vw);
  padding: var(--s3);
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  z-index: 31;
  overflow: auto;
}

.menu-close {
  min-height: 34px; width: 34px; padding: 0;
  border-radius: 999px;
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text-2);
  font-size: 0.8rem;
}

.menu-event-title {
  margin: var(--s2) 0 var(--s3);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.menu-item {
  width: 100%; min-height: 0;
  padding: 13px 0; text-align: left;
  display: flex; flex-direction: column; gap: 2px;
  background: transparent; border-radius: 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
  transition: padding-left 140ms ease;
}
.menu-item:last-child { border-bottom: 1px solid var(--border); }
.menu-item strong { color: var(--text); font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; }
.menu-item span   { color: var(--text-2); font-size: var(--text-sm); }
.menu-item:hover  { padding-left: 8px; background: transparent; opacity: 1; transform: none; }

/* ============================================================
   GLOBAL UI — TOASTS
   ============================================================ */
.global-ui { pointer-events: none; }

.toast-stack {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 360px);
  z-index: 70;
}

.toast {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: toast-in 200ms ease-out;
}
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }

.toast strong, .toast span { display: block; }
.toast strong { margin-bottom: 1px; font-size: var(--text-sm); font-weight: 700; }
.toast span   { font-size: var(--text-sm); color: rgba(255, 255, 255, 0.78); }

.toast-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 900;
  font-size: 0.8rem;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 65;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.loading-card {
  width: min(88vw, 260px);
  display: grid; justify-items: center;
  gap: 10px; text-align: center;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.loading-card strong { color: var(--text); font-size: var(--text-base); }
.loading-card span   { color: var(--text-2); font-size: var(--text-sm); }

.loading-spinner {
  width: 34px; height: 34px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton-panel { display: grid; gap: 12px; }

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--surface-raised) 20%,
    var(--surface-high)   45%,
    var(--surface-raised) 70%
  );
  background-size: 240% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-mark   { width: 52px; height: 52px; border-radius: 13px; }
.skeleton-title  { width: 60%; height: 26px; }
.skeleton-copy   { width: 100%; height: 13px; }
.skeleton-copy.short { width: 65%; }
.skeleton-input  { width: 100%; height: 44px; }
.skeleton-button { width: 100%; height: 44px; }

/* ============================================================
   MISC
   ============================================================ */
.field-note, .standalone-help {
  margin-top: 8px;
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.standalone-help {
  margin-bottom: var(--s2); padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

/* ============================================================
   RESPONSIVE — 700 px and wider
   ============================================================ */
@media (min-width: 700px) {
  .screen-shell { padding-inline: var(--s3); }

  .claim-form, .scorekeeper-bottom-actions, .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .helper-links { justify-content: flex-start; }

  .tournament-row-card, .score-match-picker-row, .access-box, .code-row {
    grid-template-columns: 1fr auto;
  }

  .grid-2, .group-grid, .team-rosters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3, .overview-grid, .security-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .create-header { grid-template-columns: auto 1fr auto; }
  .top-hero { grid-template-columns: 1fr auto; }

  .match-summary {
    grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr);
  }
  .match-side { min-height: 130px; }
  .side-inner { font-size: clamp(1.25rem, 2.2vw, 1.7rem); letter-spacing: -0.01em; }
  .match-center {
    border-top: 0; border-bottom: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: var(--s3) 14px;
  }
  .match-side.side-b { justify-content: flex-end; }
  .match-side.side-a:not(.is-trailing) {
    background: linear-gradient(
      115deg,
      var(--tone-color, var(--surface-high)) 0 78%,
      transparent 78%
    );
  }
  .match-side.side-b:not(.is-trailing) {
    background: linear-gradient(
      -115deg,
      var(--tone-color, var(--surface-high)) 0 78%,
      transparent 78%
    );
  }
  .match-side.side-a.is-trailing {
    background: color-mix(in srgb, var(--tone-color) 14%, var(--surface));
    border-left: 4px solid color-mix(in srgb, var(--tone-color) 55%, transparent);
  }
  .match-side.side-b.is-trailing {
    background: color-mix(in srgb, var(--tone-color) 14%, var(--surface));
    border-right: 4px solid color-mix(in srgb, var(--tone-color) 55%, transparent);
  }
  .align-right { text-align: right; }

  .pairing-meta-fields { grid-template-columns: minmax(0, 1fr) 130px; }
  .group-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .claim-form.single-code-form {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .field-note { max-width: 36ch; }

  .landing-hero {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
  .landing-panel { margin-left: 0; }

  .points-hero-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ryder-points-board { border-radius: var(--radius-lg); }
}

/* ============================================================
   RESPONSIVE — 960 px and wider
   ============================================================ */
@media (min-width: 960px) {
  .create-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    align-items: start;
  }

  .home-cards { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .tournament-row-card {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .claim-form, .scorekeeper-bottom-actions, .top-actions { display: flex; }

  .match-result { font-size: clamp(3rem, 8vw, 4.5rem); }
}

/* ============================================================
   MOBILE — below 700 px
   ============================================================ */
@media (max-width: 699px) {
  .screen-shell { padding-inline: 12px; }

  /* Header */
  .brand-head { grid-template-columns: auto 1fr; gap: var(--s2); align-items: center; }
  .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
  .brand-head p { display: none; }

  /* Leaderboard hero — keep 3-col topline, shrink text */
  .points-topline { gap: 4px; }
  .points-topline h1 { font-size: clamp(1.4rem, 6vw, 2rem); }
  .points-topline span { font-size: 0.6rem; }
  .points-teamline { font-size: var(--text-xs); gap: 6px; }
  .team-nameplate { min-height: 30px; font-size: 0.72rem; padding: 0 10px; }
  .points-strip { min-height: 60px; }
  .ryder-total { font-size: clamp(1.6rem, 8vw, 2.8rem); }

  /* Match cards — 3-column layout on mobile (same as desktop) */
  .match-summary {
    grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr);
  }
  .match-side { min-height: 100px; }
  .match-center {
    border-top: 0; border-bottom: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: var(--s2) 6px;
    gap: 4px;
  }
  .match-side.side-b { justify-content: flex-end; }
  .match-side.side-a:not(.is-trailing) {
    background: var(--tone-color, var(--surface-high));
  }
  .match-side.side-b:not(.is-trailing) {
    background: var(--tone-color, var(--surface-high));
  }
  .match-side.side-a.is-trailing {
    background: color-mix(in srgb, var(--tone-color) 14%, var(--surface));
    border-left: 3px solid color-mix(in srgb, var(--tone-color) 55%, transparent);
  }
  .match-side.side-b.is-trailing {
    background: color-mix(in srgb, var(--tone-color) 14%, var(--surface));
    border-right: 3px solid color-mix(in srgb, var(--tone-color) 55%, transparent);
  }
  .side-inner { font-size: 0.72rem; padding: var(--s2) var(--s2); line-height: 1.25; overflow: hidden; }
  .side-inner > div { overflow-wrap: break-word; word-break: break-word; }
  .align-right { text-align: right; }
  .match-result { font-size: clamp(1.6rem, 7vw, 2.4rem); }
  .match-label { font-size: 0.56rem; }
  .match-status-text { font-size: 0.56rem; }
  .match-mini-points { font-size: 0.56rem; }
  .match-telemetry-pill { font-size: 0.56rem; padding: 0 5px; min-height: 18px; }
  .match-progress-track { width: 80%; }

  /* Score entry table — horizontal scroll */
  .score-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .score-table, .scorecard-table { min-width: 580px; }

  /* Tournament header — tighten up */
  .tournament-header-wrap { gap: var(--s2); }
  .tournament-tabs { padding: 3px; }
  .tournament-tab { min-height: 36px; font-size: var(--text-xs); padding: 0 8px; }

  /* Scorekeeper nav */
  .hole-nav-btn { padding: 0 10px; }
  .hole-nav-center strong { font-size: 1rem; }

  /* Score entry rows — full width inputs */
  .gg-score-input { min-height: 52px; font-size: 1.3rem; }

  /* Slide menu full width */
  .slide-menu { width: 100vw; }

  /* Auth */
  .auth-panel > form > button[type="submit"],
  .auth-panel > form > button:not(.secondary):not(.ghost) { width: 100%; }

  /* Action card — stack on mobile */
  .action-card { flex-direction: column; align-items: flex-start; }
  .card-actions { margin-top: var(--s2); width: 100%; }
  .card-actions .btn, .card-actions button { width: 100%; }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
.screen-shell { animation: screen-rise 260ms ease-out; }

@keyframes screen-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   RULES TAB
   ============================================================ */
.rules-panel { }
.rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rules-list li {
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid rgba(255,255,255,0.15);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: rgba(255,255,255,0.88);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* Rules upload section in create form */
.rules-upload-section { margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.rules-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.rules-upload-btn:hover { border-color: rgba(255,255,255,0.45); background: rgba(255,255,255,0.07); color: var(--text); }
.rules-doc-loaded {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
}
.rules-doc-filename { font-size: var(--text-sm); font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rules-doc-preview-mini {
  max-height: 220px;
  overflow: hidden;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

/* Rules doc view in tournament rules tab */
.rules-doc-view {
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.7;
}
.rules-doc-view h1, .rules-doc-view h2, .rules-doc-view h3,
.rules-doc-view h4, .rules-doc-view h5, .rules-doc-view h6 {
  margin: 1.1em 0 0.4em;
  font-weight: 700;
  color: var(--text);
}
.rules-doc-view p { margin: 0.5em 0; }
.rules-doc-view ul, .rules-doc-view ol { padding-left: 1.5em; margin: 0.5em 0; }
.rules-doc-view li { margin: 0.25em 0; }
.rules-doc-view strong, .rules-doc-view b { font-weight: 700; }
.rules-doc-view em, .rules-doc-view i { font-style: italic; }
.rules-doc-view table { width: 100%; border-collapse: collapse; margin: 0.75em 0; font-size: var(--text-sm); }
.rules-doc-view th, .rules-doc-view td { padding: 6px 10px; border: 1px solid rgba(255,255,255,0.15); text-align: left; }
.rules-doc-view th { background: rgba(255,255,255,0.07); font-weight: 600; }


/* ============================================================
   PLAYER STATS TABLE
   ============================================================ */
.stats-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stats-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
.stats-table th, .stats-table td {
  padding: 7px 6px;
  border: 1px solid rgba(0,0,0,0.25);
  background: #0d1c15;
  color: rgba(255,255,255,0.82);
  text-align: center;
  white-space: nowrap;
}
.stats-table thead th {
  background: #094330;
  font-weight: 800;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.88);
  position: sticky;
  top: 0;
  padding: 7px 5px;
}
.stats-table td.stat-name {
  text-align: left;
  font-weight: 700;
  min-width: 110px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-table td.stat-name.team-a { border-left: 3px solid var(--team-a-color); background: color-mix(in srgb, var(--team-a-color) 8%, #0d1c15); }
.stats-table td.stat-name.team-b { border-left: 3px solid var(--team-b-color); background: color-mix(in srgb, var(--team-b-color) 8%, #0d1c15); }
.stat-sub { color: rgba(255,255,255,0.4); font-size: 0.7em; }
.stat-eagle { color: #fbbf24; font-weight: 900; }
.stat-birdie { color: #6ee7b7; font-weight: 900; }
.stats-format-picker { font-size: var(--text-sm); padding: 4px 10px; min-height: 32px; }

/* ============================================================
   MATCH CARD ACTIONS (share + details row)
   ============================================================ */
.match-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 10px;
}
.match-card-actions .match-details-toggle { flex: 1; }
.share-match-btn {
  font-size: var(--text-xs);
  padding: 6px 12px;
  opacity: 0.7;
  white-space: nowrap;
}
.share-match-btn:hover { opacity: 1; }

/* ============================================================
   GROUP TEAM GRID (two-column team layout in create form)
   ============================================================ */
.group-team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
.group-team-col { display: flex; flex-direction: column; gap: 8px; }
.group-team-col-head {
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.team-a-col .group-team-col-head {
  color: var(--team-a-color);
  background: color-mix(in srgb, var(--team-a-color) 14%, var(--surface-raised));
}
.team-b-col .group-team-col-head {
  color: var(--team-b-color);
  background: color-mix(in srgb, var(--team-b-color) 14%, var(--surface-raised));
}

/* Hamburger menu active item */
.menu-item.active { background: rgba(255,255,255,0.07); border-left: 3px solid rgba(255,255,255,0.4); }

/* Hover lifts */
.tournament-row:hover,
.code-row:hover,
.access-box:hover {
  transform: translateY(-1px);
}

.panel, .match-card, .round-section, .code-row, .group-row,
.tournament-row, .access-box {
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
