:root {
            --bg:      #060d14;
            --bg2:     #0b1a27;
            --bg3:     #0f2236;
            --fg:      #e0ecf5;
            --muted:   rgba(224,236,245,0.5);
            --accent:  #00c896;
            --accent2: #00a87e;
            --border:  rgba(0,200,150,0.12);
            --card:    rgba(11,26,39,0.95);
            --amber:   #f5a623;
            --teal:    #00b4d8;
        }

        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        html, body { height: 100%; overflow: hidden; }
        body {
            background: var(--bg);
            color: var(--fg);
            font-family: 'DM Sans', sans-serif;
            display: flex;
            flex-direction: column;
        }

        body::before {
            content: '';
            position: fixed; inset: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
            pointer-events: none; z-index: 1; opacity: 0.35;
        }

        /* ── NAV (old — replaced by .site-header) ── */
        #nav {
            flex-shrink: 0;
            background: rgba(6,13,20,0.95);
            backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--border);
            padding: 0 clamp(1rem,4vw,2rem);
            height: 56px;
            display: flex; align-items: center; justify-content: space-between; gap: 1rem;
            position: relative; z-index: 50;
        }
        .nav-logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--fg); }
        .nav-logo-text { font-family: 'Bebas Neue', sans-serif; font-size: 1.25rem; letter-spacing: 0.05em; line-height: 1; }
        .nav-logo-text span { color: var(--accent); }
        .nav-back {
            display: flex; align-items: center; gap: 0.4rem;
            color: var(--muted); text-decoration: none; font-size: 0.82rem; font-weight: 500;
            transition: color 0.2s;
        }
        .nav-back:hover { color: var(--fg); }
        .nav-right { display: flex; align-items: center; gap: 1rem; }
        .nav-cta {
            background: var(--accent); color: #060d14;
            padding: 0.4rem 1rem; border-radius: 8px;
            font-weight: 600; font-size: 0.78rem;
            text-decoration: none;
            transition: background 0.2s;
        }
        .nav-cta:hover { background: var(--accent2); }

        /* ── MAIN LAYOUT ── */
        .map-page {
            flex: 1;
            display: flex;
            overflow: hidden;
            min-height: 0;
        }

        /* ── SIDEBAR ── */
        .sidebar {
            width: 340px;
            flex-shrink: 0;
            background: var(--bg2);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .sidebar-head {
            padding: 1.2rem 1.2rem 0.8rem;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }

        .sidebar-title {
            display: flex; align-items: center; gap: 0.5rem;
            font-family: 'Bebas Neue', sans-serif;
            font-size: 1.5rem; letter-spacing: 0.04em; margin-bottom: 0.25rem;
        }

        .sidebar-sub { font-size: 0.78rem; color: var(--muted); }

        .filter-row {
            padding: 0.8rem 1.2rem;
            border-bottom: 1px solid var(--border);
            display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
            flex-shrink: 0;
        }

        .filter-btn {
            padding: 0.3rem 0.8rem; border-radius: 16px;
            font-size: 0.72rem; font-weight: 600; cursor: pointer;
            border: 1px solid var(--border);
            background: rgba(255,255,255,0.04); color: var(--muted);
            transition: all 0.18s; user-select: none; white-space: nowrap;
        }
        .filter-btn:hover { color: var(--fg); }
        .filter-btn.f-all    { background: var(--accent); color: #060d14; border-color: var(--accent); }
        .filter-btn.f-travel { background: rgba(0,180,216,0.18); color: var(--teal); border-color: rgba(0,180,216,0.4); }
        .filter-btn.f-hiking { background: rgba(0,200,150,0.18); color: var(--accent); border-color: rgba(0,200,150,0.4); }
        .filter-btn.f-dining { background: rgba(245,166,35,0.18); color: var(--amber); border-color: rgba(245,166,35,0.4); }

        .pin-count { margin-left: auto; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

        /* Adventure list */
        .adv-list {
            flex: 1;
            overflow-y: auto;
            padding: 0.6rem;
            scrollbar-width: thin;
            scrollbar-color: rgba(0,200,150,0.2) transparent;
        }
        .adv-list::-webkit-scrollbar { width: 4px; }
        .adv-list::-webkit-scrollbar-thumb { background: rgba(0,200,150,0.2); border-radius: 4px; }

        .adv-row {
            display: flex; align-items: flex-start; gap: 0.8rem;
            padding: 0.85rem 0.8rem;
            border-radius: 10px;
            cursor: pointer;
            transition: background 0.18s, border-color 0.18s;
            border: 1px solid transparent;
            margin-bottom: 0.35rem;
        }
        .adv-row:hover { background: rgba(255,255,255,0.04); }
        .adv-row.active { background: rgba(0,200,150,0.07); border-color: rgba(0,200,150,0.25); }

        .adv-row-emoji {
            width: 42px; height: 42px; border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.35rem; flex-shrink: 0;
        }

        .adv-row-body { flex: 1; min-width: 0; }
        .adv-row-title { font-weight: 600; font-size: 0.88rem; color: var(--fg); line-height: 1.3; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .adv-row-meta { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--muted); }

        .cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

        .adv-row-arrow { color: var(--muted); font-size: 0.75rem; align-self: center; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
        .adv-row:hover .adv-row-arrow, .adv-row.active .adv-row-arrow { opacity: 1; color: var(--accent); }

        /* Detail panel */
        .detail-panel {
            flex-shrink: 0;
            background: var(--bg);
            border-top: 1px solid var(--border);
            padding: 1rem 1.2rem;
            display: none;
        }
        .detail-panel.visible { display: block; }
        .detail-close { float: right; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0.1rem 0.2rem; }
        .detail-close:hover { color: var(--fg); }
        .detail-cat { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.4rem; display: block; }
        .detail-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.2rem; line-height: 1.3; }
        .detail-venue { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
        .detail-author { font-size: 0.78rem; color: var(--muted); }
        .detail-link { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.6rem; font-size: 0.78rem; font-weight: 600; color: var(--accent); text-decoration: none; }
        .detail-link:hover { text-decoration: underline; }

        /* ── MAP ── */
        .map-wrap {
            flex: 1;
            position: relative;
            min-width: 0;
            min-height: 0;
        }

        #adventure-map { width: 100%; height: 100%; }

        /* Leaflet dark overrides */
        .leaflet-container { background: #0a1520 !important; }
        .leaflet-control-zoom a { background: var(--bg2) !important; color: var(--fg) !important; border-color: var(--border) !important; }
        .leaflet-control-zoom a:hover { background: var(--bg3) !important; }
        .leaflet-control-attribution { background: rgba(6,13,20,0.8) !important; color: rgba(224,236,245,0.4) !important; }
        .leaflet-control-attribution a { color: var(--accent) !important; }

        .leaflet-popup-content-wrapper {
            background: var(--bg2) !important; color: var(--fg) !important;
            border: 1px solid var(--border) !important; border-radius: 12px !important;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6) !important;
            padding: 0 !important;
        }
        .leaflet-popup-content { margin: 0 !important; min-width: 230px; }
        .leaflet-popup-tip { background: var(--bg2) !important; }
        .leaflet-popup-close-button { color: var(--muted) !important; top: 8px !important; right: 10px !important; font-size: 18px !important; }
        .leaflet-popup-close-button:hover { color: var(--fg) !important; }

        .map-popup { padding: 1rem 1rem 0.8rem; }
        .popup-emoji { font-size: 1.6rem; margin-bottom: 0.5rem; display: block; }
        .popup-cat { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; padding: 0.18rem 0.6rem; border-radius: 12px; display: inline-block; margin-bottom: 0.5rem; }
        .pill-dining { background: rgba(245,166,35,0.2); color: var(--amber); border: 1px solid rgba(245,166,35,0.3); }
        .pill-travel { background: rgba(0,180,216,0.2); color: var(--teal); border: 1px solid rgba(0,180,216,0.3); }
        .pill-hiking { background: rgba(0,200,150,0.2); color: var(--accent); border: 1px solid rgba(0,200,150,0.3); }
        .popup-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; color: var(--fg); line-height: 1.3; }
        .popup-venue { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.3rem; }
        .popup-author { font-size: 0.75rem; color: var(--muted); }
        .popup-link { display: inline-flex; align-items: center; gap: 0.25rem; margin-top: 0.55rem; font-size: 0.78rem; font-weight: 600; color: var(--accent); text-decoration: none; cursor: pointer; }
        .popup-link:hover { text-decoration: underline; }

        /* Map legend overlay */
        .map-legend-overlay {
            position: absolute; bottom: 28px; left: 12px; z-index: 10;
            background: rgba(6,13,20,0.85);
            backdrop-filter: blur(8px);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 0.6rem 0.8rem;
            display: flex; flex-direction: column; gap: 0.4rem;
            font-size: 0.75rem; color: var(--muted);
            pointer-events: none;
        }
        .legend-title { font-weight: 600; color: var(--fg); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.15rem; }
        .legend-row { display: flex; align-items: center; gap: 0.5rem; }
        .legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

        /* ── REVIEW FORM ── */
        .review-section {
            margin-top: 0.75rem;
            padding-top: 0.75rem;
            border-top: 1px solid var(--border);
        }
        .review-toggle-btn {
            background: none;
            border: 1px solid var(--border);
            color: var(--muted);
            padding: 0.35rem 0.85rem;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.78rem;
            font-weight: 600;
            font-family: 'DM Sans', sans-serif;
            transition: color 0.18s, border-color 0.18s;
        }
        .review-toggle-btn:hover { color: var(--fg); border-color: var(--accent); }
        .review-fields {
            flex-direction: column;
            gap: 0.6rem;
            margin-top: 0.7rem;
        }
        .review-input, .review-textarea {
            background: var(--bg3);
            border: 1px solid var(--border);
            color: var(--fg);
            padding: 0.48rem 0.7rem;
            border-radius: 8px;
            font-size: 0.8rem;
            font-family: 'DM Sans', sans-serif;
            width: 100%;
            resize: none;
            transition: border-color 0.18s;
        }
        .review-input::placeholder, .review-textarea::placeholder { color: var(--muted); }
        .review-input:focus, .review-textarea:focus { outline: none; border-color: var(--accent); }
        .star-row { display: flex; gap: 0.3rem; }
        .rstar {
            font-size: 1.5rem;
            cursor: pointer;
            color: rgba(224,236,245,0.2);
            transition: color 0.12s;
            user-select: none;
            line-height: 1;
        }
        .rstar:hover { color: #f5a623; }
        .review-submit-btn {
            background: var(--accent);
            color: #060d14;
            border: none;
            padding: 0.5rem 1.1rem;
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 700;
            font-family: 'DM Sans', sans-serif;
            cursor: pointer;
            transition: background 0.18s;
            align-self: flex-start;
        }
        .review-submit-btn:hover { background: var(--accent2); }
        .review-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }
        .review-msg { font-size: 0.78rem; min-height: 1.1em; }
        .msg-ok  { color: var(--accent); }
        .msg-warn { color: var(--amber); }
        .msg-err { color: #f87171; }

        /* Make detail panel scrollable when review form is open */
        .detail-panel { max-height: 60vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,200,150,0.2) transparent; }
        .detail-panel::-webkit-scrollbar { width: 4px; }
        .detail-panel::-webkit-scrollbar-thumb { background: rgba(0,200,150,0.2); border-radius: 4px; }

        /* ── RESPONSIVE ── */

        /* Narrow desktop / large tablet: shrink sidebar */
        @media (max-width: 900px) and (min-width: 681px) {
            .sidebar { width: 280px; }
            .sidebar-head { padding: 0.9rem 1rem 0.7rem; }
            .sidebar-title { font-size: 1.25rem; }
        }

        /* Mobile: stacked layout — map on top, sidebar as bottom sheet */
        @media (max-width: 680px) {
            html, body { overflow: hidden; }

            /* Stack map above, sidebar below */
            .map-page { flex-direction: column; }

            /* Map takes top portion */
            .map-wrap { flex: none; height: 52svh; min-height: 220px; }
            #adventure-map { height: 100%; }

            /* Sidebar as bottom sheet */
            .sidebar {
                width: 100%;
                flex: 1;
                border-right: none;
                border-top: 1px solid var(--border);
                min-height: 0;
            }

            /* Hide verbose subtitle to save space */
            .sidebar-head { padding: 0.6rem 1rem 0; border-bottom: none; }
            .sidebar-sub  { display: none; }
            .sidebar-title { font-size: 1.1rem; }

            /* Filter row tighter */
            .filter-row { padding: 0.5rem 0.8rem; gap: 0.4rem; }
            .filter-btn  { padding: 0.28rem 0.65rem; font-size: 0.68rem; }
            .pin-count   { font-size: 0.68rem; }

            /* Horizontal scrolling adventure list */
            .adv-list {
                display: flex;
                flex-direction: row;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 0.5rem 0.8rem;
                gap: 0.5rem;
                scrollbar-width: none;
            }
            .adv-list::-webkit-scrollbar { display: none; }

            /* Each row card is a compact chip */
            .adv-row {
                flex-direction: column;
                min-width: 150px;
                max-width: 160px;
                margin-bottom: 0;
                margin-right: 0;
                padding: 0.7rem;
                flex-shrink: 0;
            }
            .adv-row-emoji { width: 36px; height: 36px; font-size: 1.1rem; margin-bottom: 0.4rem; }
            .adv-row-title { font-size: 0.78rem; white-space: normal; line-height: 1.25; }
            .adv-row-meta  { font-size: 0.65rem; flex-wrap: wrap; gap: 0.25rem; }
            .adv-row-arrow { display: none; }

            /* Detail panel as a floating overlay at bottom of map */
            .detail-panel {
                position: absolute;
                bottom: 0; left: 0; right: 0;
                z-index: 20;
                border-top: 1px solid var(--border);
                border-radius: 14px 14px 0 0;
                padding: 1rem;
                background: var(--bg2);
            }

            /* Nav: hide Share Adventure on mobile */
            .nav-cta { display: none; }
            .nav-back { font-size: 0.78rem; }
            .nav-logo-text { font-size: 1.1rem; }

            /* Legend: top-right on mobile */
            .map-legend-overlay { bottom: auto; top: 10px; left: auto; right: 10px; flex-direction: row; gap: 0.6rem; padding: 0.4rem 0.6rem; }
            .legend-title { display: none; }
        }

        /* Very small phones */
        @media (max-width: 380px) {
            .map-wrap { height: 48svh; }
            .adv-row { min-width: 135px; max-width: 145px; }
        }
