/* ============================================
   VIBEMAP — Google Maps / Waze Grade UI
   ============================================ */

:root {
    --bg-primary: #1a1a2e;
    --bg-surface: #1e1e36;
    --bg-card: #252542;
    --bg-elevated: #2a2a4a;
    --bg-glass: rgba(30, 30, 54, 0.92);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(99, 102, 241, 0.15);

    --text-primary: #f0f0f8;
    --text-secondary: #a0a0c0;
    --text-muted: #6b6b90;
    --text-inverse: #1a1a2e;

    --accent: #10b981;
    --accent-light: #34d399;
    --accent-lighter: #6ee7b7;
    --accent-surface: rgba(16, 185, 129, 0.12);

    --blue: #059669;
    --blue-surface: rgba(5, 150, 105, 0.12);
    --green: #34a853;
    --green-surface: rgba(52, 168, 83, 0.12);
    --yellow: #fbbc04;
    --yellow-surface: rgba(251, 188, 4, 0.12);
    --red: #ea4335;
    --red-surface: rgba(234, 67, 53, 0.12);
    --orange: #fa7b17;

    --route-drive: #4285f4;
    --route-cycle: #34a853;
    --route-walk: #fbbc04;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.6);

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 0.15s;
    --dur-normal: 0.25s;
    --dur-slow: 0.4s;
}

/* ── Reset ────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    /* Use dynamic viewport height so browser chrome doesn't cause vertical overflow on mobile */
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw; /* prevent horizontal overflow */
    overflow: hidden;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input {
    font-family: inherit;
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

::selection {
    background: var(--accent);
    color: white;
}

/* scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* Override .hidden for panels that use transform transitions */
#directions-panel.hidden {
    display: flex !important;
    transform: translateX(-100%);
    pointer-events: none;
}

/* ============================================
   LOADING SCREEN
   ============================================ */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}

#loading-screen.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.loader-logo-img {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
    animation: logoFloat 2s var(--ease) infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0);   }
    50%       { transform: translateY(-10px); }
}

.loader-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, var(--blue), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.loader-bar {
    width: 200px;
    height: 3px;
    border-radius: 4px;
    background: var(--bg-elevated);
    overflow: hidden;
}

.loader-bar-fill {
    height: 100%;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--blue), var(--accent));
    animation: loader-slide 1.2s var(--ease) infinite;
}

@keyframes loader-slide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

/* ============================================
   MAP
   ============================================ */
#map {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.leaflet-control-zoom,
.leaflet-control-attribution {
    display: none !important;
}

/* ============================================
   SEARCH BAR
   ============================================ */
#search-bar {
    position: fixed;
    top: 16px;
    /* Add safe-area inset for notched phones */
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 16px;
    /* Clamp: never wider than the screen minus FAB stack and padding */
    width: min(420px, calc(100vw - 80px));
    max-width: calc(100vw - 80px);
    z-index: 1000;
    animation: fadeSlideDown 0.5s var(--ease) 0.3s both;
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#search-bar-main {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 4px 8px;
    box-shadow: var(--shadow-lg);
    transition: box-shadow var(--dur-normal) var(--ease), border-color var(--dur-normal) var(--ease);
}

#search-bar-main:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-xl), 0 0 0 2px rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-xs);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--text-secondary);
    transition: all var(--dur-fast) var(--ease);
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn:active {
    transform: scale(0.9);
}

.directions-icon {
    color: var(--blue);
}

.directions-icon:hover {
    background: var(--blue-surface);
    color: var(--blue);
}

.search-divider {
    width: 1px;
    height: 24px;
    background: var(--border-strong);
    margin: 0 2px;
    flex-shrink: 0;
}

#search-input {
    flex: 1;
    height: 44px;
    padding: 0 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    min-width: 0;
}

#search-input::placeholder {
    color: var(--text-muted);
}

/* Search Results */
#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 360px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

#search-results.visible {
    display: block;
    animation: fadeIn 0.15s var(--ease);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sr-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--dur-fast);
}

