/* ═══════════════════════════════════════════════════
   GOLF TRACKER — CSS
   Mobile-first, golf-green theme
═══════════════════════════════════════════════════ */

:root {
  --g900: #0d2b1a;
  --g800: #1a4a2e;
  --g700: #2d6a4f;
  --g600: #40916c;
  --g400: #74c69d;
  --g200: #b7e4c7;
  --g100: #d8f3dc;
  --g50:  #f0faf2;
  --gold:      #e9c46a;
  --gold-dark: #c9a227;
  --red:       #e63946;
  --blue:      #457b9d;
  --birdie:    #2dc653;
  --eagle:     #e9c46a;
  --bogey:     #e76f51;
  --double:    #e63946;
  --bg:        #f2f5f2;
  --white:     #ffffff;
  --text:      #1a2e1a;
  --text2:     #4a6741;
  --text3:     #7a9a7a;
  --border:    #cce3d0;
  --shadow:    rgba(0,0,0,0.08);
  --shadow-md: rgba(0,0,0,0.14);
  --radius:    12px;
  --radius-sm: 8px;
  --nav-h:     60px;
  --header-h:  54px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ─── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--g800);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
}
.header-left, .header-right {
  width: 60px;
  display: flex;
  align-items: center;
}
.header-right { justify-content: flex-end; }
.btn-icon {
  background: none;
  border: none;
  color: var(--white);
  font-size: 18px;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.15); }
.header-hcp-badge {
  background: var(--gold);
  color: var(--g900);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

/* ─── Main / Pages ─── */
main {
  position: fixed;
  top: var(--header-h);
  bottom: var(--nav-h);
  left: 0; right: 0;
  overflow: hidden;
}
.page {
  display: none;
  height: 100%;
  overflow: hidden;
}
.page.active { display: flex; flex-direction: column; }
.page-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0 8px;
}
.page-fullscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  background: var(--bg);
}

/* ─── Bottom Nav ─── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 1000;
  box-shadow: 0 -2px 12px var(--shadow);
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text3);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s;
  padding: 4px 0;
}
.nav-btn i { font-size: 20px; }
.nav-btn.active { color: var(--g700); }
.nav-btn-play {
  position: relative;
}
.nav-btn-play i {
  width: 46px;
  height: 46px;
  background: var(--g700);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 3px 12px rgba(45,106,79,0.5);
  margin-top: -12px;
}
.nav-btn-play span { margin-top: 4px; }
.bottom-spacer { height: 16px; }

/* ─── Section Titles ─── */
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px 6px;
}

/* ─── Stat Cards Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px 4px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 1px 4px var(--shadow);
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--g800);
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* ─── Chart Cards ─── */
.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  margin: 0 12px 12px;
  padding: 12px;
  box-shadow: 0 1px 4px var(--shadow);
}

/* ─── Welcome Banner ─── */
.welcome-banner {
  background: linear-gradient(135deg, var(--g800), var(--g600));
  margin: 0 12px 4px;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 3px 12px rgba(45,106,79,0.3);
}
.player-name { font-size: 20px; font-weight: 700; color: var(--white); }
.player-sub  { font-size: 12px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.handicap-display { text-align: center; }
.hcp-label { font-size: 10px; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.5px; }
.hcp-value { font-size: 36px; font-weight: 800; color: var(--gold); line-height: 1.1; }

/* ─── Rounds List ─── */
.rounds-list { padding: 0 12px; }
.round-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 4px var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.round-item:hover { box-shadow: 0 3px 10px var(--shadow-md); }
.round-score-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--g50);
  border: 2px solid var(--g200);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  flex-direction: column;
}
.round-score-badge .score { font-size: 18px; font-weight: 800; color: var(--g800); line-height: 1; }
.round-score-badge .to-par { font-size: 10px; font-weight: 600; }
.round-info { flex: 1; }
.round-course { font-size: 14px; font-weight: 600; color: var(--text); }
.round-date   { font-size: 12px; color: var(--text3); margin-top: 1px; }
.round-mini-stats { display: flex; gap: 8px; margin-top: 4px; }
.round-mini-stats span { font-size: 11px; color: var(--text2); }
.round-mini-stats span strong { color: var(--text); }

