/* ═══════════════════════════════════════════════════════
   RARITY BAY RAFT UP MAP — STYLES
   Palette: warm olive/tan (matching raritybayliving.com)
   ═══════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root,
[data-theme='light'] {
  /* Surfaces — pure white + strong dividers for outdoor sunlight readability */
  --color-bg:             #e8ecf0;
  --color-surface:        #ffffff;
  --color-surface-2:      #f2f5f8;
  --color-border:         #6a8099;   /* darker border — visible in glare */
  --color-divider:        #8a9eb0;

  /* Text — near-black for maximum WCAG-AAA contrast in sunlight */
  --color-text:           #050d1a;   /* ~21:1 on white */
  --color-text-muted:     #1a3050;   /* ~12:1 on white */
  --color-text-faint:     #36526a;   /* ~7:1 on white */
  --color-text-inverse:   #ffffff;

  /* Primary — deep navy; strong contrast on white and light surfaces */
  --color-primary:        #083060;
  --color-primary-hover:  #051e42;
  --color-primary-active: #030f24;
  --color-primary-light:  #c8dfef;

  /* Accent — vivid lake blue — pushed darker for outdoor visibility */
  --color-accent:         #0e4f7a;
  --color-accent-hover:   #083060;

  /* Pin marker red — deeper for sun contrast */
  --color-pin:            #a0200f;

  /* Radius */
  --radius-sm:  0.375rem;
  --radius-md:  0.5rem;
  --radius-lg:  0.875rem;
  --radius-xl:  1.25rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(44,36,22,0.10);
  --shadow-md:  0 4px 16px rgba(44,36,22,0.14);
  --shadow-lg:  0 12px 40px rgba(44,36,22,0.20);

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Type */
  --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  /* Fonts */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body:    'Work Sans', 'Helvetica Neue', sans-serif;

  /* Header height */
  --header-h: 60px;
}

[data-theme='dark'] {
  --color-bg:             #1a1710;
  --color-surface:        #22201a;
  --color-surface-2:      #2a2820;
  --color-border:         #3d3928;
  --color-divider:        #332f22;
  --color-text:           #e8e2d4;
  --color-text-muted:     #9e9580;
  --color-text-faint:     #5c5646;
  --color-text-inverse:   #1a1710;
  --color-primary:        #c4a85a;
  --color-primary-hover:  #dcc070;
  --color-primary-active: #e8d28c;
  --color-primary-light:  #2e2a1e;
  --color-accent:         #6aadcf;
  --color-accent-hover:   #8ec4de;
  --color-pin:            #e74c3c;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.30);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.40);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #1a1710;
    --color-surface:        #22201a;
    --color-surface-2:      #2a2820;
    --color-border:         #3d3928;
    --color-divider:        #332f22;
    --color-text:           #e8e2d4;
    --color-text-muted:     #9e9580;
    --color-text-faint:     #5c5646;
    --color-text-inverse:   #1a1710;
    --color-primary:        #c4a85a;
    --color-primary-hover:  #dcc070;
    --color-primary-active: #e8d28c;
    --color-primary-light:  #2e2a1e;
    --color-accent:         #6aadcf;
    --color-accent-hover:   #8ec4de;
    --color-pin:            #e74c3c;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.30);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.40);
    --shadow-lg:  0 12px 40px rgba(0,0,0,0.55);
  }
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  height: 100%;
}
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.header-inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.logo-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--color-primary);
  flex-shrink: 0;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-title {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.6vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--color-primary);
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.refresh-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  white-space: nowrap;
}
.refresh-badge svg { color: var(--color-accent); flex-shrink: 0; }
#countdownTimer { color: var(--color-accent); font-weight: 600; font-variant-numeric: tabular-nums; }

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.btn-ghost:hover { background: var(--color-primary-light); color: var(--color-primary); }

/* ── Map ── */
.map-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#map {
  width: 100%;
  height: 100%;
  display: block;
}

/* Pin count — always-visible bar between map and message board */
.pin-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 6px var(--space-5);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.pin-count:hover { background: var(--color-bg); }
.pin-count svg { color: var(--color-pin); }

