/* ==========================================================================
   Pepi Atlas — Stylesheet (Vice City neon night)
   ========================================================================== */

:root {
  --bg: #0f0a1a;
  --bg-elev: #170f26;
  --bg-card: #1d1430;
  --bg-glass: rgba(23, 14, 38, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #fbf4ff;
  --text-2: #e5dcf2;
  --text-dim: #b3a6c9;
  --text-muted: #8f82a8;

  --pink: #ff2e88;
  --pink-hover: #ff5ca8;
  --pink-soft: #ff8cc6;
  --pink-tint: rgba(255, 46, 136, 0.14);
  --on-pink: #1a0510;
  --sunset: #ffb347;
  --violet: #b026ff;
  --cyan: #3ae8ff;

  --font-heading: 'Barlow Condensed', -apple-system, sans-serif;
  --font-body: 'DM Sans', -apple-system, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --header-h: 64px;
  --tabbar-h: 0px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-controls: 10;
  --z-drawer: 30;
  --z-sheet: 40;
  --z-modal: 50;
  --z-toast: 100;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
svg { flex: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mobile-only { display: none !important; }

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  position: absolute; inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgba(15, 10, 26, 0.92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  z-index: var(--z-controls);
}

.brand { display: flex; align-items: center; gap: 12px; flex: none; user-select: none; }
.brand-logo { width: 46px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 10px rgba(255, 46, 136, 0.35)); }
.brand-text h1 {
  font-family: var(--font-heading); font-weight: 800; font-size: 1.45rem;
  line-height: 1; letter-spacing: 0.05em; color: var(--text);
}
.brand-text h1 span { color: var(--pink); }
.brand-subtitle { margin-top: 2px; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }

/* Search */
.search-container { position: relative; flex: 1 1 320px; max-width: 560px; margin: 0 auto; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute; left: 14px; width: 18px; height: 18px;
  fill: none; stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search-input-wrap input {
  width: 100%; height: 42px; padding: 0 64px 0 42px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05); color: var(--text); font-size: 0.9rem; outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-input-wrap input:focus { border-color: var(--pink); background: rgba(255, 255, 255, 0.08); }
.search-kbd {
  position: absolute; right: 10px; padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim);
}
.search-input-wrap input:focus ~ .search-kbd { display: none; }
.search-clear {
  position: absolute; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-dim); font-size: 1.3rem;
}
.search-clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.search-clear:not([hidden]) ~ .search-kbd, .search-kbd:has(~ .search-clear:not([hidden])) { display: none; }

.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 420px; overflow-y: auto;
  padding: 6px; border-radius: var(--r-md); background: var(--bg-card);
  border: 1px solid var(--line-strong); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: pop-in 0.18s var(--ease);
}
.search-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; min-height: 48px; border-radius: 9px; cursor: pointer;
}
.search-item:hover, .search-item.highlighted { background: rgba(255, 255, 255, 0.06); }
.search-item-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.search-item-thumb { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.search-item-info { display: flex; flex-direction: column; min-width: 0; }
.search-item-title { font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-cat { font-size: 0.75rem; color: var(--text-dim); }
.search-item-badge { flex: none; font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim); max-width: 40%; text-align: right; }

/* Header actions */
.header-right { display: flex; align-items: center; gap: 8px; flex: none; }
.settings-row { display: contents; }
.header-divider { width: 1px; height: 24px; background: var(--line-strong); margin: 0 4px; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.seg button {
  height: 32px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
  transition: background 0.2s var(--ease), color 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--text); color: var(--bg-elev); }
.seg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; height: 36px; }

.action-btn, .icon-btn {
  height: 40px; min-width: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem; font-weight: 600; color: var(--text-2);
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.action-btn:hover, .icon-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--line-strong); }
.action-btn:active, .icon-btn:active { transform: scale(0.96); }
.action-btn svg, .icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.action-btn.active { background: var(--pink-tint); border-color: rgba(255, 46, 136, 0.55); color: var(--pink-soft); }
.action-btn.primary { background: var(--pink); border-color: var(--pink); color: var(--on-pink); box-shadow: 0 0 22px rgba(255, 46, 136, 0.35); }
.action-btn.primary:hover { background: var(--pink-hover); }
.settings-btn { display: none; }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--pink); color: var(--on-pink); font-size: 0.7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.count-mono { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--text-dim); }

