/* Ninja Explore — Chart Viewer */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --header-height: 44px;
  --toolbar-width: 48px;
  --accent: #0078d4;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* App header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: linear-gradient(135deg, #0a1628 0%, #142744 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.app-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.app-header__back:hover { background: rgba(255,255,255,0.12); }
.app-header__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Map fills below header, right of toolbar */
#map {
  position: fixed;
  top: var(--header-height);
  left: var(--toolbar-width);
  right: 0;
  bottom: 0;
}

/* ── Left toolbar ───────────────────────────────────────────── */
.toolbar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--toolbar-width);
  z-index: 1050;
  background: #1a2a44;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
  box-shadow: 2px 0 6px rgba(0,0,0,0.2);
}
.toolbar__btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.toolbar__btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.toolbar__btn.active {
  background: var(--accent);
  color: #fff;
}
.toolbar__separator {
  width: 28px;
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 6px 0;
}
.toolbar__spacer {
  flex: 1;
}

/* ── Right-side floating buttons ────────────────────────────── */
.map-btn {
  position: fixed;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #333;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.map-btn:hover { background: #f0f0f0; }
.map-btn:active { transform: scale(0.93); }

#btn-locate {
  bottom: 30px;
  right: 12px;
}
#btn-locate.active {
  background: var(--accent);
  color: #fff;
}

#btn-coast-pilot.active {
  background: var(--accent);
  color: #fff;
}

/* ── Coast Pilot popup ─────────────────────────────────────── */
.cp-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  max-width: 340px;
}
.cp-popup .leaflet-popup-content {
  margin: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  max-height: 280px;
  overflow-y: auto;
}

/* ── Coast Pilot marker ────────────────────────────────────── */
.cp-marker {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
}

/* ── Panels ─────────────────────────────────────────────────── */
.map-panel {
  position: fixed;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  padding: 8px 12px;
  font-size: 13px;
  color: #333;
}