/* ── Modals ── */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(26,20,12,0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  animation: fadeIn 200ms ease;
}
.overlay-backdrop.hidden {
  display: none;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
  position: relative;
  animation: slideUp 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--color-primary-light); color: var(--color-text); }

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  line-height: 1.1;
}
.modal-body {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  max-width: 72ch;
  text-wrap: pretty;
}

/* Help card specific */
.help-card { text-align: center; }
.help-icon {
  width: 72px;
  height: 72px;
  background: var(--color-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
  color: var(--color-primary);
}
.modal-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: var(--space-6);
  background: color-mix(in oklab, var(--color-accent) 12%, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

/* Pin card specific */
.pin-card { text-align: left; }

/* Forms */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}
.required-star { color: var(--color-pin); }
.optional-tag {
  font-size: var(--text-xs);
  font-weight: 400;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-base);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input::placeholder { color: var(--color-text-faint); }
.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 18%, transparent);
}
.form-input.error { border-color: var(--color-pin); }

.form-hint {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md); }
.btn-primary:active { background: var(--color-primary-active); transform: scale(0.98); }
.btn-full { width: 100%; margin-top: var(--space-2); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), box-shadow var(--transition);
}
.btn-secondary:hover { background: var(--color-primary); color: var(--color-text-inverse); }