/* ─── Score colors ─── */
.color-eagle  { color: var(--eagle); }
.color-birdie { color: var(--birdie); }
.color-par    { color: var(--text); }
.color-bogey  { color: var(--bogey); }
.color-double { color: var(--double); }
.color-worse  { color: var(--double); font-weight: 700; }
.bg-eagle     { background: var(--eagle) !important; }
.bg-birdie    { background: var(--birdie) !important; }
.bg-par       { background: #e8e8e8 !important; }
.bg-bogey     { background: var(--bogey) !important; }
.bg-double    { background: var(--double) !important; }

/* ─── Buttons ─── */
.btn-primary-lg {
  background: var(--g700);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  width: 100%;
}
.btn-primary-lg:hover  { background: var(--g800); }
.btn-primary-lg:active { transform: scale(0.98); }
.btn-primary-lg:disabled { background: #aaa; cursor: not-allowed; }

.btn-primary {
  background: var(--g700);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary {
  background: var(--g50);
  color: var(--g700);
  border: 1.5px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger {
  background: #fdf0f0;
  color: var(--red);
  border: 1.5px solid #f5c6c6;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn-gps {
  background: linear-gradient(135deg, var(--blue), #2c5f7a);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ─── Forms ─── */
.form-section { padding: 0 16px; }
.form-group   { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--g600);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.1);
}
.form-control-sm, .form-select-sm {
  padding: 7px 10px;
  font-size: 13px;
}

/* ─── Tee Selector ─── */
.tee-selector {
  display: flex;
  gap: 6px;
  padding: 0 16px;
  flex-wrap: wrap;
}
.tee-btn {
  flex: 1;
  min-width: 55px;
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
  text-align: center;
}
.tee-btn.active {
  background: var(--g700);
  border-color: var(--g700);
  color: var(--white);
}
.tee-btn[data-tee="black"].active { background: #1a1a1a; border-color: #1a1a1a; }
.tee-btn[data-tee="blue"].active  { background: #1a6db5; border-color: #1a6db5; }
.tee-btn[data-tee="gold"].active  { background: #c9a227; border-color: #c9a227; }
.tee-btn[data-tee="red"].active   { background: #c0392b; border-color: #c0392b; }

/* ─── Info rows ─── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row span:last-child { font-weight: 600; color: var(--g700); }

/* ─── Hole Entry Page — Map-first HUD ─── */
/* Extend to full height (bottom nav is hidden on hole page) */
#page-hole.active {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0; right: 0;
  height: auto;
  z-index: 10;
  overflow: hidden;
}

/* Satellite map: top portion */
#hole-map {
  height: 46vh;
  flex-shrink: 0;
  background: #1a2e1a;
  z-index: 1;
}

/* Floating info bar: hole number, progress dots, par/SI badges */
.hole-hud-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 14px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 100%);
  pointer-events: none;
}
.hole-hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.hole-hud-num {
  font-size: 18px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  white-space: nowrap;
}
.hole-hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.hole-progress-dots {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}
.hole-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: background 0.2s;
  flex-shrink: 0;
}
.hole-dot.completed { background: var(--g400); }
.hole-dot.active    { background: var(--gold); width: 14px; border-radius: 4px; }
.par-badge {
  background: rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  color: white;
}
.hcp-badge-small {
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

/* Weather strip */
.hole-weather-bar {
  position: absolute;
  top: 48px; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 14px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  pointer-events: none;
}
.hole-weather-dot  { opacity: 0.45; }
.hole-weather-unit { opacity: 0.65; font-size: 11px; }

/* GPS distance pill — floats at map/panel boundary */
.hole-dist-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(46vh - 52px);   /* sits at the bottom edge of the map */
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.72);
  color: white;
  padding: 6px 16px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 14px rgba(0,0,0,0.4);
  white-space: nowrap;
  pointer-events: none;
}
.hole-dist-pill i { color: var(--gold); font-size: 13px; }
.hole-dist-to   { font-size: 11px; opacity: 0.65; font-weight: 500; }
.hole-dist-club {
  font-size: 12px; font-weight: 600; opacity: 0.9;
  background: rgba(255,255,255,0.15); border-radius: 10px;
  padding: 1px 8px; margin-left: 2px;
}

/* ── Hole19-style target circle on map ── */
.target-circle-wrap {
  position: relative; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
}
.target-ring {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.92);
  background: rgba(0,0,0,0.18);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 2px 12px rgba(0,0,0,0.4);
}
.target-dot {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: white; box-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.target-dist-lbl {
  position: absolute; bottom: -20px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.72); color: white;
  font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  white-space: nowrap; pointer-events: none;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* ── Front / back of green badges ── */
.hole-green-front-badge,
.hole-green-back-badge {
  position: absolute; left: 12px; z-index: 600;
  background: rgba(0,0,0,0.65); color: white;
  font-size: 12px; font-weight: 700; padding: 4px 10px;
  border-radius: 14px; backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); pointer-events: none;
  border: 1px solid rgba(255,255,255,0.18);
}
.hole-green-front-badge { top: 60px; }
.hole-green-front-badge::before { content: '▲ '; font-size: 9px; opacity: 0.7; }
.hole-green-back-badge  { top: 92px; }
.hole-green-back-badge::before  { content: '▼ '; font-size: 9px; opacity: 0.7; }

/* Stats panel: bottom sheet */
.hole-stats-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.18);
  position: relative;
  z-index: 2;
}
.hole-panel-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px auto 0;
}
.hole-yards-row {
  text-align: center;
  padding: 4px 0 0;
}
.hole-distance-display {
  font-size: 13px;
  color: var(--text3);
}

