:root {
  --green-dark: #0d2114;
  --green-mid: #1e4a28;
  --green-light: #3a7a50;
  --green-pale: #dfeee4;
  --cream: #111c14;
  --card-bg: #f9f6f0;
  --gold: #ffffff;
  --gold-light: #ffffff;
  --maroon: #6b1a1a;
  --text-dark: #000000;
  --text-mid: #1a1a1a;
  --text-light: #333333;
  --border: #c0d4b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: var(--cream);
  color: var(--text-dark);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── HEADER ─────────────────────────────────────── */
.mc-header {
  background: var(--green-dark);
  color: white;
  text-align: center;
  padding: 1.5rem 1rem 1rem;
  border-bottom: 4px solid var(--gold);
}

.mc-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  line-height: 1.1;
}

.mc-header .subtitle {
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-top: 0.3rem;
}

.mc-header .tagline {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
  margin-top: 0.2rem;
  letter-spacing: 0.06em;
}

/* ── COURSE TABS ─────────────────────────────────── */
.course-tabs {
  display: flex;
  justify-content: center;
  background: var(--green-dark);
  border-bottom: 3px solid var(--gold);
  padding: 0 1rem;
}

.course-tab {
  padding: 0.65rem 2rem;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: all 0.2s;
  white-space: nowrap;
}

.course-tab:hover { color: rgba(255,255,255,0.85); }

.course-tab.active {
  color: var(--gold-light);
  border-bottom: 3px solid var(--gold-light);
  background: rgba(255,255,255,0.07);
}

/* ── APP SHELL ──────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
  overflow-x: clip;
}

/* ── MAIN CONTENT ───────────────────────────────── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── VIEW TABS ──────────────────────────────────── */
.view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid rgba(255,255,255,0.15);
  flex-wrap: nowrap;
}

.view-tab {
  flex: 0 0 auto;
  padding: 1.1rem 1.2rem;
  font-family: 'Playfair Display', serif;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.view-tab:hover { color: rgba(255,255,255,0.85); }

.view-tab.active {
  color: white;
  border-bottom: 2px solid var(--green-light);
  font-weight: 700;
}

/* spacer that takes up the space the fixed tab bar occupies (mobile only) */
.view-tabs-spacer {
  height: 0;
  flex-shrink: 0;
}

/* ── SECTION TITLE ──────────────────────────────── */
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--text-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--green-mid);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── RATING BADGES ──────────────────────────────── */
.rating-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.rating-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  min-width: 110px;
}