.sr-item:hover {
    background: var(--bg-hover);
}

.sr-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sr-item:hover .sr-icon {
    background: var(--accent-surface);
    color: var(--accent-light);
}

.sr-text {
    flex: 1;
    min-width: 0;
}

.sr-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* ============================================
   DIRECTIONS PANEL
   ============================================ */
#directions-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 420px;
    max-width: 100%;
    z-index: 2000;
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transition: transform 0.4s var(--ease);
}

#directions-panel.hidden {
    transform: translateX(-100%);
    pointer-events: none;
    display: flex !important;
}

.dir-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Dir Header */
.dir-header {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 8px 12px 4px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.dir-header .icon-btn {
    margin-top: 8px;
}

.dir-inputs {
    flex: 1;
    display: flex;
    gap: 8px;
}

.dir-waypoints-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 4px 14px 0;
    gap: 0;
}

.wp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid;
}

.wp-dot.origin {
    border-color: var(--blue);
    background: var(--blue-surface);
}

.wp-dot.dest {
    border-color: var(--red);
    background: var(--red-surface);
}

.wp-line {
    width: 2px;
    flex: 1;
    min-height: 20px;
    background: repeating-linear-gradient(to bottom, var(--text-muted) 0, var(--text-muted) 4px, transparent 4px, transparent 8px);
}

.dir-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dir-field-wrap {
    position: relative;
}

.dir-field-wrap input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: all var(--dur-fast);
}

.dir-field-wrap input::placeholder {
    color: var(--text-muted);
}

.dir-field-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    background: var(--bg-card);
}

.dir-field-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#dir-swap-btn {
    font-size: 1rem;
    width: 36px;
    height: 36px;
}

#dir-swap-btn:hover {
    background: var(--bg-hover);
}

/* Dir Autocomplete */
.dir-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 300;
}

.dir-autocomplete.visible {
    display: block;
    animation: fadeIn 0.15s var(--ease);
}

.dir-ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.84rem;
    transition: background var(--dur-fast);
}

.dir-ac-item:hover {
    background: var(--bg-hover);
}

.dir-ac-item i {
    color: var(--accent-light);
    font-size: 1rem;
    flex-shrink: 0;
}

.dir-ac-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mode Tabs */
.dir-modes {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.dir-mode-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px 10px;
    font-size: 1.2rem;
    color: var(--text-muted);
    position: relative;
    transition: color var(--dur-fast);
}

.dir-mode-tab .mode-eta {
    font-size: 0.72rem;
    font-weight: 600;
}

.dir-mode-tab:hover {
    color: var(--text-secondary);
}

.dir-mode-tab.active {
    color: var(--blue);
}

.dir-mode-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--blue);
}

.dir-mode-tab[data-mode="cycling"].active {
    color: var(--green);
}

.dir-mode-tab[data-mode="cycling"].active::after {
    background: var(--green);
}

.dir-mode-tab[data-mode="walking"].active {
    color: var(--yellow);
}

.dir-mode-tab[data-mode="walking"].active::after {
    background: var(--yellow);
}

/* Route Summary */
#route-summary {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.route-main-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.route-duration {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue);
}

.route-details {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.route-meta {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Steps */
#steps-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Route Badges on Map */
.route-badge {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    transition: all var(--dur-fast) var(--ease);
    pointer-events: auto;
}

.route-badge:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    transform: scale(1.05);
}

.route-badge.active {
    background: var(--blue);
    color: #ffffff;
    border-color: var(--blue);
    font-size: 0.85rem;
    padding: 5px 10px;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.route-badge.active[data-mode="cycling"] {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.3);
}

.route-badge.active[data-mode="walking"] {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(251, 188, 4, 0.3);
}

/* Alternative Routes */
#alternatives-list {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 8px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.route-card {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}

.route-card:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
}

.route-card.active {
    background: var(--bg-active);
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.1);
}

.route-card.active[data-mode="cycling"] {
    border-color: var(--green);
    background: var(--green-surface);
}