/* ─── Score Section ─── */
.score-section {
  background: var(--white);
  padding: 16px;
  margin: 10px 12px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.score-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.score-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.score-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.score-minus { background: var(--g100); color: var(--g700); }
.score-plus  { background: var(--g700); color: white; }
.score-minus:active, .score-plus:active { transform: scale(0.9); }
.score-display { text-align: center; min-width: 56px; }
.score-number {
  font-size: 42px;
  font-weight: 800;
  color: var(--g800);
  line-height: 1;
}
.score-relation {
  font-size: 14px;
  font-weight: 700;
  color: var(--text3);
  margin-top: 2px;
}
.score-relation.under { color: var(--birdie); }
.score-relation.over  { color: var(--bogey); }
.score-relation.way-over { color: var(--double); }

/* ─── Stat Sections (Fairway, GIR, etc.) ─── */
.stat-section {
  background: var(--white);
  margin: 0 12px 8px;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 1px 4px var(--shadow);
}
.stat-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.btn-group-row {
  display: flex;
  gap: 6px;
}
.stat-btn {
  flex: 1;
  padding: 11px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.stat-btn.active {
  background: var(--g700);
  border-color: var(--g700);
  color: white;
}
.stat-btn.active-red {
  background: var(--red);
  border-color: var(--red);
  color: white;
}
.stat-btn.active-gold {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  color: white;
}
.stat-btn-sm {
  padding: 8px 6px;
  font-size: 12px;
}

/* ─── Counter Row ─── */
.counter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.counter-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g700);
  transition: all 0.15s;
}
.counter-btn:active { transform: scale(0.9); background: var(--g100); }
.counter-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--g800);
  min-width: 40px;
  text-align: center;
}

/* ─── Mini counter ─── */
.mini-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}
.mini-counter button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g700);
}
.mini-counter span {
  font-size: 20px;
  font-weight: 700;
  color: var(--g800);
  min-width: 24px;
  text-align: center;
}

