/* The hub is a 100dvh app surface. The long-form note beneath it needs the
   document to scroll, so on this page the body must not lock — otherwise the
   section exists in the DOM but no reader (or crawler viewport) can reach it. */
body:has(.map-hub) { overflow-y: auto; overflow-x: hidden; height: auto; }

/* GTA 6 Glassy Gradient Color Scheme */
:root {
    --gta6-cyan: #00D4FF;
    --gta6-cyan-glow: rgba(0, 212, 255, 0.4);
    --gta6-orange: #FF6B35;
    --gta6-orange-glow: rgba(255, 107, 53, 0.4);
    --gta6-purple: #B44AFF;
    --gta6-purple-glow: rgba(180, 74, 255, 0.4);
    --gta6-pink: #FF2D95;
    --gta6-pink-glow: rgba(255, 45, 149, 0.3);
    --gta6-glass-bg: linear-gradient(135deg, #00D4FF 0%, #B44AFF 50%, #FF6B35 100%);
    --gta6-glass-border: linear-gradient(135deg, rgba(0, 212, 255, 0.4) 0%, rgba(180, 74, 255, 0.3) 50%, rgba(255, 107, 53, 0.25) 100%);
    --gta6-glass-hover: linear-gradient(135deg, #00E5FF 0%, #C060FF 50%, #FF7B45 100%);
    --gta6-glass-active: linear-gradient(135deg, #00F0FF 0%, #CC70FF 50%, #FF8B55 100%);
    --gta6-accent: #00D4FF;
    --gta6-accent-glow: rgba(0, 212, 255, 0.4);
}
.leaflet-image-layer.uv-layer {
  filter: hue-rotate(180deg) saturate(0.5) brightness(0.7) contrast(1.2);
}
.map-hub { position: relative; width: 100%; height: 100vh; height: 100dvh; min-height: 100vh; /* min-height guards dvh resolving to 0 (emulated/old webviews) collapsing the hub */ display: grid; grid-template-columns: minmax(260px, 320px) 1fr minmax(280px, 340px); grid-template-rows: 56px 1fr; grid-template-areas: "header header header" "sidebar-left map sidebar-right"; overflow: hidden; }
        .map-header { grid-area: header; display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; background: rgba(10,10,15,0.96); -webkit-backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-bottom: 1px solid var(--border-subtle); position: relative; z-index: 100; }
        .map-header .header-center { display: flex; align-items: center; gap: 0.6rem; }
        .map-header .header-right { display: flex; align-items: center; gap: 0.4rem; }
        .map-viewport { grid-area: map; position: relative; overflow: hidden; background: #0a0a12; cursor: grab; }
        /* #map must create its own stacking context (z-index: 0): without it,
           Leaflet panes (z 200-700) escape into the root context and paint over
           hub chrome (.map-controls, .map-attribution, .poi-panel) wherever a
           tile or cluster marker overlaps them (zoom buttons invisible at 390px). */
        #map { position: absolute; inset: 0; z-index: 0; }
        .map-viewport.dragging { cursor: grabbing; }
        .map-transform { position: absolute; inset: 0; transform-origin: center center; transition: none; will-change: transform; z-index: 1; touch-action: none; }
        .map-plane { position: absolute; overflow: visible; user-select: none; }
        .map-raster { position: absolute; inset: 0; z-index: 0; background-image: url('/images/gta5-map-satellite.webp'); background-position: center; background-size: 100% 100%; background-repeat: no-repeat; pointer-events: none; }
        .map-bg { display: none; }
        .map-water { position: absolute; inset: 0; background: radial-gradient(ellipse at 25% 35%, rgba(0,90,180,0.12) 0%, transparent 55%), radial-gradient(ellipse at 75% 65%, rgba(0,70,140,0.08) 0%, transparent 45%); pointer-events: none; }
        .map-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-family: 'Anton', sans-serif; font-size: 2.5rem; color: rgba(255,255,255,0.08); letter-spacing: 0.15em; text-transform: uppercase; pointer-events: none; z-index: 1; }
        .map-plane .map-marker { position: absolute; }
        .map-marker { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; transform: translate(-50%,-50%); box-shadow: 0 2px 8px rgba(0,0,0,0.6); transition: box-shadow 0.15s ease; z-index: 10; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; line-height: 1; } /* transform NOT transitioned: Leaflet moves markers via transform every pan frame — a CSS transition makes them trail/lag and forces style recalc (drag jank) */
        .map-marker:hover { transform: translate(-50%,-50%) scale(1.4); box-shadow: 0 4px 20px rgba(0,0,0,0.8); z-index: 20; }
        .map-marker-label { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); font-family: 'DM Sans', sans-serif; font-size: 0.65rem; color: #fff; background: rgba(0,0,0,0.85); padding: 2px 6px; border-radius: 3px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
        .map-marker:hover .map-marker-label { opacity: 1; }
        .map-marker.selected { transform: translate(-50%,-50%) scale(1.5); box-shadow: 0 0 0 3px rgba(255,255,255,0.4), 0 4px 20px rgba(0,0,0,0.8); z-index: 25; }
.map-marker .marker-glyph { font-size: 0.7rem; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.map-marker:focus { outline: 2px solid var(--gta6-cyan); outline-offset: 2px; }
.map-marker:focus-visible { box-shadow: 0 0 0 3px var(--gta6-cyan), 0 4px 16px rgba(0,0,0,0.7); }
        .map-marker.mission { width: 32px; height: 32px; border-radius: 4px; transform: translate(-50%,-50%) rotate(45deg); }
        .map-marker.mission .marker-glyph { transform: rotate(-45deg); }
        .map-marker.weapon { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); width: 28px; height: 24px; border-radius: 0; border: none; }
        .map-marker.collectible { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); width: 28px; height: 28px; border: none; }
        .map-marker.hidden-package, .map-marker.stunt-jump { width: 26px; height: 26px; }
        .map-marker.photo-op, .map-marker.wildlife { width: 22px; height: 22px; }
        .map-marker.service, .map-marker.business, .map-marker.property { width: 26px; height: 26px; }
        @keyframes markerDrop { from { transform: translate(-50%,-100%); opacity: 0; } to { transform: translate(-50%,-50%); opacity: 1; } }
        .map-marker.drop-in { animation: markerDrop 0.3s cubic-bezier(0.32, 0.72, 0, 1) both; }
        @keyframes markerPulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.5); } 100% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } }
        .map-marker.pulse { animation: markerPulse 1.5s ease-out infinite; }
        @media (prefers-reduced-motion: reduce) { .map-marker.drop-in, .map-marker.pulse { animation: none; } }
        .ctx-menu { position: fixed; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.3rem 0; min-width: 180px; z-index: 200; box-shadow: 0 8px 32px rgba(0,0,0,0.6); -webkit-backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: none; }
        .ctx-menu.visible { display: block; }
        .ctx-menu-item { width: 100%; border: 0; background: transparent; text-align: left; padding: 0.4rem 0.8rem; font-family: 'DM Sans', sans-serif; font-size: 0.8rem; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: background 0.1s; }
        .ctx-menu-item:hover, .ctx-menu-item:focus-visible { background: var(--bg-tertiary); color: var(--text-primary); outline: none; }
        .ctx-menu-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
        .ctx-menu-sep { height: 1px; background: var(--border-subtle); margin: 0.2rem 0; }
        .ctx-menu-coords { padding: 0.3rem 0.8rem; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); margin-bottom: 0.2rem; }
        .poi-panel { position: absolute; bottom: 0.6rem; left: 50%; transform: translateX(-50%) translateY(20px); width: 90%; max-width: 420px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.7rem; z-index: 1001; opacity: 0; pointer-events: none; transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s; -webkit-backdrop-filter: blur(12px); }
        .poi-panel.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
        .skip-link { position: absolute; top: -40px; left: 0; background: var(--gta6-cyan); color: #111827; padding: 0.5rem 1rem; z-index: 300; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; text-decoration: none; border-radius: 0 0 8px 0; transition: top 0.2s; }
        .skip-link:focus { top: 0; }
        @media (max-width: 768px) { .poi-panel { left: 0.6rem; right: 0.6rem; width: auto; transform: translateY(20px); max-width: 420px; } .poi-panel.visible { transform: translateY(0); } }
        @media (prefers-reduced-motion: reduce) { .poi-panel { transition: none; } }
        .sidebar-left, .sidebar-right { overflow-y: auto; padding: 0.6rem; background: var(--bg-secondary); }
        .sidebar-left { grid-area: sidebar-left; border-right: 1px solid var(--border-subtle); }
        .sidebar-right { grid-area: sidebar-right; border-left: 1px solid var(--border-subtle); }
        .panel-card { background: var(--bg-tertiary); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.7rem; margin-bottom: 0.5rem; }
        .panel-card h3 { font-family: 'Anton', sans-serif; font-size: 1rem; font-weight: 400; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 0.5rem; color: var(--gta6-cyan); display: flex; align-items: center; gap: 0.4rem; }
        .panel-card h3 .badge { font-family: 'DM Sans', sans-serif; font-size: 0.65rem; background: var(--gta6-cyan); color: #111827; padding: 1px 6px; border-radius: 10px; font-weight: 600; text-transform: none; letter-spacing: 0; border: 1px solid var(--gta6-cyan); }
        .filter-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
        .filter-chip { padding: 0.25rem 0.55rem; border: 1px solid rgba(0, 212, 255, 0.4); border-radius: 14px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.72rem; font-weight: 500; cursor: pointer; transition: all 0.2s; user-select: none; -webkit-backdrop-filter: blur(8px); touch-action: manipulation; /* no double-tap-zoom delay swallowing the tap */ }
        .filter-chip:hover { border-color: var(--gta6-cyan); color: var(--text-primary); background: var(--bg-tertiary); box-shadow: 0 0 12px var(--gta6-cyan-glow); }
        .filter-chip.active { background: var(--gta6-cyan); color: #111827; border-color: var(--gta6-cyan); box-shadow: 0 0 16px var(--gta6-cyan-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
        .filter-chip .chip-count { font-size: 0.6rem; opacity: 0.7; margin-left: 3px; }
.filter-chip.active { background: var(--gta6-cyan); color: #111827; border-color: var(--gta6-cyan); box-shadow: 0 0 16px var(--gta6-cyan-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
.filter-action-btn { padding: 0.25rem 0.55rem; border: 1px solid rgba(180, 74, 255, 0.2); border-radius: 5px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.7rem; font-weight: 600; cursor: pointer; transition: all 0.2s; -webkit-backdrop-filter: blur(8px); }
.filter-action-btn:hover { border-color: var(--gta6-purple); color: var(--text-primary); background: var(--bg-tertiary); box-shadow: 0 0 12px var(--gta6-purple-glow); }
.preset-btn { padding: 0.2rem 0.5rem; border: 1px solid rgba(255, 107, 53, 0.2); border-radius: 12px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.68rem; font-weight: 500; cursor: pointer; transition: all 0.2s; -webkit-backdrop-filter: blur(8px); touch-action: manipulation; }
.preset-btn:hover { border-color: var(--gta6-orange); color: var(--text-primary); background: var(--bg-tertiary); box-shadow: 0 0 12px var(--gta6-orange-glow); }
.preset-btn.active { background: var(--gta6-cyan); color: #111827; border-color: var(--gta6-orange); box-shadow: 0 0 16px var(--gta6-orange-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
.search-suggestions { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 6px; max-height: 260px; overflow-y: auto; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.search-suggestion { padding: 0.4rem 0.6rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; border-bottom: 1px solid var(--border-subtle); }
.search-suggestion:last-child { border-bottom: none; }
.search-suggestion:hover, .search-suggestion.active { background: var(--bg-tertiary); }
.search-suggestion .sug-name { font-family: 'DM Sans', sans-serif; font-size: 0.8rem; color: var(--text-primary); }
.search-suggestion .sug-cat { font-family: 'DM Sans', sans-serif; font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.search-suggestion mark { background: rgba(0, 212, 255, 0.25); color: var(--text-primary); border-radius: 2px; padding: 0 1px; }
.filter-empty { padding: 0.6rem; text-align: center; font-family: 'DM Sans', sans-serif; font-size: 0.78rem; color: var(--text-muted); }
.filter-empty button { margin-top: 0.4rem; }
        .poi-list { display: flex; flex-direction: column; gap: 0.3rem; max-height: 200px; overflow-y: auto; }
        .poi-item { display: block; width: 100%; padding: 0.45rem 0.55rem; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--bg-secondary); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; transition: all 0.15s; touch-action: manipulation; }
        .poi-item:hover { border-color: var(--gta6-cyan); background: var(--bg-tertiary); }
        .poi-item:focus-visible { outline: 2px solid var(--gta6-cyan); outline-offset: 2px; }
        .poi-item.selected { border-color: var(--gta6-cyan); background: var(--bg-tertiary); box-shadow: 0 0 8px var(--gta6-cyan-glow); }
        .poi-heading { display:flex; align-items:center; gap:0.4rem; }
        .poi-icon { font-size:0.85rem; }
        .poi-item .poi-name { display:block; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
        .poi-item .poi-meta { display:block; font-family: 'DM Sans', sans-serif; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.1rem; }
        .poi-item .poi-tags { display: flex; gap: 0.25rem; margin-top: 0.2rem; flex-wrap: wrap; }
        .poi-tag { font-family: 'DM Sans', sans-serif; font-size: 0.6rem; padding: 1px 5px; border-radius: 8px; background: var(--bg-primary); color: var(--text-muted); }
        .event-card { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.55rem; margin-bottom: 0.3rem; transition: border-color 0.2s; }
        .event-card:hover { border-color: var(--gta6-cyan); }
        .event-card .event-name { font-family: 'Anton', sans-serif; font-size: 0.9rem; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-primary); }
        .event-card .event-timer { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--gta6-orange); margin-top: 0.1rem; }
        .event-card .event-reward { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }
        .event-card .event-type { display: inline-block; font-family: 'DM Sans', sans-serif; font-size: 0.6rem; padding: 1px 5px; border-radius: 8px; background: var(--bg-primary); color: var(--gta6-purple); margin-bottom: 0.2rem; }
        .progress-label { font-family: 'DM Sans', sans-serif; font-size: 0.78rem; color: var(--text-secondary); display: flex; justify-content: space-between; }
        .progress-label label { font: inherit; color: inherit; }
        .progress-input { width: 100%; max-width: 5rem; padding: 0.2rem 0.35rem; margin: 0.15rem 0 0.25rem; background: var(--bg-primary); border: 1px solid var(--border-subtle); border-radius: 5px; color: var(--text-primary); font: 0.72rem 'JetBrains Mono', monospace; }
        .progress-bar { width: 100%; height: 5px; background: var(--bg-primary); border-radius: 3px; overflow: hidden; margin: 0.3rem 0; }
        .progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gta6-cyan), var(--gta6-purple), var(--gta6-orange)); border-radius: 3px; transition: width 0.3s; }
        .calc-label { display:block; margin:0.2rem 0 0.1rem; font-family:'DM Sans',sans-serif; font-size:0.72rem; color:var(--text-secondary); }
        .calc-input { width: 100%; padding: 0.35rem 0.55rem; background: var(--bg-primary); border: 1px solid var(--border-subtle); border-radius: 6px; color: var(--text-primary); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; margin-bottom: 0.3rem; }
        .calc-result { font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; font-weight: 600; color: var(--gta6-cyan); padding: 0.35rem; background: var(--bg-primary); border-radius: 6px; text-align: center; margin-top: 0.3rem; }
        .layer-toggle { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0; border-bottom: 1px solid var(--border-subtle); }
        .layer-toggle label { font-family: 'DM Sans', sans-serif; font-size: 0.78rem; color: var(--text-secondary); cursor: pointer; }
        .layer-toggle input { accent-color: var(--gta6-cyan); width: 15px; height: 15px; cursor: pointer; }
        .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; margin: 0.4rem 0; }
        .stat-box { background: var(--bg-primary); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.35rem; text-align: center; }
        .stat-box .stat-value { font-family: 'Anton', sans-serif; font-size: 1.2rem; color: var(--gta6-cyan); }
        .stat-box .stat-label { font-family: 'DM Sans', sans-serif; font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.1rem; }
        .theme-btn { padding: 0.2rem 0.45rem; border: 1px solid rgba(180, 74, 255, 0.2); border-radius: 5px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.68rem; font-weight: 500; cursor: pointer; transition: all 0.2s; -webkit-backdrop-filter: blur(8px); }
        .theme-btn.active { background: var(--gta6-cyan); color: #111827; border-color: var(--gta6-purple); box-shadow: 0 0 16px var(--gta6-purple-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
        .back-link { color: var(--text-secondary); text-decoration: none; font-family: 'DM Sans', sans-serif; font-size: 0.78rem; font-weight: 500; }
        .back-link:hover { color: var(--gta6-cyan); }
        .legend-item { display: flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0; }
        .legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
        .legend-label { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-secondary); }
        .build-card { background: var(--bg-primary); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.55rem; margin-bottom: 0.3rem; }
        .build-card h4 { font-family: 'Oswald', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.3rem; }
        .build-stat { display: flex; justify-content: space-between; font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 0.1rem; }
        .build-stat span:last-child { color: var(--gta6-cyan); font-weight: 600; }
        .poi-panel h4 { font-family: 'Anton', sans-serif; font-size: 1rem; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-primary); margin-bottom: 0.3rem; }
        .poi-panel p { font-family: 'DM Sans', sans-serif; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }
        .poi-panel .poi-meta { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }
        .poi-panel .poi-actions { margin-top: 0.5rem; display: flex; gap: 0.3rem; }
        .poi-panel .poi-actions button { padding: 0.25rem 0.5rem; border: 1px solid rgba(0, 212, 255, 0.2); border-radius: 5px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.72rem; cursor: pointer; transition: all 0.2s; -webkit-backdrop-filter: blur(8px); }
        .poi-panel .poi-actions button:hover { border-color: var(--gta6-cyan); color: var(--text-primary); background: var(--bg-tertiary); box-shadow: 0 0 12px var(--gta6-cyan-glow); }
        .map-controls { position: absolute; top: 0.6rem; right: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; z-index: 1000; }
        .map-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; background: var(--bg-tertiary); border: 1px solid rgba(0, 212, 255, 0.4); border-radius: 5px; box-shadow: 0 0 8px rgba(0, 212, 255, 0.3); color: var(--text-primary); font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; -webkit-backdrop-filter: blur(8px); touch-action: manipulation; }
        .map-type-btn, #resetView { min-height: 44px; padding: 0.35rem 0.6rem; border: 1px solid rgba(0, 212, 255, 0.4); border-radius: 5px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.72rem; font-weight: 600; cursor: pointer; white-space: nowrap; touch-action: manipulation; }
        #resetView { border-color: rgba(180, 74, 255, 0.35); }
        .map-btn:hover { background: var(--bg-tertiary); border-color: var(--gta6-cyan); box-shadow: 0 0 12px var(--gta6-cyan-glow); }
        .map-btn:focus-visible, .map-type-btn:focus-visible { outline: 2px solid var(--gta6-cyan); outline-offset: 2px; }
        .map-status { position: absolute; z-index: 998; left: 50%; top: 50%; transform: translate(-50%,-50%); max-width: min(90%, 420px); padding: 0.75rem 1rem; border: 1px solid var(--border-subtle); border-radius: 8px; background: rgba(10,10,15,0.94); color: var(--text-primary); font: 0.85rem 'DM Sans', sans-serif; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.35); pointer-events: none; }
        .map-type-btn.active { border-color: var(--gta6-cyan); color: #111827; background: var(--gta6-cyan); box-shadow: 0 0 12px var(--gta6-cyan-glow); }
        .map-attribution { position:absolute; z-index:999; left:0.55rem; bottom:0.45rem; max-width:min(70%,500px); padding:0.3rem 0.45rem; border:1px solid var(--border-subtle); border-radius:5px; background:rgba(10,10,15,.82); color:var(--text-muted); font:0.62rem 'DM Sans',sans-serif; line-height:1.3; }
        .map-attribution a { color:var(--gta6-orange); text-decoration:underline; }
        .search-bar { position: absolute; top: 0.6rem; left: 0.6rem; z-index: 14; width: 230px; max-width: calc(100% - 1.2rem); }
        .search-bar input { width: 100%; padding: 0.4rem 0.65rem; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 6px; color: var(--text-primary); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; -webkit-backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
        .search-bar input::placeholder { color: var(--text-muted); }
        .mobile-tabs { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-secondary); border-top: 1px solid var(--border-subtle); z-index: 95; padding: 0.3rem 0.3rem calc(0.3rem + env(safe-area-inset-bottom, 0px)); }
        .mobile-tab { flex: 1; padding: 0.35rem; min-height: 44px; background: none; border: none; color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.68rem; font-weight: 500; cursor: pointer; text-align: center; }
        .mobile-tab.active { color: var(--gta6-cyan); }
        .favorites-list { font-family: 'DM Sans', sans-serif; font-size: 0.78rem; color: var(--text-muted); }
        .favorites-list div { padding: 0.15rem 0; color: var(--text-primary); }
        .tab-bar { display: flex; gap: 0.2rem; margin-bottom: 0.5rem; }
        .tab-btn { padding: 0.3rem 0.6rem; border: 1px solid rgba(180, 74, 255, 0.2); border-radius: 5px; background: var(--bg-tertiary); color: var(--text-secondary); font-family: 'DM Sans', sans-serif; font-size: 0.72rem; font-weight: 500; cursor: pointer; transition: all 0.2s; -webkit-backdrop-filter: blur(8px); touch-action: manipulation; }
        .tab-btn.active { background: var(--gta6-cyan); color: #111827; border-color: var(--gta6-purple); box-shadow: 0 0 16px var(--gta6-purple-glow), inset 0 1px 0 rgba(255,255,255,0.15); }
        .time-slider { width: 100%; margin: 0.4rem 0; }
        .time-slider input { width: 100%; accent-color: var(--gta6-cyan); }
        .time-label { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-secondary); display: flex; justify-content: space-between; }
        .overlay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; }
        .map-layer-note { font-family: 'DM Sans', sans-serif; font-size: 0.68rem; line-height: 1.4; color: var(--text-muted); margin: 0 0 0.4rem; }
        .overlay-item { display: flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0; }
        .overlay-item label { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-secondary); cursor: pointer; }
        .overlay-item input { accent-color: var(--gta6-cyan); width: 13px; height: 13px; }
        .overlay-item input:disabled + label { opacity: 0.5; cursor: not-allowed; }
        .mission-card { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.5rem; margin-bottom: 0.3rem; }
        .mission-card .mission-title { font-family: 'Oswald', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
        .mission-card .mission-type { display: inline-block; font-family: 'DM Sans', sans-serif; font-size: 0.6rem; padding: 1px 5px; border-radius: 8px; background: var(--bg-primary); color: var(--gta6-purple); margin-left: 0.3rem; }
        .mission-card .mission-desc { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
        .mission-card .mission-reward { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--gta6-orange); margin-top: 0.15rem; }
        .skill-tree { display: flex; flex-direction: column; gap: 0.3rem; }
        .skill-row { display: flex; align-items: center; gap: 0.3rem; }
        .skill-name { font-family: 'DM Sans', sans-serif; font-size: 0.72rem; color: var(--text-secondary); width: 70px; }
        .skill-bar { flex: 1; height: 6px; background: var(--bg-primary); border-radius: 3px; overflow: hidden; }
        .skill-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gta6-cyan), var(--gta6-orange)); border-radius: 3px; }
        .skill-level { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--gta6-cyan); width: 25px; text-align: right; }
        .community-item { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.5rem; margin-bottom: 0.3rem; }
        .community-item .community-title { font-family: 'Oswald', sans-serif; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
        .community-item .community-meta { font-family: 'DM Sans', sans-serif; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.1rem; }
        .community-item .community-rep { display: inline-block; font-family: 'DM Sans', sans-serif; font-size: 0.6rem; padding: 1px 5px; border-radius: 8px; background: var(--bg-primary); color: var(--gta6-purple); margin-top: 0.2rem; }
        .money-route { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.5rem; margin-bottom: 0.3rem; }
        .money-route .route-name { font-family: 'Oswald', sans-serif; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
        .money-route .route-detail { font-family: 'DM Sans', sans-serif; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.1rem; }
        .money-route .route-profit { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--gta6-orange); margin-top: 0.1rem; }
        .stock-item { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px solid var(--border-subtle); font-family: 'DM Sans', sans-serif; font-size: 0.78rem; }
        .stock-item .stock-name { color: var(--text-primary); }
        .stock-item .stock-price { color: var(--gta6-cyan); font-family: 'JetBrains Mono', monospace; }
        .stock-item .stock-change { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; }
        .stock-item .stock-change.up { color: #00FFAA; }
        .stock-item .stock-change.down { color: #FF4D8A; }

/* LIGHT MODE contrast fixes (map) */
html[data-theme="light"] .map-header { background: rgba(255,255,255,.96); }
html[data-theme="light"] .map-status { background: rgba(255,255,255,.96); }
html[data-theme="light"] .map-attribution { background: rgba(255,255,255,.9); }
html[data-theme="light"] .panel-card h3, html[data-theme="light"] .calc-result, html[data-theme="light"] .stat-box .stat-value,
html[data-theme="light"] .build-stat, html[data-theme="light"] .build-stat span:last-child, html[data-theme="light"] .skill-level, html[data-theme="light"] .stock-price { color: #0077B6; }
html[data-theme="light"] .map-type-btn.active { color: #111827; }
html[data-theme="light"] .event-timer, html[data-theme="light"] .mission-reward, html[data-theme="light"] .route-profit, html[data-theme="light"] .map-attribution a { color: #C2410C; }
html[data-theme="light"] .event-type, html[data-theme="light"] .mission-type, html[data-theme="light"] .community-rep { color: #7E22CE; }
html[data-theme="light"] .stock-change.up { color: #047857; }
html[data-theme="light"] .stock-change.down { color: #9D174D; }
html[data-theme="light"] .mobile-tab.active, html[data-theme="light"] .back-link:hover { color: #0077B6; }

/* LIGHT MODE (map, continued): chips/panels/markers lacking overrides above.
   Existing block covers header/status/attribution + text accents; this covers
   the remaining hardcoded-dark surfaces. Marker glyphs sit on the satellite
   photo (unchanged in light), so their white on-photo treatment is kept. */
html[data-theme="light"] .map-viewport { background: #E8EEF2; }
html[data-theme="light"] .filter-chip { border-color: rgba(0,119,182,.45); }
html[data-theme="light"] .filter-chip:hover { border-color: #0077B6; }
html[data-theme="light"] .filter-chip.active { color: #111827; }
html[data-theme="light"] .filter-action-btn { border-color: rgba(126,34,206,.35); }
html[data-theme="light"] .preset-btn { border-color: rgba(194,65,12,.35); }
html[data-theme="light"] .preset-btn:hover { border-color: #C2410C; }
html[data-theme="light"] .theme-btn, html[data-theme="light"] .tab-btn { border-color: rgba(126,34,206,.35); }
html[data-theme="light"] .map-btn { border-color: rgba(0,119,182,.45); }
html[data-theme="light"] .map-btn:hover { border-color: #0077B6; }
html[data-theme="light"] .poi-panel, html[data-theme="light"] .ctx-menu,
html[data-theme="light"] .search-suggestions { background: rgba(255,255,255,.96); }
html[data-theme="light"] .poi-panel .poi-actions button { border-color: rgba(0,119,182,.35); }
html[data-theme="light"] .map-marker.selected { box-shadow: 0 0 0 3px rgba(0,0,0,.35), 0 4px 20px rgba(0,0,0,.5); }
html[data-theme="light"] .map-label { color: rgba(0,0,0,.10); }

/* Mobile (iOS Safari/Android): 44px tap targets, 16px inputs (prevents auto-zoom), cheaper blur.
   Inputs <16px trigger iOS focus auto-zoom; never disable zoom via maximum-scale (a11y). */
@media (pointer: coarse) {
    .map-btn { width: 44px; height: 44px; min-width: 44px; }
    .map-marker { width: 44px; height: 44px; }
    .filter-chip, .tab-btn, .preset-btn, .filter-action-btn, .theme-btn, .map-type-btn, #resetView, .poi-panel .poi-actions button { min-height: 44px; }
    .overlay-item input, .layer-toggle input { width: 20px; height: 20px; }
    .search-bar input, .calc-input, .progress-input { font-size: 16px; min-height: 44px; }
    .map-header { -webkit-backdrop-filter: blur(12px); }
}

        /* Small screens: stack hub (320px viewports clip the 3-column grid).
           vh row first so Safari <15.4 (no dvh) keeps the stacked layout instead
           of dropping the whole declaration back to the 3-column grid. */
        @media (max-width: 768px) {
            .map-hub { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px 55vh auto auto; grid-template-rows: 56px 55dvh auto auto; grid-template-areas: "header" "map" "sidebar-left" "sidebar-right"; overflow-y: auto; }
            .map-viewport { min-height: 300px; }
            .sidebar-left, .sidebar-right { max-height: none; overflow: visible; }
            /* One-handed: zoom in the bottom-right thumb zone (was top-right,
               and off-screen entirely when the header blew the grid out to 496px) */
            .map-controls { top: auto; bottom: 3.4rem; right: 0.6rem; }
            /* Header controls (layer/reset/theme) overflow 390px — let them
               shrink-scroll instead of clipping off-screen */
            .map-header { min-width: 0; overflow: hidden; }
            .map-header .header-center { min-width: 0; flex-shrink: 1; }
            .map-header .header-right { min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
            .map-header .header-right::-webkit-scrollbar { display: none; }
            /* Global fixed mode toggle (top:16px, tokens.css) overlaps the
               header-right cluster at 390/320px — drop it below the 56px
               header row, over free map space (controls sit bottom-right). */
            .mode-toggle--fixed { top: calc(56px + env(safe-area-inset-top, 0px) + 0.5rem); }
        }

        /* At 320px the title + badge (center) crowd the layer cluster and
           the badge overflows onto the first layer button — keep the POI
           badge, drop the title text (the page <title> carries it). The
           center item must not shrink below the badge width (overflow would
           paint over the first layer button). */
        @media (max-width: 480px) {
            .map-header .header-center strong { display: none; }
            .map-header .header-center { flex-shrink: 0; min-width: 0; }
        }


/* Intro block at the top of the left sidebar: gives /map.html real, crawlable
   editorial copy (the page was 67 words with no <h1>, which reads as thin
   content to search and review teams). */
.sidebar-left .map-intro-title {
    /* base.css has `h1:not(.hero-title)` (0,1,1) setting --type-h1; a bare class
       loses to it, so the sidebar context is required to size this h1 as a panel title. */
    font-family: var(--font-subheadline, inherit);
    font-size: 0.95rem;
    line-height: 1.3;
    margin: 0 0 0.5rem;
    color: var(--text-primary, inherit);
}

.sidebar-left .map-intro-copy {
    font-size: 0.74rem;
    line-height: 1.55;
    margin: 0 0 0.55rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.72));
}

.sidebar-left .map-intro-copy:last-child { margin-bottom: 0; }

.sidebar-left .map-panel-title {
    font-size: 0.8rem;
    margin: 0 0 0.45rem;
    font-family: var(--font-subheadline, inherit);
}


/* Context image in the map intro panel — the page had no imagery at all. */
.sidebar-left .map-intro-figure {
    margin: 0.7rem 0 0;
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.16));
    border-radius: 8px;
    overflow: hidden;
    background: #0b0b10;
}

.sidebar-left .map-intro-figure img {
    display: block;
    width: 100%;
    height: auto;
}

.sidebar-left .map-intro-figure figcaption {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.45rem 0.55rem 0.5rem;
    font-size: 0.68rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-left .map-intro-figure figcaption span {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
}


/* ============================================================================
   SCHEMATIC LEONIDA MAP (images/leonida-map.svg)
   Drawn for this site; no third-party tiles. The SVG is vector, so it stays
   sharp at every zoom level and costs one request.
   ========================================================================== */
.leonida-map {
    image-rendering: auto;
}

.leonida-map--dark {
    filter: saturate(0.55) brightness(0.72) contrast(1.12) hue-rotate(-8deg);
}

@media (prefers-reduced-motion: no-preference) {
    .leaflet-zoom-animated .leonida-map { transition: filter 0.25s ease; }
}


/* The plate only covers its own extent; anything beyond it is the container.
   Give the pane the same deep-water tone so out-of-bounds space reads as sea
   rather than as a grey void. */
.map-viewport,
#map {
    background: #0a1826;
}

html[data-theme="light"] .map-viewport,
html[data-theme="light"] #map {
    background: #0a1826;
}

/* Boot watchdog: shown when Leaflet never initialises (e.g. a stale cached
   module). Must be legible in both themes, so it uses the page text tokens. */
.map-boot-error {
  display: grid;
  gap: 0.75rem;
  align-content: center;
  justify-items: start;
  height: 100%;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  color: var(--text-primary, #fff);
  background: var(--surface-2, #111);
  text-align: left;
}
.map-boot-error h3 { margin: 0; font-size: 1.1rem; letter-spacing: 0.02em; }
.map-boot-error p { margin: 0; max-width: 46ch; font-size: 0.9rem; line-height: 1.5; opacity: 0.8; }
.map-boot-error__meta { font-family: ui-monospace, monospace; font-size: 0.78rem !important; opacity: 0.6 !important; }
.map-boot-error button {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.map-boot-error button:hover { background: rgba(255, 255, 255, 0.12); }

/* Cluster bubbles sit on the light atlas land, so they are dark with sand
   numerals — the default transparent icon left white circles over the sand. */
.marker-cluster { background: transparent !important; border: 0 !important; }
.cluster-icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #16323d, #08151d 78%);
  color: #f1e4c6;
  border: 2px solid rgba(212, 175, 55, 0.55);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font: 700 12.5px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: transform 120ms ease;
}
.marker-cluster:hover .cluster-icon { transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) { .marker-cluster:hover .cluster-icon { transform: none; } }

/* === CATEGORY COLOURS ===
   One hue per landmark category, shared by the map markers and the filter
   chips so the two always agree. Chosen dark enough to carry a white glyph on
   the sand plate, and separated in hue rather than lightness. */
.map-marker.district  { background: #6d28d9; }
.map-marker.landmark  { background: #c2410c; }
.map-marker.shopping  { background: #db2777; }
.map-marker.food      { background: #ea8c00; }
.map-marker.stay      { background: #0284c7; }
.map-marker.transport { background: #0d9488; }
.map-marker.leisure   { background: #9333ea; }
.map-marker.nature    { background: #15803d; }
.map-marker.civic     { background: #4338ca; }
.map-marker.business  { background: #be123c; }
.map-marker.industry  { background: #57534e; }
.map-marker.history   { background: #a16207; }

/* chips carry the same hue as a dot, so the filter reads without counting */
.filter-chip { position: relative; }
.filter-chip::before {
  content: "";
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.45em;
  border-radius: 50%;
  background: var(--chip-color, #7f8c94);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
  vertical-align: 0.02em;
}
.filter-chip[data-cat="district"]  { --chip-color: #6d28d9; }
.filter-chip[data-cat="landmark"]  { --chip-color: #c2410c; }
.filter-chip[data-cat="shopping"]  { --chip-color: #db2777; }
.filter-chip[data-cat="food"]      { --chip-color: #ea8c00; }
.filter-chip[data-cat="stay"]      { --chip-color: #0284c7; }
.filter-chip[data-cat="transport"] { --chip-color: #0d9488; }
.filter-chip[data-cat="leisure"]   { --chip-color: #9333ea; }
.filter-chip[data-cat="nature"]    { --chip-color: #15803d; }
.filter-chip[data-cat="civic"]     { --chip-color: #4338ca; }
.filter-chip[data-cat="business"]  { --chip-color: #be123c; }
.filter-chip[data-cat="industry"]  { --chip-color: #57534e; }
.filter-chip[data-cat="history"]   { --chip-color: #a16207; }

/* Long-form note under the map. The hub above is a 100dvh app surface, so this
   sits in normal flow beneath it — visible to readers and to crawlers. */
.map-about {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.25rem;
}
.map-about__inner { max-width: 68ch; margin: 0 auto; }
.map-about h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
  color: var(--text-primary);
}
.map-about h3 {
  font-size: 1.05rem;
  margin: 1.9rem 0 0.5rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.map-about p {
  margin: 0 0 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 0.98rem;
}
.map-about__lede { font-size: 1.08rem !important; color: var(--text-primary) !important; }
.map-about strong { color: var(--text-primary); font-weight: 600; }
.map-about__credit {
  margin-top: 1.75rem !important;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem !important;
  opacity: 0.75;
}
html[data-theme="light"] .map-about { background: #fff; }
