:root {
  --bg: #070b09;
  --bg-2: #0d1410;
  --panel: rgba(16, 24, 20, 0.92);
  --panel-solid: #121a16;
  --line: rgba(224, 184, 74, 0.22);
  --text: #f4f1e8;
  --muted: #9aa89c;
  --gold: #e0b84a;
  --gold-2: #c9a227;
  --green: #3dcf8a;
  --water: #4db2e0;
  --warm: #e08a4a;
  --pin: #1a1408;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --top: env(safe-area-inset-top, 0px);
  --bot: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  font-size: 16px;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Noto Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; touch-action: manipulation; }

#app {
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

.topbar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 20;
  padding: calc(10px + var(--top)) 12px 10px;
  background: linear-gradient(180deg, rgba(7, 11, 9, 0.96), rgba(7, 11, 9, 0.88));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.topbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 650;
}

.chip-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 650;
  font-size: 0.86rem;
}

.chip[aria-pressed="true"] {
  background: var(--gold);
  color: var(--pin);
  border-color: var(--gold);
}

.chip-gold {
  border-color: rgba(224, 184, 74, 0.45);
  color: var(--gold);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn.solid {
  background: var(--panel-solid);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  font-size: 1.25rem;
  font-weight: 700;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 12px;
  z-index: 40;
  min-width: 230px;
  background: var(--panel-solid);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.menu button {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.menu button:last-child { border-bottom: 0; }

.calibrate-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  top: auto;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 14px;
  background: #2a2210;
  border: 1px solid rgba(224, 184, 74, 0.4);
  box-shadow: var(--shadow);
}
.calibrate-banner p { margin: 0; font-size: 0.86rem; }

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--bg);
}

.map-status {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  color: var(--muted);
}
.map-status strong { color: var(--text); display: block; margin-bottom: 8px; }

.map-fab {
  position: absolute;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--bot) + 16px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bottomnav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--nav-h) + var(--bot));
  padding-bottom: var(--bot);
  background: rgba(10, 14, 12, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}
.bottomnav button {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  min-height: var(--nav-h);
}
.bottomnav button svg { width: 22px; height: 22px; }
.bottomnav button:active { color: var(--gold); }

.backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.45);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  max-height: min(88dvh, 760px);
  background: var(--panel-solid);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(110%);
  transition: transform 0.38s var(--ease);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--bot);
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  margin: 10px auto 0;
  flex: none;
}

.sheet-body {
  overflow: auto;
  padding: 8px 18px 20px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sheet-head h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.sheet-kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.close-x {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.3rem;
  line-height: 1;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
}
.badge.par3 { color: var(--water); }
.badge.par4 { color: var(--gold); }
.badge.par5 { color: var(--green); }

.block { margin: 0 0 16px; }
.block h3 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.block p { margin: 0; line-height: 1.45; font-size: 0.95rem; }

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.feature-list li {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(77, 178, 224, 0.1);
  color: #d4eef8;
  font-size: 0.82rem;
  font-weight: 600;
}

.hole-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.hole-nav button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 650;
}

.score-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.score-strip div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.score-strip strong { display: block; font-size: 0.95rem; }
.score-strip span { color: var(--muted); font-size: 0.72rem; }

.hole-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.hole-card {
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 8px;
  text-align: left;
}
.hole-card b { display: block; font-size: 1.05rem; }
.hole-card span { color: var(--muted); font-size: 0.75rem; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li {
  position: relative;
  padding: 0 0 18px 18px;
  border-left: 2px solid rgba(224, 184, 74, 0.35);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
}
.timeline button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
}
.timeline .when {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.timeline strong { display: block; margin: 2px 0 4px; }
.timeline p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }

.tip-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 8px;
}
.tip-card strong { display: block; margin-bottom: 4px; }
.tip-card span { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }

.callout {
  background: rgba(224, 184, 74, 0.1);
  border: 1px solid rgba(224, 184, 74, 0.28);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 12px 0;
  line-height: 1.45;
}

.muted { color: var(--muted); }
.fine { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

.install-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--bot) + 12px);
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-radius: 16px;
  background: var(--panel-solid);
  border: 1px solid rgba(224, 184, 74, 0.3);
  box-shadow: var(--shadow);
}
.install-bar div { flex: 1; }
.install-bar strong { display: block; font-size: 0.9rem; }
.install-bar span { font-size: 0.75rem; color: var(--muted); }

.coach {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: end center;
  padding: 16px 16px calc(var(--nav-h) + var(--bot) + 16px);
}
.coach-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel-solid);
  border-radius: 20px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.coach-card ul {
  margin: 10px 0 16px;
  padding-left: 18px;
  line-height: 1.5;
  color: var(--text);
}
.coach-card li { margin: 0 0 8px; }
.coach-card .chip { width: 100%; }

.leaflet-container {
  background: var(--bg);
  font: inherit;
}
.leaflet-control-zoom,
.leaflet-control-attribution { display: none !important; }

.marker-wrap,
.leaflet-div-icon.marker-wrap {
  background: none !important;
  border: 0 !important;
}
.hole-pin {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--pin);
  background: linear-gradient(180deg, #f0d78c, var(--gold-2));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(7, 11, 9, 0.85);
}
.hole-pin.par-3 { background: linear-gradient(180deg, #8fd4f0, #2f8fbd); color: #062033; }
.hole-pin.par-5 { background: linear-gradient(180deg, #7ee0ad, #2ea56c); color: #062816; }
.hole-pin.is-spot {
  box-shadow: 0 0 0 3px var(--warm), 0 4px 14px rgba(0, 0, 0, 0.45);
}

.spot-pin {
  width: 100%;
  height: 100%;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--warm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
}
.spot-pin span {
  transform: rotate(45deg);
  font-size: 0.7rem;
}

.trophy-pin {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, #f0d78c, var(--gold-2));
  color: var(--pin);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.club-pin {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: #f4f1e8;
  color: #1a1408;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  font-size: 0.7rem;
  font-weight: 800;
}

.start-pin {
  min-width: 58px;
  height: 26px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--pin);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: grid;
  place-items: center;
  padding: 0 8px;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--warm);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  from { transform: scale(0.85); opacity: 0.8; }
  to { transform: scale(1.35); opacity: 0; }
}

.noscript { padding: 24px; }

[hidden] { display: none !important; }

@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; width: min(480px, 100%); transform: translate(-50%, 110%); }
  .sheet.open { transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .backdrop, .hole-pin { transition: none; }
  .pulse::after { animation: none; }
}
