/* ============================================
   Route One (r1.pt) — V2.0.0
   Map-centric, minimal chrome
   ============================================ */

:root, [data-theme="light"] {
    --bg: #f8f7f4;
    --bg-card: #ffffff;
    --bg-nav: rgba(255,255,255,0.92);
    --bg-stats: rgba(255,255,255,0.95);
    --text: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #9a9a9a;
    --accent: #E67E22;
    --accent-hover: #d35400;
    --border: #e8e6e1;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --route-color: #E67E22;
    --route-outline: #c0650e;
    --tile-url: https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png;
    --live-pulse: #e74c3c;
    --badge-bg: rgba(231,76,60,0.1);
    --action-bg: rgba(230,126,34,0.06);
    --action-border: rgba(230,126,34,0.15);
}

[data-theme="dark"] {
    --bg: #111111;
    --bg-card: #1a1a1a;
    --bg-nav: rgba(17,17,17,0.92);
    --bg-stats: rgba(26,26,26,0.95);
    --text: #e8e6e1;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #F0A500;
    --accent-hover: #e6950a;
    --border: #2a2a2a;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --route-color: #F0A500;
    --route-outline: #b87a00;
    --live-pulse: #ff5252;
    --badge-bg: rgba(255,82,82,0.15);
    --action-bg: rgba(240,165,0,0.08);
    --action-border: rgba(240,165,0,0.2);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- Nav ---- */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}
.brand-icon {
    color: var(--accent);
    font-size: 1.5rem;
}
.brand-logo {
    height: 36px;
    width: auto;
}
.brand-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.brand-text {
    font-size: 1.15rem;
    font-weight: 600;
}
.brand-by {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 400;
}
.brand-by a {
    color: var(--text-muted);
    transition: color 0.2s;
}
.brand-by a:hover {
    color: var(--accent);
}
.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.5rem !important;
}
.lang-flag {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    display: block;
}
.nav-actions {
    display: flex;
    gap: 0.4rem;
}
.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Route page nav — overlays the map */
.route-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-back {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color 0.2s;
}
.nav-back:hover { color: var(--accent); }
.route-title-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.route-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Hero ---- */
.hero {
    text-align: center;
    padding: 3.5rem 1.5rem 2rem;
}
.hero h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}
.hero-sub {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 300;
}

/* ---- Trip Grid ---- */
.trip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    padding: 0 1.5rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}
.trip-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}
.trip-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Mini map in card */
.card-map {
    height: 180px;
    background: var(--bg);
    position: relative;
}
.card-map .leaflet-control-container { display: none; }