/* ─── Detail Group ─── */
.detail-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.detail-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* ─── Collapse toggle ─── */
.collapse-toggle {
  background: var(--g50);
  border: 1.5px solid var(--g200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--g700);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.collapse-toggle[aria-expanded="true"] i { transform: rotate(45deg); }

/* ─── Hole Navigation ─── */
.hole-nav-btns {
  display: flex;
  gap: 10px;
  padding: 0 12px;
  margin-bottom: 8px;
}
.hole-nav-btns .btn-secondary { flex: 1; }
.hole-nav-btns .btn-primary   { flex: 2; }

/* ─── Round Setup — new search-first flow ─── */
.rs-search-section {
  padding: 20px 16px 8px;
}
.rs-search-label {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}
.rs-search-input {
  height: 48px;
  font-size: 16px;
  padding-left: 42px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--white);
}
.rs-search-input:focus {
  border-color: var(--g600);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.12);
}
.rs-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 15px;
  pointer-events: none;
  z-index: 2;
}

/* Selected course card */
.rs-course-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 16px 4px;
  padding: 14px 16px;
  background: var(--g800);
  border-radius: var(--radius);
  color: white;
}
.rs-course-card-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.rs-course-card-body { flex: 1; min-width: 0; }
.rs-course-card-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-course-card-loc {
  font-size: 12px;
  opacity: 0.65;
  margin-top: 1px;
}
.rs-change-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.rs-change-btn:hover { background: rgba(255,255,255,0.28); }

/* Round option cards */
.rs-card {
  background: var(--white);
  margin: 10px 16px 0;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 6px var(--shadow);
}
.rs-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text3);
  margin-bottom: 10px;
}
.rs-hint {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  margin-top: 6px;
}

/* Collapsible conditions card */
.rs-card-collapse { padding: 0; }
.rs-collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.rs-collapse-toggle i:first-child { color: var(--g600); font-size: 16px; }
.rs-chevron { margin-left: auto; font-size: 11px; color: var(--text3); transition: transform 0.2s; }
.rs-collapse-toggle[aria-expanded="true"] .rs-chevron { transform: rotate(180deg); }
.rs-collapse-body { padding: 0 16px 16px; }

/* Recent / nearby course rows (below search bar) */
.rs-recents-list {
  padding: 0 16px 8px;
}
.rs-nearby-divider {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 10px 0 6px;
}
.rs-course-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px var(--shadow);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.rs-course-row:active { background: var(--g50); }
.rs-course-row-img {
  width: 52px;
  height: 44px;
  border-radius: 6px;
  background-color: var(--g700);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  overflow: hidden;
}
.rs-course-row-info {
  flex: 1;
  min-width: 0;
}
.rs-course-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-course-row-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-course-row-arrow {
  color: var(--text3);
  font-size: 13px;
  flex-shrink: 0;
}

/* Course fetch progress card */
.rs-fetch-card {
  margin: 0 16px 8px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: 0 1px 4px var(--shadow);
}
.rs-fetch-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.rs-fetch-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--g200);
  border-top-color: var(--g600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.rs-fetch-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.rs-fetch-track {
  height: 4px;
  background: var(--g100);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.rs-fetch-bar {
  height: 100%;
  background: var(--g600);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}
.rs-fetch-steps {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rs-fetch-step {
  font-size: 11px;
  color: var(--text3);
  padding-left: 4px;
}
.rs-fetch-step::before { content: '✓ '; color: var(--g600); }
.rs-fetch-done .rs-fetch-spinner { border-color: var(--g600); border-top-color: transparent; animation: none; }

/* ─── AI Worker card (Settings) ─── */
.ai-worker-card {
  display: flex;
  gap: 12px;
  background: var(--white);
  border: 1.5px solid var(--g200);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
}
.ai-worker-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--g700), var(--g600));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px;
  flex-shrink: 0;
}
.ai-worker-body { flex: 1; min-width: 0; }
.ai-worker-label { font-size: 13px; font-weight: 700; color: var(--text); }
.ai-worker-hint  { font-size: 11px; color: var(--text3); margin-top: 2px; line-height: 1.4; }
.ai-worker-status { font-size: 11px; margin-top: 6px; font-weight: 600; min-height: 16px; }
.ai-worker-status.ok  { color: var(--g600); }
.ai-worker-status.err { color: var(--red); }

