/* ============================================================
   SHELL V2 — Google-Maps-style layout, Venetian chart aesthetic
   Loaded AFTER map-shell.css on the three map landing pages.
   Top search pill · bottom sheet · place card · directions.
   Scoped to body.map-page so content pages keep the old drawer.
   ============================================================ */

/* ── Neutralise the old map-page shell (topbar / left drawer / route panel) ──
   These are still emitted on content pages, so we only kill them here. */
.map-page .map-topbar,
.map-page .route-panel-toggle,
.map-page #canalSheet,
.map-page #routePanel.route-panel { display: none !important; }

/* Leaflet controls: tuck zoom under the floating search bar, bottom-right clear */
.map-page .leaflet-top { top: 66px; }
.map-page .leaflet-bottom.leaflet-right { bottom: 8px; }
.map-page .leaflet-control-attribution { font-size: 0.62rem; opacity: 0.7; }

/* The locate FAB (from mapa-app.js) sits above the bottom sheet peek */
.map-page .locate-fab { bottom: 96px !important; }
/* When user manually tucks the sheet, FAB drops to near-bottom */
.map-page.sheet-user-tucked .locate-fab { bottom: 60px !important; }

/* Restore pill — appears when user hides the bottom sheet */
.sheet-restore-btn {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1101;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 18px 8px 14px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.38);
  border-radius: 20px;
  box-shadow: 0 4px 18px -4px rgba(28, 28, 40, 0.32);
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink, #1a1a1a);
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow .2s, transform .2s;
}
.sheet-restore-btn:hover {
  box-shadow: 0 6px 22px -4px rgba(28, 28, 40, 0.42);
  transform: translateX(-50%) translateY(-1px);
}
.sheet-restore-btn.show { display: flex; }

/* ─────────────────────────────────────────────────────────────
   TOP SEARCH BAR
   ───────────────────────────────────────────────────────────── */
.top-bar {
  position: fixed;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 1200;
  display: flex;
  align-items: stretch;
  gap: 8px;
  max-width: 560px;
  pointer-events: none; /* let map breathe between children */
}
.top-bar > * { pointer-events: auto; }

