:root {
  --bg: #0b1320;
  --panel: #111c2f;
  --panel-2: #18253c;
  --ink: #e7eef7;
  --ink-dim: #93a4bb;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --warn: #fbbf24;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

/* Rifle scope loading screen */
.scope-loader {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
  animation: scopeFadeOut 0.8s ease-out forwards;
  animation-delay: 3.5s;
}
.scope-loader.hidden { display: none; }

.scope-background {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(11, 19, 32, 0.98) 0%, rgba(20, 33, 54, 0.98) 100%);
  overflow: hidden;
  animation: scopeBgFade 0.6s ease-out forwards;
  animation-delay: 3.5s;
}

.scope-waves {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0.4;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 20px,
      rgba(14, 165, 233, 0.15) 20px,
      rgba(14, 165, 233, 0.15) 22px,
      transparent 22px,
      transparent 40px,
      rgba(14, 165, 233, 0.08) 40px,
      rgba(14, 165, 233, 0.08) 41px
    );
  animation: scopeWaveFlow 4s ease-in-out infinite;
  animation-delay: 0.2s;
  background-size: 100% 80px;
  background-position: 0 0;
}

.scope-container {
  position: relative;
  z-index: 1;
  animation: scopeWobble 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.scope-container.drift {
  animation: scopeWobble 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
            scopeDrift 3s ease-in-out forwards 0.3s;
}

.scope-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #0ea5e9;
  opacity: 0;
  animation: scopeTitleFade 0.8s ease-out forwards 1.8s;
  text-shadow: 0 0 8px rgba(14, 165, 233, 0.5);
  position: relative;
  z-index: 2;
  margin-top: 16px;
}

.scope-reticle {
  width: 160px;
  height: 160px;
  position: relative;
  z-index: 1;
  animation: scopeZoom 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards,
            scopeFocus 3s ease-in-out forwards;
}

/* Outer ring rotates clockwise */
.scope-outer {
  animation: scopeRotateCW 6s linear infinite;
  transform-origin: 100px 100px;
}

/* Crosshairs pulse and brighten */
.scope-crosshairs {
  animation: scopePulse 1.2s ease-in-out infinite 0.3s;
}

/* Inner circle rotates counter-clockwise */
.scope-inner {
  animation: scopeRotateCCW 4s linear infinite;
  transform-origin: 100px 100px;
}

/* Center dot has a subtle glow */
.scope-center {
  animation: scopeDotGlow 1.5s ease-in-out infinite 0.5s;
}

@keyframes scopeWobble {
  0% {
    transform: scale(4) translateX(-15%) translateY(-15%) rotate(0deg);
    opacity: 0.2;
  }
  15% {
    transform: scale(1.2) translateX(-2px) translateY(2px) rotate(-1deg);
  }
  30% {
    transform: scale(0.95) translateX(3px) translateY(-1px) rotate(0.5deg);
  }
  45% {
    transform: scale(1.05) translateX(-1px) translateY(-2px) rotate(-0.3deg);
  }
  100% {
    transform: scale(1) translateX(0) translateY(0) rotate(0deg);
    opacity: 1;
  }
}

@keyframes scopeZoom {
  0% {
    transform: scale(4) translateX(-15%) translateY(-15%);
    opacity: 0.2;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    transform: scale(1) translateX(0) translateY(0);
    opacity: 1;
  }
}

@keyframes scopeFocus {
  0% {
    filter: drop-shadow(0 0 25px rgba(56, 189, 248, 0.2)) blur(3px);
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.3)) blur(1px);
  }
  100% {
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.5)) blur(0px);
  }
}

@keyframes scopeRotateCW {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes scopeRotateCCW {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

@keyframes scopePulse {
  0%, 100% {
    stroke-width: 1.5;
    opacity: 0.7;
    filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.3));
  }
  50% {
    stroke-width: 2;
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
  }
}

@keyframes scopeDotGlow {
  0%, 100% {
    r: 2;
    fill-opacity: 0.7;
    filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.4));
  }
  50% {
    r: 2.5;
    fill-opacity: 1;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8));
  }
}

@keyframes scopeTitleFade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes scopeDrift {
  0% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(var(--scope-drift-x, 0)) translateY(var(--scope-drift-y, 0));
  }
}