/* Measure/route info panel */
.measure-panel {
  bottom: 30px;
  left: calc(var(--toolbar-width) + 12px);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 13px;
  white-space: nowrap;
}
.measure-clear {
  border: none;
  background: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.measure-clear:hover { color: #e63946; }

/* GPS coordinates display */
.coords-panel {
  bottom: 80px;
  right: 12px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  display: none;
}
.coords-panel.visible { display: block; }

/* Loading indicator */
.loading-indicator {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  right: 12px;
  z-index: 1001;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s;
}
.loading-indicator.hidden { opacity: 0; }

/* ── GPS styles ─────────────────────────────────────────────── */
.gps-accuracy-circle {
  stroke: var(--accent);
  stroke-width: 1.5;
  fill: rgba(0, 120, 212, 0.1);
}
.gps-dot {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Popup styles ───────────────────────────────────────────── */
.coord-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  font-size: 13px;
}
.coord-popup .leaflet-popup-content {
  margin: 8px 12px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  line-height: 1.5;
}
.info-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  min-width: 280px;
  max-width: 340px;
}
.info-popup .leaflet-popup-content {
  margin: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  max-height: 280px;
  overflow-y: auto;
}
.info-popup table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  table-layout: fixed;
}
.info-popup td {
  padding: 2px 6px 2px 0;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.info-popup td:first-child {
  font-weight: 600;
  color: #555;
  width: 40%;
}

/* ── Measure/route map elements ─────────────────────────────── */
.measure-label {
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  white-space: nowrap;
  border: none;
  box-shadow: none;
}
.measure-dot {
  width: 14px;
  height: 14px;
  background: #e63946;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  cursor: grab;
}
.measure-dot:active {
  cursor: grabbing;
}
.route-midpoint {
  width: 18px;
  height: 18px;
  background: rgba(0,120,212,0.25);
  border: 2px dashed var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.route-midpoint:hover {
  background: rgba(0,120,212,0.5);
  color: #fff;
}
.route-marker {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ── Modal backdrop & panels ────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1059;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 1060;
  width: 90vw;
  max-width: 600px;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.modal-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.modal-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}
.modal-panel__header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1a2a44;
}
.modal-panel__close {
  border: none;
  background: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-panel__close:hover { color: #333; }
.modal-panel__body {
  padding: 12px 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-panel__footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 16px 14px;
  border-top: 1px solid #e5e5e5;
  flex-shrink: 0;
}
.modal-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-btn--primary {
  background: var(--accent);
  color: #fff;
}
.modal-btn--primary:hover { background: #0063b1; }
.modal-btn--danger {
  background: #fee;
  color: #c0392b;
}
.modal-btn--danger:hover { background: #fdd; }

/* Route details table */
.route-table-wrap {
  overflow-x: auto;
}
.route-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.route-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #888;
  padding: 6px 8px;
  border-bottom: 2px solid #e5e5e5;
}
.route-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
}
.legend-section {
  margin-bottom: 18px;
}
.legend-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: #1a2a44;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}
.legend-note {
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
  font-style: italic;
}
.legend-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: #444;
  line-height: 1.4;
}
.legend-item strong {
  color: #1a2a44;
  display: block;
  font-size: 12.5px;
}
.legend-svg {
  width: 28px;
  height: 40px;
  flex-shrink: 0;
}
.legend-section:nth-child(n+5) .legend-svg {
  height: 28px;
}
.legend-swatch {
  display: inline-block;
  width: 28px;
  height: 16px;
  border: 1px solid #ccc;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-line {
  display: inline-block;
  width: 28px;
  height: 0;
  border-bottom: 2px solid;
  flex-shrink: 0;
}
.legend-patch {
  display: inline-block;
  width: 28px;
  height: 16px;
  border: 1px dashed #999;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  font-size: 13px;
  font-weight: 700;
  color: #1a3a5c;
  font-style: italic;
  flex-shrink: 0;
}
.legend-abbr {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  color: #555;
  margin-right: 2px;
}
.legend-abbr-row {
  margin-top: 10px;
  font-size: 12px;
  color: #555;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.legend-abbr-row .legend-abbr {
  margin-left: 0;
  margin-right: 3px;
}
.legend-pdf-link {
  display: block;
  margin-top: 16px;
  padding: 10px;
  text-align: center;
  background: #f0f4f8;
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.legend-pdf-link:hover {
  background: #e2e8f0;
}

/* ── Settings tabs ─────────────────────────────────────────── */
.settings-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  padding: 0 16px;
}
.settings-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab:hover { color: #1a2a44; }
.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; }

/* ── Settings panel ────────────────────────────────────────── */
.settings-group {
  margin-bottom: 18px;
}
.settings-group:last-child {
  margin-bottom: 0;
}
.settings-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1a2a44;
  margin-bottom: 8px;
}
.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
}
.settings-radio input[type="radio"] {
  accent-color: var(--accent);
  margin: 0;
}
.settings-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
}
.settings-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
}
.settings-layer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.settings-layer .settings-checkbox {
  flex-shrink: 0;
  min-width: 140px;
}
.settings-slider-sm {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 18px;
}

.settings-coverage {
  font-size: 10px;
  color: #8899aa;
  font-weight: normal;
}

/* Boat settings inputs */
.settings-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #ccd;
  border-radius: 4px;
  font-size: 13px;
  color: #1a2a44;
  background: #fff;
}
.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.settings-input--wide { width: 100%; }
.settings-select {
  padding: 6px 8px;
  border: 1px solid #ccd;
  border-radius: 4px;
  font-size: 13px;
  color: #444;
  background: #fff;
  cursor: pointer;
}
.settings-select:focus {
  outline: none;
  border-color: var(--accent);
}
.settings-unit-label {
  font-size: 13px;
  color: #666;
}
.settings-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: #888;
}