/* ─── GPS Page ─── */
.gps-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--g800);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 3000;
}
.gps-distance-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: white;
}
.gps-distance-display span:first-child {
  font-size: 32px;
  font-weight: 800;
  color: var(--gold);
}
.gps-distance-unit { font-size: 16px; color: rgba(255,255,255,0.7); }
#gps-map {
  position: absolute;
  top: 60px; left: 0; right: 0; bottom: 80px;
  z-index: 2000;
}
.gps-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: var(--g800);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 3000;
}
.gps-instructions { font-size: 12px; color: rgba(255,255,255,0.6); }
.gps-targets { display: flex; gap: 8px; }
.gps-target-btn {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
}
.gps-target-btn.active {
  background: var(--g600);
  border-color: var(--g400);
}
/* Leaflet player marker */
.player-dot {
  width: 18px;
  height: 18px;
  background: #2196F3;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.player-pulse {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid #2196F3;
  border-radius: 50%;
  top: -11px; left: -11px;
  animation: pulse 2s infinite;
  opacity: 0.5;
}
@keyframes pulse {
  0%   { transform: scale(0.8); opacity: 0.5; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(0.8); opacity: 0; }
}
.pin-marker-div {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

/* ─── Round Summary ─── */
.summary-header {
  background: linear-gradient(135deg, var(--g800), var(--g600));
  padding: 20px 16px;
  text-align: center;
  color: white;
  margin-bottom: 4px;
}
.summary-score {
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
}
.summary-to-par {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  margin: 2px 0;
}
.summary-course { font-size: 15px; color: rgba(255,255,255,0.85); }
.summary-date   { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 2px; }

/* ─── Differential Card ─── */
.differential-card {
  background: var(--white);
  border-radius: var(--radius);
  margin: 0 12px 8px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 1px 4px var(--shadow);
  border-left: 4px solid var(--g600);
}
.diff-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.diff-value { font-size: 24px; font-weight: 800; color: var(--g700); margin-top: 2px; }

/* ─── Scoring Breakdown ─── */
.scoring-breakdown {
  display: flex;
  gap: 6px;
  padding: 0 12px;
  flex-wrap: wrap;
}
.score-type-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  min-width: 52px;
  color: white;
}
.score-type-chip .stc-count { font-size: 20px; font-weight: 800; line-height: 1; }
.score-type-chip .stc-label { font-size: 10px; margin-top: 2px; opacity: 0.9; }

/* ─── Scorecard ─── */
.scorecard-wrapper {
  margin: 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 500px;
}
.scorecard-table th {
  background: var(--g800);
  color: white;
  padding: 6px 5px;
  text-align: center;
  font-weight: 600;
}
.scorecard-table td {
  padding: 6px 5px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.scorecard-table tr:nth-child(even) td { background: var(--g50); }
.scorecard-table .total-row td { font-weight: 700; background: var(--g100); }
.sc-hole { font-weight: 700; color: var(--g800); }
.sc-score-cell {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* ─── Filter Bar ─── */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
}
.filter-bar .form-select { flex: 1; }

/* ─── Stats Tabs ─── */
.stats-tabs {
  overflow-x: auto;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  flex-wrap: nowrap;
  display: flex;
}
.stats-tabs .nav-item { flex-shrink: 0; }
.stats-tabs .nav-link {
  color: var(--text3);
  font-size: 13px;
  padding: 8px 12px;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  white-space: nowrap;
}
.stats-tabs .nav-link.active {
  color: var(--g700);
  border-bottom-color: var(--g700);
  font-weight: 700;
}
.stats-tab-content { display: none; }
.stats-tab-content.active { display: block; }

/* ─── Course Setup Table ─── */
.hole-setup-row {
  display: grid;
  grid-template-columns: 28px 90px 70px 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}
.hole-setup-row .hole-num {
  font-weight: 700;
  color: var(--text3);
  text-align: center;
}
.hole-setup-row select,
.hole-setup-row input {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 13px;
  width: 100%;
  background: white;
}

/* Tee ratings grid */
.tee-ratings-grid { display: flex; flex-direction: column; gap: 6px; }
.tee-rating-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.tee-rating-row .tee-label {
  font-weight: 700;
  font-size: 13px;
  padding: 6px;
  border-radius: 6px;
  text-align: center;
  color: white;
}

/* ─── Club Set ─── */
.club-set-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; margin-bottom: 12px; }
.club-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--g50);
  border: 1.5px solid var(--g200);
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.club-chip:active { background: var(--g100); }
.club-chip-body { display: flex; flex-direction: column; gap: 2px; }
.club-chip-name { font-size: 14px; font-weight: 600; color: var(--g700); }
.club-chip-meta { font-size: 12px; color: var(--text3); }
.club-chip-empty { font-style: italic; }
.club-set-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.club-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 18px;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