.route-card.active[data-mode="walking"] {
    border-color: var(--yellow);
    background: var(--yellow-surface);
}

.route-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.route-card-duration {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.route-card.active .route-card-duration {
    color: var(--blue);
}

.route-card.active[data-mode="cycling"] .route-card-duration {
    color: var(--green);
}

.route-card.active[data-mode="walking"] .route-card-duration {
    color: var(--yellow);
}

.route-card-dist {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.route-card-via {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-item {
    display: flex;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--dur-fast);
}

.step-item:hover {
    background: var(--bg-hover);
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.step-item:hover .step-icon {
    background: var(--accent-surface);
    color: var(--accent-light);
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-text {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
}

.step-text strong {
    color: var(--text-primary);
}

.step-dist {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: var(--font-mono);
}

#dir-bottom-bar {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-surface);
}

.start-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-xl);
    background: var(--blue);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(66, 133, 244, 0.35);
    transition: all var(--dur-fast);
}

.start-btn:hover {
    background: #5a95f5;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.45);
}

.start-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all var(--dur-fast);
}

.secondary-btn:hover {
    background: var(--red-surface);
    color: var(--red);
}

/* ============================================
   FABs
   ============================================ */
#fab-stack {
    position: fixed;
    right: 16px;
    /* Respect iPhone home indicator / Android nav bar */
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeSlideDown 0.5s var(--ease) 0.5s both;
}

.fab {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
    transition: all var(--dur-fast);
}

.fab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    transform: scale(1.06);
}

.fab:active {
    transform: scale(0.94);
}

.fab.active {
    color: var(--blue);
    background: var(--blue-surface);
    border-color: rgba(66, 133, 244, 0.3);
}

/* ============================================
   LANDING PAGE — Premium Redesign
   ============================================ */
#landing-page {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(160deg, #051a0e 0%, #0a2e18 40%, #063b22 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
}

#landing-page.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Background orbs ────────────────────── */
.lp-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.lp-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: orbDrift 12s ease-in-out infinite;
}

.lp-orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #10b981, #059669);
    top: -150px; left: -100px;
    animation-delay: 0s;
}
.lp-orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #38bdf8, #0284c7);
    bottom: -100px; right: -80px;
    animation-delay: -4s;
}
.lp-orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #6ee7b7, #10b981);
    top: 40%; left: 60%;
    animation-delay: -8s;
}

@keyframes orbDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -40px) scale(1.08); }
    66%       { transform: translate(-20px, 20px) scale(0.95); }
}

/* ── Content ────────────────────────────── */
.landing-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
    padding: 2rem 1.5rem;
    max-width: 480px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Logo ────────────────────────────────── */
.landing-logo-wrap {
    position: relative;
    display: inline-flex;
    margin-bottom: 1.6rem;
    animation: fadeSlideDown 0.7s var(--ease-bounce) 0.1s both;
}

.landing-logo-glow {
    position: absolute;
    inset: -18px;
    background: radial-gradient(circle, rgba(16,185,129,0.55) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.12); }
}

.landing-logo {
    width: 140px;
    height: 140px;
    border-radius: 32px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1.5px rgba(110,231,183,0.3);
    position: relative;
    z-index: 1;
}

/* ── Badge ───────────────────────────────── */
.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 100px;
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.3);
    font-size: 0.75rem;
    font-weight: 600;
    color: #6ee7b7;
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
    animation: fadeSlideDown 0.6s var(--ease) 0.25s both;
}

/* ── Title & slogan ──────────────────────── */
.landing-title {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #ffffff 0%, #6ee7b7 60%, #10b981 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeSlideDown 0.65s var(--ease) 0.35s both;
}

.landing-slogan {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.65);
    margin-bottom: 1.8rem;
    font-weight: 400;
    line-height: 1.6;
    animation: fadeSlideDown 0.65s var(--ease) 0.45s both;
}

/* ── Feature pills ───────────────────────── */
.landing-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2rem;
    animation: fadeSlideDown 0.65s var(--ease) 0.55s both;
}