/* Placing banner */
.mode-banner {
  position: absolute; top: calc(var(--header-h) + 14px); left: 50%; transform: translateX(-50%);
  z-index: calc(var(--z-drawer) + 1);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  padding: 8px 8px 8px 14px; border-radius: 14px;
  background: var(--text); color: var(--bg-elev); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  animation: drop-in 0.3s var(--ease);
}
.mode-banner svg { width: 18px; height: 18px; fill: none; stroke: #d6156c; stroke-width: 2; }
.mode-banner span { font-size: 0.875rem; }
.banner-cancel-btn {
  flex: none; height: 36px; padding: 0 12px; border-radius: 9px;
  border: 1px solid rgba(0, 0, 0, 0.15); background: transparent; font-size: 0.8rem; font-weight: 700; color: var(--bg-elev);
}
.banner-cancel-btn:hover { background: rgba(0, 0, 0, 0.06); }
body.placing-mode .maplibregl-canvas { cursor: crosshair !important; }

/* ==========================================================================
   Map
   ========================================================================== */
.map-viewport { position: absolute; top: var(--header-h); left: 0; right: 0; bottom: var(--tabbar-h); }
#map { position: absolute; inset: 0; background: var(--bg); }

.map-controls {
  position: absolute; top: 16px; right: 16px; z-index: var(--z-controls);
  display: flex; flex-direction: column; gap: 10px;
}
.ctrl-group {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--r-md); background: var(--bg-glass); border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ctrl-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text);
  transition: background 0.15s;
}
.ctrl-group .ctrl-btn + .ctrl-btn { border-top: 1px solid var(--line); }
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.08); }
.ctrl-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.compass-btn {
  border-radius: 50%; background: var(--bg-glass); border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.compass-btn .compass-needle { width: 22px; height: 22px; stroke: none; transition: transform 0.25s var(--ease); }

.bottom-dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: var(--z-controls);
  display: flex; align-items: flex-end; gap: 12px; padding: 0 16px 16px; pointer-events: none;
}
.bottom-dock > * { pointer-events: auto; }
.quick-categories-bar {
  flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px;
  scrollbar-width: none; scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.quick-categories-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; height: 40px; padding: 0 12px 0 8px; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 0.8rem; font-weight: 600; color: var(--text-2); white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.cat-chip:hover { border-color: rgba(255, 255, 255, 0.3); }
.cat-chip:active { transform: scale(0.96); }
.cat-chip.active { background: var(--pink); border-color: var(--pink); color: var(--on-pink); box-shadow: 0 0 18px rgba(255, 46, 136, 0.35); }
#chip-show-all, .clean-chip, .chip-filters { padding-left: 12px; }
.chip-img { width: 24px; height: 24px; border-radius: 50%; }
.chip-svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); margin-left: 4px; }
.cat-chip.active .chip-dot { background: var(--on-pink); }
.chip-count { font-family: var(--font-mono); font-size: 0.68rem; opacity: 0.7; }

.map-hud {
  flex: none; display: flex; gap: 14px; padding: 9px 12px; border-radius: 10px;
  background: var(--bg-glass); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); white-space: nowrap;
}
.hud-strong { color: var(--text); }

/* Highlighted location (tips) */
.focus-marker {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--pink); border: 3px solid var(--text);
  box-shadow: 0 0 0 0 rgba(255, 46, 136, 0.6), 0 0 26px rgba(255, 46, 136, 0.9);
  animation: pulse 1.8s ease-out infinite;
}

/* ==========================================================================
   Drawers
   ========================================================================== */