/* ─── Bottom Sheet ─── */
.bottom-sheet-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.bottom-sheet {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 40px;
  width: 100%; max-width: 480px;
  max-height: 85vh; overflow-y: auto;
}
.bottom-sheet-handle {
  width: 40px; height: 4px;
  background: var(--g200); border-radius: 2px;
  margin: 0 auto 16px;
}
.bottom-sheet-title {
  font-size: 18px; font-weight: 700;
  color: var(--g800); text-align: center; margin-bottom: 4px;
}

/* ─── Tendency buttons ─── */
.tendency-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.tendency-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--g200);
  border-radius: 20px;
  background: white;
  font-size: 13px; font-weight: 500;
  color: var(--g700);
  cursor: pointer;
  transition: all 0.15s;
}
.tendency-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; color: var(--g200); }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast-msg {
  background: var(--g900);
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-msg.success { background: var(--g700); }
.toast-msg.error   { background: var(--red); }

/* ─── Modal overrides ─── */
.modal-content { border-radius: var(--radius); border: none; }
.modal-header { background: var(--g800); color: white; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header .btn-close { filter: invert(1); }

/* ─── Resume Banner ─── */
.resume-banner {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  margin: 0 12px 8px;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(201,162,39,0.3);
  cursor: pointer;
}
.resume-banner-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--g900);
}
.resume-banner-sub {
  font-size: 12px;
  color: rgba(13,43,26,0.7);
  margin-top: 2px;
}

/* ─── Responsive ─── */
@media (min-width: 600px) {
  main, .app-header, .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
  }
  main { left: 50%; }
  .app-header, .bottom-nav { left: 50%; }
}

/* ─── Player chips row (round setup) ─── */
.player-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--g50);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
}
.player-chip.selected {
  background: var(--g700);
  border-color: var(--g700);
  color: var(--white);
}
.me-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--gold);
  color: var(--g900);
  border-radius: 6px;
  padding: 1px 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Game mode grid (round setup) ─── */
.gamemode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px;
}
.gamemode-btn {
  flex: 1 1 calc(33% - 8px);
  min-width: 80px;
  padding: 9px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
  text-align: center;
}
.gamemode-btn.active {
  background: var(--g700);
  border-color: var(--g700);
  color: var(--white);
}

/* ─── Course autocomplete suggestions ─── */
.course-suggestions {
  position: absolute;
  top: calc(100% - 4px);
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--g300);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 999;
  max-height: 280px;
  overflow-y: auto;
}
.cs-item {
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--g100);
  transition: background 0.1s;
}
.cs-item:last-child { border-bottom: none; }
.cs-item:hover { background: var(--g50); }
.cs-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--g900);
}
.cs-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.cs-dist {
  color: var(--g600);
  font-weight: 600;
}
.cs-selected-loc {
  font-size: 13px;
  color: var(--g600);
  padding: 4px 16px 8px;
  font-weight: 500;
}
.cs-loading, .cs-empty {
  color: var(--text3);
  font-size: 13px;
  cursor: default;
  padding: 12px 16px;
}
.cs-loading:hover, .cs-empty:hover { background: none; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 4px; }