.landing-feature {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 100px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    transition: background 0.2s, border-color 0.2s;
}

.landing-feature:hover {
    background: rgba(16,185,129,0.15);
    border-color: rgba(16,185,129,0.4);
}

/* ── CTA button ──────────────────────────── */
.landing-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1rem 2.4rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #051a0e;
    background: linear-gradient(135deg, #6ee7b7 0%, #10b981 50%, #059669 100%);
    border-radius: 100px;
    border: none;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.45), 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    margin-bottom: 2rem;
    animation: fadeSlideDown 0.65s var(--ease-bounce) 0.65s both;
}

.landing-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 40px rgba(16, 185, 129, 0.55), 0 4px 12px rgba(0,0,0,0.3);
}

.landing-btn:active {
    transform: translateY(0) scale(0.98);
}

.landing-btn i {
    font-size: 1.25rem;
}

/* Shimmer sweep across the button */
.landing-btn-shimmer {
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: btnShimmer 2.5s ease-in-out 1.5s infinite;
    transform: skewX(-20deg);
}

@keyframes btnShimmer {
    0%   { left: -100%; }
    60%  { left: 160%; }
    100% { left: 160%; }
}

/* ── Stats row ───────────────────────────── */
.landing-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    animation: fadeSlideDown 0.6s var(--ease) 0.75s both;
}

.lstat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.lstat-num {
    font-size: 1.35rem;
    font-weight: 800;
    color: #6ee7b7;
    line-height: 1;
}

.lstat-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.lstat-divider {
    width: 1px;
    height: 32px;
    background: rgba(255,255,255,0.12);
}

/* Mobile tweaks */
@media (max-width: 480px) {
    .landing-title  { font-size: 2.4rem; }
    .landing-logo   { width: 110px; height: 110px; }
    .landing-btn    { padding: 0.9rem 2rem; font-size: 1rem; }
}

/* ============================================
   ONBOARDING SCREEN
   ============================================ */
#onboarding-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(160deg, #051a0e 0%, #0a2e18 40%, #063b22 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    animation: obFadeIn 0.4s var(--ease) both;
    transition: opacity 0.6s var(--ease);
}

#onboarding-screen.hidden {
    display: none;
}

#onboarding-screen.leaving {
    opacity: 0;
    pointer-events: none;
}

@keyframes obFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Spinner wrap — positions the rings + logo */
#ob-spinner-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dual counter-rotating arc rings */
.ob-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.ob-ring-outer {
    border-top-color: #10b981;
    border-right-color: rgba(16,185,129,0.3);
    animation: ringSpinCW 0.9s linear infinite;
}

.ob-ring-inner {
    inset: 10px;
    border-bottom-color: #38bdf8;
    border-left-color: rgba(56,189,248,0.3);
    animation: ringSpinCCW 1.1s linear infinite;
}

@keyframes ringSpinCW  { to { transform: rotate(360deg);  } }
@keyframes ringSpinCCW { to { transform: rotate(-360deg); } }

.ob-logo {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    z-index: 1;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Tip text */
.ob-tip {
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    text-align: center;
    max-width: 280px;
    line-height: 1.5;
    min-height: 3em;           /* prevent layout shift during swap */
    transition: opacity 0.2s ease;
}

.ob-tip.tip-fade {
    opacity: 0;
}

/* Welcome phase */
#ob-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: obWelcomeIn 0.5s var(--ease-bounce) both;
}

#ob-welcome.hidden {
    display: none;
}

@keyframes obWelcomeIn {
    from { opacity: 0; transform: scale(0.85) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.ob-check {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    font-weight: 900;
    box-shadow: 0 8px 28px rgba(16,185,129,0.45);
}

.ob-welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.ob-welcome-sub {
    font-size: 1rem;
    color: rgba(255,255,255,0.55);
    margin: 0;
}

/* ============================================
   SIDEBAR MENU
   ============================================ */
#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 2500;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

#sidebar-overlay:not(.hidden) {
    opacity: 1;
}

#sidebar-overlay.hidden {
    display: none;
}

