/* ── Reset & variables ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:             #0d0d0d;
  --surface:        #1a1a2e;
  --surface2:       #16213e;
  --border:         #2a2a3e;
  --accent:         #e94560;
  --success:        #4ecca3;
  --warning:        #f5a623;
  --hole-btn:       #0f3460;
  --club-sel:       #e94560;
  --text:           #ffffff;
  --text-muted:     #8a8a9a;
  --panel-bg:       rgba(13,13,13,0.88);
}

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Screens ──────────────────────────────────────────────────── */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ── Welcome ──────────────────────────────────────────────────── */
.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  gap: 1.25rem;
  background: linear-gradient(160deg, #0d0d0d 0%, #1a1a2e 100%);
}

.app-logo { font-size: 3rem; }

.app-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: -0.5rem;
}

.form-group { width: 100%; max-width: 340px; }

.form-group label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.1s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { opacity: 0.82; transform: scale(0.97); }

.btn-large        { width: 100%; max-width: 340px; padding: 1.1rem; font-size: 1.05rem; }
.btn-large-outline{ width: 100%; max-width: 340px; padding: 1rem; font-size: 1.05rem; background: transparent; border: 2px solid var(--border); color: var(--text-muted); }
.btn-primary      { background: var(--accent); color: #fff; }
.btn-secondary    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); padding: 0.875rem 1.5rem; }
.btn-success      { background: var(--success); color: #000; padding: 0.9rem 2rem; font-size: 1rem; }
.btn-danger       { background: #7b2235; color: #fff; }
.btn-sm           { padding: 0.5rem 1rem; font-size: 0.82rem; }
.btn-icon         { background: none; color: var(--text); font-size: 1.4rem; padding: 0.25rem 0.5rem; }

/* ── Map ──────────────────────────────────────────────────────── */
#map { position: absolute; inset: 0; }

/* ── GPS indicator ────────────────────────────────────────────── */
.gps-indicator {
  position: absolute;
  top: 72px;
  right: 12px;
  background: rgba(0,0,0,0.72);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.68rem;
  color: var(--text-muted);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
}
.gps-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

/* ── Round header ─────────────────────────────────────────────── */
.round-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  padding-top: max(0.7rem, env(safe-area-inset-top));
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  gap: 0.5rem;
}

.hole-control { display: flex; align-items: center; gap: 4px; }

.hole-arrow {
  background: var(--hole-btn);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  line-height: 1;
}
.hole-arrow:active { opacity: 0.7; }

.hole-display, .shot-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
}

.info-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

#current-hole, #current-shot-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}

/* ── Shot message banner ──────────────────────────────────────── */
.shot-message {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(233,69,96,0.92);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  z-index: 10;
  max-width: 86vw;
  white-space: normal;
  pointer-events: none;
}

.hidden { display: none !important; }

/* ── Bottom panel ─────────────────────────────────────────────── */
.bottom-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* ── Club selector ────────────────────────────────────────────── */
.club-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.club-scroll-wrapper::-webkit-scrollbar { display: none; }

.club-selector { display: flex; gap: 6px; padding: 2px 0; }

.club-group-label {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 3px 10px;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.club-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  min-height: 44px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.club-btn.selected {
  background: var(--club-sel);
  border-color: var(--club-sel);
  color: #fff;
}
.club-btn:active { opacity: 0.75; }

/* ── Action button ────────────────────────────────────────────── */
.btn-action {
  width: 100%;
  padding: 1.1rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  min-height: 56px;
}
.btn-action.marking {
  background: var(--success);
  color: #000;
}
.btn-action:active { opacity: 0.82; transform: scale(0.98); }

/* ── Shot confirmation card ───────────────────────────────────── */
.shot-confirm-card {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: rgba(0,0,0,0.55);
  z-index: 20;
}
.shot-confirm-content {
  width: 100%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 1.5rem 1.25rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}
.shot-summary {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.shot-confirm-buttons {
  display: flex;
  gap: 0.75rem;
}
.shot-confirm-buttons .btn { flex: 1; padding: 1rem; font-size: 1rem; }

/* ── Screen header ────────────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.screen-header h2 { flex: 1; font-size: 1.1rem; }

/* ── History ──────────────────────────────────────────────────── */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg);
}

.history-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  border: 1px solid var(--border);
  active: opacity 0.8;
}
.history-card:active { opacity: 0.75; }
.history-card-title { font-weight: 700; font-size: 1rem; }
.history-card-meta { color: var(--text-muted); font-size: 0.82rem; display: flex; gap: 1rem; }
.history-empty { color: var(--text-muted); text-align: center; margin-top: 3rem; font-size: 0.95rem; }

/* ── Analysis ─────────────────────────────────────────────────── */
.analysis-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--bg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
.stat-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.8rem 0.5rem;
  text-align: center;
  border: 1px solid var(--border);
}
.stat-value { font-size: 1.45rem; font-weight: 800; }
.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.chart-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border);
}
.chart-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

/* ── Mapbox overrides ─────────────────────────────────────────── */
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right { bottom: 165px !important; }
.mapboxgl-ctrl-logo { display: none !important; }