.drawer {
  position: absolute; top: var(--header-h); bottom: 0; width: 340px; max-width: 100%;
  z-index: var(--z-drawer); display: flex; flex-direction: column;
  background: var(--bg-elev); box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
}
.drawer-left { left: 0; border-right: 1px solid var(--line); animation: slide-left 0.32s var(--ease); }
.drawer-right { right: 0; border-left: 1px solid var(--line); animation: slide-right 0.32s var(--ease); }
.drawer-wide { width: 400px; }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 12px; flex: none;
}
.drawer-header h2 { font-family: var(--font-heading); font-weight: 800; font-size: 1.6rem; letter-spacing: 0.02em; line-height: 1; }
.drawer-header-actions { display: flex; align-items: center; gap: 8px; }
.drawer-close {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text-dim); font-size: 1.6rem; line-height: 1;
}
.drawer-close:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 20px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.drawer-footer { flex: none; padding: 14px 20px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.drawer-intro { font-size: 0.875rem; line-height: 1.5; color: var(--text-dim); }

.filter-actions-top { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-group { display: flex; flex-direction: column; gap: 2px; }
.group-header { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 6px; }
.group-header h3 { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.group-count { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); }
.filter-item {
  display: flex; align-items: center; gap: 12px; padding: 6px 8px; min-height: 46px;
  border-radius: 10px; cursor: pointer; transition: background 0.15s;
}
.filter-item:hover { background: rgba(255, 255, 255, 0.05); }
.filter-item input { width: 18px; height: 18px; accent-color: var(--pink); flex: none; }
.filter-item-icon { width: 28px; height: 28px; border-radius: 50%; flex: none; transition: filter 0.2s, opacity 0.2s; }
.item-name { flex: 1; font-size: 0.875rem; color: var(--text-2); }
.item-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); }
.filter-item input:not(:checked) ~ .filter-item-icon { filter: grayscale(1); opacity: 0.4; }
.filter-item input:not(:checked) ~ .item-name { color: var(--text-muted); text-decoration: line-through; }

/* Buttons */
.btn {
  height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-md); border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.05);
  font-size: 0.875rem; font-weight: 600; color: var(--text);
  transition: background 0.2s, transform 0.15s var(--ease);
}
.btn:hover { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: var(--on-pink); }
.btn.primary:hover { background: var(--pink-hover); }
.btn-sm { height: 38px; padding: 0 12px; font-size: 0.8rem; }
.full-width { width: 100%; }
.danger-text { color: var(--pink-soft); }
.btn-link { border: 0; background: transparent; padding: 8px; font-size: 0.8rem; text-decoration: underline; color: var(--text-dim); }
.danger-link { color: var(--pink-soft); }
.danger-link:hover { color: var(--pink); }