#sidebar-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-surface);
    z-index: 2600;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.35s var(--ease);
}

#sidebar-menu.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

/* Landing logo */
.landing-logo {
    width: 112px;
    height: 112px;
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.35);
    margin-bottom: 1.5rem;
    animation: fadeSlideDown 0.7s var(--ease-bounce) both;
}

/* Sidebar brand (logo + name side by side) */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    color: var(--accent-light);
    font-weight: 700;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.categories-list,
.my-places-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item,
.saved-place-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--dur-fast);
}

.saved-place-item {
    justify-content: space-between;
}

.saved-place-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.saved-place-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.saved-place-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-place-cat {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-empty-state {
    padding: 16px 12px;
    background: rgba(239, 68, 68, 0.05);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.saved-empty-state i {
    font-size: 1.5rem;
    color: #ef4444;
    margin-bottom: 8px;
    opacity: 0.8;
}

.category-item:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
}

.category-item.active {
    background: var(--bg-active);
    border-color: var(--accent);
}

.category-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.category-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--dur-fast);
}

.sidebar-link i {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-link:hover i {
    color: var(--accent-light);
}

/* ── Streak Widget ── */
.streak-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 0 0 12px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(253, 115, 22, 0.15), rgba(234, 88, 12, 0.08));
    border: 1px solid rgba(253, 115, 22, 0.3);
    box-shadow: 0 0 20px rgba(253, 115, 22, 0.1);
}

.streak-flames {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.streak-count {
    font-size: 1rem;
    font-weight: 700;
    color: #fb923c;
}

.streak-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Streak CTA (Empty State) ── */
.streak-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 0 0 12px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.06));
    border: 1px dashed rgba(16, 185, 129, 0.4);
    cursor: pointer;
    transition: all var(--dur-fast);
}

.streak-cta:hover {
    background: rgba(16, 185, 129, 0.18);
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.streak-cta-icon {
    font-size: 1.5rem;
    background: var(--bg-primary);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.streak-cta-body {
    flex: 1;
    animation: ctaShake 5s infinite;
}

.streak-cta-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-light);
}

.streak-cta-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.3;
}

.streak-cta i {
    color: var(--text-muted);
    font-size: 1rem;
}

.streak-cta:hover i {
    color: var(--accent-light);
    transform: translateX(3px);
    transition: transform 0.2s;
}

@keyframes ctaShake {
    0%, 90%, 100% { transform: translateX(0); }
    92% { transform: translateX(-2px); }
    94% { transform: translateX(2px); }
    96% { transform: translateX(-2px); }
    98% { transform: translateX(2px); }
}


.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--dur-fast);
}

.category-item:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
}

.category-item.active {
    background: var(--bg-active);
    border-color: var(--accent);
}

.category-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.category-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ============================================
   LAYERS PANEL
   ============================================ */
#layers-panel {
    position: fixed;
    right: 16px;
    bottom: 92px;
    z-index: 950;
    width: 240px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 16px;
    animation: fadeScaleIn 0.2s var(--ease-bounce);
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.layers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.layers-header h3 {
    font-size: 0.88rem;
    font-weight: 600;
}

.layers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.layer-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    transition: all var(--dur-fast);
    cursor: pointer;
}

.layer-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
}

.layer-card.active {
    border-color: var(--blue);
    background: var(--blue-surface);
}