@keyframes scopeWaveFlow {
  0% {
    background-position: 0 0;
    opacity: 0.3;
  }
  50% {
    opacity: 0.45;
  }
  100% {
    background-position: 0 80px;
    opacity: 0.3;
  }
}

@keyframes scopeWaveMove {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(200px);
  }
}

.scope-wave {
  animation: scopeWaveMove 3s linear infinite;
}

@keyframes scopeBgFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes scopeFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

#footer {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 100;
  font-size: 11px;
}
#footer a {
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.2s;
}
#footer a:hover {
  color: var(--accent);
}

header {
  padding: 12px 18px;
  background: linear-gradient(90deg, #0b1320 0%, #142136 100%);
  border-bottom: 1px solid #1f2c44;
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 { margin: 0; font-size: 18px; letter-spacing: 0.3px; }
header .hint { color: var(--ink-dim); font-size: 13px; }
.hdr-social { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.hdr-social a { color: #38bdf8; display: flex; align-items: center; text-decoration: none; transition: color .15s; }
.hdr-social a:hover { color: #7dd3fc; }
#menu-btn {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  padding: 4px 10px;
  height: 32px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#menu-btn:hover, #menu-btn:active {
  background: var(--accent);
  color: #0b1320;
  border-color: var(--accent);
}

/* Regions drawer */
#drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--panel);
  border-right: 1px solid #1f2c44;
  padding: 20px 18px max(20px, env(safe-area-inset-bottom));
  padding-top: max(20px, env(safe-area-inset-top));
  z-index: 1300;
  overflow-y: auto;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.45);
  transform: translateX(0);
  transition: transform 0.22s ease;
}
#drawer.hidden { transform: translateX(-105%); }
#drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1250;
  opacity: 1;
  transition: opacity 0.22s ease;
}
#drawer-scrim.hidden { opacity: 0; pointer-events: none; }
#drawer-close {
  position: sticky;
  top: 0;
  float: right;
  width: 40px;
  height: 40px;
  margin: -8px -8px 0 8px;
  background: var(--panel-2);
  border: 1px solid #2a3a58;
  border-radius: 50%;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
#drawer-close:hover, #drawer-close:active {
  background: var(--accent);
  color: #0b1320;
  border-color: var(--accent);
}
.drawer-title {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.drawer-sub {
  margin: 0 0 14px;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.5;
}
.region-card {
  background: var(--panel-2);
  border: 1px solid #1f2c44;
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.region-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.region-card > summary::-webkit-details-marker { display: none; }
.region-card > summary::before {
  content: '▸';
  color: var(--ink-dim);
  font-size: 12px;
  width: 12px;
  transition: transform 0.18s ease;
}
.region-card[open] > summary::before { transform: rotate(90deg); }
.region-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-dim);
}
.region-body {
  padding: 4px 14px 12px;
  border-top: 1px solid #1f2c44;
}
.region-blurb {
  margin: 8px 0;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.45;
}
.region-zoom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
  background: var(--accent);
  color: #0b1320;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.region-sub {
  border-top: 1px solid #1f2c44;
  padding: 6px 0;
}
.region-sub > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.region-sub > summary::-webkit-details-marker { display: none; }
.region-sub > summary::before {
  content: '▸';
  color: var(--ink-dim);
  font-size: 11px;
  width: 10px;
  transition: transform 0.18s ease;
}
.region-sub[open] > summary::before { transform: rotate(90deg); }
.region-sub-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-dim);
  text-transform: none;
  letter-spacing: 0;
}
.region-spot-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.region-spot-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.region-spot-list button:hover, .region-spot-list button:active {
  background: var(--panel);
  border-color: #2a3a58;
}
.region-shops {
  padding-top: 6px;
}
.region-shops .shop-card { margin-bottom: 6px; }

main { flex: 1; position: relative; overflow: hidden; }
#map { position: absolute; inset: 0; }

#panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--panel);
  border-left: 1px solid #1f2c44;
  padding: 18px;
  overflow-y: auto;
  z-index: 1100;
  box-shadow: -10px 0 30px rgba(0,0,0,0.35);
  transform: translateX(0);
  transition: transform 0.22s ease;
}