/* Pins */
.pin-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.pin-action {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 14px; text-align: left;
  border-radius: var(--r-lg); border: 1px solid var(--line-strong); background: var(--bg-card); color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.pin-action:hover { border-color: rgba(255, 46, 136, 0.5); }
.pin-action:active { transform: scale(0.98); }
.pin-action-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--pink-tint); color: var(--pink-soft);
}
.pin-action-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pin-action-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pin-action-title { font-size: 0.95rem; font-weight: 700; }
.pin-action-sub { font-size: 0.78rem; color: var(--text-dim); }
.pin-action-primary { background: linear-gradient(135deg, #ff2e88, #b026ff); border-color: transparent; box-shadow: 0 10px 30px rgba(255, 46, 136, 0.3); }
.pin-action-primary .pin-action-icon { background: rgba(255, 255, 255, 0.2); color: #fff; }
.pin-action-primary .pin-action-sub { color: rgba(255, 255, 255, 0.85); }
.btn-danger { border-color: rgba(255, 46, 136, 0.5); color: var(--pink-soft); background: transparent; }
.btn-danger:hover { background: var(--pink-tint); }
.btn.is-busy { opacity: 0.6; pointer-events: none; }
.search-shortcut .search-item-title { color: var(--pink-soft); }
.empty-state { padding: 32px 14px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty-state h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; color: var(--text-dim); }
.custom-markers-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.custom-marker-card {
  padding: 12px 12px 12px 14px; border-radius: var(--r-lg);
  background: var(--bg-card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
  animation: fade-up 0.3s var(--ease) both;
}
.marker-card-top { display: flex; align-items: center; gap: 10px; }
.marker-dot-preview { width: 13px; height: 13px; border-radius: 50%; flex: none; }
.marker-card-title { flex: 1; min-width: 0; font-size: 0.95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marker-card-actions { display: flex; gap: 2px; }
.icon-btn-ghost {
  width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.icon-btn-ghost svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.marker-card-note { font-size: 0.85rem; line-height: 1.45; color: var(--text-dim); }
.marker-card-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
.share-code-btn {
  align-self: flex-start; height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 10px; border: 1px solid rgba(255, 46, 136, 0.45); background: var(--pink-tint);
  font-size: 0.78rem; font-weight: 600; color: var(--pink-soft);
}
.share-code-btn:hover { background: rgba(255, 46, 136, 0.22); }
.share-code-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Tips */
.tips-view { display: flex; flex-direction: column; min-height: 0; flex: 1; animation: fade-in 0.25s var(--ease); }
.tip-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.tip-cat {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04); font-size: 0.8rem; font-weight: 600; color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.tip-cat.active { background: var(--pink); border-color: var(--pink); color: var(--on-pink); }
.tips-list { display: flex; flex-direction: column; gap: 14px; }
.tip-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden;
  border-radius: var(--r-lg); background: var(--bg-card); border: 1px solid var(--line);
  transition: transform 0.2s var(--ease), border-color 0.2s;
  animation: fade-up 0.35s var(--ease) both;
}
.tip-card:hover { border-color: rgba(255, 46, 136, 0.45); transform: translateY(-2px); }
.tip-card-img { position: relative; height: 150px; background: #23163a; overflow: hidden; }
.tip-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tip-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.tip-cat-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pink-hover); }
.tip-card-title { font-size: 1.02rem; font-weight: 600; line-height: 1.3; color: var(--text); }
.tip-author { font-size: 0.8rem; color: var(--text-muted); }

.tip-hero { position: relative; height: 260px; flex: none; background: #23163a; overflow: hidden; }
.tip-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tip-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(23, 15, 38, 0.4) 0%, rgba(23, 15, 38, 0) 35%, var(--bg-elev) 100%); }
.hero-btn {
  position: absolute; top: 14px; left: 14px; z-index: 1; width: 44px; height: 44px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--bg-glass); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.hero-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tip-article { margin-top: -36px; position: relative; gap: 10px; }
.tip-title { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; line-height: 1.02; }
.section-label { margin-top: 10px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.tip-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: step; }
.tip-steps li { display: flex; gap: 12px; font-size: 0.92rem; line-height: 1.5; color: var(--text-2); counter-increment: step; }
.tip-steps li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--pink-tint); color: var(--pink-soft); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.tip-location {
  margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border-radius: var(--r-lg); background: var(--bg-card); border: 1px solid var(--line);
}
.tip-location > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tip-location code { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); }
.muted-label { font-size: 0.75rem; color: var(--text-muted); }

.editor-badge {
  padding: 4px 10px; border-radius: 999px; background: rgba(58, 232, 255, 0.12); color: #7ff0ff;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.tip-form fieldset { border: 0; }
.image-drop {
  position: relative; height: 150px; border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  border: 1.5px dashed rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.03);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 0.875rem; font-weight: 600;
}
.image-drop:hover { border-color: var(--pink); }
.image-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#tip-image-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#tip-image-placeholder svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.location-pick {
  min-height: 52px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; text-align: left;
  border-radius: var(--r-md); border: 1px dashed rgba(255, 46, 136, 0.55); background: var(--pink-tint);
  font-size: 0.875rem; font-weight: 600; color: var(--pink-soft);
}
.location-pick svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.location-pick.set { border-style: solid; font-family: var(--font-mono); font-weight: 500; }

/* ==========================================================================
   Modals & forms
   ========================================================================== */