.layer-thumb {
    width: 100%;
    aspect-ratio: 1.5;
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.dark-thumb {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.light-thumb {
    background: linear-gradient(135deg, #e8eaf6 0%, #f5f5f5 50%, #c5cae9 100%);
}

.sat-thumb {
    background: linear-gradient(135deg, #1b3a20 0%, #2e6b2e 50%, #3d8b3d 100%);
}

.terrain-thumb {
    background: linear-gradient(135deg, #d4a574 0%, #8fbc8f 50%, #f5f5dc 100%);
}

.layer-card span {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.layer-card.active span {
    color: var(--blue);
}

/* ============================================
   ZOOM CONTROLS
   ============================================ */
#zoom-controls {
    position: fixed;
    right: 16px;
    bottom: calc(160px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: fadeSlideDown 0.5s var(--ease) 0.6s both;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all var(--dur-fast);
}

.zoom-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.zoom-btn:active {
    background: var(--bg-elevated);
}

.zoom-btn:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.zoom-btn:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    border-top: none;
}

/* ============================================
   INFO CARD (bottom card for clicked locations)
   ============================================ */
#info-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;
    pointer-events: none;
}

#info-card:not(.hidden) {
    pointer-events: auto;
}

.info-card-content {
    max-width: 420px;
    margin: 0 auto 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 16px 20px;
    animation: slideUp 0.35s var(--ease-bounce);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.info-card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.info-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
}

.info-card-actions {
    display: flex;
    gap: 16px;
}

.info-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    color: var(--blue);
    transition: all var(--dur-fast);
    cursor: pointer;
}

.info-action span {
    font-size: 0.7rem;
    font-weight: 500;
}

.info-action:hover {
    background: var(--blue-surface);
}

#info-saved-btn.saved-active {
    color: #ef4444;
}

#info-saved-btn.saved-active:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================
   TOAST
   ============================================ */
#toast-container {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
    /* Prevent the toast from being wider than the screen */
    max-width: calc(100vw - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 0.86rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: auto;
    animation: toastIn 0.35s var(--ease-bounce);
}

.toast.removing {
    animation: toastOut 0.25s var(--ease) forwards;
}

.toast i {
    font-size: 1.15rem;
}

.toast.success i {
    color: var(--green);
}

.toast.error i {
    color: var(--red);
}

.toast.info i {
    color: var(--blue);
}

@keyframes toastIn {
    from {
        transform: translateY(16px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastOut {
    to {
        transform: translateY(16px) scale(0.95);
        opacity: 0;
    }
}

/* ============================================
   ECO CHIP MARKERS (replaces .marker-pin)
   ============================================ */
.eco-chip {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chip-color, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), 0 0 0 2.5px rgba(255,255,255,0.9);
    cursor: pointer;
    animation: chipPop 0.4s var(--ease-bounce) both;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
    position: relative;
    will-change: transform;
}

.eco-chip:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 18px rgba(0,0,0,0.4),
                0 0 0 3px white,
                0 0 0 5.5px var(--chip-color, #10b981);
    z-index: 1000;
}

.eco-chip:active {
    transform: scale(1.1);
}

/* Visited state — green ring + checkmark badge */
.eco-chip.visited {
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), 0 0 0 2.5px #10b981;
}

.eco-chip.visited::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 900;
    line-height: 14px;
    text-align: center;
    color: white;
    border: 1.5px solid white;
    pointer-events: none;
}

.eco-chip.saved::before {
    content: '❤';
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
    color: white;
    border: 1.5px solid white;
    pointer-events: none;
    z-index: 2;
}

@keyframes chipPop {
    0%   { transform: scale(0) translateY(-8px); opacity: 0; }
    65%  { transform: scale(1.22) translateY(0); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Keep the red info-marker pin for search results */
.marker-pin.red {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: linear-gradient(135deg, var(--red), #f06);
    transform: rotate(-45deg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    border: 2px solid white;
    animation: markerDrop 0.5s var(--ease-bounce) forwards;
}

@keyframes markerDrop {
    0%   { transform: rotate(-45deg) translateY(-30px) scale(0.6); opacity: 0; }
    100% { transform: rotate(-45deg) translateY(0) scale(1); opacity: 1; }
}

/* Origin/Dest nav markers */
.nav-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    animation: markerDrop 0.4s var(--ease-bounce);
}

.nav-marker.origin {
    background: var(--blue);
    border: 3px solid white;
}

.nav-marker.dest {
    background: var(--red);
    border: 3px solid white;
}

.nav-marker-label {
    font-family: var(--font);
    font-weight: 700;
    font-size: 11px;
}

/* User location blue dot */
.user-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--blue);
    border: 3px solid white;
    box-shadow: 0 0 0 6px rgba(66, 133, 244, 0.25), 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: userPulse 2.5s ease-in-out infinite;
}

@keyframes userPulse {

    0%,
    100% {
        box-shadow: 0 0 0 6px rgba(66, 133, 244, 0.25), 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 0 14px rgba(66, 133, 244, 0.08), 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* Leaflet popup restyle */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    font-family: var(--font) !important;
    font-size: 14px !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
}

.popup-inner {
    padding: 14px 16px;
}

.popup-inner h4 {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.popup-inner .popup-coords {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.popup-inner .popup-btns {
    display: flex;
    gap: 8px;
}

.popup-btn {
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.76rem;
    font-weight: 500;
    transition: all var(--dur-fast);
    cursor: pointer;
}

.popup-btn.primary {
    background: var(--blue-surface);
    color: var(--blue);
    border: 1px solid rgba(66, 133, 244, 0.2);
}

.popup-btn.primary:hover {
    background: rgba(66, 133, 244, 0.2);
}

.popup-btn.danger {
    background: var(--red-surface);
    color: var(--red);
    border: 1px solid rgba(234, 67, 53, 0.2);
}

.popup-btn.danger:hover {
    background: rgba(234, 67, 53, 0.2);
}

/* ============================================
   FLAWLESS MARKER POPUPS
   ============================================ */
.leaflet-popup.flawless-popup {
    margin-bottom: 25px;
}

.flawless-popup .leaflet-popup-content-wrapper {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 0;
    overflow: hidden;
    min-width: 260px;
    max-width: 300px;
    border: 1px solid var(--border);
}

.flawless-popup .leaflet-popup-content {
    margin: 0;
    line-height: 1.5;
}

.flawless-popup .leaflet-popup-tip-container {
    overflow: visible;
}

.flawless-popup .leaflet-popup-tip {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.flawless-popup .leaflet-popup-close-button {
    color: var(--text-secondary) !important;
    padding: 12px 12px 0 0 !important;
    font-size: 18px !important;
    transition: color 0.2s;
    z-index: 10;
}

.flawless-popup .leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

.custom-popup {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.custom-popup .popup-meta {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.custom-popup .popup-meta i {
    font-size: 1rem;
}

.custom-popup .popup-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    padding-right: 20px;
}

.custom-popup .popup-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 6px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    #search-bar {
        width: calc(100vw - 80px);
    }

    #directions-panel {
        width: 100%;
    }

    .info-card-content {
        margin: 0 8px 8px;
        margin-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    #zoom-controls {
        display: none;
    }

    .flawless-popup .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 48px) !important;
        min-width: 0 !important;
    }

    .landing-title {
        font-size: 2.4rem;
    }

    #layers-panel {
        right: 8px;
        max-width: calc(100vw - 16px);
    }
}

/* ============================================
   ECO SCORE WIDGET (sidebar)
   ============================================ */
#eco-score-widget {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 4px;
}