.card-body {
    padding: 1rem 1.25rem 0.75rem;
    flex: 1;
}
.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    flex: 1;
    line-height: 1.3;
}
.badge-live {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--badge-bg);
    color: var(--live-pulse);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.badge-live i {
    font-size: 0.45rem;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.card-dates {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}
.card-stats .stat {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.card-stats .stat i {
    color: var(--accent);
    font-size: 0.75rem;
}
.card-flags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.flag-mini {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.card-action {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--action-bg);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    transition: background 0.2s;
}
.card-action i { transition: transform 0.2s; }
.trip-card:hover .card-action i { transform: translateX(4px); }

/* ---- Route Map Page ---- */
.route-map {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 60px;
    z-index: 1;
}
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Stats bar at bottom */
.stats-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-stats);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}
.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-flags {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

/* ---- Leaflet popup custom ---- */
.r1-popup .leaflet-popup-content-wrapper {
    border-radius: 10px;
    padding: 0;
    box-shadow: var(--shadow-lg);
}
.r1-popup .leaflet-popup-content {
    margin: 0;
    min-width: 220px;
    max-width: 300px;
}
.popup-inner {
    padding: 0.75rem 1rem;
}
.popup-inner h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.popup-meta {
    font-size: 0.78rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.popup-meta img { display: inline; }
.popup-category {
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.05);
    margin-bottom: 0.35rem;
}
.popup-notes {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.4;
    margin-top: 0.35rem;
}
.popup-photos {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
    overflow-x: auto;
}
.popup-photo {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.popup-photo:hover { transform: scale(1.05); }

/* ---- Lightbox ---- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.92);
    align-items: center;
    justify-content: center;
}
.lightbox.active { display: flex; }
.lb-close, .lb-prev, .lb-next {
    position: absolute;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; }
.lb-close { top: 0.5rem; right: 0.5rem; }
.lb-prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.5rem; top: 50%; transform: translateY(-50%); }
.lb-content { text-align: center; max-width: 90vw; max-height: 85vh; }
#lb-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 6px;
    object-fit: contain;
}
.lb-caption {
    color: #ccc;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--text);
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 2000;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Footer (crew standard) ---- */
.site-footer {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.site-footer a {
    color: var(--accent);
    font-weight: 500;
    transition: color 0.2s;
}
.site-footer a:hover { color: var(--accent-hover); }
.footer-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
}
.footer-brand {
    font-weight: 600;
    color: var(--text);
}
.footer-brand i { color: var(--accent); }
.footer-sep { color: var(--text-muted); }
.footer-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}
.footer-social a {
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.2s;
}
.footer-social a:hover { color: var(--accent); }
.footer-dot { color: var(--border); }
.footer-copy {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* ---- Global stats header ---- */
.global-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.gs-item strong {
    color: var(--accent);
    font-weight: 700;
}
.gs-dot {
    color: var(--border);
}

/* ---- Section title ---- */
.section-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1.5rem 0 1rem;
    letter-spacing: 0.01em;
}

/* ---- Grid header with filters ---- */
.grid-header {
    max-width: 1200px;
    margin: 1.5rem auto 0.75rem;
    padding: 0 1.5rem;
    text-align: center;
}
.grid-header .section-title { margin: 0 0 0.75rem; }
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.filter-select {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: var(--accent); }
.filter-flags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}
.ff-btn {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ff-btn:hover { opacity: 0.8; }
.ff-btn.active {
    opacity: 1;
    border-color: var(--accent);
}
.ff-btn img {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    display: block;
}
.ff-btn i {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 1px 3px;
}
.ff-btn.active i { color: var(--accent); }
.filter-empty {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ---- Trip description (route page) ---- */
.trip-desc {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    text-align: center;
}
.trip-desc p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
    max-width: 800px;
    margin-inline: auto;
    line-height: 1.4;
}
/* Push map down when description is present */
body.page-route .trip-desc ~ .route-map { top: 80px; }

/* ---- Photo strip on route detail ---- */
.photo-strip-route {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 60px;
    z-index: 700;
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-stats);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.photo-strip-route::-webkit-scrollbar { display: none; }
.photo-strip-route.hidden { display: none; }
.psr-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    width: 100px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}
.psr-item:hover { transform: scale(1.05); }
.psr-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.psr-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: #fff;
    font-size: 0.55rem;
    font-weight: 500;
    padding: 0.8rem 0.3rem 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.psr-date {
    display: none;
}
/* Adjust route map and controls when photo strip is visible */
.page-route.has-photos .stats-bar { bottom: 0; }
.page-route.has-photos .photo-strip-route { bottom: 60px; }
.page-route.has-photos .route-controls { bottom: 140px; }
.page-route.has-photos .route-map { bottom: 130px; }

/* ---- Overview map ---- */
.overview-section {
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}
.overview-map-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.overview-map {
    height: 380px;
    width: 100%;
    background: var(--bg);
}
.overview-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--bg-card);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text);
    transition: color 0.2s;
}
.legend-item:hover { color: var(--accent); }
.legend-color {
    width: 14px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}
.legend-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.overview-tooltip {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

/* ---- Photo highlights strip ---- */
.photo-strip-section {
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}
.photo-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.photo-strip::-webkit-scrollbar { height: 4px; }
.photo-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.ps-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    width: 160px;
    height: 110px;
    transition: transform 0.2s;
}
.ps-item:hover { transform: scale(1.03); }
.ps-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ps-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: #fff;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 1.2rem 0.5rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Cover photo on cards ---- */
.card-map.has-cover { position: relative; }
.card-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.2;
    z-index: 0;
}
.card-map.has-cover .leaflet-container { position: relative; z-index: 1; }

/* ---- Route controls (animation + map style) ---- */
.route-controls {
    position: fixed;
    bottom: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 850;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 0.4rem 0.75rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.anim-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ctrl-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.ctrl-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.speed-control {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.speed-slider {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.speed-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.speed-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}
.style-picker {
    display: flex;
    gap: 0.25rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border);
}
.ms-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s;
}
.ms-btn:hover { color: var(--text); }
.ms-btn.active {
    background: var(--action-bg);
    color: var(--accent);
    border-color: var(--action-border);
}

