/* ============================================
   MAP SHELL — Map-first layout + drawer nav
   Po wodach Wenecji / Par le aque de Venessia
   ============================================ */


/* ── FULL-VIEWPORT MAP ── */
.map-page {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.map-viewport {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.map-viewport #map {
  width: 100%;
  height: 100%;
  background: #c2d6e6;
}


/* ── MAP TOPBAR (floating over map) ── */
.map-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1.5px solid rgba(201, 162, 39, 0.25);
  font-family: var(--font, 'Alegreya', Georgia, serif);
  pointer-events: auto;
}

.map-topbar .drawer-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px 6px 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}

.map-topbar .drawer-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink, #1a1a1a);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.2s;
}

.map-topbar .map-brand {
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.88rem;
  font-weight: 700;
  font-style: italic;
  color: var(--ink, #1a1a1a);
  text-decoration: none;
  margin-left: 4px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: visible;
  flex-shrink: 0;
  min-width: 0;
}

.map-topbar .lang-switch-mini {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.map-topbar .lang-switch-mini a {
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink-faint, #888);
  padding: 4px 5px;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}

.map-topbar .lang-switch-mini a:hover {
  color: var(--ink, #1a1a1a);
}

.map-topbar .lang-switch-mini a.current {
  color: var(--ink, #1a1a1a);
  background: rgba(0, 0, 0, 0.06);
}

.map-topbar .lang-switch-mini span {
  color: var(--ink-faint, #888);
  font-size: 0.82rem;
  opacity: 0.4;
}

/* ── CONTENT PAGE TOPBAR ── */
.content-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px;
  background: rgba(250, 246, 238, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1.5px solid rgba(201, 162, 39, 0.30);
  font-family: var(--font, 'Alegreya', Georgia, serif);
}

.content-topbar .back-to-map {
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-dark, #8a6a10);
  text-decoration: none;
  padding: 6px 8px;
  transition: color 0.2s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.content-topbar .back-to-map:hover {
  color: var(--red, #8b0000);
}

.content-topbar .page-title-bar {
  font-family: var(--font-sans, 'Alegreya Sans', sans-serif);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink-faint, #888);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-left: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-topbar .drawer-toggle {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}

.content-topbar .drawer-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--accent-dark, #8a6a10);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.2s;
}

.content-topbar .drawer-toggle:hover span {
  background: var(--red, #8b0000);
}

.content-topbar .lang-switch-mini {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  margin-left: 12px;
  margin-right: 8px;
}

.content-topbar .lang-switch-mini a {
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink-light, #444);
  padding: 4px 5px;
  border-radius: 3px;
  transition: color 0.2s;
}

.content-topbar .lang-switch-mini a:hover {
  color: var(--red, #8b0000);
}

.content-topbar .lang-switch-mini a.current {
  color: var(--accent-dark, #8a6a10);
  background: rgba(201, 162, 39, 0.12);
}

.content-topbar .lang-switch-mini span {
  color: rgba(201, 162, 39, 0.4);
  font-size: 0.82rem;
}

/* ── DRAWER SCRIM ── */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(26, 26, 26, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  -webkit-tap-highlight-color: transparent;
}

.drawer-scrim.open {
  opacity: 1;
  visibility: visible;
}

/* ── NAVIGATION DRAWER ── */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 2000;
  width: 300px;
  max-width: 85vw;
  background: rgba(250, 246, 238, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 3px solid var(--accent, #c9a227);
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(26, 26, 26, 0.08);
  flex-shrink: 0;
}

.drawer-brand {
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 1.05rem;
  font-weight: 700;
  font-style: italic;
  color: var(--ink, #1a1a1a);
  letter-spacing: -0.01em;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--ink-faint, #888);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.15s;
}

.drawer-close:hover {
  color: var(--ink, #1a1a1a);
}

/* Drawer navigation links */
.drawer-links {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex-shrink: 0;
}

.drawer-links li {
  padding: 0;
  margin: 0;
}

.drawer-links li::before {
  display: none;
}

.drawer-links a {
  display: block;
  padding: 10px 24px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-light, #444);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: background 0.15s, color 0.15s, padding-left 0.2s;
  border-left: 3px solid transparent;
}

.drawer-links a:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink, #1a1a1a);
  padding-left: 28px;
}

.drawer-links a.drawer-active {
  color: var(--accent, #c9a227);
  border-left-color: var(--accent, #c9a227);
  font-style: italic;
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: -0.01em;
}

/* Drawer: quick-start collapsible */
.drawer-quickstart {
  border-top: 1px solid rgba(26, 26, 26, 0.08);
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.drawer-quickstart summary {
  display: block;
  padding: 12px 24px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-light, #444);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  list-style: none;
  user-select: none;
}

.drawer-quickstart summary::-webkit-details-marker { display: none; }
.drawer-quickstart summary::marker { display: none; content: ''; }

.drawer-quickstart summary::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 8px;
  font-size: 0.78rem;
  transition: transform 0.2s;
  color: var(--accent, #c9a227);
}

.drawer-quickstart[open] summary::before {
  transform: rotate(90deg);
}

.drawer-quickstart summary:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink, #1a1a1a);
}

.drawer-quickstart-content {
  padding: 0 20px 16px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-light, #444);
}

.drawer-quickstart-content table {
  font-size: 0.82rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--bg-dark, #d4ccb8);
}

.drawer-quickstart-content th {
  font-size: 0.76rem;
  padding: 0.35rem 0.5rem;
}

.drawer-quickstart-content td {
  padding: 0.3rem 0.5rem;
  font-size: 0.76rem;
}

.drawer-quickstart-content h3 {
  font-size: 0.82rem;
  margin: 1rem 0 0.4rem;
}

.drawer-quickstart-content ul {
  margin: 0.3rem 0 0.8rem;
}

.drawer-quickstart-content li {
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

/* Drawer footer */
.drawer-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(26, 26, 26, 0.08);
  flex-shrink: 0;
}

.drawer-footer .lang-switch-drawer {
  display: flex;
  align-items: center;
  gap: 2px;
}

.drawer-footer .lang-switch-drawer a {
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink-faint, #888);
  padding: 5px 7px;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}

.drawer-footer .lang-switch-drawer a:hover {
  color: var(--ink, #1a1a1a);
}

.drawer-footer .lang-switch-drawer a.current {
  color: var(--ink, #1a1a1a);
  background: rgba(0, 0, 0, 0.06);
}

.drawer-footer .lang-switch-drawer span {
  color: var(--ink-faint, #888);
  font-size: 0.82rem;
  opacity: 0.4;
}

.drawer-attrib {
  margin-top: 10px;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-faint, #888);
  line-height: 1.5;
}

.drawer-attrib a {
  color: var(--accent, #c9a227);
  font-size: 0.82rem;
}

/* ── DRAWER: LAYER CONTROLS (merged from former .layer-panel) ── */
.drawer-layers {
  border-top: 1px solid rgba(26, 26, 26, 0.08);
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.drawer-layers summary {
  display: block;
  padding: 12px 24px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-light, #444);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  list-style: none;
  user-select: none;
}

.drawer-layers summary::-webkit-details-marker { display: none; }
.drawer-layers summary::marker { display: none; content: ''; }

.drawer-layers summary::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 8px;
  font-size: 0.78rem;
  transition: transform 0.2s;
  color: var(--accent, #c9a227);
}

.drawer-layers[open] summary::before {
  transform: rotate(90deg);
}

.drawer-layers summary:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink, #1a1a1a);
}

.drawer-layers-content {
  padding: 2px 20px 14px;
}

.drawer-zoom-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(26, 26, 26, 0.22);
  background: transparent;
  border-radius: 0;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.82rem;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink, #1a1a1a);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, letter-spacing 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.drawer-zoom-btn:hover {
  background: var(--accent, #c9a227);
  color: #f5ecd0;
  border-color: var(--accent, #c9a227);
  letter-spacing: 0.16em;
}

.drawer-layer-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 9px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink, #1a1a1a);
  text-align: left;
  transition: opacity 0.18s, background 0.15s, padding-left 0.2s;
  border-bottom: 1px dotted rgba(26, 26, 26, 0.14);
  -webkit-tap-highlight-color: transparent;
}

.drawer-layer-btn:last-child { border-bottom: none; }

.drawer-layer-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  padding-left: 8px;
}

.drawer-layer-btn:not(.active) { opacity: 0.42; }

.drawer-layer-btn .swatch-bar,
.drawer-layer-btn .swatch-solid {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 2px;
  margin-top: 5px;
}

.drawer-layer-label-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-layer-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.drawer-layer-desc {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--ink-light, #555);
  line-height: 1.3;
  white-space: normal;
}

.drawer-layer-btn:not(.active) .drawer-layer-desc {
  color: var(--ink-faint, #888);
}

.drawer-layer-state {
  flex-shrink: 0;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.86rem;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  border: 1px solid currentColor;
  min-width: 28px;
  text-align: center;
}

.drawer-layer-btn.active .drawer-layer-state {
  color: var(--accent, #c9a227);
}
.drawer-layer-btn.active .drawer-layer-state .state-off { display: none; }
.drawer-layer-btn:not(.active) .drawer-layer-state {
  color: var(--ink-faint, #888);
}
.drawer-layer-btn:not(.active) .drawer-layer-state .state-on { display: none; }

/* Safety: hide any lingering old layer-panel (cached markup) */
.layer-panel { display: none !important; }

/* ── Bathymetry layer extras ── */

/* Subtle separator above the bathymetry section */
.drawer-layer-sep {
  height: 1px;
  margin: 8px 0 4px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(201, 162, 39, 0.18) 20%,
    rgba(201, 162, 39, 0.18) 80%,
    transparent 100%);
}

/* Isobath tooltip — small, neutral, non-intrusive */
.leaflet-tooltip.isobath-tip {
  background: rgba(255, 252, 245, 0.95);
  border: 1px solid rgba(2, 132, 199, 0.5);
  color: #075985;
  font-family: 'Alegreya', serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 1px 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}


/* ── MAP CONTROLS: extracted from mapa.html inline styles ── */
/* .layer-panel + .layer-btn + .layer-zoom-btn were migrated to the drawer
   (see .drawer-layer-btn above). Safety hide on `.layer-panel` at L646 covers
   any stale cached markup. */

/* Popups */
.leaflet-popup-content-wrapper {
  border-radius: 4px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
}

.leaflet-popup-content {
  margin: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.leaflet-popup-content h3 {
  margin: 0 0 4px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 1rem;
  color: var(--lagoon-deep, #0e3b3b);
}

.leaflet-popup-content .tag {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  font-size: 0.84rem; font-family: inherit; font-weight: 500; margin-bottom: 4px;
}

.leaflet-popup-content .tag-blu { background: #1456a820; color: #0d3f7a; }
.leaflet-popup-content .tag-restricted { background: #9b233520; color: #6b1525; }
.leaflet-popup-content .tag-other { background: #2878a820; color: #1a5c82; }
.leaflet-popup-content .tag-danger { background: #8b1a2b20; color: #5c1120; }
.leaflet-popup-content .dist { color: var(--ink-faint, #8a8a9a); font-size: 0.78rem; }

.leaflet-popup-content .restriction {
  margin-top: 4px; padding: 3px 6px; background: #fef3c7;
  border-radius: 3px; font-size: 0.86rem; color: #92400e;
}

/* ── Route panel ── Maritime ephemeris / chart cartouche ────────────────── */

.route-panel {
  position: absolute;
  top: 54px;
  left: 10px;
  z-index: 1000;
  width: 296px;
  padding: 16px 18px 18px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.8rem;
  color: var(--ink, #1a1a1a);
  background:
    linear-gradient(180deg, rgba(250,246,238,0.97), rgba(244,239,228,0.94));
  backdrop-filter: blur(10px) saturate(110%);
  -webkit-backdrop-filter: blur(10px) saturate(110%);
  border: 1px solid rgba(201, 162, 39, 0.18);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 0 0 1px rgba(255,252,245,0.6) inset,
    0 8px 24px -8px rgba(28, 28, 40, 0.18);
}
/* Inner hairline frame — chart plate border */
.route-panel::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 0.5px solid rgba(201, 162, 39, 0.16);
  border-radius: 1px;
  pointer-events: none;
}

/* ── Close button floats top-right (no title) ── */
.route-panel .close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--ink-faint, #888);
  padding: 4px 6px;
  line-height: 1;
  letter-spacing: 0;
  transition: color 0.15s, transform 0.15s;
}
.route-panel .close-btn:hover {
  color: var(--accent, #c9a227);
  transform: rotate(90deg);
}

/* ── Toggle button (now lives in .map-topbar via JS) ── */
.route-panel-toggle {
  position: absolute;
  top: 54px;
  left: 10px;
  z-index: 1001;
  padding: 7px 14px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent, #c9a227);
  background: rgba(250, 246, 238, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 2px;
  box-shadow: 0 4px 12px -4px rgba(28, 28, 40, 0.2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.route-panel-toggle:hover {
  background: var(--accent, #c9a227);
  color: var(--bg-card, #faf6ee);
}
.route-panel:not(.open) { display: none; }

/* In-topbar variant: tucks alongside hamburger + brand */
.map-topbar .route-panel-toggle.in-topbar {
  position: static;
  margin-left: 14px;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.35);
  box-shadow: none;
  color: var(--accent, #c9a227);
  font-size: 0.86rem;
  letter-spacing: 0.22em;
  border-radius: 1px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.map-topbar .route-panel-toggle.in-topbar:hover {
  background: var(--accent, #c9a227);
  color: var(--bg-card, #faf6ee);
  border-color: var(--accent, #c9a227);
}
.map-topbar .route-panel-toggle.in-topbar.is-open { display: none; }
/* When toggle is inside topbar, push the lang-switch out of the way */
.map-topbar .route-panel-toggle.in-topbar + .lang-switch-mini { margin-left: 10px; }

/* ── Inputs: ship's log fill-in lines ── */
.route-input-wrap {
  position: relative;
  margin-bottom: 11px;
  padding-left: 16px;
}
.route-input-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1.55rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green, #2a6a2a);
  box-shadow: 0 0 0 2px rgba(250, 246, 238, 1), 0 0 0 3px rgba(42, 106, 42, 0.25);
}
.route-input-wrap#toWrap::before {
  background: var(--accent, #c9a227);
  box-shadow: 0 0 0 2px rgba(250, 246, 238, 1), 0 0 0 3px rgba(201, 162, 39, 0.25);
  border-radius: 50%;
}
/* Subtle vertical tie-line between origin & destination dots */
.route-input-wrap#fromWrap::after {
  content: '';
  position: absolute;
  left: 4px;
  top: calc(1.55rem + 9px);
  bottom: -11px;
  width: 1px;
  border-left: 1px dotted rgba(201, 162, 39, 0.35);
}

.route-input-wrap label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-light, #444);
  margin-bottom: 2px;
}
.route-input-wrap input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 0 5px;
  border: none;
  border-bottom: 1px dotted rgba(28, 28, 40, 0.45);
  border-radius: 0;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: var(--ink, #1a1a1a);
  outline: none;
  transition: border-color 0.18s;
}
.route-input-wrap input[type="text"]::placeholder {
  color: var(--ink-faint, #888);
  font-style: italic;
  opacity: 0.7;
}
.route-input-wrap input:focus {
  border-bottom: 1px solid var(--accent, #c9a227);
  border-bottom-style: solid;
}

/* ── Autocomplete: index card stack ── */
.route-ac {
  position: absolute;
  top: 100%;
  left: 16px;
  right: 0;
  margin-top: 2px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.18);
  border-radius: 1px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 1002;
  display: none;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 6px 16px -4px rgba(28, 28, 40, 0.18);
  animation: ac-slide 0.16s ease-out;
}
.route-ac.show { display: block; }

@keyframes ac-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.route-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink, #1a1a1a);
  border-bottom: 1px dotted rgba(28, 28, 40, 0.1);
  position: relative;
  transition: background 0.12s, padding-left 0.12s;
}
.route-ac-item:last-child { border-bottom: none; }
.route-ac-item::before {
  content: '·';
  position: absolute;
  left: 6px;
  color: var(--accent, #c9a227);
  font-weight: 700;
  opacity: 0.5;
}
.route-ac-item:hover,
.route-ac-item.active {
  background: rgba(201, 162, 39, 0.05);
  padding-left: 16px;
}
.route-ac-item:hover::before,
.route-ac-item.active::before {
  opacity: 1;
}
.route-ac-item .ac-type {
  margin-left: auto;
  flex-shrink: 0;
  padding: 1px 4px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint, #888);
  background: rgba(28, 28, 40, 0.05);
  border-radius: 1px;
}
.route-ac-item .ac-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Boat & time settings panel (revealed by trigger in action row) ── */
.boat-time-settings {
  margin: 6px 0 12px;
  padding: 12px 12px 8px;
  background: rgba(201, 162, 39, 0.035);
  border: 1px dotted rgba(201, 162, 39, 0.25);
  border-radius: 1px;
  animation: ac-slide 0.18s ease-out;
}
.boat-time-settings[hidden] { display: none; }

.route-options {
  display: flex;
  gap: 0;
  margin: 0 0 10px;
  align-items: stretch;
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 1px;
  overflow: hidden;
}
.route-options .opt-label { display: none; }

.boat-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--ink-light, #444);
  transition: all 0.18s;
  position: relative;
}
.boat-btn + .boat-btn { border-left: 1px solid rgba(201, 162, 39, 0.22); }
.boat-btn:hover { background: rgba(201, 162, 39, 0.04); color: var(--ink, #1a1a1a); }
.boat-btn.active {
  background: var(--accent, #c9a227);
  color: var(--bg-card, #faf6ee);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* Danger checkbox row (moved inside boat-time-settings) */
.boat-time-settings > label[style] {
  font-size: 0.7rem !important;
  color: var(--ink-light, #444) !important;
  padding: 4px 0 8px;
  margin: 0 !important;
  font-style: italic;
}
.boat-time-settings input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin: 0 6px 0 0;
  border: 1px solid rgba(28, 28, 40, 0.45);
  background: var(--bg-card, #faf6ee);
  border-radius: 1px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.boat-time-settings input[type="checkbox"]:hover {
  border-color: var(--accent, #c9a227);
}
.boat-time-settings input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.35);
}
.boat-time-settings input[type="checkbox"]:checked {
  background: var(--accent, #c9a227);
  border-color: var(--accent-dark, #8a6a10);
}
.boat-time-settings input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 4px;
  height: 8px;
  border: solid var(--bg-card, #faf6ee);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.route-time-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}
.route-time-row input[type="time"],
.route-time-row select {
  flex: 1;
  padding: 5px 6px;
  border: none;
  border-bottom: 1px dotted rgba(28, 28, 40, 0.4);
  border-radius: 0;
  font-family: inherit;
  font-size: 0.78rem;
  background: transparent;
  color: var(--ink, #1a1a1a);
  font-variant-numeric: tabular-nums;
  outline: none;
}
.route-time-row input[type="time"]:focus,
.route-time-row select:focus { border-bottom: 1px solid var(--accent, #c9a227); }
.route-time-row select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-faint, #888) 50%),
    linear-gradient(135deg, var(--ink-faint, #888) 50%, transparent 50%);
  background-position: calc(100% - 8px) 50%, calc(100% - 4px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 16px;
}

/* ── Actions: one row → [Barca e ora] [Sercamar] [Netar] ── */
.route-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
}

/* Inline trigger that reveals the boat/time settings panel */
.boat-time-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  border: 1px dotted rgba(201, 162, 39, 0.45);
  border-radius: 1px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-light, #444);
  text-align: left;
  min-width: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.boat-time-trigger:hover {
  background: rgba(201, 162, 39, 0.05);
  border-color: rgba(201, 162, 39, 0.7);
  color: var(--ink, #1a1a1a);
}
.boat-time-trigger.open {
  background: rgba(201, 162, 39, 0.06);
  border-style: solid;
  border-color: rgba(201, 162, 39, 0.5);
}
.boat-time-trigger .boat-time-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-light, #444);
  flex-shrink: 0;
}
.boat-time-trigger.open .boat-time-label { color: var(--accent, #c9a227); }
.boat-time-trigger .boat-time-value {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--ink, #1a1a1a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.boat-time-trigger .boat-time-value:empty { display: none; }
.boat-time-trigger .boat-time-arrow {
  font-size: 0.72rem;
  color: var(--accent, #c9a227);
  margin-left: auto;
  flex-shrink: 0;
}

.route-go {
  padding: 8px 14px;
  border: none;
  border-radius: 1px;
  background: var(--accent, #c9a227);
  color: var(--bg-card, #faf6ee);
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s, letter-spacing 0.18s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
  white-space: nowrap;
}
.route-go:hover {
  background: var(--accent-light, #a03020);
  letter-spacing: 0.26em;
}
.route-go:disabled {
  opacity: 0.4;
  cursor: default;
  letter-spacing: 0.22em;
}

.route-clear {
  padding: 8px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink-faint, #888);
  border-bottom: 1px dotted transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  align-self: center;
}
.route-clear:hover {
  color: var(--accent, #c9a227);
  border-bottom-color: var(--accent, #c9a227);
}

/* ── Result: sextant readout ── */
.route-result {
  margin-top: 14px;
  padding: 12px 0 4px;
  border-top: 1px solid rgba(201, 162, 39, 0.22);
  background: transparent;
  font-size: 0.72rem;
  line-height: 1.5;
  display: none;
  position: relative;
}
.route-result::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 28px;
  height: 2px;
  background: var(--accent, #c9a227);
}
.route-result.show { display: block; animation: ac-slide 0.24s ease-out; }
.route-result .result-dist {
  display: inline-block;
  font-weight: 400;
  font-style: italic;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  color: var(--accent, #c9a227);
  font-variant-numeric: tabular-nums oldstyle-nums;
  line-height: 1;
  margin-bottom: 2px;
}
.route-result #resultTime {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-light, #444);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.route-result .result-warn {
  margin-top: 10px;
  padding: 6px 8px 6px 22px;
  background: rgba(155, 35, 53, 0.08);
  border-left: 2px solid #9b2335;
  border-radius: 0;
  font-size: 0.72rem;
  font-style: italic;
  color: #6b1525;
  position: relative;
}
.route-result .result-warn::before {
  content: '⚠';
  position: absolute;
  left: 7px;
  top: 6px;
  font-style: normal;
  color: #9b2335;
}

.route-error {
  margin-top: 10px;
  padding: 8px 10px 8px 22px;
  background: rgba(201, 162, 39, 0.06);
  border-left: 2px solid var(--accent, #c9a227);
  border-radius: 0;
  font-size: 0.74rem;
  font-style: italic;
  color: var(--accent, #c9a227);
  display: none;
  position: relative;
}
.route-error::before {
  content: '✕';
  position: absolute;
  left: 8px;
  top: 8px;
  font-style: normal;
}
.route-error.show { display: block; }

.route-hint {
  margin-top: 10px;
  padding-left: 14px;
  font-size: 0.7rem;
  color: var(--ink-faint, #888);
  font-style: italic;
  position: relative;
  line-height: 1.4;
}
.route-hint::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent, #c9a227);
  font-style: normal;
}

/* Push Leaflet controls below the floating topbar */
.map-page .leaflet-top { top: 52px; }
@media (max-width: 600px) {
  .map-page .leaflet-top { top: 48px; }
}

/* Map page: no footer visible */
.map-page footer { display: none; }

/* SVG hatching defs */
.hatch-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── RESPONSIVE ── */

/* Desktop: route panel always visible */
@media (min-width: 801px) {
  .route-panel { display: block !important; width: 360px; }
  .route-panel-toggle { display: none !important; }
  .route-panel .close-btn { display: none; }
}

@media (min-width: 1200px) {
  .route-panel { width: 440px; }
}

@media (max-width: 800px) {
  .route-panel:not(.open) { display: none; }
}

@media (max-width: 600px) {
  .map-topbar { height: 40px; }
  .map-topbar .map-brand { font-size: 0.82rem; }

  .layer-panel {
    top: 50px;
    font-size: 0.78rem;
    padding: 6px;
    gap: 2px;
  }
  .layer-btn { padding: 3px 6px; font-size: 0.78rem; gap: 5px; }

  .route-panel {
    top: 40px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    font-size: 0.88rem;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
  .route-panel-toggle { top: 50px; }
  .route-panel-title { font-size: 0.8rem; }

  /* Lang switch hidden in topbar on mobile — available in drawer */
  .map-topbar .lang-switch-mini,
  .content-topbar .lang-switch-mini { display: none; }

  /* Mobile: tighten inner frame of route panel — no border-radius/shadow */
  .route-panel::before { inset: 0; border: none; }
  .route-panel { padding: 12px 14px 16px; }

  .drawer { width: 280px; }

  .content-topbar { height: 40px; }
}

/* Content page: adjust scroll padding for new topbar height */
.content-page {
  scroll-padding-top: 3.5rem;
}

/* Content page: hide old nav (safety, in case any remain) */
.content-page > nav { display: none; }

/* ── Canal bottom sheet — opens on canal click, replaces hover bubbles ───── */
.canal-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  padding: 14px 22px 24px;
  font-family: var(--font, 'Alegreya', Georgia, serif);
  color: var(--ink, #1a1a1a);
  background:
    linear-gradient(180deg, rgba(250,246,238,0.985), rgba(244,239,228,0.97));
  backdrop-filter: blur(12px) saturate(115%);
  -webkit-backdrop-filter: blur(12px) saturate(115%);
  border-top: 1px solid rgba(201, 162, 39, 0.22);
  box-shadow: 0 -14px 36px -10px rgba(28, 28, 40, 0.28);
  transform: translateY(105%);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
.canal-sheet.open {
  transform: translateY(0);
  pointer-events: auto;
}
.canal-sheet-close {
  position: absolute;
  top: 10px;
  right: 18px;
  z-index: 2;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ink-faint, #888);
  padding: 2px 6px;
  transition: color 0.15s, transform 0.2s;
}
.canal-sheet-close:hover {
  color: var(--accent, #c9a227);
  transform: rotate(90deg);
}
.canal-sheet-tag {
  display: inline-block;
  margin: 0;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: var(--ink, #1a1a1a);
  border-radius: 3px;
}
.canal-sheet-tag.tag-blu        { background: #0f3d7a; }
.canal-sheet-tag.tag-restricted { background: #9b2335; }
.canal-sheet-tag.tag-danger     { background: #6b1018; }
.canal-sheet-tag.tag-other      { background: #2c5f4f; }
.canal-sheet-tag.tag-lagoon     { background: #6b9685; }
.canal-sheet-name {
  margin: 10px 0 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.15;
  color: var(--ink, #1a1a1a);
}
.canal-sheet-desc {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-light, #444);
  background: rgba(244, 239, 228, 0.6);
  border-left: 3px solid var(--accent, #c9a227);
}
.canal-sheet-desc:empty { display: none; }
.canal-sheet-desc .dist {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint, #888);
  margin-bottom: 4px;
}
.canal-sheet-actions {
  display: flex;
  gap: 10px;
  margin: 20px 0 0;
}
.canal-sheet-btn {
  flex: 1;
  padding: 13px 10px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 1px;
  transition: background 0.16s, color 0.16s, transform 0.1s;
}
.canal-sheet-btn:active { transform: translateY(1px); }
.canal-sheet-btn.primary {
  color: var(--bg-card, #faf6ee);
  background: var(--ink, #1a1a1a);
  border: 1px solid var(--ink, #1a1a1a);
}
.canal-sheet-btn.primary:hover { background: #000; }
.canal-sheet-btn.ghost {
  color: var(--accent, #c9a227);
  background: transparent;
  border: 1.4px solid var(--accent, #c9a227);
}
.canal-sheet-btn.ghost:hover {
  background: var(--accent, #c9a227);
  color: var(--bg-card, #faf6ee);
}
@media (min-width: 720px) {
  .canal-sheet {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 360px;
    border: 1px solid rgba(201, 162, 39, 0.22);
    border-radius: 2px;
  }
  .canal-sheet:not(.open) { transform: translateY(120%); }
}

/* ── MOBILE READABILITY OVERRIDES (added 2026-06-15) ── */
@media (max-width: 700px) {
  /* Topbar: bigger brand + bigger hamburger hitbox */
  .map-topbar { height: 52px; padding: 0 14px; }
  .map-topbar .map-brand { font-size: 0.98rem; }
  .map-topbar .drawer-toggle { padding: 10px 10px 10px 4px; }
  .map-topbar .drawer-toggle span { width: 22px; height: 2px; }
  .map-topbar .lang-switch-mini a { padding: 6px 7px; font-size: 0.68rem; letter-spacing: 0.06em; }
  .map-topbar .lang-switch-mini span { font-size: 0.62rem; }
}

@media (max-width: 420px) {
  .map-topbar .map-brand { font-size: 0.9rem; }
  .map-topbar .lang-switch-mini a { padding: 5px 5px; font-size: 0.76rem; }
  .map-topbar .route-panel-toggle.in-topbar { padding: 6px 9px; font-size: 0.68rem; letter-spacing: 0.14em; }
}

@media (max-width: 700px) {

  /* Content topbar: bigger Back + page title */
  .content-topbar { height: 52px; }
  .content-topbar .back-to-map { font-size: 0.92rem; padding: 8px 10px; }
  .content-topbar .page-title-bar { font-size: 0.9rem; color: rgba(244, 239, 228, 0.6); }
  .content-topbar .drawer-toggle { padding: 10px 6px; }
  .content-topbar .drawer-toggle span { width: 22px; height: 2px; }

  /* Drawer: more breathable nav, bigger tap targets */
  .drawer { width: 320px; }
  .drawer-brand { font-size: 1.2rem; }
  .drawer-close { font-size: 1.7rem; padding: 6px 12px; }
  .drawer-links a { padding: 13px 24px; font-size: 0.92rem; letter-spacing: 0.06em; }
  .drawer-links a.drawer-active { font-size: 1rem; }
  .drawer-quickstart summary,
  .drawer-layers summary { padding: 14px 24px; font-size: 0.88rem; }
  .drawer-layer-btn { padding: 12px 6px; font-size: 0.92rem; }
  .drawer-layer-state { font-size: 0.62rem; padding: 3px 7px; min-width: 32px; letter-spacing: 0.12em; }
  .drawer-zoom-btn { padding: 11px 14px; font-size: 0.86rem; }
  .drawer-footer .lang-switch-drawer a { padding: 8px 10px; font-size: 0.88rem; }
  .drawer-attrib { font-size: 0.82rem; line-height: 1.6; }

  /* Leaflet popups: bigger text + chunkier tags */
  .leaflet-popup-content { font-size: 1rem; line-height: 1.55; margin: 12px 16px; }
  .leaflet-popup-content h3 { font-size: 1.15rem; }
  .leaflet-popup-content .tag { font-size: 0.82rem; padding: 2px 9px; }
  .leaflet-popup-content .dist { font-size: 0.88rem; }
  .leaflet-popup-content .restriction { font-size: 0.86rem; padding: 5px 8px; }

  /* Route panel toggle in topbar: more legible */
  .map-topbar .route-panel-toggle.in-topbar { padding: 7px 12px; font-size: 0.74rem; letter-spacing: 0.18em; }
}

/* ── Live user position marker (Google-style blue dot + pulse aura) ───── */
.user-pos-icon { background: transparent; border: 0; }
.user-pos {
  position: relative;
  width: 32px;
  height: 32px;
}
.user-pos-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8ab4ff 0%, #4285F4 55%, #1a5cd6 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(16, 50, 120, 0.5), 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.user-pos-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.55);
  animation: userPosPulse 2s ease-out infinite;
  z-index: 1;
}
@keyframes userPosPulse {
  0%   { transform: scale(0.55); opacity: 0.95; }
  80%  { transform: scale(2.8); opacity: 0;     }
  100% { transform: scale(2.8); opacity: 0;     }
}