.eco-score-level {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.eco-score-count {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.eco-score-bar {
    height: 5px;
    border-radius: 5px;
    background: var(--bg-primary);
    overflow: hidden;
}

.eco-score-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s var(--ease);
}

/* ============================================
   DAILY CHALLENGE WIDGET (sidebar)
   ============================================ */
#daily-challenge-widget {
    background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(5,150,105,0.05));
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: var(--radius-md);
    padding: 13px 15px;
    margin-bottom: 4px;
}

.challenge-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.challenge-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.challenge-text.done {
    text-decoration: line-through;
    opacity: 0.55;
}

.challenge-complete-badge {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--accent-light);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Visited button in info card — active state */
.info-action.visited-active {
    color: var(--accent-light) !important;
}

.info-action.visited-active i {
    color: var(--accent-light);
}

/* ============================================
   LIVE NAVIGATION HUD
   ============================================ */
#nav-hud {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    font-family: 'Inter', sans-serif;
}

#nav-hud-step {
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    pointer-events: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

#nav-hud-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

#nav-hud-instruction {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}

#nav-hud-dist-step {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-top: 3px;
    font-weight: 500;
}

#nav-hud-bottom {
    background: rgba(10, 20, 12, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(76, 175, 80, 0.25);
    display: flex;
    align-items: center;
    gap: 0;
    padding: 12px 20px;
    pointer-events: auto;
}