/* While the report panel is open, hide map controls that overlap it */
body.report-open .leaflet-top.leaflet-right,
body.report-open .leaflet-bottom.leaflet-right {
  display: none;
}
#panel.hidden { transform: translateX(105%); }

#panel-close {
  position: sticky;
  top: 0;
  float: right;
  width: 40px;
  height: 40px;
  margin: -8px -8px 0 8px;
  background: var(--panel-2);
  border: 1px solid #2a3a58;
  border-radius: 50%;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
#panel-close:hover, #panel-close:active {
  background: var(--accent);
  color: #0b1320;
  border-color: var(--accent);
}

#panel h2 { margin: 0 0 4px; font-size: 20px; }
#panel .meta { margin: 0 0 14px; color: var(--ink-dim); font-size: 13px; }
.spot-name-link { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(56,189,248,0.35); }
.spot-name-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.now { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.now-card {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.now-label { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; }
.now-value { font-size: 18px; font-weight: 600; margin-top: 4px; color: var(--accent); }
.now-sub { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }

.cam-block { margin-bottom: 22px; }
.cam-block.hidden { display: none; }
.cam-block h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#cam-img-link { display: block; line-height: 0; }
#cam-img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--panel-2);
  display: block;
}
.cam-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
}
.cam-updated { color: var(--ink-dim); }
#cam-link { color: var(--accent); text-decoration: none; }
#cam-link:hover { text-decoration: underline; }

.chart-block { margin-bottom: 22px; }
.chart-block h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chart-wrap {
  position: relative;
  height: 200px;
  background: var(--panel-2);
  border-radius: 8px;
  padding: 6px;
}
.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.wind-quality-legend, .period-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.wq { padding: 2px 6px; border-radius: 4px; color: #0b1320; }
.wq-offshore { background: #22c55e; }
.wq-cross    { background: #eab308; }
.wq-onshore  { background: #ef4444; color: #fff; }
.period-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--ink-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.period-gradient {
  flex: 0 0 130px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    rgb(71,85,105) 0%,
    rgb(14,165,233) 30%,
    rgb(6,182,212) 50%,
    rgb(20,184,166) 70%,
    rgb(168,85,247) 100%
  );
}
.period-legend-note { color: #6b7a92; margin-left: 4px; font-style: italic; }

.tide-events {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-dim);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 12px;
}
.tide-events .hi { color: var(--accent-2); }
.tide-events .lo { color: var(--warn); }

/* Master toggle wrap — always visible, never hidden */
.master-toggle-wrap {
  margin-bottom: 0 !important;
}

.master-toggle-btn {
  background: var(--accent) !important;
  color: #0b1320 !important;
  border: 1px solid var(--accent-2) !important;
  border-radius: 3px !important;
  padding: 6px 10px !important;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700 !important;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.master-toggle-btn:hover {
  background: var(--accent-2) !important;
  color: #0b1320;
}

.wave-toggle.hidden {
  display: none !important;
}

/* Details container - collapse all shops/bars/etc */
#details-container {
  margin-bottom: 18px;
  transition: all 0.3s ease;
}

#details-toggle {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 6px;
  padding: 6px 10px;
  height: 32px;
  min-width: 40px;
  width: 100%;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  -webkit-tap-highlight-color: transparent;
}

#details-toggle:hover {
  background: var(--accent);
  color: #0b1320;
  border-color: var(--accent);
}

#details-container.collapsed {
  margin-bottom: 0;
  padding: 8px 0;
}

#details-container.collapsed ~ .shops-block,
#details-container.collapsed ~ .locals-block {
  display: none;
}