.modal-dialog {
  margin: auto; border: 0; background: transparent; color: var(--text); padding: 16px;
  max-width: 100vw; width: 460px;
}
.modal-dialog[open] { animation: pop-in 0.28s var(--ease); }
.modal-dialog::backdrop { background: rgba(6, 3, 12, 0.7); backdrop-filter: blur(4px); }
.modal-card { border-radius: 20px; background: var(--bg-card); border: 1px solid var(--line-strong); box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 4px; }
.modal-header h3 { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800; }
.modal-close { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text-dim); font-size: 1.6rem; }
.modal-close:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.modal-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-text { font-size: 0.875rem; line-height: 1.5; color: var(--text-dim); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#code-share-box, #code-import-form { display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label, .form-group legend, .label-like { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.form-group legend { margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select, .code-box {
  width: 100%; padding: 11px 13px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font-size: 0.92rem; outline: none; resize: vertical;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus, .code-box:focus { border-color: var(--pink); }
.code-box { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.5; word-break: break-all; color: var(--pink-soft); }
.code-preview {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--bg-elev); border: 1px solid var(--line); font-size: 0.85rem; color: var(--text-2);
}
.code-preview strong { color: var(--text); }
.code-preview.invalid { border-color: rgba(255, 46, 136, 0.5); color: var(--pink-soft); }
.color-picker-row { display: flex; gap: 12px; }
.color-option { position: relative; cursor: pointer; }
.color-option input { position: absolute; opacity: 0; }
.color-circle { display: block; width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; transition: transform 0.15s var(--ease); }
#marker-form:not(.has-selected-icon) .color-option input:checked + .color-circle { border-color: var(--text); box-shadow: inset 0 0 0 3px var(--bg-card); transform: scale(1.08); }
.color-option input:focus-visible + .color-circle { outline: 2px solid var(--pink); outline-offset: 2px; }
.filter-type { margin-block: 14px; }
#pin-icon-picker > summary {
  cursor: pointer; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); font-size: 0.86rem;
}
#pin-icon-selection { float: right; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.pin-icon-search { margin-block: 8px; }
.pin-icon-options {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 5px;
  max-height: min(32vh, 220px); overflow: auto; padding: 3px;
}
.pin-icon-options button {
  display: grid; place-items: center; gap: 3px; min-height: 62px; padding: 4px;
  color: var(--text); font-size: 0.66rem; line-height: 1.2; overflow-wrap: anywhere;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer;
}
.pin-icon-options button:hover, .pin-icon-options button[aria-pressed="true"] { border-color: var(--pink); }
.pin-icon-thumb { width: 28px; height: 28px; object-fit: contain; }
#pin-icon-selection .pin-icon-thumb { width: 18px; height: 18px; }
.marker-card-top .pin-icon-thumb { width: 24px; height: 24px; flex: none; }
.form-coords-preview { font-size: 0.75rem; color: var(--text-dim); }
.form-coords-preview code { font-family: var(--font-mono); color: var(--text-2); }

/* ==========================================================================
   MapLibre popups
   ========================================================================== */
.maplibregl-popup-content {
  padding: 14px !important; border-radius: 16px !important;
  background: var(--bg-card) !important; border: 1px solid var(--line-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55) !important; color: var(--text); font-family: var(--font-body);
}
.maplibregl-popup-tip { border-top-color: var(--bg-card) !important; border-bottom-color: var(--bg-card) !important; }
.maplibregl-popup-close-button { width: 30px; height: 30px; font-size: 18px; color: var(--text-dim); border-radius: 8px; top: 6px; right: 6px; }
.maplibregl-popup-close-button:hover { background: rgba(255, 255, 255, 0.08) !important; color: var(--text); }
.popup-card { display: flex; flex-direction: column; gap: 10px; min-width: 220px; max-width: 280px; }
.popup-header-row { display: flex; align-items: center; gap: 12px; padding-right: 22px; }
.popup-icon-wrap { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.popup-icon-img { width: 34px; height: 34px; border-radius: 50%; }
.popup-pin-dot { width: 16px; height: 16px; border-radius: 50%; }
.popup-meta-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.popup-badge { align-self: flex-start; padding: 2px 8px; border-radius: 999px; border: 1px solid; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; }
.popup-title { font-size: 1rem; font-weight: 700; line-height: 1.25; }
.poi-popup-photo {
  display: block; width: 100%; max-height: min(160px, 25vh); object-fit: contain;
  background: var(--bg); border-radius: 8px;
}
.popup-cat { font-size: 0.75rem; color: var(--text-muted); }
.popup-desc { font-size: 0.82rem; line-height: 1.45; color: var(--text-dim); }
.popup-coords {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim);
}
.copy-coords-btn { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; font-family: var(--font-body); font-size: 0.72rem; font-weight: 600; color: var(--text); }
.copy-coords-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 84px); transform: translateX(-50%);
  z-index: var(--z-toast); max-width: calc(100% - 32px);
  padding: 11px 18px; border-radius: 12px; background: var(--text); color: var(--bg-elev);
  font-size: 0.875rem; font-weight: 600; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  animation: drop-in 0.3s var(--ease);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes slide-left { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-right { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 46, 136, 0.6), 0 0 26px rgba(255, 46, 136, 0.9); }
  100% { box-shadow: 0 0 0 22px rgba(255, 46, 136, 0), 0 0 26px rgba(255, 46, 136, 0.9); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  .header-right .btn-text { display: none; }
  .brand-subtitle { display: none; }
}