#nav-hud-eta,
#nav-hud-remain {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    flex: 1;
}

#nav-hud-eta {
    color: var(--accent-light, #81c784);
}

#nav-stop-btn {
    background: rgba(255, 80, 80, 0.15);
    border: 1px solid rgba(255, 80, 80, 0.4);
    color: #ff6b6b;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, border-color 0.2s;
}

#nav-stop-btn:hover {
    background: rgba(255, 80, 80, 0.3);
    border-color: #ff6b6b;
}

/* live user position arrow during navigation */
.nav-arrow-dot {
    width: 22px;
    height: 22px;
    background: #4285f4;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.35), 0 2px 10px rgba(0, 0, 0, 0.4);
    animation: nav-pulse 2s ease-in-out infinite;
}

@keyframes nav-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.35), 0 2px 10px rgba(0, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(66, 133, 244, 0.12), 0 2px 10px rgba(0, 0, 0, 0.4);
    }
}

/* ============================================
   SUGGEST A SPOT FAB & MODAL
   ============================================ */
#suggest-btn {
    position: fixed;
    bottom: calc(260px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 18px 10px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.02em;
    pointer-events: auto;
}

#suggest-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.6);
}

#suggest-btn i {
    font-size: 1rem;
}

/* ── Base Modal Styles ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 1;
    transition: opacity 0.3s var(--ease);
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    position: relative;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(0) scale(1);
    transition: transform 0.3s var(--ease-bounce);
    display: flex;
    flex-direction: column;
}

.modal-overlay.hidden .modal-content {
    transform: translateY(20px) scale(0.96);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
}

/* ── Suggest Modal ── */
.suggest-modal-content {
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.suggest-intro {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.form-group .req {
    color: #f87171;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 10px 12px;
    outline: none;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group select option {
    background: var(--bg-surface);
}

.suggest-status {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.suggest-status.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.suggest-status.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.suggest-submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 13px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    letter-spacing: 0.02em;
}

.suggest-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.suggest-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   FEATURED CAROUSEL
   ============================================ */
#featured-carousel {
    position: absolute;
    bottom: 24px;
    left: 48px;
    right: 48px;
    z-index: 1000;
    overflow: hidden;
    pointer-events: auto;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#featured-carousel.hidden {
    opacity: 0;
    transform: translateY(32px);
    pointer-events: none;
}

/* Inner scrolling track — driven by JS */
#fc-track {
    display: flex;
    gap: 14px;
    padding: 8px 4px 24px;
    width: max-content;
    will-change: transform;
}

/* Pause scroll on hover */
#featured-carousel:hover #fc-track {
    animation-play-state: paused;
}

.featured-card {
    flex: 0 0 auto;
    width: 230px;
    background: rgba(8, 28, 14, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
    animation: fcSlideUp 0.5s ease both;
}

@keyframes fcSlideUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.featured-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Colored accent strip at the top */
.fc-accent {
    height: 5px;
    width: 100%;
    border-radius: 0;
}

.fc-body {
    padding: 13px 15px 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fc-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

.fc-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fc-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.fc-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0;
}

.fc-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   SETTINGS MODAL
   ============================================ */
.settings-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.st-options {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.st-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.st-btn:hover {
    color: var(--text-primary);
}

.st-btn.active {
    background: var(--bg-elevated);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.danger-zone {
    margin-top: 10px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.danger-zone label {
    color: #f87171;
}

.st-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.st-danger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.st-danger-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}
@media (max-width: 768px) {
    #nav-hud-instruction {
        font-size: 1rem;
    }

    #nav-hud-step {
        padding: 14px 18px;
    }
}