/* ---- Country transition flags on map ---- */
.country-flag-marker {
    background: none !important;
    border: none !important;
}
.country-flag-marker img {
    width: 28px;
    height: 21px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    border: 1.5px solid #fff;
}

/* ---- Stop list sidebar ---- */
.stop-list {
    position: fixed;
    top: 50px;
    left: 0;
    bottom: 60px;
    width: 340px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 800;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}
.stop-list.open {
    transform: translateX(0);
}
.sl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sl-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sl-header h2 i { color: var(--accent); }
.sl-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
}
.sl-close:hover { color: var(--text); }
.sl-description {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
    flex-shrink: 0;
}
.sl-items {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.sl-country {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
}
.sl-country img {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}
.sl-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.sl-item:hover { background: var(--action-bg); }
.sl-item.active {
    background: var(--action-bg);
    border-left: 3px solid var(--accent);
}
.sl-item-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.sl-item-info { flex: 1; min-width: 0; }
.sl-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sl-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.sl-item-photo {
    flex-shrink: 0;
}
.sl-item-photo img {
    width: 40px;
    height: 30px;
    border-radius: 4px;
    object-fit: cover;
}
.sl-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .trip-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem 2rem;
    }
    .hero { padding: 2.5rem 1rem 1.5rem; }
    .hero h1 { font-size: 1.6rem; }
    .global-stats { flex-wrap: wrap; font-size: 0.8rem; gap: 0.3rem; }
    .overview-map { height: 260px; }
    .overview-section { padding: 0 1rem; }
    .overview-legend { bottom: 8px; left: 8px; padding: 0.35rem 0.5rem; }
    .legend-name { max-width: 120px; }
    .photo-strip-section { padding: 0 1rem; }
    .ps-item { width: 130px; height: 90px; }
    .section-title { font-size: 1rem; }
    .stats-bar { gap: 0.75rem; padding: 0.5rem 0.5rem; }
    .stat-value { font-size: 0.95rem; }
    .stat-label { font-size: 0.6rem; }
    .route-nav { padding: 0.5rem 0.75rem; gap: 0.5rem; }
    .route-title { font-size: 0.9rem; }

    /* Stop list → bottom sheet on mobile */
    .stop-list {
        top: auto;
        left: 0;
        right: 0;
        bottom: 60px;
        width: 100%;
        max-height: 55vh;
        border-right: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    .stop-list.open {
        transform: translateY(0);
    }
    .sl-header {
        position: relative;
        padding-top: 1rem;
    }
    /* Drag handle indicator */
    .sl-header::before {
        content: '';
        position: absolute;
        top: 0.4rem;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }
    .route-map {
        bottom: 60px;
    }
    /* V2: photo strip adjustments */
    .page-route.has-photos .stats-bar { bottom: 0; }
    .page-route.has-photos .photo-strip-route { bottom: 50px; }
    .page-route.has-photos .route-controls { bottom: 115px; }
    .page-route.has-photos .route-map { bottom: 105px; }
    .photo-strip-route { padding: 0.3rem 0.5rem; gap: 0.35rem; }
    .psr-item { width: 75px; height: 55px; }
    .psr-label { font-size: 0.5rem; }
    .stop-list.open { bottom: 50px; }
    .page-route.has-photos .stop-list.open { bottom: 105px; }
    .trip-desc { padding: 0.35rem 1rem; }
    .trip-desc p { font-size: 0.75rem; }
    .grid-header { padding: 0 1rem; }
    .filter-flags { gap: 0.15rem; }
    .ff-btn img { width: 20px; height: 15px; }

    /* Route controls mobile */
    .route-controls {
        bottom: 66px;
        padding: 0.35rem 0.5rem;
        gap: 0.4rem;
    }
    .speed-slider { width: 70px; }
    .ctrl-btn { width: 30px; height: 30px; font-size: 0.75rem; }
    .ms-btn { width: 26px; height: 26px; font-size: 0.7rem; }

    /* Footer adjustments */
    .footer-copy { font-size: 0.65rem; padding: 0 0.5rem; }
}
@media (max-width: 400px) {
    .card-map { height: 150px; }
    .stat-flags { display: none; }
    .global-stats .gs-dot:last-of-type,
    .global-stats .gs-item:last-child { display: none; }
}

/* ---- Leaflet overrides ---- */
.leaflet-container { background: var(--bg) !important; }