/* Surf shops nearby (collapsible) */
.shops-block { margin-bottom: 18px; }
.shops-block .shops-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.shops-block .shops-summary::-webkit-details-marker { display: none; }
.shops-block .shops-summary::before {
  content: '▸';
  display: inline-block;
  font-size: 11px;
  color: var(--ink-dim);
  transition: transform 0.18s ease;
  width: 12px;
  text-align: center;
}
.shops-block[open] .shops-summary::before { transform: rotate(90deg); }
.shops-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-dim);
  text-transform: none;
  letter-spacing: 0;
}
.shops-block > #shops-list {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #1f2c44;
}
.shop-card {
  background: var(--panel-2);
  border: 1px solid #1f2c44;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}
.shop-photo {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: #0e1a2c;
}
.shop-photo-fav {
  height: 64px;
  object-fit: contain;
  padding: 14px;
  background: #0e1a2c;
}
.shop-photo-empty {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--ink-dim);
  background: #0e1a2c;
}
.shop-card-body { padding: 10px 12px 12px; }
.shop-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}
.shop-card .shop-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.shop-card .shop-dist {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.14);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.shop-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 3px 0 4px;
}
.shop-rating {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 600;
}
.shop-rating-count { color: var(--ink-dim); font-weight: 400; }
.shop-source {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--ink-dim);
  border: 1px solid #2a3a58;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.shop-addr {
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.4;
}
.shop-hours {
  margin-top: 6px;
  font-size: 12px;
}
.shop-hours summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.shop-hours[open] summary { margin-bottom: 4px; }
.shop-hours div {
  color: var(--ink-dim);
  padding: 1px 0;
}
.shop-hours-line { font-size: 12px; color: var(--ink-dim); margin-top: 4px; }
.shop-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.shop-btn {
  flex: 1 1 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.shop-btn:hover, .shop-btn:active {
  background: var(--accent);
  color: #0b1320;
  border-color: var(--accent);
}
.shop-btn-call { color: #22c55e; }
.shop-btn-web  { color: var(--accent); }
.shop-btn-map  { color: #fbbf24; }
.shops-loading, .shops-empty {
  font-size: 12px;
  color: var(--ink-dim);
  margin: 4px 0;
}
.shops-attr {
  font-size: 10px;
  color: var(--ink-dim);
  text-align: right;
  margin-top: 4px;
}

/* Locals Only events */
.locals-block { margin-bottom: 18px; }
.locals-block h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.local-event {
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.local-when {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
}
.local-title { font-size: 13px; font-weight: 600; margin-top: 2px; }
.local-info  { font-size: 12px; color: var(--ink-dim); margin-top: 4px; line-height: 1.4; }
.local-link  { font-size: 12px; color: var(--accent); text-decoration: none; margin-top: 4px; display: inline-block; }
.local-link:hover { text-decoration: underline; }
.locals-empty, .locals-cta { font-size: 11px; color: var(--ink-dim); margin: 4px 0 0; }
.locals-cta a { color: var(--accent); }

/* Sponsor banner */
.sponsor-block { margin-bottom: 18px; }
.sponsor-block.hidden { display: none; }
.sponsor-block a {
  display: flex;
  flex-direction: column;
  background: linear-gradient(90deg, #0e1a2c 0%, #1a2742 100%);
  border: 1px solid #2a3a58;
  border-radius: 8px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s;
}
.sponsor-block a:hover { border-color: var(--accent); }
.sponsor-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.sponsor-tag {
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 2px;
}

/* Shop markers */
.shop-marker { background: transparent !important; border: 0 !important; }
.shop-dot {
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
.shop-surf  { background: #06b6d4; }
.shop-skate { background: #f97316; }
.shop-mixed { background: #a855f7; }
.shop-bait    { background: #dc2626; }
.shop-camp    { background: #16a34a; }
.shop-bar     { background: #14b8a6; }
.shop-shaper  { background: #f97316; }
.shop-hotel   { background: #8b5cf6; }
.shop-charter { background: #0ea5e9; }

.spot-tooltip .tt-shop-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 3px;
  vertical-align: middle;
  color: #0b1320;
}
.tt-shop-surf  { background: #06b6d4; }
.tt-shop-skate { background: #f97316; }
.tt-shop-mixed { background: #a855f7; color: #fff; }

.status { color: var(--warn); font-size: 12px; min-height: 16px; }

/* Leaflet popup tweak */
.leaflet-popup-content { font-size: 13px; }

/* Shop popup (map markers) */
.leaflet-popup.shop-popup .leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  padding: 0;
}
.leaflet-popup.shop-popup .leaflet-popup-tip { background: var(--panel); }
.leaflet-popup.shop-popup .leaflet-popup-content { margin: 0; padding: 12px 14px; min-width: 220px; }
.leaflet-popup.shop-popup .leaflet-popup-close-button { color: var(--ink-dim); padding: 6px 8px 0 0; font-size: 18px; }
.map-pop-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.map-pop-rating { font-size: 12px; color: #fbbf24; margin-top: 2px; font-weight: 600; }
.map-pop-rating .muted { color: var(--ink-dim); font-weight: 400; }
.map-pop-addr { font-size: 12px; color: var(--ink-dim); margin-top: 4px; line-height: 1.4; }
.map-pop-row { font-size: 12px; margin-top: 4px; color: var(--ink-dim); }
.map-pop-row .muted { color: var(--ink-dim); margin-right: 4px; }
.map-pop-row a { color: var(--accent); text-decoration: none; }
.map-pop-hours { margin-top: 6px; font-size: 12px; }
.map-pop-hours summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.map-pop-hours div { color: var(--ink-dim); padding: 1px 0; }
.map-pop-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.map-pop-btn {
  flex: 1 1 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.map-pop-btn-primary {
  background: var(--accent);
  color: #0b1320;
  border-color: var(--accent);
}
.map-pop-btn:hover { filter: brightness(1.1); }

/* Hover tooltip on markers */
.leaflet-tooltip.spot-tooltip {
  background: rgba(17, 28, 47, 0.96);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  white-space: nowrap;
}
.leaflet-tooltip.spot-tooltip::before { border-top-color: #2a3a58; }
.spot-tooltip .tt-name { font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.spot-tooltip .tt-cam {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  background: #ef4444;
  color: #fff;
  border-radius: 3px;
  vertical-align: middle;
}
.spot-tooltip .tt-row { display: flex; gap: 8px; }
.spot-tooltip .tt-label { color: var(--ink-dim); width: 38px; }
.spot-tooltip .tt-loading { color: var(--ink-dim); font-style: italic; }
.spot-popup-btn {
  background: var(--accent);
  color: #0b1320;
  border: 0;
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

/* Wave overlay control + legend */
.wave-toggle {
  margin-bottom: 4px !important;
  display: flex !important;
  flex-direction: row !important;
  gap: 4px !important;
  align-items: center !important;
  transition: transform 0.3s ease, opacity 0.3s ease !important;
}
.wave-toggle.collapsed {
  transform: translateX(400px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.wave-toggle.hidden {
  display: none !important;
}
.wave-toggle button {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #2a3a58;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  width: 130px;
  text-align: center;
  display: block;
  box-sizing: border-box;
}
.wave-toggle button:hover { border-color: var(--accent); }
.wave-toggle button.active { background: var(--accent); color: #0b1320; border-color: var(--accent); }
.wave-toggle button:disabled { opacity: 0.6; cursor: wait; }

.map-subscribe-link {
  display: block !important;
  width: 130px;
  padding: 8px 12px !important;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%) !important;
  color: var(--bg) !important;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none !important;
  border: 1px solid var(--accent) !important;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 4px !important;
  box-sizing: border-box;
  line-height: 1.4;
}
.map-subscribe-link:hover {
  border-color: var(--accent-2) !important;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}
.map-subscribe-link:active {
  transform: translateY(0);
}

.wave-legend {
  background: rgba(17, 28, 47, 0.95);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.wave-legend .legend-title {
  font-weight: 600;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
  width: 100%;
  margin-bottom: 2px;
}
.wave-legend .legend-row { display: flex; align-items: center; gap: 4px; }
.wave-legend .sw {
  width: 14px;
  height: 10px;
  display: inline-block;
  border-radius: 2px;
}

/* Animated wave canvas — drawn under markers */
.wave-field-canvas {
  pointer-events: none;
}

/* Time slider control */
.time-controls {
  background: rgba(17, 28, 47, 0.95);
  border: 1px solid #2a3a58;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink);
  min-width: 380px;
  max-width: calc(100vw - 24px);
}

/* Compact attribution top-left so it doesn't crowd the bottom controls */
.leaflet-top.leaflet-left .leaflet-control-attribution {
  font-size: 9px;
  padding: 2px 6px;
  background: rgba(17, 28, 47, 0.7);
  color: var(--ink-dim);
  border-radius: 4px;
  margin: 6px 0 0 6px;
  max-width: 200px;
}
.leaflet-top.leaflet-left .leaflet-control-attribution a {
  color: var(--ink-dim);
}
.time-controls button {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid #2a3a58;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.time-controls button:hover { border-color: var(--accent); }
.time-controls #time-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.time-controls #time-label {
  color: var(--ink-dim);
  min-width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* NDBC buoy marker */
.buoy-marker {
  background: transparent !important;
  border: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.buoy-arrow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.6));
}
.buoy-dot {
  width: 10px;
  height: 10px;
  background: #facc15;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 0 6px rgba(250, 204, 21, 0.8);
  animation: buoy-pulse 2s ease-in-out infinite;
}
@keyframes buoy-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 0 4px rgba(250, 204, 21, 0.6); }
  50%      { box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 0 10px rgba(250, 204, 21, 1); }
}
.spot-tooltip .tt-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: #facc15;
  color: #1f1700;
  border-radius: 3px;
  vertical-align: middle;
}
.spot-tooltip .tt-foot {
  margin-top: 4px;
  color: var(--ink-dim);
  font-size: 10px;
}

@media (max-width: 600px) {
  #panel {
    width: 100%;
    padding-top: max(18px, env(safe-area-inset-top));
  }
  #panel-close {
    width: 44px;
    height: 44px;
    font-size: 26px;
    background: var(--accent);
    color: #0b1320;
    border-color: var(--accent);
  }
  .wave-legend { font-size: 10px; padding: 6px 8px; }

  /* Compact time slider on phones — wraps the date label below the row */
  .time-controls {
    min-width: 0;
    width: 280px;
    padding: 6px 8px 8px;
    gap: 6px;
    font-size: 11px;
    flex-wrap: wrap;
  }
  .time-controls #time-slider { flex: 1; }
  .time-controls #time-label {
    flex: 0 0 auto;
    order: 3;
    text-align: center;
    min-width: 0;
    font-size: 11px;
    margin-left: 4px;
  }
  .time-controls button { padding: 6px 10px; min-height: 32px; order: 1; }

  /* Legends stay visible, slider is just narrower */
  .period-legend {
    margin-top: 4px;
  }
  .wind-quality-legend {
    margin-top: 4px;
  }
}

/* Subscribe popup */
.subscribe-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 5000;
  max-width: 340px;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}
.subscribe-popup.hidden { display: none; }

@keyframes slideUp {
  from {
    transform: translateY(400px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.subscribe-content {
  background: linear-gradient(135deg, var(--panel-2) 0%, rgba(24, 37, 60, 0.8) 100%);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 12px 48px rgba(56, 189, 248, 0.15), 0 0 40px rgba(0, 0, 0, 0.6);
  position: relative;
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.subscribe-icon {
  font-size: 36px;
  text-align: center;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.subscribe-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none !important;
  background: rgba(56, 189, 248, 0.1) !important;
  color: var(--accent);
  font-size: 24px;
  cursor: pointer !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  border-radius: 6px;
  padding: 0 !important;
  pointer-events: auto !important;
  z-index: 5001;
}
.subscribe-close:hover {
  background: rgba(56, 189, 248, 0.2);
  transform: rotate(90deg);
}

.subscribe-content h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subscribe-content p {
  margin: 0 0 18px 0;
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.5;
}

#subscribe-email {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(147,164,187,0.4);
  border-radius: 6px;
  color: var(--ink);
  font-size: 15px;
  box-sizing: border-box;
  outline: none;
}
#subscribe-email:focus { border-color: var(--accent); }
#subscribe-email::placeholder { color: var(--ink-dim); }

.subscribe-error {
  color: #f87171;
  font-size: 13px;
  margin-bottom: 8px;
  min-height: 18px;
}

.subscribe-link {
  display: block !important;
  width: 100% !important;
  padding: 14px 12px !important;
  margin-bottom: 12px !important;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%) !important;
  color: var(--bg) !important;
  text-align: center !important;
  text-decoration: none !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  border: 2px solid transparent !important;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3) !important;
  pointer-events: auto !important;
  z-index: 5001 !important;
}
.subscribe-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
  border-color: var(--accent);
}
.subscribe-link:active {
  transform: translateY(0);
}

.subscribe-later {
  width: 100% !important;
  padding: 10px !important;
  background: transparent !important;
  color: var(--ink-dim) !important;
  border: 1px solid rgba(147, 164, 187, 0.3) !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.3s !important;
  pointer-events: auto !important;
  z-index: 5001 !important;
}
.subscribe-later:hover {
  background: rgba(56, 189, 248, 0.05);
  border-color: var(--accent);
  color: var(--accent);
}

/* Wave Brain Chat Widget */
.wb-map-btn {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #2a3a58;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  text-align: center;
  display: block;
  box-sizing: border-box;
  width: 130px;
  transition: all 0.3s;
}
.wb-map-btn:hover { border-color: var(--accent); background: var(--panel-2); }
.wb-map-btn:active { transform: scale(0.98); }

.wave-brain-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 360px;
  max-height: 520px;
  z-index: 4900;
  background: linear-gradient(135deg, var(--panel-2) 0%, rgba(24, 37, 60, 0.8) 100%);
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(56, 189, 248, 0.15), 0 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}
.wave-brain-panel.hidden { display: none; }

.wb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  position: relative;
}

.wb-character {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.wb-character svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.wb-wave-1 {
  animation: waveFlow1 3s ease-in-out infinite;
}
.wb-wave-2 {
  animation: waveFlow2 3.5s ease-in-out infinite 0.3s;
}
.wb-wave-3 {
  animation: waveFlow3 4s ease-in-out infinite 0.6s;
}

@keyframes waveFlow1 {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}
@keyframes waveFlow2 {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}
@keyframes waveFlow3 {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.wb-title {
  flex: 1;
}
.wb-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.wb-tm {
  font-size: 9px;
  vertical-align: super;
  margin-left: 2px;
  color: var(--accent);
  opacity: 0.8;
}
.wb-tagline {
  display: block;
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 2px;
}

.wb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  border-radius: 6px;
  padding: 0;
  pointer-events: auto;
}
.wb-close:hover {
  background: rgba(56, 189, 248, 0.2);
  transform: rotate(90deg);
}

.wb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.wb-msg {
  display: flex;
  max-width: 85%;
  word-wrap: break-word;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
}
.wb-msg span {
  display: block;
}

.wb-msg-bot {
  align-self: flex-start;
  background: rgba(56, 189, 248, 0.15);
  color: var(--ink);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.wb-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
}

.wb-input-row {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid rgba(56, 189, 248, 0.2);
}

#wb-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(147, 164, 187, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: all 0.3s;
}
#wb-input:focus {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
}
#wb-input::placeholder {
  color: var(--ink-dim);
}

#wb-send {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#wb-send:hover {
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}
#wb-send:active {
  transform: translateY(0);
}

.wb-status {
  font-size: 11px;
  color: var(--ink-dim);
  padding: 0 12px;
  min-height: 16px;
  font-style: italic;
}

@media (max-width: 600px) {
  .wave-brain-panel {
    width: calc(100vw - 32px);
    max-height: 55vh;
    right: 16px;
    left: 16px;
    top: 64px;
    bottom: auto;
    transform: none;
    z-index: 9000;
  }
  .wave-brain-panel.hidden {
    display: none;
  }
}

/* ── Mobile optimizations ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Header: hide hint text, keep social icons manageable */
  header .hint { display: none; }
  header h1 { font-size: 15px; }
  .hdr-social { gap: .7rem; }

  /* Shop cards: horizontal layout on mobile */
  .shop-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
  }
  .shop-photo {
    width: 80px;
    min-width: 80px;
    height: auto;
    flex-shrink: 0;
  }
  .shop-photo-fav {
    width: 80px;
    min-width: 80px;
    height: auto;
    padding: 12px 8px;
  }
  .shop-photo-empty {
    width: 80px;
    min-width: 80px;
    height: auto;
  }
  .shop-card-body { flex: 1; min-width: 0; }
  .shop-card-actions { flex-wrap: wrap; gap: 6px; }

  /* Charts: prevent horizontal overflow */
  .chart-wrap { overflow-x: hidden; }

  /* Now cards: slightly smaller text */
  .now-value { font-size: 16px; }

  /* Cam block */
  .cam-block img { max-height: 180px; }
}