/* ── Long-press ripple ── */
.press-ripple {
  position: fixed;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  margin-top: -32px;
  border-radius: 50%;
  border: 3px solid var(--color-accent);
  pointer-events: none;
  z-index: 150;
  animation: rippleGrow 5s linear forwards;
  opacity: 0.8;
}
.press-ripple.hidden { display: none; }
@keyframes rippleGrow {
  0%   { transform: scale(0.3); opacity: 0.8; border-color: var(--color-accent); }
  70%  { transform: scale(1.1); opacity: 0.9; border-color: var(--color-primary); }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ── Info Window (custom Google Maps popup) ── */
/* Let the Google wrapper scroll if content is tall */
.gm-style-iw,
.gm-style-iw-c {
  max-height: 280px !important;
  overflow: visible !important;
}
.gm-style-iw-d {
  max-height: 260px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.rb-info-window {
  font-family: var(--font-body, 'Work Sans', sans-serif);
  min-width: 180px;
  max-width: 260px;
  max-height: 250px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.rb-info-boat {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0a1628;
  margin-bottom: 4px;
  line-height: 1.2;
}
.rb-info-captain {
  font-size: 0.875rem;
  color: #2a4060;
  margin-bottom: 2px;
}
.rb-info-mobile {
  font-size: 0.875rem;
  color: #1a6b9a;
  font-weight: 600;
  margin-top: 4px;
}
.rb-info-mobile a { color: #1a6b9a; text-decoration: none; font-weight: 600; }
.rb-info-mobile a:hover { text-decoration: underline; }
.rb-info-time {
  font-size: 0.75rem;
  color: #b5aa94;
  margin-top: 6px;
  border-top: 1px solid #ddd5c0;
  padding-top: 6px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .refresh-badge span:not(#countdownTimer) { display: none; }
  .modal-card { padding: var(--space-6); }
  .logo-subtitle { display: none; }
}

/* ═══ STATUS LEGEND BAR ═══ */
.status-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 10px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--color-text-muted);
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}
.legend-item { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.legend-sep { width: 1px; height: 10px; background: #ddd; flex-shrink: 0; }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* ═══ STATUS COLORS ═══ */
/* Anchored — olive green */
.legend-dot.anchored, .status-dot.anchored { background: #1a7a2a; }
/* Underway — vivid blue */
.legend-dot.underway, .status-dot.underway { background: #0d5fa8; }
/* Heading back — burnt orange */
.legend-dot.heading_back, .status-dot.heading_back { background: #c05000; }
/* Invite — pin red */
.legend-dot.invite { background: #c0392b; }

/* ═══ STATUS SELECTOR ═══ */
.status-selector {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.status-selector-lg { gap: var(--space-3); margin-bottom: var(--space-2); }
.status-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.status-btn:hover { border-color: var(--color-primary); color: var(--color-text); }
.status-btn.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-text);
  font-weight: 600;
}
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══ INVITE BANNER ═══ */
.invite-banner {
  position: fixed;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 180;
  width: calc(100% - 32px);
  max-width: 520px;
  background: var(--color-surface);
  border: 2px solid #c0392b;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.invite-banner.hidden { display: none; }
.invite-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}
.invite-banner-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}
.invite-wave { font-size: 1.5rem; flex-shrink: 0; }
.invite-banner-content strong { color: var(--color-primary); font-weight: 700; }
.invite-banner-content { font-size: var(--text-sm); color: var(--color-text); }
.invite-banner-msg { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }
.invite-banner-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

.btn-coming {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: #c0392b;
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.btn-coming:hover { background: #a93226; }

.btn-dismiss-banner {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: background var(--transition);
}
.btn-dismiss-banner:hover { background: var(--color-primary-light); }

/* ═══ SEND INVITE BUTTON ═══ */
#sendInviteBtn {
  background: #c0392b;
  margin-top: var(--space-4);
}
#sendInviteBtn:hover { background: #a93226; }

/* ═══ SELECT DROPDOWN ═══ */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a6f5a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ── GPS Locate Button ─────────────────────────────────────── */
#gpsLocateBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 10px 10px 0;
  background: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22);
  cursor: pointer;
  color: #3b6e8c;
  transition: background 0.15s, color 0.15s;
}
#gpsLocateBtn:hover { background: #3b6e8c; color: #fff; }
#gpsLocateBtn:active { transform: scale(0.93); }
#gpsLocateBtn.gps-searching { animation: gps-pulse 1s infinite; }
@keyframes gps-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Pin Label (boat name under pin) ──────────────────────── */
.rb-pin-label {
  background: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 1px 4px;
  margin-top: 2px;
  font-family: 'Work Sans', sans-serif;
  white-space: nowrap;
  text-shadow: none;
  pointer-events: none;
}

/* -- Drop Pin FAB (bottom center of map) -- */
/* Boat list panel ──────────────────────────────────────── */
.boat-list-panel {
  position: fixed;
  top: auto;
  bottom: 230px;
  left: 12px;
  z-index: 200;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  min-width: 240px;
  max-width: 300px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Work Sans', sans-serif;
}
.boat-list-panel.hidden { display: none; }
.boat-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #3b2e0e;
  border-bottom: 1px solid #ede8da;
}
.boat-list-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9a8f7a;
  padding: 2px 4px;
  line-height: 1;
}
#boatListUl {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
}
.boat-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.boat-list-item:hover { background: #f4f1ea; }
.bli-icon  { font-size: 1.1rem; flex-shrink: 0; }
.bli-name  { font-weight: 700; font-size: 0.88rem; color: #3b2e0e; flex: 1; }
.bli-cap   { font-size: 0.78rem; color: #9a8f7a; white-space: nowrap; }
.boat-list-empty {
  padding: 18px 14px;
  font-size: 0.85rem;
  color: #9a8f7a;
  text-align: center;
}

/* ── Pick-mode instruction banner ──────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* FAB in cancel state ──────────────────────────────────── */
/* Collapsed: header bar only */
.message-board--collapsed {
  height: 42px;
  overflow: hidden;
}
/* Expanded: generous space for messages */
.message-board--expanded {
  height: 310px;
}
.message-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7a6b3e;
  border-bottom: 1px solid #ede8da;
  background: #faf8f2;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}
.message-board-header svg { vertical-align: -2px; margin-right: 5px; }
.msg-board-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: #b5aa94;
}
/* ── Post message toggle button in header ── */
.post-msg-toggle-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
  padding: 0;
}
.post-msg-toggle-btn:hover { background: var(--color-primary-hover); transform: rotate(45deg); }
.post-msg-toggle-btn.active { background: var(--color-accent); transform: rotate(45deg); }
/* ── Inline post area ── */
.inline-post-area {
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inline-post-input {
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--color-text);
  background: var(--color-surface-2);
  resize: none;
  outline: none;
  box-sizing: border-box;
}
.inline-post-input:focus { border-color: var(--color-primary); }
.inline-post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.inline-post-send {
  padding: 5px 14px;
  font-size: 0.78rem;
  margin-top: 0 !important;
}
/* Board body (visible only when expanded) */
.msg-board-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.msg-board-body.hidden { display: none; }

/* Post button row inside expanded board */
.msg-board-actions {
  padding: 6px 10px 4px;
  flex-shrink: 0;
  border-bottom: 1px solid #f0ece2;
}
.msg-post-btn {
  font-size: 0.78rem;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.message-feed {
  overflow-y: scroll;
  flex: 1;
  padding: 6px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c8bfa0 transparent;
}
.message-feed::-webkit-scrollbar { width: 4px; }
.message-feed::-webkit-scrollbar-thumb { background: #c8bfa0; border-radius: 4px; }
.message-feed::-webkit-scrollbar-track { background: transparent; }

/* Post message modal card */
.post-msg-card {
  max-width: 360px;
  width: 92vw;
}


.message-empty {
  padding: 16px 14px;
  font-size: 0.82rem;
  color: #b5aa94;
  text-align: center;
}
.message-item {
  display: flex;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid #f4f1ea;
  animation: msgIn 0.18s ease;
}
.message-item:last-child { border-bottom: none; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #7a6b3e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.msg-avatar.mine { background: #3b6e8c; }
.msg-body-wrap { flex: 1; min-width: 0; }
.msg-meta {
  font-size: 0.72rem;
  color: #b5aa94;
  margin-bottom: 2px;
}
.msg-meta strong { color: #7a6b3e; font-weight: 700; }
.msg-text {
  font-size: 0.85rem;
  color: #3b2e0e;
  word-break: break-word;
  line-height: 1.4;
}
.msg-delete {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 0 0 6px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.msg-delete:hover { color: #c0392b; }

/* FAB sits 24px from bottom of map wrapper (board is now in-flow, not fixed) */
/* Char counter hint ─────────────────── */
#broadcastMsgCount { font-size: 0.72rem; color: #b5aa94; }
#broadcastMsgCount.warn { color: #c07a00; }

/* ── Start Screen ─────────────────────────────────────── */
.start-screen {
  max-width: 380px;
  padding: 2rem 1.75rem 1.5rem;
}
.start-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.start-title {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}
.start-tagline {
  font-size: 0.9rem;
  color: var(--color-muted, #8a7f6a);
  margin-bottom: 1.25rem;
  text-align: center;
}
.start-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: left;
}
.start-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(168,200,216,0.12);
  border-radius: 10px;
}
.start-feature--reset {
  background: rgba(192,57,43,0.08);
  border: 1px solid rgba(192,57,43,0.18);
}
.start-feat-icon {
  font-size: 1.2rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.start-feature strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text, #3b2e0e);
  margin-bottom: 0.1rem;
}
.start-feature span {
  font-size: 0.77rem;
  color: var(--color-muted, #8a7f6a);
  line-height: 1.35;
}
.start-cta {
  width: 100%;
  margin-bottom: 0.75rem;
}
.start-fine {
  font-size: 0.7rem;
  color: var(--color-muted, #8a7f6a);
  text-align: center;
  opacity: 0.75;
}

/* ── Compact zoom controls (upper right) ─────────────── */
.gm-bundled-control .gmnoprint,
.gmnoprint[style*="right"] {
  transform: scale(0.82);
  transform-origin: top right;
}

/* ── Demo video link ──────────────────────────────────── */
.start-demo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a7a94;
  text-decoration: none;
  margin-bottom: 0.75rem;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.start-demo-link:hover { opacity: 1; text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   LANDSCAPE / SHORT-VIEWPORT OVERRIDES
   Targets phones in landscape (height ≤ 500px)
   ═══════════════════════════════════════════════════════════ */
@media (orientation: landscape) and (max-height: 500px) {

  /* ── Shrink header to reclaim vertical space ── */
  :root {
    --header-h: 44px;
  }
  .app-header {
    height: 44px;
    padding: 0 0.75rem;
  }
  .app-header h1 {
    font-size: 1rem;
  }
  .header-btn {
    height: 32px;
    font-size: 0.72rem;
    padding: 0 0.6rem;
  }

  /* ── Start screen: scrollable, fits in landscape ── */
  .start-screen {
    padding: 0.75rem 1rem;
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .start-screen h2 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
  }
  .start-screen p {
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
  }
  .start-features {
    gap: 0.4rem;
    margin-bottom: 0.5rem;
  }
  .start-feature {
    padding: 0.4rem 0.5rem;
  }
  .start-feature strong {
    font-size: 0.78rem;
  }
  .start-feature span {
    font-size: 0.7rem;
  }
  .start-demo-link {
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
  }
  .start-cta {
    margin-bottom: 0.4rem;
  }

  /* ── All modals: scrollable, capped height ── */
  .modal-card {
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
  }
  .modal-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  /* ── Lake Chat message board: shorter in landscape ── */
  .message-board--expanded {
    height: 180px;
  }

  /* ── Boat list panel: lower bottom offset in landscape ── */
  .boat-list-panel {
    bottom: 140px;
    max-height: calc(100dvh - 44px - 140px - 0.5rem);
  }

  /* ── Invite banner: lower in landscape ── */
  .invite-banner {
    bottom: 110px;
  }

  /* ── Bottom action bar / FAB buttons tighter ── */
  .fab-group {
    bottom: 0.6rem;
    gap: 0.4rem;
  }
  .fab {
    height: 40px;
    font-size: 0.75rem;
    padding: 0 0.75rem;
  }

  /* ── Slide-up chat panel: shorter ── */
  .chat-panel {
    max-height: 75dvh;
  }

  /* ── Bottom toolbar / action row ── */
  .bottom-bar {
    bottom: 0;
    padding: 0.3rem 0.75rem;
  }

  /* ── Pin info popup: max-height guard ── */
  .pin-popup,
  .gm-style-iw {
    max-height: 70dvh;
    overflow-y: auto;
  }
}

/* ═══ VIDEO POPUP OVERLAY ═══ */
.video-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.video-popup-backdrop.hidden { display: none; }
.video-popup-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #0d1c2e;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.video-popup-card video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}
.video-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s;
}
.video-popup-close:hover { background: rgba(200,0,0,0.75); }

/* ═══════════════════════════════════════════════════════
   SUNLIGHT READABILITY — applied globally in light mode
   Goal: every surface legible in direct afternoon sun
   ═══════════════════════════════════════════════════════ */

/* ── Base font weight bump ── */
body {
  font-weight: 500;   /* medium base instead of 400 */
}

/* ── Legend bar — high-contrast strip ── */
.status-legend {
  background: #050d1a !important;    /* near-black bar */
  color: #ffffff !important;
  border-bottom: 2px solid #6a8099;
}
.legend-item {
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  text-shadow: none !important;
}
.legend-sep { background: rgba(255,255,255,0.35) !important; }

/* Battery audit button in legend */
.legend-battery-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: 6px;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  padding: 1px 5px;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: background 120ms;
}
.legend-battery-btn:hover { background: rgba(255,255,255,0.18); }

/* ── Status-countdown header ── */
.header-bar {
  background: #0a1e38 !important;     /* very dark navy */
  color: #ffffff !important;
  border-bottom: 3px solid #083060 !important;
}
.site-title { color: #ffffff !important; font-weight: 800 !important; }
.countdown-label { color: rgba(255,255,255,0.80) !important; font-weight: 600 !important; }
#countdownTimer { color: #7dd3fc !important; font-weight: 800 !important; }

/* ── Help/start overlay ── */
.overlay-backdrop {
  background: rgba(5, 13, 26, 0.82) !important;  /* darker scrim */
}
.modal-card {
  background: #ffffff !important;
  border: 2px solid #6a8099 !important;
  box-shadow: 0 8px 40px rgba(5,13,26,0.40) !important;
}
.modal-title {
  color: #050d1a !important;
  font-weight: 800 !important;
  font-size: 1.15rem !important;
}

/* ── Form elements ── */
.form-label {
  color: #050d1a !important;
  font-weight: 700 !important;
}
.form-input, .form-select, .form-textarea {
  color: #050d1a !important;
  background: #ffffff !important;
  border: 2px solid #6a8099 !important;
  font-weight: 500 !important;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #083060 !important;
  box-shadow: 0 0 0 3px rgba(8,48,96,0.20) !important;
}
.form-hint {
  color: #36526a !important;
  font-weight: 600 !important;
}

/* ── Buttons — maximum contrast ── */
.btn-primary {
  background: #083060 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: 2px solid #051e42 !important;
  letter-spacing: 0.02em;
}
.btn-primary:hover { background: #051e42 !important; }
.btn-primary:active { background: #030f24 !important; }

.btn-secondary {
  background: #ffffff !important;
  color: #083060 !important;
  border: 2px solid #083060 !important;
  font-weight: 700 !important;
}
.btn-secondary:hover { background: #c8dfef !important; }

/* ── Pick-mode banner ── */
/* ── Message board ── */
.message-board {
  background: #ffffff !important;
  border: 2px solid #6a8099 !important;
}
.message-board-header {
  background: #0a1e38 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}
.msg-board-title { color: #ffffff !important; font-weight: 700 !important; }
.msg-board-count { color: #7dd3fc !important; font-weight: 600 !important; }
.post-msg-toggle-btn { color: #ffffff !important; }
.msg-item {
  border-bottom: 1.5px solid #c8d4dc !important;
}
.msg-captain { color: #050d1a !important; font-weight: 700 !important; }
.msg-body    { color: #1a3050 !important; font-weight: 500 !important; }
.msg-time    { color: #36526a !important; font-weight: 600 !important; }

/* ── Invite banner ── */
.invite-banner {
  background: #0a1e38 !important;
  color: #ffffff !important;
  border-top: 3px solid #083060 !important;
}
.invite-banner-content strong { color: #7dd3fc !important; }
.invite-banner-msg { color: rgba(255,255,255,0.90) !important; font-weight: 600 !important; }

/* ── FAB (drop pin button) ── */
.fab {
  background: #083060 !important;
  color: #ffffff !important;
  border: 2px solid #051e42 !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 20px rgba(8,48,96,0.50) !important;
}
.fab:hover { background: #051e42 !important; }

/* ── Info-window pin popup ── */
.rb-info-header  { background: #0a1e38 !important; }
.rb-info-name    { color: #ffffff !important; font-weight: 800 !important; }
.rb-info-captain { color: #c8dfef !important; font-weight: 600 !important; }
.rb-info-body    { background: #ffffff !important; }
.rb-info-label   { color: #36526a !important; font-weight: 700 !important; }
.rb-info-value   { color: #050d1a !important; font-weight: 600 !important; }
.rb-info-mobile a { color: #083060 !important; font-weight: 700 !important; }

/* ── Dark mode: restore darker theme untouched ── */
@media (prefers-color-scheme: dark) {
  body { font-weight: 400; } /* undo the 500 bump in dark */
  .status-legend { background: var(--color-surface-2) !important; border-bottom-color: var(--color-border) !important; }
  .legend-item   { color: var(--color-text) !important; }
  .header-bar    { background: var(--color-surface) !important; border-bottom-color: var(--color-border) !important; }
  .site-title    { color: var(--color-text) !important; }
  .overlay-backdrop { background: rgba(0,0,0,0.72) !important; }
  .modal-card    { background: var(--color-surface) !important; border-color: var(--color-border) !important; }
  .modal-title   { color: var(--color-text) !important; }
  .btn-primary   { background: var(--color-primary) !important; border-color: var(--color-primary-hover) !important; }
  .btn-secondary { background: transparent !important; color: var(--color-primary) !important; border-color: var(--color-primary) !important; }
  .message-board { background: var(--color-surface) !important; border-color: var(--color-border) !important; }
  .message-board-header { background: var(--color-surface-2) !important; }
  .invite-banner { background: var(--color-surface) !important; }
  .fab           { background: var(--color-primary) !important; border-color: var(--color-primary-hover) !important; box-shadow: var(--shadow-lg) !important; }
  .form-input, .form-select, .form-textarea { background: var(--color-surface-2) !important; border-color: var(--color-border) !important; color: var(--color-text) !important; }
  .legend-battery-btn { border-color: rgba(255,255,255,0.25) !important; color: var(--color-text) !important; }
}

/* ═══════════════════════════════════════════════════════
   BATTERY AUDIT PANEL
   ═══════════════════════════════════════════════════════ */

.battery-card {
  max-width: 560px;
  width: 94vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.battery-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.battery-table-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  min-height: 80px;
}
.battery-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.bat-hdr {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  text-align: left;
  padding: 6px 8px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.bat-cell {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  font-weight: 500;
  vertical-align: middle;
}
.bat-count { font-weight: 700; color: var(--color-primary); text-align: right; }
.bat-rate  { text-align: right; color: var(--color-text-muted); }
.bat-time  { font-size: 0.78rem; white-space: nowrap; color: var(--color-text-faint); }
.battery-note {
  font-size: 0.75rem;
  color: var(--color-text-faint);
  padding: 6px 8px;
  font-style: italic;
}
.battery-empty {
  padding: 16px;
  text-align: center;
  color: var(--color-text-faint);
  font-size: 0.88rem;
}
.battery-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: flex-end;
}
.btn-danger-sm {
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms;
}
.btn-danger-sm:hover { background: #962d22; }

/* ═══════════════════════════════════════════════════════
   FIRST DROP PAGER POPUP
   Font: Share Tech Mono — authentic dot-matrix / pager feel
   ═══════════════════════════════════════════════════════ */

.first-drop-card {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  background: #0b1a0b !important;    /* deep terminal green-black */
  border: 2.5px solid #33ff33 !important;
  border-radius: 4px !important;
  box-shadow: 0 0 28px rgba(51,255,51,0.28), 0 0 6px rgba(51,255,51,0.15) !important;
  max-width: 340px;
  width: 92vw;
  padding: 0 !important;
  overflow: hidden;
  color: #33ff33;
  /* subtle scanline overlay */
  position: relative;
}
.first-drop-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.18) 2px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 0;
}
.first-drop-card > * { position: relative; z-index: 1; }

/* Header bar */
.fd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #33ff33;
  color: #0b1a0b;
  padding: 5px 10px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.fd-title {
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.fd-signal {
  font-size: 0.7rem;
  letter-spacing: -0.05em;
  opacity: 0.85;
}

/* Body */
.fd-body {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fd-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
}
.fd-num {
  color: rgba(51,255,51,0.45);
  font-size: 0.75rem;
  flex-shrink: 0;
  padding-top: 1px;
}
.fd-text {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #b8ffb8;
  letter-spacing: 0.04em;
}
.fd-hi {
  color: #33ff33;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.fd-divider {
  color: rgba(51,255,51,0.25);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0 0 0 2px;
}

/* OK button */
.fd-ok-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px 16px;
  background: transparent;
  border: 1.5px solid #33ff33;
  color: #33ff33;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 9px 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  text-align: center;
}
.fd-ok-btn:hover,
.fd-ok-btn:active {
  background: #33ff33;
  color: #0b1a0b;
}

/* ═══════════════════════════════════════════════════════
   VERSION FOOTER
   ═══════════════════════════════════════════════════════ */
.version-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 2px 8px;
  background: transparent;
  pointer-events: none;
  user-select: none;
}
.version-footer span {
  font-size: 0.62rem;
  color: rgba(10, 30, 56, 0.35);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.04em;
  line-height: 1;
}
@media (prefers-color-scheme: dark) {
  .version-footer span { color: rgba(255,255,255,0.25); }
}