.rating-badge .tee-name { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }
.rating-badge .tee-name.black { color: #222; }
.rating-badge .tee-name.blue  { color: #1a4fa0; }
.rating-badge .tee-name.white { color: #666; }
.rating-badge .tee-name.silver{ color: #777; }
.rating-badge .tee-name.red   { color: #9b1c1c; }
.rating-badge .rating-val { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 700; color: var(--text-dark); }
.rating-badge .slope-val { font-size: 0.72rem; color: var(--text-light); }

/* ── SCORECARD TABLE ────────────────────────────── */
.scorecard-section {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}

.scorecard-header {
  background: var(--green-dark);
  color: white;
  padding: 0.7rem 1.2rem;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.scorecard-header .nine-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  font-family: 'Source Serif 4', serif;
}

.sc-wrap { overflow-x: auto; }

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 640px;
}

.sc-table th {
  background: var(--green-dark);
  color: rgba(255,255,255,0.8);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.5rem 0.5rem;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.1);
}

.sc-table th.lbl { text-align: left; padding-left: 0.8rem; min-width: 110px; }
.sc-table th.tot { background: #051009; color: var(--gold-light); }

.sc-table td {
  text-align: center;
  padding: 0.45rem 0.4rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.sc-table td.lbl { text-align: left; padding-left: 0.8rem; font-weight: 600; font-size: 0.72rem; letter-spacing: 0.06em; min-width: 110px; }
.sc-table td.tot { background: #f0f5ec; font-weight: 600; color: var(--green-dark); }
.sc-table td.topar { text-align: center; font-weight: 600; font-size: 0.85rem; min-width: 44px; }

.sc-table tr.row-black td { background: #1a1a1a; color: #eee; }
.sc-table tr.row-black td.tot { background: #111; }
.sc-table tr.row-blue  td { background: #dceefa; color: #0c3b70; }
.sc-table tr.row-blue  td.tot { background: #b8d8f2; }
.sc-table tr.row-white td { background: #fafafa; color: #333; }
.sc-table tr.row-white td.tot { background: #eeeeee; }
.sc-table tr.row-silver td { background: #f5f5f5; color: #444; }
.sc-table tr.row-silver td.tot { background: #e8e8e8; }
.sc-table tr.row-red   td { background: #fdf0f0; color: #7a1c1c; }
.sc-table tr.row-red   td.tot { background: #f5dede; }

.sc-table tr.row-par td { background: var(--green-pale); font-weight: 700; color: var(--text-dark); font-size: 0.9rem; }
.sc-table tr.row-par td.tot { background: #cee8d8; }
.sc-table tr.row-hdcp td { background: #faf8f3; font-size: 0.78rem; color: var(--text-mid); }
.sc-table tr.row-hdcp td.tot { background: #f5f0e8; }

.sc-table tr.team-divider td {
  padding: 3px 10px;
  font-family: 'Playfair Display', serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: white;
}

.sc-table tr.row-score td { background: var(--card-bg); }
.sc-table tr.row-score td.lbl { font-weight: 400; font-size: 0.78rem; color: var(--text-dark); }
.sc-table tr.row-score td.tot { font-weight: 700; font-size: 0.95rem; }

.sc-table tr.row-score input[type=number] {
  width: 34px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  color: var(--text-dark);
  background: white;
  -moz-appearance: textfield;
}
.sc-table tr.row-score input[type=number]::-webkit-inner-spin-button,
.sc-table tr.row-score input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
.sc-table tr.row-score input[type=number]:focus {
  outline: none;
  border-color: var(--green-light);
  background: #f8fff8;
}

/* skin winner highlight */
.sc-table td.skin-win { background: #c8f0d0 !important; }
.sc-table td.hole-tie { background: #fde8a0 !important; }

/* ── TEAM SETUP CARDS ────────────────────────────── */
.team-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) { .team-setup-grid { grid-template-columns: 1fr; } }

.team-card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
}

.team-card-header {
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
}

.team-card-header input[type=text] {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.4);
  color: white;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  width: 100%;
  outline: none;
  padding-bottom: 2px;
}

.team-card-body { padding: 0.8rem 1rem; }

.player-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.player-row input[type=text], .player-row select, .player-row input[type=number] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.83rem;
  color: var(--text-dark);
  background: var(--card-bg);
}

.player-row input[type=text]:focus, .player-row select:focus, .player-row input[type=number]:focus {
  outline: none;
  border-color: var(--green-mid);
}

.player-row input[type=number] { width: 52px; text-align: center; -moz-appearance: textfield; }
.player-row input[type=number]::-webkit-inner-spin-button,
.player-row input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

.hcp-label { font-size: 0.68rem; color: var(--text-light); text-align: right; }

/* ── MATCH SUMMARY ──────────────────────────────── */
.match-summary {
  background: var(--green-dark);
  color: white;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.summary-item { text-align: center; }
.summary-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(255,255,255,0.55); display: block; }
.summary-val { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: var(--gold-light); display: block; line-height: 1.2; }
.summary-val.neutral { color: white; }

/* ── HOLE DIAGRAM CARDS ─────────────────────────── */
.yardage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.hole-card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.hole-card-header {
  background: var(--green-dark);
  color: white;
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hole-card-header .hole-num { font-family: 'Playfair Display', serif; font-size: 1.1rem; }
.hole-card-header .hole-par { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--gold-light); }
.hole-card-header .hole-hcp { font-size: 0.68rem; color: rgba(255,255,255,0.55); }

.hole-card-body { padding: 0.6rem 0.8rem; }

.hole-card-body img {
  width: 100%;
  border-radius: 4px;
  display: block;
  margin-bottom: 0.6rem;
  max-height: 160px;
  object-fit: cover;
}

.hole-yards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.yard-cell {
  text-align: center;
  padding: 3px 2px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.yard-cell .dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin: 0 auto 2px;
}

.yard-cell.c-black .dot { background: #111; }
.yard-cell.c-blue  .dot { background: #1a4fa0; }
.yard-cell.c-white .dot { background: #bbb; border: 1px solid #999; }
.yard-cell.c-silver .dot { background: #999; }
.yard-cell.c-red   .dot { background: #9b1c1c; }

.yard-cell.c-black { color: #111; font-weight: 600; }
.yard-cell.c-blue  { color: #1a4fa0; }
.yard-cell.c-white { color: #777; }
.yard-cell.c-silver{ color: #888; }
.yard-cell.c-red   { color: #9b1c1c; }

.hole-note { font-size: 0.7rem; color: var(--green-mid); font-style: italic; margin-top: 4px; }

/* ── ACTION BUTTONS ─────────────────────────────── */
.actions-row {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.45rem 1.2rem;
  border-radius: 6px;
  border: 1.5px solid var(--green-light);
  color: white;
  background: var(--green-mid);
  font-family: 'Source Serif 4', serif;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}

.btn:hover { background: var(--green-light); color: white; }

.btn-primary { background: var(--green-light); color: white; border-color: var(--green-light); }
.btn-primary:hover { background: #4a9060; border-color: #4a9060; color: white; }

.btn-danger { background: transparent; border-color: #c0392b; color: #c0392b; }
.btn-danger:hover { background: #c0392b; color: white; }

/* ── SETUP PAGE ─────────────────────────────────── */
.setup-section {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.setup-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.form-field { display: flex; flex-direction: column; gap: 3px; }

.form-field label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
}

.radio-group {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  padding: 0.35rem 0;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-dark);
  cursor: pointer;
}
.radio-label input[type=radio] { cursor: pointer; accent-color: var(--green-mid); }

.form-field input[type=text],
.form-field input[type=number],
.form-field input[type=date],
.form-field input[type=email],
.form-field select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  color: var(--text-dark);
  background: var(--card-bg);
  width: 100%;
}

.form-field input:focus, .form-field select:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 2px rgba(46,107,71,0.12);
}

.player-setup-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: var(--cream);
  border-radius: 6px;
}

.player-setup-row input, .player-setup-row select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.85rem;
  background: var(--card-bg);
  color: var(--text-dark);
}

.player-setup-row input:focus, .player-setup-row select:focus {
  outline: none;
  border-color: var(--green-mid);
}

.team-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.team-block-header {
  padding: 0.5rem 0.8rem;
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.team-block-header input[type=text] {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.35);
  color: white;
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  flex: 1;
}

.team-block-body { padding: 0.6rem 0.8rem; }

/* ── COURSE INFO ─────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.info-card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 1.1rem;
}

.info-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.info-card ul { list-style: none; }
.info-card ul li {
  font-size: 0.8rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-mid);
  display: flex;
  gap: 0.4rem;
}
.info-card ul li:last-child { border-bottom: none; }
.info-card ul li::before { content: '–'; color: var(--green-mid); flex-shrink: 0; }

/* ── SIDEBAR (desktop) ──────────────────────────── */
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #081509;
  border-right: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.2rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.sidebar-logo {
  width: 100%;
  height: auto;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.sidebar-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.sidebar-brand-sub {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'Source Serif 4', serif;
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--gold-light);
}
.sidebar-link.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-left-color: var(--green-light);
}
.sidebar-icon {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 0.75rem 1.1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.sidebar-username {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 0.4rem;
  word-break: break-word;
}
.sidebar-admin-badge {
  display: inline-block;
  background: var(--green-light);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-bottom: 0.55rem;
}
.connected-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-light);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1;
}
.sidebar-signout {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 0.3rem;
}

/* ── MOBILE TOP BAR ─────────────────────────────── */
.app-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: #081509;
  border-bottom: 2px solid var(--gold);
  height: 54px;
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.app-topbar-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}
.nav-hamburger {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  border-radius: 6px;
}
.nav-hamburger:active { background: rgba(255,255,255,0.1); }

/* ── RIGHT SLIDE-OUT NAV DRAWER ─────────────────── */
.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 900;
}
.nav-drawer-overlay.open { display: block; }

.nav-drawer {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  height: 100vh;
  height: 100dvh;
  background: #081509;
  border-left: 2px solid rgba(255,255,255,0.15);
  z-index: 1000;
  transition: right 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-drawer.open { right: 0; }

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.nav-drawer-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}
.nav-drawer-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.nav-drawer-close:active { color: white; }

.nav-drawer-links {
  flex: 1;
  padding: 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-drawer-online {
  padding: 0.6rem 1.1rem 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.nav-drawer-online-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 0.4rem;
}
.nav-drawer-online-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  padding: 0.15rem 0;
}
.nav-drawer-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-light);
  flex-shrink: 0;
}

.nav-drawer-footer {
  padding: 0.75rem 1.1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

/* ── AUTH NAV ───────────────────────────────────── */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  font-size: 0.8rem;
}
.auth-user { color: var(--gold-light); font-weight: 500; }
.auth-badge { font-size: 0.65rem; padding: 0.15rem 0.45rem; border-radius: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.auth-badge.admin { background: var(--green-light); color: #fff; }
.btn-logout { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 0.2rem 0.6rem; border-radius: 5px; font-size: 0.75rem; cursor: pointer; }
.btn-logout:hover { background: rgba(255,255,255,0.1); }

/* ── TOAST NOTIFICATION ─────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: white;
  background: var(--green-dark);
  border-left: 4px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: fadeIn 0.2s ease;
}
.toast.error { background: #6b1a1a; border-color: #c0392b; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── SCHEDULE ───────────────────────────────────── */
.schedule-grid { display: flex; flex-direction: column; gap: 1rem; }

.week-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.week-card.week-current { border-color: var(--green-mid); box-shadow: 0 0 0 2px var(--green-mid)33; }
.week-card.week-past { opacity: 0.75; }

.week-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--green-dark);
  color: white;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
}
.week-num { font-weight: 700; font-family: 'Playfair Display', serif; font-size: 0.95rem; }
.week-date { color: var(--gold-light); }
.week-course { margin-left: auto; font-style: italic; color: var(--gold-light); }

.week-matches { padding: 0.5rem 0; }

.match-row {
  display: grid;
  grid-template-columns: 160px 1fr 2.2rem auto 2.2rem 1fr 160px;
  align-items: center;
  column-gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--green-pale);
  font-size: 0.88rem;
}
.match-row:last-child { border-bottom: none; }
.match-header-line { font-size: 0.72rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-team { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-team-a { text-align: right; }
.match-team-b { text-align: left; }
.match-score-a { text-align: right; font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1rem; color: var(--text-dark); }
.match-score-b { text-align: left; font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1rem; color: var(--text-dark); }
.match-vs { text-align: center; color: var(--text-light); font-size: 0.78rem; white-space: nowrap; padding: 0 1.2rem; }
.match-controls { display: flex; align-items: center; justify-content: flex-end; gap: 0.4rem; overflow: hidden; }

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.status-scheduled  { background: var(--green-pale); color: var(--green-mid); }
.status-in-progress { background: #fff3cd; color: #856404; }
.status-complete   { background: #e8f5ed; color: var(--green-dark); }

.btn-score { background: var(--green-mid); color: white; padding: 0.25rem 0.7rem; font-size: 0.78rem; border-radius: 5px; white-space: nowrap; }
.btn-score:hover { background: var(--green-mid); }
.btn-view { background: var(--green-pale); color: var(--green-dark); padding: 0.25rem 0.7rem; font-size: 0.78rem; border-radius: 5px; white-space: nowrap; }
.btn-preview { background: #e8e8e8; color: #666; padding: 0.25rem 0.7rem; font-size: 0.78rem; border-radius: 5px; white-space: nowrap; }
.btn-preview:hover { background: #d8d8d8; }

/* ── MATCH META ─────────────────────────────────── */
.match-meta-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--green-dark);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.match-teams-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.match-team-name { font-family: 'Playfair Display', serif; font-size: 1.15rem; font-weight: 700; flex: 1; }
.match-teams-header .match-team-name:first-child { text-align: right; }
.match-teams-header .match-team-name:last-child { text-align: left; }
.match-vs-lg { font-size: 0.85rem; color: var(--text-light); flex-shrink: 0; }

.hole-tie { background: rgba(218,165,32,0.25) !important; }

.row-pts-total td { padding: 0.3rem 0.2rem; background: #f8f4ed; border-top: 2px solid var(--border); }

/* ── LEADERBOARD ────────────────────────────────── */
.lb-section { }
.lb-title { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: white; border-bottom: 2px solid rgba(255,255,255,0.2); padding-bottom: 0.4rem; margin-bottom: 0.75rem; }

.lb-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lb-table thead tr { background: var(--green-dark); color: white; }
.lb-table thead th { padding: 0.55rem 0.5rem; text-align: center; font-weight: 600; font-size: 0.78rem; }
.lb-table tbody tr { background: var(--card-bg); border-bottom: 1px solid var(--border); }
.lb-table tbody tr:hover { background: var(--green-pale); }
.lb-table td { padding: 0.5rem 0.5rem; }

/* ── AUTH PAGES ─────────────────────────────────── */
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.auth-title { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: var(--text-dark); margin-bottom: 1.25rem; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.auth-error { background: #fde8e8; border: 1px solid #e57373; border-radius: 6px; padding: 0.6rem 0.9rem; font-size: 0.85rem; color: #8b1a1a; margin-bottom: 1rem; }
.auth-success { background: var(--green-pale); border: 1px solid var(--green-mid); border-radius: 6px; padding: 0.6rem 0.9rem; font-size: 0.85rem; color: var(--text-dark); margin-bottom: 1rem; }

/* ── HOLE THUMBNAILS ────────────────────────────── */
.hole-thumb-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.5rem 0 0.75rem;
  margin-bottom: 0.75rem;
}
.hole-thumb {
  flex: 0 0 80px;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
}
.hole-thumb:hover { border-color: var(--gold); transform: scale(1.05); }
.hole-thumb img { width: 80px; height: 56px; object-fit: cover; display: block; }
.hole-thumb-label { font-size: 0.62rem; text-align: center; padding: 0.15rem 0; background: var(--green-dark); color: var(--gold-light); }

/* ── LIGHTBOX ───────────────────────────────────── */
/* Desktop: centered popup box */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox-fullscreen {
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: min(860px, 92vw);
  max-height: 90vh;
  position: relative;
}
.lightbox-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  background: #000;
}
.lightbox-img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  border: none;
  color: white;
  font-size: 1.4rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
  z-index: 1;
}
.lightbox-arrow:hover { background: rgba(0,0,0,0.75); }
.lightbox-arrow:disabled { opacity: 0.2; cursor: default; }
.lightbox-prev { left: 0; border-radius: 0 5px 5px 0; }
.lightbox-next { right: 0; border-radius: 5px 0 0 5px; }
.lightbox-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  flex-shrink: 0;
  background: rgba(0,0,0,0.7);
}
.lightbox-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}
.lightbox-dot.active { background: var(--gold-light); }
.lightbox-dot:hover { background: rgba(255,255,255,0.55); }
.lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  background: rgba(0,0,0,0.55);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.55rem;
  border-radius: 50%;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(0,0,0,0.85); }

/* Mobile: full screen */
@media (max-width: 600px) {
  .lightbox-overlay { padding: 0; background: rgba(0,0,0,0.96); align-items: stretch; }
  .lightbox-fullscreen { max-width: 100%; max-height: 100%; width: 100%; height: 100%; border-radius: 0; }
  .lightbox-img { max-height: calc(100vh - 60px); }
}

/* ── SCORE ROWS ─────────────────────────────────── */
.my-row > td:first-child::after {
  content: " ★";
  font-size: 0.6rem;
  color: var(--green-light);
}
.score-display { font-size: 0.88rem; }
.stroke-dot { display: block; font-size: 7px; color: #c0392b; line-height: 1; }

/* ── LANDING PAGE ───────────────────────────────── */
.landing-signin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--green-dark);
  color: white;
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.landing-signin-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.landing-signin-text strong { font-family: 'Playfair Display', serif; font-size: 1.1rem; }
.landing-signin-text span { font-size: 0.85rem; color: rgba(255,255,255,0.75); }

.landing-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.landing-announcements {}
.landing-standings {}

.announcement-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.announcement-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.15rem;
}
.announcement-date {
  font-size: 0.72rem;
  color: var(--text-light);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.announcement-body {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.6;
  white-space: pre-wrap;
}

.standings-more-link {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  text-decoration: underline;
}
.standings-more-link:hover { color: white; }

.empty-state {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ── WEATHER WIDGET ─────────────────────────────── */
.weather-section { margin-top: 1.75rem; }

.forecast-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.forecast-day {
  flex: 0 0 110px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.forecast-day-name {
  font-family: 'Playfair Display', serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}
.forecast-day-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.3rem;
  display: block;
}
.forecast-day-temp {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}
.forecast-day-desc {
  font-size: 0.68rem;
  color: var(--text-mid);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}
.forecast-day-wind {
  font-size: 0.65rem;
  color: var(--text-light);
}

.radar-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.radar-wrap iframe {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
  border: none;
}

/* ── ADMIN PANEL ────────────────────────────────── */
.admin-list-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.admin-list-row:last-child { border-bottom: none; }
.admin-list-main { flex: 1; min-width: 0; }
.admin-list-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.15rem; }
.admin-list-meta { font-size: 0.72rem; color: var(--text-light); margin-bottom: 0.3rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; }
.admin-list-body { font-size: 0.85rem; color: var(--text-mid); line-height: 1.5; white-space: pre-wrap; }
.admin-list-actions { display: flex; gap: 0.4rem; flex-shrink: 0; padding-top: 0.1rem; }

/* ── LEAGUE INFO ────────────────────────────────── */
.info-rows {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.info-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  flex: 0 0 220px;
  color: var(--text-light);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.info-val {
  flex: 1;
  color: var(--text-dark);
  font-weight: 500;
}

/* ── SKINS CARD ─────────────────────────────────── */
.week-skins-bar {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--cream);
  display: flex;
  align-items: center;
}

.week-action-bar {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--cream);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-results {
  background: transparent;
  border: 1.5px solid var(--green-light);
  color: white;
  border-radius: 5px;
  padding: 0.25rem 0.85rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.78rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.btn-results:hover, .btn-results.active {
  background: var(--green-mid);
  border-color: var(--green-mid);
  color: white;
}

.btn-skins {
  background: transparent;
  border: 1.5px solid var(--green-light);
  color: white;
  border-radius: 5px;
  padding: 0.25rem 0.85rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.78rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.btn-skins:hover, .btn-skins.active {
  background: var(--green-mid);
  border-color: var(--green-mid);
  color: white;
}

/* ── MATCH RESULTS PANEL ────────────────────────── */
.results-card {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0 0.5rem;
}

.results-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.results-modal-card {
  background: var(--card-bg);
  border-radius: 10px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55);
}
.results-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.results-modal-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--green-dark);
}
.results-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.results-modal-close:hover { color: var(--text-dark); background: var(--green-pale); }

.results-match-scores {
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.results-match-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.results-match-num {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.results-team-name {
  font-weight: 700;
}

.results-score-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.results-sep {
  color: var(--text-light);
  font-size: 0.78rem;
}

.results-section-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.45rem 1rem;
  background: var(--green-mid);
  color: #fff;
  margin-bottom: 0;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.results-table thead tr { background: var(--green-dark); color: white; }
.results-table thead th { padding: 0.45rem 0.5rem; font-weight: 600; font-size: 0.76rem; text-align: center; }
.results-table tbody tr { background: var(--card-bg); border-bottom: 1px solid var(--green-pale); }
.results-table tbody tr:last-child { border-bottom: none; }
.results-table tbody tr:hover { background: var(--green-pale); }
.results-table td { padding: 0.45rem 0.6rem; }

.results-leaders-table td:first-child { font-weight: 600; color: var(--text-dark); white-space: nowrap; }
.col-course-short { display: none; }
@media (max-width: 768px) {
  .col-course-full { display: none; }
  .col-course-short { display: inline; }
}

.result-cell { font-weight: 700; text-align: center; white-space: nowrap; }
.result-w { color: var(--green-mid); }
.result-l { color: #b83a2a; }
.result-t { color: var(--text-mid); }

/* ── Player Season Stats card ────────────────── */
.ps-stats-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.75rem;
}
.ps-stats-empty {
  opacity: 0.5;
  font-style: italic;
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.25rem;
}
.ps-stats-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.ps-stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin-bottom: 1.25rem;
}
.ps-stat-item { display: flex; flex-direction: column; }
.ps-stat-label {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ps-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}
.ps-dist-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.ps-dist-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ps-dist-table {
  border-collapse: collapse;
  min-width: 500px;
  width: 100%;
}
.ps-dist-table th {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 2px solid rgba(255,255,255,0.1);
}
.ps-dist-table td {
  padding: 0.45rem 0.6rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
}
.ps-dist-pct {
  font-size: 0.76rem !important;
  font-weight: 400 !important;
  opacity: 0.65;
  padding-top: 0 !important;
}

.ps-chart-wrap {
  max-width: 440px;
  margin: 1.75rem auto 0.5rem;
}

.ps-par-table { min-width: 580px; }
.ps-par-row-label {
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  padding-right: 1rem;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.ps-par-table tr:nth-child(2) td {
  border-top: 2px solid rgba(255,255,255,0.1);
}

/* Score type colors */
.ps-dist-hio       { color: #ffd700; }
.ps-dist-dbl-eagle { color: #2ecc71; }
.ps-dist-eagle     { color: #52c478; }
.ps-dist-birdie    { color: #a8dfb8; }
.ps-dist-par       { color: rgba(255,255,255,0.85); }
.ps-dist-bogey     { color: #f0c040; }
.ps-dist-dbl-bogey { color: #e8873a; }
.ps-dist-tri-bogey { color: #e05d44; }
.ps-dist-dbl-par   { color: #d9534f; }

.skins-card {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0 0.5rem;
}

.skins-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  padding: 0 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.skins-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.skins-table thead tr { background: var(--green-dark); color: white; }
.skins-table thead th { padding: 0.4rem 0.3rem; text-align: center; font-size: 0.75rem; font-weight: 600; }
.skins-table tbody tr { background: var(--card-bg); border-bottom: 1px solid var(--green-pale); }
.skins-table tbody tr:last-child { border-bottom: none; }
.skins-name-col { text-align: left; padding: 0.4rem 0.75rem 0.4rem 1rem; white-space: nowrap; }

.skins-cell {
  text-align: center;
  padding: 0.35rem 0.2rem;
  position: relative;
}
.skin-winner { background: rgba(201,162,39,0.18); }
.skin-carry { background: rgba(200,200,200,0.18); }

.skins-score-val { display: block; font-weight: 600; line-height: 1.1; }
.skins-skin-num {
  display: block;
  font-size: 0.6rem;
  color: var(--green-dark);
  font-weight: 700;
  line-height: 1;
}

.score-birdie { color: var(--green-mid); }
.score-par { color: var(--text-dark); }
.score-bogey { color: #b83a2a; }
.score-dbl { color: #8b1a1a; font-weight: 700; }

.skins-winners {
  padding: 0.6rem 1rem 0.25rem;
}
.skins-winners-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 0.4rem;
}
.skins-winner-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}
.skins-winner-name { font-weight: 600; flex: 1; }
.skins-winner-count { color: var(--green-mid); font-size: 0.82rem; }
.skins-winner-money { color: var(--green-mid); font-weight: 700; font-size: 0.9rem; }

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 900px) {
  .landing-grid { grid-template-columns: 1fr; }
  .landing-standings { order: -1; }
}

@media (max-width: 768px) {
  /* Switch from flex-row to block so sidebar doesn't shrink content */
  .app-shell { display: block; }

  /* Hide desktop sidebar, show mobile topbar */
  .app-sidebar { display: none !important; }
  .app-topbar { display: flex; }

  /* No bottom nav — drawer handles navigation */
  .app-main { padding-top: 54px; padding-bottom: 1rem; }

  /* Full-bleed content — no green strips on sides */
  .main-content { padding: 1rem 0 2rem; }

  /* Tabs fixed below the 54px mobile topbar, full width */
  .view-tabs { position: fixed; top: 54px; left: 0; right: 0; z-index: 100; background: var(--cream); }
  .view-tabs-spacer { height: 58px; }
  .view-tab { flex: 1; text-align: center; padding: 0.9rem 0.3rem; font-size: 0.74rem; }

  .course-tab { padding: 0.55rem 1rem; font-size: 0.85rem; }
  .team-setup-grid { grid-template-columns: 1fr; }
  .match-row { display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; column-gap: 0.4rem; row-gap: 0.3rem; padding: 0.65rem 0.75rem; }
  .match-header-line { grid-column: 1 / -1; text-align: center; font-size: 0.7rem; }
  .match-team-a { text-align: right; font-size: 0.85rem; }
  .match-score-a { text-align: center; font-size: 1rem; }
  .match-vs { text-align: center; padding: 0 0.35rem; }
  .match-score-b { text-align: center; font-size: 1rem; }
  .match-team-b { text-align: left; font-size: 0.85rem; }
  .match-controls { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 0.4rem; }
  .week-header { flex-wrap: wrap; gap: 0.3rem; padding: 0.5rem 0.75rem; }
  .week-course { margin-left: 0; }
  .lb-table { font-size: 0.78rem; }
  .lb-table thead th { padding: 0.4rem 0.3rem; font-size: 0.68rem; }
  .lb-table td { padding: 0.4rem 0.3rem; }
  .landing-signin-banner { flex-direction: column; align-items: flex-start; }
  .admin-list-row { flex-direction: column; }
  .admin-list-actions { flex-direction: row; }
  .match-summary { gap: 1rem; }
  .setup-section { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .sc-table { font-size: 0.78rem; }
  .sc-table th, .sc-table td { padding: 0.35rem 0.3rem; }
  .radar-wrap iframe { aspect-ratio: 1 / 1; height: auto; }
}

@media (max-width: 600px) {
  .mc-header h1 { font-size: 1.8rem; }
  .mc-header .subtitle { font-size: 0.75rem; }
}

/* ── MOBILE (480px and below) ────────────────────────── */
@media (max-width: 480px) {
  /* Column hiding utility */
  .hide-mobile { display: none !important; }

  /* Tighter page padding on very small screens */
  .main-content { padding: 0.75rem 0 2rem; }

  /* Bigger touch targets for all buttons */
  .btn { padding: 0.6rem 1rem; font-size: 0.88rem; min-height: 40px; }
  .btn-score, .btn-view, .btn-preview {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    min-height: 38px;
  }

  /* Form inputs — easier to tap */
  .form-field input, .form-field select, .form-field textarea {
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    min-height: 40px;
  }

  /* Schedule match teams — tighter on small screens */
  .match-header-line { font-size: 0.68rem; }
  .match-team-a, .match-team-b { font-size: 0.82rem; }

  /* Scorecard — reduce min-width, shrink label col so it scrolls less */
  .sc-table { min-width: 460px; font-size: 0.74rem; }
  .sc-table th.lbl, .sc-table td.lbl {
    min-width: 72px;
    padding-left: 0.35rem;
    font-size: 0.66rem;
    letter-spacing: 0.03em;
  }
  .sc-table th, .sc-table td { padding: 0.25rem 0.18rem; }
  .sc-table tr.row-score input[type=number] { width: 28px; height: 34px; font-size: 0.92rem; }

  /* Leaderboard tables — slightly more readable */
  .lb-table { font-size: 0.84rem; }
  .lb-table thead th { font-size: 0.72rem; padding: 0.45rem 0.35rem; }
  .lb-table td { padding: 0.45rem 0.35rem; }

  /* Week header — one centered line */
  .week-header { flex-direction: row; justify-content: center; align-items: center; gap: 0.35rem; flex-wrap: nowrap; }
  .week-course { margin-left: 0; }
  .week-num { font-size: 0.88rem; font-weight: 700; }
  .week-date { font-size: 0.82rem; }

  /* Section headers — centered on mobile */
  .lb-title { text-align: center; }
  .setup-section h2 { text-align: center; }

  /* Weather block — stack on tiny screens */
  .weather-match-row { flex-direction: column; gap: 0.4rem; }

  /* Bracket graphic — stack columns on mobile */
  .bracket-row { flex-direction: column; align-items: center; }
  .bracket-connector-h { transform: rotate(90deg); margin: 0.25rem 0; }
  .bracket-match-card { width: 100%; max-width: 320px; }
  .bracket-graphic { padding: 0.5rem; }
}

/* ── Championship / Playoff ──────────────────────────────── */

.champ-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1.25rem;
  color: var(--gold);
}
.champ-divider::before, .champ-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}
.champ-divider-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.champ-divider-icon { font-size: 1rem; }

.week-playoff { border-left: 3px solid var(--gold); }

.reschedule-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  color: white;
  font-size: 0.75rem;
}
.week-reschedule-label { color: white; font-size: 0.75rem; white-space: nowrap; }
.reschedule-input {
  width: 1.6rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: transparent;
  filter: brightness(0) invert(1);
  padding: 0;
}
@media (max-width: 768px) {
  .reschedule-input {
    width: auto;
    color: rgba(255,255,255,0.9);
    filter: none;
  }
}

.playoff-matchup .match-teams { flex-wrap: wrap; gap: 0.3rem; }
.playoff-seed {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 22px;
}

/* ── Bracket Page ────────────────────────────────────────── */

.bracket-seeds-wrap {
  background: #dfeee4;
  border: 1px solid #3a7a50;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  max-width: 360px;
}
.bracket-seeds-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  color: #1e4a28;
  margin-bottom: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.bracket-seeds-list { display: flex; flex-direction: column; gap: 0.3rem; }
.bracket-seed-row { display: flex; align-items: center; gap: 0.6rem; }
.bracket-seed-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3a7a50;
  min-width: 28px;
}
.bracket-seed-name { font-size: 0.88rem; font-weight: 600; }

.bracket-graphic { padding: 1rem 0; }

.bracket-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.bracket-match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-width: 200px;
  max-width: 260px;
}
.bracket-r2-card { border-color: var(--gold); }

.bracket-card-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}
.bracket-card-team {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
}
.bracket-card-seed {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 22px;
}
.bracket-card-name { font-size: 0.88rem; font-weight: 600; }
.bracket-card-vs { font-size: 0.7rem; color: var(--text-light); padding: 0.15rem 0 0.15rem 1.5rem; }
.bracket-card-date { font-size: 0.72rem; color: var(--text-light); margin-top: 0.4rem; font-style: italic; }

.bracket-winner .bracket-card-name {
  color: var(--gold) !important;
  font-weight: 700;
}
.bracket-winner .bracket-card-seed { color: var(--gold); }
.bracket-winner::before { content: "✓ "; color: var(--gold); font-size: 0.72rem; }

.bracket-connector-h {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  flex-shrink: 0;
}
.bracket-arrow {
  color: var(--gold);
  font-size: 1.1rem;
  line-height: 1;
}

.bracket-nonscore-wrap {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}
.bracket-nonscore-label {
  font-size: 0.78rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 0.6rem;
}
.bracket-nonscore-card {
  max-width: 280px;
  border-color: var(--text-light);
  opacity: 0.8;
}
.bracket-champion-label {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}

.bracket-viewer-wrap {
  overflow-x: auto;
  margin-top: 1.5rem;
}
.bracket-svg-wrap {
  overflow-x: auto;
  width: 100%;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}
.bracket-nonscore-note {
  font-size: 0.82rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--border);
}

/* ── brackets-viewer.js theme ────────────────────────────── */
.brackets-viewer {
  background: transparent !important;
  --primary-background: var(--green-pale);
  --secondary-background: var(--green-mid);
  --match-background: var(--green-pale);
  --font-color: var(--text-dark);
  --border-color: var(--green-light);
  --connector-color: var(--green-light);
  --label-color: #555;
  --hint-color: #666;
  --match-width: 360px;
  --text-size: 18px;
  --round-margin: 90px;
  --match-vertical-padding: 14px;
  --match-horizontal-padding: 18px;
  padding: 20px 0 !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  align-items: flex-start !important;
  width: 100%;
}

/* Hide auto-generated stage title (h1/h2) above bracket */
.brackets-viewer h1,
.brackets-viewer h2 {
  display: none !important;
}

/* Force all match boxes to uniform width */
.brackets-viewer .match {
  width: var(--match-width) !important;
  min-width: var(--match-width) !important;
  max-width: var(--match-width) !important;
}
.brackets-viewer .opponents {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Round title — standalone rounded card */
.brackets-viewer h3 {
  background: var(--green-mid) !important;
  color: rgba(255,255,255,0.92) !important;
  font-family: 'Playfair Display', serif !important;
  font-size: 1em !important;
  border-radius: 8px !important;
  letter-spacing: 0.05em;
  margin-bottom: 10px !important;
}

/* Every match box — fully rounded, uniform */
.brackets-viewer .opponents {
  border-radius: 8px !important;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
}

.brackets-viewer .opponents > span {
  background: var(--green-pale) !important;
  color: #555 !important;
  font-size: 0.75em;
}

/* Participant rows — rounded corners to match box */
.brackets-viewer .participant:nth-of-type(1) {
  border-top-left-radius: 8px !important;
  border-top-right-radius: 8px !important;
}
.brackets-viewer .participant:nth-of-type(2) {
  border-bottom-left-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}

/* Disable all hover effects */
.brackets-viewer .participant:hover,
.brackets-viewer .participant.hover { background: var(--match-background) !important; }
.brackets-viewer .opponents:hover { border-color: var(--border-color) !important; }

/* Hide W / L result text */
.brackets-viewer .participant .result {
  display: none !important;
}

/* Winner name highlight — bold green only */
.brackets-viewer .participant.win .name {
  color: var(--green-mid) !important;
  font-weight: 700 !important;
}

.brackets-viewer .participant .name {
  font-size: 1em;
  color: var(--text-dark);
  width: 100%;
}

/* ── Handicap match card — matches brackets-viewer Round 1 style ── */
.handicap-match-wrap {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-start;
}
.handicap-match-box {
  width: 360px;
  border: 1px solid var(--green-light);
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  overflow: hidden;
}
.handicap-match-header {
  background: var(--green-mid);
  color: rgba(255,255,255,0.92);
  font-family: 'Playfair Display', serif;
  font-size: 1em;
  padding: 10px 0;
  text-align: center;
  letter-spacing: 0.05em;
  border-radius: 8px 8px 0 0;
}
.handicap-match-note {
  font-size: 0.78em;
  opacity: 0.7;
  font-style: italic;
  font-family: 'Source Serif 4', serif;
  letter-spacing: 0;
}
.handicap-match-body {
  background: var(--green-pale);
  border-radius: 0 0 8px 8px;
}
.handicap-participant {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 14px 18px;
  font-size: 18px;
}
.handicap-divider {
  height: 1px;
  background: var(--green-light);
  margin: 0 18px;
  opacity: 0.4;
}
.handicap-origin {
  font-size: 0.75em;
  color: #555;
  min-width: 24px;
}
.handicap-name {
  font-weight: 600;
  color: var(--text-dark);
}

/* ── Bracket page text (light text on dark bg) ───────────── */
.bracket-nonscore-note {
  color: rgba(255,255,255,0.72) !important;
  border-left-color: var(--green-light) !important;
}

.bracket-seeds-wrap {
  background: #dfeee4 !important;
  border-color: #3a7a50 !important;
}

.bracket-seeds-title {
  color: #000 !important;
}

.bracket-seed-num {
  color: #000 !important;
}

/* ── Custom bracket ───────────────────────────────────────── */
.cbracket {
  overflow-x: auto;
  width: 100%;
  padding: 1.5rem 0;
}

.cbracket-headers {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.cbhdr {
  width: 240px;
  background: var(--green-mid);
  color: rgba(255,255,255,0.92);
  font-family: 'Playfair Display', serif;
  font-size: 1em;
  padding: 10px 0;
  text-align: center;
  letter-spacing: 0.05em;
  border-radius: 8px;
}

.cbgap-hdr {
  width: 70px;
}

.cbracket-rows {
  display: flex;
  align-items: stretch;
  height: 400px;
}

.cbcol {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* flex-basis:0 ensures equal distribution regardless of content height */
.cbslot {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
}

.cbslot-dbl {
  flex: 2 2 0;
  min-height: 0;
  display: flex;
  align-items: center;
}

.cbmatch {
  width: 240px;
  border: 1px solid var(--green-light);
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  overflow: hidden;
}

.cbp {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: var(--green-pale);
  font-size: 18px;
  gap: 0.5rem;
}

.cbp:first-child {
  border-bottom: 1px solid var(--green-light);
}

.cbp-seed {
  font-size: 0.75em;
  color: #555;
  min-width: 26px;
  flex-shrink: 0;
}

.cbp-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbp-tbd .cbp-name {
  color: rgba(0,0,0,0.3);
  font-weight: 400;
  font-style: italic;
}

.cbp-win .cbp-name {
  color: var(--green-mid) !important;
  font-weight: 700;
}

/* Championship Final column — vertically centered */
.cbcol-final {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cbslot-final {
  display: flex;
  align-items: center;
}

.cbmatch-champ {
  width: 240px;
}

/* Champion (winner) column */
.cbcol-champion {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cbmatch-champion {
  width: 160px;
  border: 2px solid var(--green-mid);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  text-align: center;
}

.cbhdr-sm {
  width: 160px;
}

.cbchamp-label {
  background: var(--green-mid);
  color: rgba(255,255,255,0.92);
  font-family: 'Playfair Display', serif;
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 0;
}

.cbchamp-team {
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--green-pale);
}

.cbchamp-tbd {
  color: rgba(0,0,0,0.3) !important;
  font-style: italic;
  font-weight: 400 !important;
}