/* Brand badge — maroon monogram + gold wordmark */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
  height: 46px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.30);
  border-radius: 24px;
  box-shadow: 0 6px 20px -8px rgba(28, 28, 40, 0.35);
  text-decoration: none;
  flex-shrink: 0;
  transition: box-shadow .2s, transform .2s;
}
.brand:hover { box-shadow: 0 8px 26px -8px rgba(28, 28, 40, 0.45); transform: translateY(-1px); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red, #8b0000);
  color: #f6efd9;
  font-family: var(--font, 'Alegreya', serif);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1.5px rgba(246, 239, 217, 0.35);
}
.brand-word {
  font-family: var(--font, 'Alegreya', serif);
  font-weight: 700;
  font-size: 1.04rem;
  letter-spacing: 0.01em;
  color: var(--ink, #1a1a1a);
}

/* Search field */
.search {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 10px 0 12px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.30);
  border-radius: 24px;
  box-shadow: 0 6px 20px -8px rgba(28, 28, 40, 0.35);
  transition: box-shadow .2s, border-color .2s;
}
.search:focus-within {
  border-color: var(--accent, #c9a227);
  box-shadow: 0 8px 26px -8px rgba(28, 28, 40, 0.45);
}
.search-icon { width: 18px; height: 18px; color: var(--accent-dark, #8a6a10); flex-shrink: 0; opacity: 0.8; }
.search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font, 'Alegreya', serif);
  font-size: 1rem;
  color: var(--ink, #1a1a1a);
  padding: 0 6px;
}
.search input::placeholder { color: var(--ink-faint, #888); font-style: italic; opacity: 0.8; }
.search-clear {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border: none; background: transparent;
  color: var(--ink-faint, #888);
  font-size: 1.3rem; line-height: 1;
  cursor: pointer; border-radius: 50%;
}
.search-clear:hover { background: rgba(28,28,40,0.06); color: var(--red, #8b0000); }

/* Language toggle button */
.top-lang {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 46px; height: 46px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.30);
  border-radius: 50%;
  box-shadow: 0 6px 20px -8px rgba(28, 28, 40, 0.35);
  color: var(--accent-dark, #8a6a10);
  cursor: pointer;
  transition: box-shadow .2s, color .2s, transform .2s;
}
.top-lang:hover { color: var(--red, #8b0000); transform: translateY(-1px); }
.top-lang svg { width: 20px; height: 20px; }

.lang-menu[hidden] { display: none; }
.lang-menu {
  position: absolute;
  top: 54px; right: 0;
  z-index: 1300;
  display: flex; flex-direction: column;
  min-width: 150px;
  padding: 6px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.30);
  border-radius: 8px;
  box-shadow: 0 12px 32px -10px rgba(28, 28, 40, 0.45);
}
.lang-menu a {
  padding: 8px 12px;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.86rem;
  color: var(--ink, #1a1a1a);
  text-decoration: none;
  border-radius: 5px;
}
.lang-menu a:hover { background: rgba(201, 162, 39, 0.12); }
.lang-menu a.current { color: var(--accent-dark, #8a6a10); font-weight: 700; }

/* Search autocomplete — chart index cards */
.search-ac {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  z-index: 1300;
  display: none;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 10px;
  max-height: 320px; overflow-y: auto;
  box-shadow: 0 14px 36px -12px rgba(28, 28, 40, 0.5);
}
.search-ac.show { display: block; }
.search-ac .route-ac-item { padding: 9px 14px; }

/* ─────────────────────────────────────────────────────────────
   PLACE CARD — selected canal (destination candidate)
   ───────────────────────────────────────────────────────────── */
.place-card {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 1150;
  max-width: 460px;
  margin: 0 auto;
  padding: 16px 18px 14px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(28, 28, 40, 0.5);
  animation: card-rise 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.place-card[hidden] { display: none; }
@keyframes card-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.place-card::before {
  /* hairline chart plate */
  content: '';
  position: absolute; inset: 5px;
  border: 1px solid rgba(201, 162, 39, 0.18);
  border-radius: 10px;
  pointer-events: none;
}
.pc-close {
  position: absolute; top: 10px; right: 12px;
  width: 28px; height: 28px;
  border: none; background: transparent;
  color: var(--ink-faint, #888);
  font-size: 1.5rem; line-height: 1;
  cursor: pointer; border-radius: 50%;
}
.pc-close:hover { background: rgba(28,28,40,0.06); color: var(--red, #8b0000); }
.pc-tag {
  display: inline-block;
  padding: 2px 9px;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  border-radius: 3px;
  background: rgba(201, 162, 39, 0.16);
  color: var(--accent-dark, #8a6a10);
}
.pc-tag.tag-blu { background: rgba(20,86,168,0.14); color: #0d3f7a; }
.pc-tag.tag-restricted { background: rgba(107,58,138,0.14); color: #4a2668; }
.pc-tag.tag-other { background: rgba(40,120,168,0.14); color: #1a5c82; }
.pc-tag.tag-danger { background: rgba(139,26,43,0.14); color: var(--red, #8b0000); }
.pc-name {
  margin: 8px 0 4px;
  font-family: var(--font, 'Alegreya', serif);
  font-weight: 700;
  font-size: 1.42rem;
  line-height: 1.15;
  color: var(--ink, #1a1a1a);
  padding-right: 28px;
}
.pc-desc {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-light, #444);
  margin-bottom: 12px;
}
.pc-desc:empty { display: none; }
.pc-actions { display: flex; gap: 8px; }
.pc-go {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: var(--red, #8b0000);
  color: #f6efd9;
  border: none; border-radius: 22px;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.84rem; font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 5px 14px -5px rgba(139, 0, 0, 0.6);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.pc-go:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -5px rgba(139, 0, 0, 0.7); background: #a00000; }
.pc-go svg { width: 17px; height: 17px; }

/* ─────────────────────────────────────────────────────────────
   DIRECTIONS — TOP PANEL (replaces topbar when open)
   ───────────────────────────────────────────────────────────── */

.dirs-open .top-bar { display: none; }

.directions {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 12px; right: 12px;
  z-index: 1160;
  max-width: 560px;
  background: rgba(250, 246, 238, 0.98);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(201, 162, 39, 0.32);
  border-radius: 14px;
  box-shadow: 0 8px 32px -8px rgba(28, 28, 40, 0.52);
  animation: card-rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.directions[hidden] { display: none; }

/* Inner hairline chart-plate border */
.directions::after {
  content: '';
  position: absolute; inset: 4px;
  border: 0.5px solid rgba(201, 162, 39, 0.18);
  border-radius: 11px;
  pointer-events: none; z-index: 0;
}

/* ── FIELDS: inputs take full width, swap absolute on right ── */
.dir-fields {
  position: relative;
  padding-right: 52px; /* reserved column for swap button */
}
.dir-fields-inputs { position: relative; }

.dir-field {
  position: relative;
  display: flex; align-items: center;
  padding: 12px 48px 12px 28px; /* 48px right = space for 34px loc-btn */
  min-height: 48px;
  z-index: 1;
}
.dir-field + .dir-field {
  border-top: 1px solid rgba(28, 28, 40, 0.07);
}
.dir-dot {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%; z-index: 2;
}
.dot-from {
  background: #2a6a2a;
  box-shadow: 0 0 0 2px rgba(250,246,238,0.98), 0 0 0 3.5px rgba(42,106,42,0.32);
}
.dot-to {
  background: #8b0000;
  box-shadow: 0 0 0 2px rgba(250,246,238,0.98), 0 0 0 3.5px rgba(139,0,0,0.28);
}
/* Dashed connector between dots */
.dir-fields-inputs::before {
  content: '';
  position: absolute; left: 12px; top: 28px; bottom: 28px; width: 1px;
  background: repeating-linear-gradient(
    180deg, rgba(139,0,0,0.26) 0 2px, transparent 2px 5px
  );
  z-index: 1; pointer-events: none;
}

.dir-field input {
  flex: 1; min-width: 0;
  border: none; background: transparent; outline: none;
  font-family: var(--font, 'Alegreya', serif);
  font-size: 24px; font-weight: 500;
  color: var(--ink, #1a1a1a); line-height: 1.3;
}
.dir-field input::placeholder {
  color: rgba(28,28,40,0.36); font-style: italic;
}
/* Location pin — right edge of each field, within the 36px padding zone */
.dir-field .route-loc-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: rgba(28,28,40,0.55) !important;
  width: 34px !important; height: 34px !important;
}
.dir-field .route-loc-btn svg { width: 26px !important; height: 26px !important; }
.dir-field .route-loc-btn:hover { color: #8b0000 !important; }

/* Swap — absolute, centered vertically over the separator, in the 52px right column */
.dir-swap {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  border: 2px solid #8b0000;
  background: rgba(250, 246, 238, 0.97);
  border-radius: 50%;
  color: #8b0000;
  cursor: pointer; z-index: 3;
  display: grid; place-items: center;
  font-size: 0;
  box-shadow: 0 2px 10px -3px rgba(139,0,0,0.32);
  transition: background 0.2s, color 0.2s,
              transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s;
}
.dir-swap:hover {
  background: #8b0000; color: #faf6ee;
  transform: translateY(-50%) rotate(180deg);
  box-shadow: 0 4px 14px -3px rgba(139,0,0,0.48);
}

/* ── BOTTOM ROW: 3 equal buttons + × ── */
.dir-bottom-row {
  display: flex; align-items: center;
  gap: 6px; padding: 8px 10px 10px;
  border-top: 1px solid rgba(201,162,39,0.18);
  position: relative; z-index: 1;
}

/* Shared base for all three action buttons */
.dir-settings-trigger,
.dir-bottom-row .route-clear,
.dir-bottom-row .route-go {
  flex: 1;
  height: 36px;
  border-radius: 7px;
  font-family: var(--font-sans, sans-serif);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s,
              transform 0.12s, box-shadow 0.15s;
}

/* Czym i kiedy — amber ghost */
.dir-settings-trigger {
  border: 1.5px solid rgba(201,162,39,0.48);
  background: transparent;
  color: #8a6a10;
}
.dir-settings-trigger:hover {
  border-color: #c9a227;
  background: rgba(201,162,39,0.08);
}
.dir-settings-icon { flex-shrink: 0; opacity: 0.8; }

/* Wyczyść — maroon ghost */
.dir-bottom-row .route-clear {
  flex: 1;
  height: 36px;
  border: 1.5px solid rgba(139,0,0,0.35);
  border-radius: 7px;
  background: transparent;
  color: #8b0000;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0 8px;
}
.dir-bottom-row .route-clear:hover {
  background: rgba(139,0,0,0.07);
  border-color: #8b0000;
}

/* Wyznacz — maroon fill, primary */
.dir-bottom-row .route-go {
  flex: 1 !important;
  height: 36px !important;
  border: none !important;
  border-radius: 7px !important;
  background: #8b0000 !important;
  color: #faf6ee !important;
  font-size: 13px !important; font-weight: 700 !important;
  letter-spacing: 0.05em !important; text-transform: uppercase !important;
  box-shadow: 0 3px 10px -3px rgba(139,0,0,0.42);
  padding: 0 8px !important;
}
.dir-bottom-row .route-go:hover {
  background: #a00000 !important;
  box-shadow: 0 5px 16px -4px rgba(139,0,0,0.55);
  transform: translateY(-1px);
}

/* × close — small circle at end */
.dir-close {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border: 1.5px solid rgba(28,28,40,0.15);
  background: transparent; color: rgba(28,28,40,0.42);
  cursor: pointer; border-radius: 50%;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dir-close:hover {
  background: rgba(139,0,0,0.07);
  border-color: rgba(139,0,0,0.35);
  color: #8b0000;
}

/* ── SETTINGS PANEL ── */
.dir-settings { padding: 0 12px 12px; }
.dir-settings[hidden] { display: none; }
.dir-settings-hint {
  margin: 0 0 9px;
  font-size: 10px; font-style: italic;
  color: rgba(28,28,40,0.40); letter-spacing: 0.04em;
}

.boat-row {
  display: flex; margin-bottom: 9px;
  border: 1px solid rgba(201,162,39,0.30);
  border-radius: 7px; overflow: hidden;
}
.danger-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: rgba(28,28,40,0.60);
  margin-bottom: 9px; cursor: pointer;
}
.time-row { display: flex; gap: 8px; }
.time-row input[type="time"], .time-row select {
  flex: 1; padding: 6px 7px;
  font-family: var(--font, serif); font-size: 13px;
  border: 1px solid rgba(201,162,39,0.28); border-radius: 6px;
  background: rgba(250,246,238,0.8); color: #1a1a1a;
  appearance: auto;
}

/* ─────────────────────────────────────────────────────────────
   DIRECTIONS — BOTTOM PANEL (results)
   ───────────────────────────────────────────────────────────── */
.dir-result {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 1160;
  max-width: 480px; margin: 0 auto;
  padding: 16px 20px 18px;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(201, 162, 39, 0.30);
  border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(28, 28, 40, 0.5);
  animation: card-rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}
.dir-result[hidden] { display: none; }

/* Inner chart-plate hairline */
.dir-result::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 0.5px solid rgba(201, 162, 39, 0.18);
  border-radius: 10px;
  pointer-events: none;
}

/* Gold accent bar top-left */
.dir-result::after {
  content: '';
  position: absolute;
  top: 0; left: 20px;
  width: 28px; height: 2px;
  background: var(--accent, #c9a227);
  border-radius: 0 0 2px 2px;
}

/* Result stat row: dist + time side by side */
.dir-result .route-result,
.dir-result .route-result.show {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0 20px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.dir-result .route-result::before { display: none; }

.dir-result .result-dist {
  font-size: 2.2rem;
  font-weight: 700;
  font-style: normal;
  color: var(--ink, #1a1a1a);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0;
}
.dir-result #resultTime {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light, #444);
  margin-top: 0;
  padding-bottom: 4px;
}
.dir-result .result-warn { width: 100%; }

/* ─────────────────────────────────────────────────────────────
   BOTTOM SHEET — settings / legend / rules / nav
   ───────────────────────────────────────────────────────────── */
.sheet-scrim {
  position: fixed; inset: 0;
  z-index: 1090;
  background: rgba(20, 18, 14, 0.32);
  opacity: 0; pointer-events: none;
  transition: opacity .28s;
}
.sheet-scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1100;
  display: flex; flex-direction: column;
  max-height: 82vh;
  background: var(--bg-card, #faf6ee);
  border-top: 2px solid var(--accent, #c9a227);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 36px -12px rgba(28, 28, 40, 0.4);
  transform: translateY(calc(100% - var(--peek-h, 56px)));
  transition: transform .32s cubic-bezier(0.2, 0.8, 0.2, 1);
  touch-action: none;
}
.sheet.open { transform: translateY(0); }
/* When a place card / directions is showing, hide the peek entirely */
.sheet.tucked { transform: translateY(100%); }

.sheet-handle {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 100%;
  padding: 12px 0 10px;
  border: none; background: transparent; cursor: grab;
}
.sheet-handle:active { cursor: grabbing; }
.sheet-handle .grip {
  width: 42px; height: 4px;
  border-radius: 2px;
  background: rgba(28, 28, 40, 0.22);
}

/* Header — hidden in peek, visible when open */
.sheet-header {
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 6px;
}
.sheet.open .sheet-header {
  display: flex;
}
.peek-brand {
  font-family: var(--font, 'Alegreya', serif);
  font-weight: 700; font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--ink, #1a1a1a);
}
.peek-hint {
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.78rem;
  color: var(--ink-light, #555);
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* Three switchable tabs */
.sheet-tabs {
  display: flex; gap: 4px;
  padding: 2px;
  margin-bottom: 6px;
  background: rgba(201, 162, 39, 0.10);
  border-radius: 9px;
}
.sheet-tab {
  flex: 1;
  padding: 8px 6px;
  border: none; background: transparent;
  border-radius: 7px;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-light, #444);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.sheet-tab:hover { color: var(--red, #8b0000); }
.sheet-tab.active {
  background: var(--bg-card, #faf6ee);
  color: var(--accent-dark, #8a6a10);
  box-shadow: 0 2px 8px -3px rgba(28, 28, 40, 0.3);
}
.sheet-panel { padding: 8px 0 4px; }
.sheet-panel[hidden] { display: none; }
.legend-note {
  margin: 12px 2px 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(201, 162, 39, 0.18);
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.82rem; line-height: 1.45;
  color: var(--ink-light, #444);
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 20px 28px;
  -webkit-overflow-scrolling: touch;
}

/* Section scaffold inside the sheet */
.sheet-section { border-top: 1px solid rgba(201, 162, 39, 0.18); padding: 14px 0 4px; }
.sheet-section:first-child { border-top: none; }
.sheet-section > h3 {
  margin: 0 0 10px;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-dark, #8a6a10);
}

/* Legend grid */
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; color: var(--ink-light, #444); }
.legend-swatch { width: 16px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend-swatch.dot { width: 11px; height: 11px; border-radius: 50%; }

/* Guide TOC — editorial chart index ─────────────────────────── */
.guide-group-title {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 6px;
  font-family: var(--font-sans, sans-serif);
  font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-dark, #8a6a10);
}
.guide-group-title:first-child { margin-top: 2px; }
/* trailing rule after the heading label */
.guide-group-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(201,162,39,0.45), rgba(201,162,39,0));
}

.toc-list { display: flex; flex-direction: column; }
.toc-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 4px 10px 2px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.16);
  text-decoration: none;
  position: relative;
  transition: padding-left .18s ease, background .18s ease;
}
.toc-entry:last-child { border-bottom: none; }
.toc-entry:hover { padding-left: 10px; background: rgba(201, 162, 39, 0.06); }
.toc-num {
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.82rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #c9a227);
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.toc-entry:hover .toc-num { color: var(--red, #8b0000); }
.toc-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.toc-title {
  font-family: var(--font, 'Alegreya', serif);
  font-size: 1.06rem; font-weight: 700;
  color: var(--ink, #1a1a1a);
  line-height: 1.2;
}
.toc-entry:hover .toc-title { color: var(--red, #8b0000); }
.toc-desc {
  font-size: 0.78rem; font-style: italic;
  color: var(--ink-faint, #888);
  line-height: 1.35;
}
.toc-arrow {
  align-self: center;
  font-size: 0.95rem;
  color: var(--accent, #c9a227);
  opacity: 0; transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.toc-entry:hover .toc-arrow { opacity: 1; transform: translateX(0); }
.toc-entry.toc-active { background: rgba(201, 162, 39, 0.10); padding-left: 10px; }
.toc-entry.toc-active .toc-title,
.toc-entry.toc-active .toc-num { color: var(--accent-dark, #8a6a10); }
.toc-entry.toc-active .toc-arrow { opacity: 1; transform: none; }

/* Parent entry (e.g. "Kajak") — not a link, just a labelled group with children */
.toc-entry.toc-parent { cursor: default; }
.toc-entry.toc-parent:hover { padding-left: 2px; background: none; }
.toc-entry.toc-parent:hover .toc-num { color: var(--accent, #c9a227); }
.toc-entry.toc-parent:hover .toc-title { color: var(--ink, #1a1a1a); }

/* Sub-list under a parent entry — indented, hairline spine */
.toc-sub {
  margin: 0 0 6px 2px;
  padding-left: 18px;
  border-left: 1px solid rgba(201, 162, 39, 0.30);
}
.toc-subentry {
  position: relative;
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 4px 7px 10px;
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
  transition: padding-left .16s ease, background .16s ease;
}
.toc-subentry:last-child { border-bottom: none; }
.toc-subentry::before {
  content: '—';
  position: absolute; margin-left: -18px;
  color: var(--accent, #c9a227);
}
.toc-subentry:hover { padding-left: 14px; background: rgba(201, 162, 39, 0.05); }
.toc-subtitle {
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.98rem; font-weight: 700;
  color: var(--ink, #1a1a1a); line-height: 1.2;
}
.toc-subentry:hover .toc-subtitle { color: var(--red, #8b0000); }
.toc-subdesc { font-size: 0.74rem; font-style: italic; color: var(--ink-faint, #888); line-height: 1.3; }
.toc-subentry.toc-active .toc-subtitle { color: var(--accent-dark, #8a6a10); }

/* Content-page nav links inside sheet */

/* Content-page nav links inside sheet */
.sheet-links { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 18px; }
.sheet-links li { break-inside: avoid; margin-bottom: 7px; }
.sheet-links a {
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.96rem;
  color: var(--ink, #1a1a1a);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.sheet-links a:hover { color: var(--red, #8b0000); border-bottom-color: var(--accent, #c9a227); }
.sheet-links a.sheet-active { color: var(--accent-dark, #8a6a10); font-weight: 700; }

/* Footer (lang + attribution) inside sheet */
.sheet-foot { border-top: 1px solid rgba(201,162,39,0.18); margin-top: 14px; padding-top: 14px; text-align: center; }
.sheet-author {
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.92rem; color: var(--ink-light, #444);
  margin-bottom: 10px;
}
.sheet-author a {
  color: var(--accent-dark, #8a6a10);
  font-weight: 700; text-decoration: none;
  border-bottom: 1px solid rgba(201, 162, 39, 0.4);
}
.sheet-author a:hover { color: var(--red, #8b0000); border-bottom-color: var(--red, #8b0000); }
.sheet-foot .lang-switch-drawer { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 0.86rem; margin-bottom: 8px; }
.sheet-foot .lang-switch-drawer a { color: var(--ink-light,#444); text-decoration: none; }
.sheet-foot .lang-switch-drawer a.current { color: var(--accent-dark,#8a6a10); font-weight: 700; }
.sheet-foot .lang-switch-drawer span { color: var(--ink-faint,#888); }
.sheet-attrib { font-size: 0.66rem; line-height: 1.5; color: var(--ink-faint, #888); }
.sheet-attrib a { color: var(--accent-dark, #8a6a10); }

/* Reuse the existing drawer-layer button look inside the sheet, but neutralise
   the drawer's own box model where it differs. The layer + quickstart markup
   from map-shell.js carry their original classes, which map-shell.css styles. */
.sheet-body .drawer-layers,
.sheet-body .drawer-quickstart { border: none; margin: 0; padding: 0; }

/* ── Desktop: dock cards & sheet to a left column so the map stays open ── */
@media (min-width: 801px) {
  .top-bar { max-width: 600px; }
  .place-card, .dir-result { left: 16px; right: auto; bottom: 16px; margin: 0; width: 400px; }
  .directions { max-width: 560px; }
  .sheet {
    --peek-h: 116px;
    left: 16px; right: auto;
    width: 380px;
    max-height: 70vh;
    border: 2px solid var(--accent, #c9a227);
    border-radius: 14px;
    bottom: 16px;
    transform: translateY(calc(100% - var(--peek-h) + 16px));
  }
  .sheet.open { transform: translateY(0); }
  .sheet.tucked { transform: translateY(calc(100% + 24px)); }
  .map-page .locate-fab { bottom: 24px !important; }
}

/* ── Small phones ── */
@media (max-width: 380px) {
  .brand-word { display: none; }
  .brand { padding: 0 6px; }
}

/* Przepisy / Porady panels — intro note + cloned FAQ content above the links */
.panel-note {
  margin: 2px 0 12px;
  font-family: var(--font, 'Alegreya', serif);
  font-size: 0.92rem; line-height: 1.4;
  color: var(--ink-light, #444);
}
.sheet-panel > table { margin-top: 0; }
.sheet-panel > ul { margin: 0 0 12px; padding-left: 1.1rem; font-size: 0.9rem; line-height: 1.5; color: var(--ink-light, #444); }
.sheet-panel > .callout { margin: 0 0 14px; font-size: 0.85rem; }
.sheet-panel .toc-list { border-top: 1px solid rgba(201, 162, 39, 0.18); padding-top: 6px; margin-top: 4px; }

/* Emergency numbers block (Porady panel) — big, tappable tel: links */
.emergency {
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: rgba(139, 0, 0, 0.05);
  border: 1px solid rgba(139, 0, 0, 0.22);
  border-radius: 12px;
}
.emrg-title {
  font-family: var(--font-sans, sans-serif);
  font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--red, #8b0000);
  margin-bottom: 10px;
}
.emrg-row { display: flex; gap: 10px; }
.emrg-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 10px 8px;
  text-decoration: none;
  background: var(--bg-card, #faf6ee);
  border: 1px solid rgba(139, 0, 0, 0.25);
  border-radius: 10px;
  box-shadow: 0 3px 10px -6px rgba(139, 0, 0, 0.5);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.emrg-item:hover, .emrg-item:active {
  transform: translateY(-1px);
  background: var(--red, #8b0000);
  box-shadow: 0 6px 16px -6px rgba(139, 0, 0, 0.6);
}
.emrg-num {
  font-family: var(--font, 'Alegreya', serif);
  font-weight: 700; font-size: 1.7rem; line-height: 1;
  color: var(--red, #8b0000);
  letter-spacing: 0.02em;
}
.emrg-lbl {
  font-family: var(--font-sans, sans-serif);
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-light, #444);
}
.emrg-item:hover .emrg-num, .emrg-item:active .emrg-num { color: #f6efd9; }
.emrg-item:hover .emrg-lbl, .emrg-item:active .emrg-lbl { color: rgba(246, 239, 217, 0.85); }