/* ---- Phones: app-like layout (tab bar + bottom sheets) ---- */
@media (max-width: 720px) {
  :root { --header-h: calc(64px + env(safe-area-inset-top)); --tabbar-h: calc(60px + env(safe-area-inset-bottom)); }
  .desktop-only { display: none !important; }
  .sheet-title.mobile-only, .settings-label.mobile-only { display: block !important; }
  .cat-chip.mobile-only, .btn.mobile-only { display: inline-flex !important; }

  .app-header {
    padding: env(safe-area-inset-top) 12px 0; gap: 8px;
    background: rgba(15, 10, 26, 0.97);
    /* backdrop-filter would make the fixed Settings sheet position relative to the header */
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .brand-text { display: none; }
  .brand-logo { width: 40px; height: 32px; }
  .search-container { margin: 0; flex: 1; }
  .search-input-wrap input { height: 44px; font-size: 16px; padding-right: 40px; }
  .search-kbd { display: none; }
  .settings-btn { display: inline-flex; width: 44px; height: 44px; }

  /* Header actions become the Settings sheet */
  .header-right {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet);
    flex-direction: column; align-items: stretch; gap: 16px;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
    background: var(--bg-elev); border-top: 1px solid var(--line-strong); border-radius: 26px 26px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(110%); transition: transform 0.38s var(--ease);
  }
  body.settings-open .header-right { transform: none; }
  .settings-row { display: flex; flex-direction: column; gap: 8px; }
  .settings-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
  .sheet-title { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800; }
  .header-right .seg { display: flex; }
  .header-right .seg button { flex: 1; height: 40px; font-size: 0.9rem; }
  #btn-tilt { height: 48px; }
  #btn-tilt .btn-text { display: inline; }
  .sheet-backdrop { position: fixed; inset: 0; z-index: calc(var(--z-sheet) - 1); background: rgba(6, 3, 12, 0.55); animation: fade-in 0.25s; }

  .map-controls { top: 12px; right: 12px; gap: 8px; }
  .bottom-dock { padding: 0 0 10px; }
  .quick-categories-bar { padding: 4px 12px; mask-image: none; }
  /* On phones every filter lives inside the Filtros button */
  .quick-categories-bar .cat-chip:not(.chip-filters) { display: none; }
  .chip-filters { height: 46px; padding: 0 18px !important; font-size: 0.9rem; background: var(--pink); border-color: var(--pink); color: var(--on-pink); box-shadow: 0 8px 24px rgba(255,46,136,0.35); }
  .chip-filters.has-filter::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--on-pink); }

  .mode-banner { top: calc(var(--header-h) + 10px); width: calc(100% - 24px); }
  .mode-banner span { flex: 1; }

  /* Drawers become full-height sheets above the tab bar */
  .drawer, .drawer-wide {
    top: var(--header-h); bottom: var(--tabbar-h); width: 100%;
    border: 0; animation: slide-up 0.36s var(--ease);
  }
  #drawer-filters {
    top: auto; max-height: 78vh; border-radius: 24px 24px 0 0; border-top: 1px solid var(--line-strong);
  }
  #drawer-tips, #drawer-markers { top: 0; padding-top: env(safe-area-inset-top); z-index: calc(var(--z-controls) + 5); }
  .drawer-header h2 { font-size: 2.2rem; }
  .tip-hero { height: 240px; }

  .tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-sheet) - 2);
    height: var(--tabbar-h); padding: 4px 16px env(safe-area-inset-bottom);
    display: flex !important; background: rgba(15, 10, 26, 0.97); border-top: 1px solid var(--line);
  }
  .tab {
    flex: 1; border: 0; background: transparent; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 0.68rem; font-weight: 600; transition: color 0.2s;
  }
  .tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s var(--ease); }
  .tab.active { color: var(--pink); }
  .tab.active svg { transform: translateY(-1px) scale(1.06); }

  .modal-dialog { width: 100%; padding: 12px; }
  .toast { bottom: calc(var(--tabbar-h) + 70px); }
  .maplibregl-popup-content { max-width: 78vw; }
}