/* Route depth warning */
.route-depth-warning {
  background: #fef3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #856404;
}
.route-depth-warning strong { color: #664d03; }
.route-passage-info {
  background: #e8f4f8;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #0c5460;
}

/* ── Info popup pilot content ─────────────────────────────── */
.info-learn-link {
  color: #0078d4;
  cursor: pointer;
  border-bottom: 1px dotted #0078d4;
}
.info-learn-link:hover {
  color: #005a9e;
  border-bottom-style: solid;
}
.pilot-content {
  font-size: 12px;
  line-height: 1.5;
}
.pilot-content h3 {
  font-size: 14px;
  margin: 0 0 8px;
  color: #1a2a44;
}
.pilot-content p {
  margin: 0 0 8px;
  color: #444;
}
.pilot-back {
  border: none;
  background: none;
  color: #0078d4;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  margin-bottom: 8px;
  display: block;
}
.pilot-back:hover {
  text-decoration: underline;
}
.pilot-tip {
  background: #f0f7ee;
  border-left: 3px solid #4caf50;
  padding: 6px 10px;
  margin: 8px 0;
  font-size: 11px;
  border-radius: 2px;
}
.pilot-warning {
  background: #fef3cd;
  border-left: 3px solid #ffc107;
  padding: 6px 10px;
  margin: 8px 0;
  font-size: 11px;
  border-radius: 2px;
}

/* ── Coast Pilot content ─────────────────────────────────── */
.coast-pilot-link {
  cursor: pointer;
  color: #0078d4;
  font-size: 12px;
  margin: 4px 0 2px;
  padding: 3px 0;
}
.coast-pilot-link:hover {
  text-decoration: underline;
}
.coast-pilot-content {
  font-size: 12px;
  line-height: 1.5;
  color: #1a2a44;
}
.coast-pilot-content h3 {
  font-size: 14px;
  margin: 6px 0 4px;
  color: #1a2a44;
}
.coast-pilot-content p {
  margin: 4px 0;
}
.coast-pilot-cite {
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}
.coast-pilot-subheading {
  font-size: 12px;
  font-weight: 700;
  margin: 8px 0 3px;
  color: #2c5282;
}

/* ── Nautical mile scale bar ──────────────────────────────── */
.nm-scale {
  position: fixed;
  bottom: 8px;
  left: calc(var(--toolbar-width) + 10px);
  z-index: 1000;
  background: rgba(255,255,255,0.85);
  padding: 2px 8px 4px;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 11px;
  color: #333;
  pointer-events: none;
  line-height: 1;
}
.nm-scale__bar {
  height: 4px;
  background: #333;
  border-left: 2px solid #333;
  border-right: 2px solid #333;
  margin-bottom: 2px;
}

/* ── Draw tool panel ───────────────────────────────────────── */
.draw-panel {
  top: calc(var(--header-height) + 8px);
  left: calc(var(--toolbar-width) + 8px);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}
.draw-mode-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #555;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.draw-mode-btn:hover { background: #e8e8e8; color: #333; }
.draw-mode-btn.active { background: var(--accent); color: #fff; }
.draw-mode-btn.active svg { stroke: #fff; }
.draw-clear-btn { color: #c0392b; }
.draw-clear-btn:hover { background: #fee; }
.draw-sep {
  width: 1px;
  height: 20px;
  background: #ccc;
  margin: 0 2px;
}

/* Draw markers */
.draw-point {
  width: 22px;
  height: 22px;
  background: #e63946;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: grab;
}
.draw-point:active { cursor: grabbing; }
.draw-point--standalone {
  background: #333;
}
.draw-coord-label {
  background: rgba(255,255,255,0.9);
  color: #333;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 10px;
  white-space: nowrap;
  border: 1px solid #ccc;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.draw-coord-label:hover {
  border-color: var(--accent);
}
.draw-dist-label {
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 11px;
  white-space: nowrap;
  border: none;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s;
}
.draw-dist-label:hover {
  background: rgba(0,120,212,0.9);
}
.draw-edit-popup .leaflet-popup-content-wrapper {
  border-radius: 6px;
  padding: 0;
}
.draw-edit-popup .leaflet-popup-content {
  margin: 8px 10px;
}
.draw-edit-input {
  width: 180px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
  outline: none;
}
.draw-edit-input:focus { border-color: var(--accent); }
.draw-circle-outline {
  stroke: #e63946;
  stroke-width: 2;
  stroke-dasharray: 8,6;
  fill: rgba(230,57,70,0.08);
}

/* ── Coords cursor tooltip ─────────────────────────────────── */
.coords-cursor {
  position: fixed;
  z-index: 1000;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  display: none;
}

/* Coords input panel */
.coords-input-panel {
  bottom: 30px;
  left: calc(var(--toolbar-width) + 12px);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
}
.coords-input {
  width: 220px;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
  outline: none;
}
.coords-input:focus {
  border-color: var(--accent);
}
.coords-go-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.coords-go-btn:hover { background: #0063b1; }

/* Pinned coord marker */
.coord-pin {
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  font-size: 11px;
  white-space: nowrap;
  border: none;
  box-shadow: none;
}

/* ── Search bar (in header) ─────────────────────────────────── */
.search-bar {
  position: relative;
  margin-left: auto;
  width: 260px;
  flex-shrink: 0;
}
.search-bar__input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 0 8px;
  height: 32px;
  transition: background 0.2s;
}
.search-bar__input-wrap:focus-within {
  background: rgba(255,255,255,0.95);
}
.search-bar__input-wrap:focus-within .search-bar__icon {
  stroke: #555;
}
.search-bar__icon {
  flex-shrink: 0;
  stroke: rgba(255,255,255,0.7);
  transition: stroke 0.2s;
}
.search-bar__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 13px;
  padding: 0 6px;
  outline: none;
}
.search-bar__input::placeholder {
  color: rgba(255,255,255,0.55);
}
.search-bar__input-wrap:focus-within .search-bar__input {
  color: #222;
}
.search-bar__input-wrap:focus-within .search-bar__input::placeholder {
  color: #999;
}
.search-bar__clear {
  display: none;
  border: none;
  background: none;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.search-bar__input-wrap:focus-within .search-bar__clear {
  color: #888;
}
.search-bar__clear.visible {
  display: block;
}

/* Dropdown (scope toggle + results) */
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  margin-top: 4px;
  background: #fff;
  color: #222;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  overflow: hidden;
  max-height: 55vh;
  flex-direction: column;
  z-index: 1200;
}
.search-dropdown.open {
  display: flex;
}
.search-scope-row {
  display: flex;
  padding: 6px 8px;
  gap: 0;
  border-bottom: 1px solid #e5e5e5;
}
.search-scope-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.search-scope-btn:first-child {
  border-radius: 4px 0 0 4px;
}
.search-scope-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}
.search-scope-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.search-results {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.search-results-group h4 {
  margin: 0;
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  background: #f7f7f7;
  border-bottom: 1px solid #eee;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover {
  background: #e8f0fe;
}
.search-result-item.active {
  background: #d0e2fd;
}
.search-result-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-type {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  background: #e8e8e8;
  color: #555;
}
.search-result-type--place {
  background: #e0f2e9;
  color: #1b6e3d;
}
.search-result-type--nav {
  background: #e0ecf8;
  color: #1a5290;
}
.search-loading,
.search-empty {
  padding: 16px 12px;
  text-align: center;
  color: #888;
  font-size: 12px;
}
.search-marker-icon {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* ── Tutorial modal ────────────────────────────────────────── */
.tutorial-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.tutorial-item:last-child {
  border-bottom: none;
}
.tutorial-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a2a44;
  border-radius: 6px;
  color: #fff;
}
.tutorial-text strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
  color: #1a2a44;
}
.tutorial-text p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #555;
}
.tutorial-list {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.5;
  color: #555;
}
.tutorial-list li {
  margin-bottom: 4px;
}
.tutorial-list li strong {
  color: #1a2a44;
}
.tutorial-text em {
  font-style: normal;
  font-weight: 600;
  color: #0078d4;
}
.tutorial-tip {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f0f6ff;
  border-radius: 6px;
  font-size: 12px;
  color: #1a5290;
}
.tutorial-tip strong {
  color: #0078d4;
}
.tutorial-tip kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  font-family: inherit;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 1px 0 #ddd;
}

/* ── Cursors for tool modes ─────────────────────────────────── */
.cursor-crosshair { cursor: crosshair; }
.cursor-route { cursor: crosshair; }
.cursor-info { cursor: help; }

/* ── Mobile adjustments ─────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --toolbar-width: 42px;
  }
  .toolbar__btn {
    width: 36px;
    height: 36px;
  }
  #btn-locate {
    bottom: 20px;
    right: 8px;
  }
  .coords-panel {
    bottom: 70px;
    right: 8px;
    font-size: 11px;
  }
  .measure-panel {
    left: calc(var(--toolbar-width) + 8px);
    bottom: 20px;
    font-size: 12px;
  }
  .modal-panel {
    width: 95vw;
    max-height: 85vh;
  }
  .coords-input-panel {
    left: calc(var(--toolbar-width) + 8px);
    bottom: 20px;
  }
  .coords-input {
    width: 160px;
    font-size: 11px;
  }
  .search-bar {
    width: 160px;
  }
}
