:root {
  --bg: #0a0f14;
  --bg-elevated: #111920;
  --surface: #151d26;
  --border: rgba(148, 163, 184, 0.14);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #3ddc84;
  --accent-dim: rgba(61, 220, 132, 0.15);
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --tab-h: 64px;
  --header-h: 52px;
}

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

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

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(61, 220, 132, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 100%, rgba(56, 189, 248, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono,
.text-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.text-muted {
  color: var(--text-muted);
}

.text-small {
  font-size: 0.8125rem;
  line-height: 1.45;
}

.app-frame {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid transparent;
}

.top-bar {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.top-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.logo--img {
  display: block;
  object-fit: contain;
  border-radius: 10px;
}

.top-bar__titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.top-bar__name {
  font-weight: 700;
  font-size: 0.95rem;
}

.pill {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
}

.pill--muted {
  color: var(--text-muted);
  font-weight: 500;
  max-width: 160px;
}

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Auth */
.app-frame.is-auth-screen {
  background: var(--bg);
}

.app-frame.is-auth-screen .top-bar {
  display: none;
}

.auth-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
  overflow-y: auto;
  min-height: 0;
}

.auth-layout {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
}

.auth-mascot {
  width: min(68vw, 220px);
  margin: 0 auto;
  aspect-ratio: 1;
  max-height: 34vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.auth-mascot__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.auth-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-input:focus {
  outline: none;
  border-color: rgba(61, 220, 132, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-panel {
  display: none;
  width: 100%;
}

.auth-panel.is-active {
  display: block;
}

.auth-panel-title {
  margin: 0;
}

.auth-actions {
  margin-top: 8px;
}

.auth-switch {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-switch__label {
  margin-right: 6px;
}

.auth-switch__btn {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-switch__btn:hover {
  color: #6ee7a8;
}

.auth-switch__btn--solo {
  display: block;
  margin: 0 auto;
}

.auth-panel-lead {
  margin: 0 0 14px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.btn-auth {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #052e16;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 8px 24px rgba(61, 220, 132, 0.22);
}

.btn-auth:hover {
  filter: brightness(1.05);
}

.btn-auth:active {
  transform: scale(0.98);
}

.btn-golf-ball {
  flex: 0 0 auto;
  width: min(39vw, 132px);
  height: min(39vw, 132px);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  font-family: "Arvo", Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(0.62rem, 2.5vw, 0.72rem);
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #5c1f1f;
  text-transform: uppercase;
  padding: 8px;
  text-align: center;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.5),
    inset 0 -10px 22px rgba(0, 0, 0, 0.14),
    inset 0 3px 8px rgba(255, 255, 255, 0.9);
  background-color: #e8e8e8;
  background-image:
    radial-gradient(ellipse 85% 55% at 35% 22%, rgba(255, 255, 255, 0.97) 0%, transparent 48%),
    radial-gradient(circle at 72% 38%, rgba(0, 0, 0, 0.07) 0%, transparent 28%),
    radial-gradient(circle, rgba(60, 60, 60, 0.14) 1.2px, transparent 1.6px),
    radial-gradient(circle, rgba(50, 50, 50, 0.11) 1px, transparent 1.5px),
    linear-gradient(168deg, #fafafa 0%, #e2e2e2 42%, #c6c6c6 100%);
  background-size: 100% 100%, 100% 100%, 10px 10px, 10px 10px, 100% 100%;
  background-position: 0 0, 0 0, 1px 2px, 5px 6px, 0 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-golf-ball:hover {
  filter: brightness(1.03);
}

.btn-golf-ball:active {
  transform: scale(0.96);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.45),
    inset 0 -6px 16px rgba(0, 0, 0, 0.12),
    inset 0 2px 6px rgba(255, 255, 255, 0.85);
}

.auth-api-hint {
  margin: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.65;
  text-align: center;
  max-width: 100%;
  word-break: break-all;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

input,
.select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

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

.label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: #052e16;
}

.btn--secondary {
  background: #334155;
  color: var(--text);
}

.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--sm {
  padding: 8px 12px;
  font-size: 0.8125rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.btn-row--tight {
  margin-top: 8px;
}

.osm-hint {
  margin: 10px 0 0;
}

.osm-hint strong {
  font-weight: 600;
  color: var(--text);
}

.osm-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.osm-results {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.osm-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.osm-row__text {
  flex: 1;
  min-width: 0;
}

.osm-row__title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
}

.osm-row__sub {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

/* Logged-in: one tab at a time */
.app-logged-in {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.app-frame.clubhouse-home .top-bar {
  display: none;
}

/* Bottom nav stays visible over course finder (see z-index below). */

/* Clubhouse (home) */
.tab-panel--clubhouse {
  background: var(--bg-elevated);
}

.panel-scroll--clubhouse {
  padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-elevated);
}

.clubhouse-header {
  position: relative;
  margin-bottom: 8px;
}

.clubhouse-messages {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.clubhouse-messages:hover {
  background: rgba(255, 255, 255, 0.06);
}

.clubhouse-stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 44px 0 0;
}

.clubhouse-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.clubhouse-stat__circle {
  width: min(22vw, 88px);
  height: min(22vw, 88px);
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.clubhouse-stat__value {
  font-family: "Arvo", Georgia, serif;
  font-size: clamp(1rem, 4.2vw, 1.35rem);
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.clubhouse-stat__label {
  font-family: "Arvo", Georgia, serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
  letter-spacing: 0.02em;
}

.clubhouse-feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.clubhouse-empty {
  margin: 24px 0;
  text-align: center;
  font-family: "Arvo", Georgia, serif;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
}

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.feed-card__media {
  aspect-ratio: 16 / 10;
  background: #1a1a1a center / cover no-repeat;
  background-image: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
}

.feed-card__media--brand {
  background-image: url("../images/golfolotl.png");
}

.feed-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  gap: 10px;
}

.feed-card__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feed-card__action {
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.15rem;
  line-height: 1;
}

.feed-card__action--like {
  color: #e53935;
}

.feed-card__score {
  font-family: "Arvo", Georgia, serif;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
}

.feed-card__caption {
  padding: 0 12px 14px;
  font-family: "Arvo", Georgia, serif;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #fff;
}

.feed-card__caption strong {
  font-weight: 700;
}

.clubhouse-kicker {
  font-weight: 700;
}

.play-tab-finder-btn {
  margin-bottom: 12px;
}

/* Course finder overlay — sits below tab bar (see .app-logged-in > .tab-bar z-index) */
.course-finder-page {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  color: var(--text);
}

.course-finder-page.hidden {
  display: none !important;
}

.course-finder-page__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 20, 0.96);
}

.course-finder-page__back {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

.course-finder-page__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.course-finder-page__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px));
}

/* Clubhouse tab bar + Play ball */
.tab-bar--clubhouse {
  position: relative;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  min-height: calc(var(--tab-h) + 28px);
}

.app-logged-in > .tab-bar {
  flex-shrink: 0;
  position: relative;
  z-index: 60;
}

.tab-bar__cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.tab-bar__cluster--right {
  justify-content: flex-end;
}

.tab-bar__icon-btn {
  flex: 0 0 auto;
  width: 52px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #6b7280;
  cursor: pointer;
}

.tab-bar__icon-btn.tab-bar__btn.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tab-bar__svg {
  width: 26px;
  height: 26px;
  display: block;
}

.tab-bar__play-slot {
  position: relative;
  flex: 0 0 auto;
  width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0;
  transform: translateY(-22px);
}

.tab-bar__play-ball {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  font-family: "Arvo", Georgia, serif;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #111;
  text-transform: uppercase;
  padding: 8px;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.55),
    inset 0 -10px 20px rgba(0, 0, 0, 0.12),
    inset 0 3px 8px rgba(255, 255, 255, 0.9);
  background-color: #eaeaea;
  background-image:
    radial-gradient(ellipse 85% 55% at 35% 22%, rgba(255, 255, 255, 0.97) 0%, transparent 48%),
    radial-gradient(circle at 72% 38%, rgba(0, 0, 0, 0.07) 0%, transparent 28%),
    radial-gradient(circle, rgba(60, 60, 60, 0.14) 1.2px, transparent 1.6px),
    radial-gradient(circle, rgba(50, 50, 50, 0.11) 1px, transparent 1.5px),
    linear-gradient(168deg, #fafafa 0%, #e2e2e2 42%, #c6c6c6 100%);
  background-size: 100% 100%, 100% 100%, 9px 9px, 9px 9px, 100% 100%;
  background-position: 0 0, 0 0, 1px 2px, 5px 6px, 0 0;
}

.tab-bar__play-ball:active {
  transform: scale(0.96);
}

.tab-bar__play-text {
  display: block;
  line-height: 1.1;
}

.tab-bar__tee {
  width: 36px;
  height: 14px;
  margin-top: -6px;
  background: linear-gradient(180deg, #f5f5f5 0%, #d0d0d0 100%);
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.tab-bar--clubhouse.tab-bar {
  flex: 0 0 auto;
}

.tab-bar--clubhouse .tab-bar__icon-btn.tab-bar__btn {
  flex: 0 0 auto;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
}

.tab-bar--clubhouse .tab-bar__icon-btn.tab-bar__btn.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tab-bar--clubhouse .tab-bar__icon-btn.tab-bar__btn.is-active::after {
  display: none;
}

.tab-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.tab-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel.is-active {
  display: flex;
  flex-direction: column;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 20px;
  -webkit-overflow-scrolling: touch;
}

.panel-scroll--map {
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
}

.screen-head {
  margin-bottom: 14px;
}

.screen-head--tight {
  margin-bottom: 10px;
}

.screen-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.screen-sub {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-msg {
  margin: 8px 0 0;
  min-height: 1.2em;
}

.status-msg.is-error {
  color: var(--danger);
}

.status-msg.is-ok {
  color: var(--accent);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.map-controls {
  padding: 14px 16px 12px;
}

.yardage-readout {
  margin: 12px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.yardage-readout--secondary {
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}

.leaflet-control-layers {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}

.leaflet-control-layers-expanded {
  padding: 8px 10px !important;
}

.map-canvas {
  height: min(52vh, 420px);
  min-height: 220px;
  width: 100%;
  background: #05080c;
}

.tab-panel--map.is-active {
  flex-direction: column;
}

.tab-panel--map .panel-scroll--map {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-panel--map .card--flush {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-panel--map .map-canvas {
  flex: 1;
  min-height: 240px;
  height: auto;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
}

.tab-bar {
  flex: 0 0 var(--tab-h);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 15, 20, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.tab-bar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 6px 4px;
  position: relative;
}

.tab-bar__btn.is-active {
  color: var(--accent);
  background: var(--accent-dim);
}

.tab-bar__btn.is-active::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.tab-bar__ico {
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0.9;
}

/* Feed */
.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-list li {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.feed-meta {
  display: block;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

th,
td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modal */
.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  max-width: 400px;
  width: calc(100% - 24px);
}

.modal--wide {
  max-width: min(440px, 100% - 24px);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.modal__body {
  padding: 20px;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal__title {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.modal__head .modal__title {
  margin: 0;
}

.camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 50vh;
  margin: 12px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  touch-action: none;
}

.rf-zoom-btns {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}

.rf-zoom-btn {
  min-width: 88px;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.rf-zoom-btn:active {
  background: rgba(61, 220, 132, 0.85);
  border-color: #3ddc84;
}

#video,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#overlay {
  pointer-events: none;
}

.toast {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(400px, calc(100% - 24px));
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.leaflet-container {
  font-family: var(--font);
}

.label--spaced {
  margin-top: 1.25rem;
}

.select--inline {
  margin-bottom: 10px;
  width: 100%;
  max-width: 320px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.settings-card__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.settings-details {
  margin-top: 6px;
  padding: 8px 0 4px;
  border-top: 1px dashed var(--border);
}

.settings-details > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.settings-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr auto;
  gap: 6px;
  align-items: center;
}

.settings-row--add {
  margin-bottom: 6px;
}

.settings-row input,
.settings-row select {
  min-width: 0;
}

.settings-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.settings-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-item__title {
  font-weight: 600;
  margin: 0;
  word-break: break-word;
}

.settings-item__sub {
  font-size: 0.8rem;
  color: var(--muted, #888);
}

.settings-item__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-item__editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.settings-item__editor.hidden {
  display: none;
}

.settings-holes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.settings-hole {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  gap: 4px;
  align-items: center;
  font-size: 0.85rem;
}

.settings-hole input {
  width: 100%;
  padding: 4px 6px;
}

.settings-hole__label {
  font-weight: 600;
}

.settings-list:empty::before {
  content: "Nothing yet.";
  color: var(--muted, #888);
  font-size: 0.85rem;
}

.tab-bar__sidebar-brand {
  display: none;
}

/* —— Tablet: centered phone-style shell —— */
@media (min-width: 600px) {
  body {
    overflow: auto;
  }

  .app-frame {
    max-width: 520px;
    height: min(100dvh, 920px);
    margin: max(16px, env(safe-area-inset-top)) auto max(16px, env(safe-area-inset-bottom));
    border-radius: 20px;
    border-color: var(--border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    overflow: hidden;
  }

  .auth-layout {
    max-width: 400px;
  }

  .auth-mascot {
    width: 200px;
    max-height: none;
  }
}

/* —— Desktop: wide layout + sidebar nav —— */
@media (min-width: 960px) {
  .app-frame {
    max-width: min(1280px, calc(100vw - 48px));
    height: min(100dvh, 900px);
    margin: 24px auto;
  }

  /* Auth: split brand + form card */
  .auth-screen {
    padding: 48px 56px;
  }

  .auth-layout {
    max-width: 920px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, 400px);
    gap: 48px;
    align-items: center;
  }

  .auth-mascot {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    max-width: 320px;
    max-height: 320px;
    margin: 0 auto;
    justify-self: center;
  }

  .auth-panel,
  .auth-api-hint {
    grid-column: 2;
  }

  .auth-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 28px 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  }

  .auth-api-hint {
    justify-self: stretch;
  }

  /* Logged-in: sidebar + main */
  .app-logged-in {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
  }

  .tab-viewport {
    grid-column: 2;
    grid-row: 1;
  }

  .app-logged-in > .tab-bar {
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    height: auto;
    min-height: 0;
  }

  .tab-bar--clubhouse {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: 20px 14px;
    min-height: 0;
    border-top: none;
    border-right: 1px solid var(--border);
    padding-bottom: 20px;
  }

  .tab-bar__sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 20px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  .tab-bar__sidebar-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: contain;
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .tab-bar__sidebar-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-align: center;
  }

  .tab-bar__cluster {
    flex-direction: column;
    flex: 0 0 auto;
    gap: 4px;
    width: 100%;
  }

  .tab-bar__cluster--right {
    justify-content: flex-start;
  }

  .tab-bar__icon-btn {
    width: 100%;
    height: 48px;
    justify-content: flex-start;
    padding-left: 14px;
    gap: 10px;
    border-radius: var(--radius-sm);
  }

  .tab-bar__icon-btn::after {
    content: attr(aria-label);
    font-size: 0.82rem;
    font-weight: 600;
    color: inherit;
  }

  .tab-bar__play-slot {
    width: 100%;
    transform: none;
    margin: 12px 0 4px;
  }

  .tab-bar__play-ball {
    width: 100%;
    max-width: none;
    height: 52px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
  }

  .tab-bar__tee {
    display: none;
  }

  .app-frame:not(.is-auth-screen) .top-bar {
    display: flex;
  }

  .panel-scroll,
  .panel-scroll--clubhouse {
    padding-left: 24px;
    padding-right: 24px;
  }

  .panel-scroll--clubhouse {
    padding-bottom: 24px;
  }

  .clubhouse-feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .clubhouse-stat__circle {
    width: 88px;
    height: 88px;
  }

  .clubhouse-stats {
    max-width: 520px;
    margin: 0 auto;
    padding-right: 0;
  }

  .clubhouse-messages {
    right: 24px;
  }

  #pageProfile .panel-scroll {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-content: start;
  }

  #pageProfile .screen-head {
    grid-column: 1 / -1;
  }

  .tab-panel--map .map-canvas {
    min-height: 420px;
  }

  .course-finder-page__body {
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 24px;
  }

  .toast {
    top: 32px;
    max-width: 420px;
  }
}

/* —— Large desktop —— */
@media (min-width: 1200px) {
  .clubhouse-feed {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #pageProfile .panel-scroll {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Visual rangefinder — dead simple */
.modal--rangefinder {
  width: min(100vw - 12px, 480px);
  max-width: none;
  padding: 0;
  border: none;
  background: #0a0f14;
}

.modal--rangefinder::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.rf-simple {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px max(18px, env(safe-area-inset-bottom));
}

.rf-simple__top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rf-hint {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: #e8eef4;
}

.rf-done-btn {
  flex-shrink: 0;
  min-width: 72px;
  min-height: 48px;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  background: #1e293b;
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.rf-done-btn:active {
  background: #334155;
}

.rf-hero {
  text-align: center;
  padding: 6px 0 2px;
}

.rf-hero__num {
  display: block;
  font-size: clamp(3.25rem, 18vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent);
}

.rf-hero__label {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
}

.rf-camera {
  aspect-ratio: 3 / 4;
  max-height: min(58vh, 520px);
  margin: 0;
  border-radius: 16px;
  border-width: 2px;
}

.rf-camera-btn {
  width: 100%;
  min-height: 56px;
  padding: 16px 20px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #04120a;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.rf-camera-btn:active {
  filter: brightness(0.92);
}

@media (min-width: 960px) {
  .modal--rangefinder {
    width: min(520px, calc(100vw - 40px));
  }

  .rf-camera {
    max-height: 52vh;
  }
}

@media (max-width: 480px) {
  .settings-row {
    grid-template-columns: 1fr 1fr;
  }
  .settings-row > button {
    grid-column: 1 / -1;
  }

  .auth-screen {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal--rangefinder {
    width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .rf-simple {
    padding-top: max(14px, env(safe-area-inset-top));
  }
}
