/* ===========================================
   EARTHS - Cinematic Map Visualization
   Dark Theme with Glow Effects
   =========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0f;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Hide Mapbox logo and attribution watermarks.
   We still pass attributionControl: false in map.js, but the logo control
   is always added — hide it and any attribution remnants via CSS. */
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
    display: none !important;
}

/* ===========================================
   Loading Screen
   =========================================== */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a15 0%, #1a1a2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 0.3em;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.loading-content p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
}

#loading-status {
    font-size: 12px;
    color: rgba(0, 255, 255, 0.7);
    margin-top: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00ffff;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

/* ===========================================
   Map Container
   =========================================== */

#map {
    /* Now positioned by .main-viewport in layout.css */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ===========================================
   Labels Overlay Container
   =========================================== */

#labels-container {
    /* Now positioned by .main-viewport in layout.css */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    /* Containment hints: isolate layout/style recalculations to this
       subtree so label repositioning doesn't trigger full-page reflow */
    will-change: contents;
    contain: layout style;
}

/* ===========================================
   Vignette Overlay - Cinematic dark corners
   =========================================== */

#vignette-overlay {
    /* Now positioned by .main-viewport in layout.css */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    background: radial-gradient(circle at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.7) 100%);
    box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
}

/* =============================================
   Labels - Hard "sticker" look with Oswald font
   ============================================= */

:root {
    --label-font: 'Poppins', sans-serif;
    --label-weight: 300;
}

.map-label {
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--label-font);
    font-weight: var(--label-weight);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: pre-line;
    text-align: center;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, font-family 0.2s ease, font-weight 0.2s ease;
    z-index: 100;
    /* CSS variables for animatable properties */
    --glow-color: #00ffff;
    --glow-intensity: 1;
    /* The "Hard Cut" Shadow - No blur (0px) */
    text-shadow:
        2px 2px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    /* Apply glow with intensity */
    filter: drop-shadow(0 0 calc(8px * var(--glow-intensity)) var(--glow-color));
}

/* Region Label - Douglas County (cyan) */
.map-label.region-label {
    font-size: 24px;
    color: #ccffff;
}

/* City Label - Omaha (big white), Council Bluffs (cyan) */
.map-label.city-label {
    font-size: 42px;
    color: #ffffff;
}

/* Landmark Label - Small gray */
.map-label.landmark-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888888;
}

/* River/Water Label - Blue Italic */
.map-label.water-label {
    font-size: 12px;
    font-style: italic;
    text-transform: none;
    letter-spacing: 1px;
    color: #4488ff;
}

/* River Label - Yellow text with blue glow (for dashed rivers) */
.map-label.river-label {
    font-size: 13px;
    font-style: italic;
    text-transform: none;
    letter-spacing: 2px;
    color: #FFD700;
    text-shadow:
        0 0 8px #00FFFF,
        0 0 15px #00FFFF,
        2px 2px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000;
}

/* POI/Landmark Label - White, small, clear */
.map-label.poi-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow:
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        0 0 6px rgba(255,255,255,0.5);
}

/* ===========================================
   Control Panel (Left Side)
   =========================================== */

/* Control Panel - Now inside left-panel grid cell */
#control-panel {
    /* REMOVED: absolute positioning - now using CSS Grid layout */
    /* position: absolute; top: 20px; left: 20px; width: 300px; */
    width: 100%;
    height: 100%;
    background: transparent; /* Parent has background */
    border: none; /* Parent handles border */
    border-radius: 0;
    backdrop-filter: none;
    z-index: 1;
    overflow-y: auto;
    box-shadow: none; /* Parent has shadow */
}

#control-panel::-webkit-scrollbar {
    width: 6px;
}

#control-panel::-webkit-scrollbar-track {
    background: transparent;
}

#control-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.panel-section {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-section:last-child {
    border-bottom: none;
}

/* Collapsible Section Header */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: rgba(0, 0, 0, 0.15);
    transition: background 0.15s ease;
}

.section-header-row:hover {
    background: rgba(0, 0, 0, 0.25);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-collapse-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
    font-size: 10px;
}

.panel-section.collapsed .section-collapse-icon {
    transform: rotate(-90deg);
}

.panel-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.section-badge {
    font-size: 9px;
    padding: 2px 6px;
    background: rgba(0, 255, 255, 0.15);
    color: #00ffff;
    border-radius: 10px;
    font-weight: 500;
}

/* Section Content */
.section-content {
    padding: 14px 16px;
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.panel-section.collapsed .section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* Preset Grid */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.preset-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
    color: #00ffff;
}

.preset-btn:active {
    transform: scale(0.97);
}

/* Layer List Items */
#regions-list,
#paths-list,
#markers-list,
#labels-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.layer-item.selected {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
}

.layer-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.layer-item-name {
    flex: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.layer-item:hover .layer-item-actions {
    opacity: 1;
}

.layer-item-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layer-item-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.layer-item-btn.danger:hover {
    background: rgba(255, 85, 85, 0.3);
    color: #ff5555;
}

/* Empty state */
.layer-empty {
    padding: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    font-style: italic;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 10px 12px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.search-box input:focus {
    border-color: #00ffff;
    background: rgba(255, 255, 255, 0.12);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.search-box button {
    background: linear-gradient(135deg, #00cccc, #0088aa);
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.search-box button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 204, 204, 0.4);
}

/* Search Results */
#search-results {
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.search-result-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}

.search-result-item:hover {
    background: rgba(0, 255, 255, 0.15);
}

/* hq765: Approximate result badge (Mapbox-geocoded synthesized polygon) */
.search-result-item.approximate {
    border-left: 3px solid #ff9530;
    padding-left: 9px;
}
.result-approx-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #ff9530;
    background: rgba(255, 149, 48, 0.15);
    border: 1px solid rgba(255, 149, 48, 0.4);
    border-radius: 3px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* hq765: Region Library panel */
.library-empty {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px;
    text-align: center;
    line-height: 1.5;
    font-style: italic;
}
#region-library-list .library-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    font-size: 12px;
    transition: background 0.15s;
}
#region-library-list .library-item:hover {
    background: rgba(0, 255, 255, 0.08);
    border-color: rgba(0, 255, 255, 0.25);
}
.library-item-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.library-item-name {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.library-item-meta {
    margin-top: 2px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
}
.library-source {
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    color: rgba(0, 255, 255, 0.75);
}
.library-source-mapbox  { color: #ff9530; }
.library-source-manual  { color: #88ddff; }
.library-source-ai      { color: #c990ff; }
.library-approx {
    color: #ff9530;
    font-weight: 700;
    margin-left: 4px;
}
.library-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.library-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}
.library-btn:hover {
    background: rgba(0, 255, 255, 0.18);
    border-color: rgba(0, 255, 255, 0.4);
    color: #fff;
}
.library-load {
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.35);
    color: #aaf;
    font-weight: 600;
}
.library-mini-btn {
    font-size: 11px !important;
    padding: 6px 10px !important;
    flex: 1;
}

.search-result-item .result-name {
    font-weight: 500;
    color: #fff;
}

.search-result-item .result-type {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

/* ====================================================================
   Inline search progress row
   Shown inside #search-results while searchLocation is cascading
   through the Nominatim -> Overpass -> AI tiers. Left border color
   reflects which tier is currently running.
   ==================================================================== */
.search-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #00ffff;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    transition: border-left-color 0.2s;
}
.search-progress[data-tier="nominatim"] { border-left-color: #00bfff; }
.search-progress[data-tier="overpass"]  { border-left-color: #b265ff; }
.search-progress[data-tier="ai"]        { border-left-color: #ffcc00; }

.search-progress-dots {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}
.search-progress-dots span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    animation: searchProgressDot 1.2s ease-in-out infinite;
}
.search-progress-dots span:nth-child(2) { animation-delay: 0.15s; }
.search-progress-dots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes searchProgressDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.35; }
    40%           { transform: scale(1.2); opacity: 1;    }
}

.search-progress-text {
    flex: 1;
    line-height: 1.35;
}

/* Regions List */
#regions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.region-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.region-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.region-item.selected {
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.region-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--region-glow, rgba(0, 255, 255, 0.5));
}

.region-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.region-delete {
    width: 20px;
    height: 20px;
    background: rgba(255, 100, 100, 0.2);
    border: none;
    border-radius: 4px;
    color: #ff6666;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.region-item:hover .region-delete {
    opacity: 1;
}

.region-delete:hover {
    background: rgba(255, 100, 100, 0.4);
}

.region-edit {
    width: 22px;
    height: 20px;
    background: rgba(0, 255, 255, 0.15);
    border: none;
    border-radius: 4px;
    color: #00ffff;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.region-item:hover .region-edit {
    opacity: 1;
}

.region-edit:hover {
    background: rgba(0, 255, 255, 0.35);
}

/* hq136: per-region "find neighborhoods inside" button — shown on hover
 * like edit/delete. Amber to read as a distinct "drill-in" action. */
.region-neighborhoods {
    width: 22px;
    height: 20px;
    background: rgba(255, 191, 0, 0.16);
    border: none;
    border-radius: 4px;
    color: #ffcf4d;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.region-item:hover .region-neighborhoods {
    opacity: 1;
}

.region-neighborhoods:hover {
    background: rgba(255, 191, 0, 0.35);
}

/* hq136: Neighborhood finder panel — a scoped, ranked, searchable list of the
 * sub-areas inside a region. Floating panel anchored near the sidebar. */
.nbhd-panel {
    position: fixed;
    top: 90px;
    right: 24px;
    width: 300px;
    max-height: 70vh;
    display: none;
    flex-direction: column;
    background: rgba(20, 22, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    z-index: 4000;
    overflow: hidden;
    color: #e8e8ef;
}

.nbhd-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nbhd-panel-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.nbhd-panel-close {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.nbhd-panel-close:hover {
    background: rgba(255, 100, 100, 0.3);
    color: #fff;
}

.nbhd-panel-search {
    margin: 10px 14px 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.nbhd-panel-search:focus {
    border-color: rgba(255, 191, 0, 0.5);
}

.nbhd-panel-status {
    padding: 2px 14px 8px;
    font-size: 11px;
    color: #9aa0ad;
    min-height: 14px;
}

.nbhd-panel-list {
    overflow-y: auto;
    padding: 0 8px 10px;
}

.nbhd-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.nbhd-row:hover {
    background: rgba(255, 191, 0, 0.12);
}

.nbhd-row-name {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nbhd-row-meta {
    font-size: 11px;
    color: #9aa0ad;
    flex-shrink: 0;
}

/* Outskirts (straddles the city boundary) — amber meta so it reads as a
 * boundary-edge neighborhood you can still add. */
.nbhd-row.outskirts .nbhd-row-meta {
    color: #ffcf4d;
}

/* Live-search results (from the same cascade as the add-region search) —
 * cyan meta + a thin left accent so they read as "found via search". */
.nbhd-row.from-search {
    box-shadow: inset 2px 0 0 rgba(0, 255, 255, 0.45);
}

.nbhd-row.from-search .nbhd-row-meta {
    color: #6fe3ff;
}

.nbhd-row.added {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.nbhd-row.added .nbhd-row-name::after {
    content: ' ✓';
    color: #66dd99;
}

.nbhd-row.loading .nbhd-row-meta::after {
    content: ' …';
}

.nbhd-empty {
    padding: 14px 12px;
    font-size: 12px;
    color: #9aa0ad;
    text-align: center;
}

/* Per-region water-mask toggle — shown on hover like edit/delete.
 * Clicking the droplet icon toggles whether the highlight subtracts water
 * (bays, oceans, rivers). Off by default. */
.region-water-mask {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    background: rgba(0, 170, 255, 0.12);
    transition: opacity 0.2s, background 0.2s;
    opacity: 0;
    position: relative;
    flex-shrink: 0;
}

.region-item:hover .region-water-mask {
    opacity: 1;
}

/* Keep the droplet visible when the mask is ON, even without hover,
 * so the user can see which regions currently have land-only highlights. */
.region-water-mask:has(.region-water-mask-cb:checked) {
    opacity: 1;
}

.region-water-mask:hover {
    background: rgba(0, 170, 255, 0.28);
}

.region-water-mask-cb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.region-water-mask-icon {
    font-size: 12px;
    line-height: 1;
    color: #7fd8ff;
    filter: grayscale(1) opacity(0.55);
    pointer-events: none;
    transition: filter 0.15s, color 0.15s, text-shadow 0.15s;
}

/* Checked state — water mask is ACTIVE for this region. Brighten the
 * droplet and add a subtle glow so users can see the state at a glance. */
.region-water-mask-cb:checked + .region-water-mask-icon {
    filter: none;
    color: #00bfff;
    text-shadow: 0 0 6px rgba(0, 170, 255, 0.75);
}

.region-water-mask-cb:checked ~ .region-water-mask-icon,
.region-water-mask:has(.region-water-mask-cb:checked) {
    background: rgba(0, 170, 255, 0.25);
}

/* Style Controls */
.style-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.style-row:last-child {
    margin-bottom: 0;
}

.style-row label {
    width: 100px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.style-row input[type="color"] {
    width: 36px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.style-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

.style-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.style-row span {
    width: 40px;
    text-align: right;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.style-row select {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* Action Buttons */
.action-btn {
    background: linear-gradient(135deg, #00cccc, #0088aa);
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    width: 100%;
    margin-top: 8px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 204, 204, 0.4);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    transform: none;
}

/* ===========================================
   Timeline Panel (Bottom)
   =========================================== */

/* Timeline Panel - Now in grid row 2, spans full width */
#timeline-panel {
    /* REMOVED: absolute positioning - now using CSS Grid layout */
    /* position: absolute; bottom: 20px; left: 340px; right: 20px; */
    background: transparent; /* Parent .timeline-panel has background */
    border: none; /* Parent handles border */
    border-radius: 0;
    backdrop-filter: none;
    z-index: 1;
    padding: 0; /* Padding now on .timeline-panel-content */
    box-shadow: none; /* Parent has shadow */
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
}

.icon-btn.active {
    background: #00cccc;
}

#time-display {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    font-variant-numeric: tabular-nums;
    min-width: 100px;
}

.timeline-spacer {
    flex: 1;
}

.timeline-controls .action-btn {
    width: auto;
    margin-top: 0;
}

/* Timeline Quick Actions Bar */
.timeline-quick-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.quick-action-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.animation-combo-buttons {
    display: flex;
    gap: 6px;
}

.combo-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.combo-btn:hover {
    background: rgba(0, 204, 204, 0.15);
    border-color: rgba(0, 204, 204, 0.4);
    transform: translateY(-1px);
}

.combo-btn:active {
    transform: translateY(0);
}

.combo-btn .combo-icon {
    font-size: 16px;
    margin-bottom: 2px;
}

.combo-btn .combo-name {
    font-size: 10px;
    font-weight: 500;
}

.quick-action-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 8px;
}

/* Timeline Track */
.timeline-track {
    position: relative;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
}

#timeline-scrubber {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 204, 204, 0.3), rgba(0, 204, 204, 0.1));
    border-radius: 6px;
    width: 0%;
    pointer-events: none;
}

#keyframes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.keyframe {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #ffcc00;
    border: 2px solid #fff;
    border-radius: 2px;
    transform: translate(-50%, -50%) rotate(45deg);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

.keyframe:hover {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.2);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.8);
}

.keyframe.selected {
    background: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

#playhead {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: #00ffff;
    left: 0%;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    pointer-events: none;
}

#playhead::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -5px;
    width: 12px;
    height: 8px;
    background: #00ffff;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 2px;
}

/* ===========================================
   Modal
   =========================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(20, 20, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px 28px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #fff;
}

.export-options {
    margin-bottom: 20px;
}

/* Export Preset Buttons */
.export-presets {
    margin-bottom: 15px;
}

.export-presets .preset-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 10px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.export-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-preset-btn:hover {
    background: rgba(0, 204, 204, 0.15);
    border-color: rgba(0, 204, 204, 0.4);
    transform: translateY(-2px);
}

.export-preset-btn:active {
    transform: translateY(0);
}

.export-preset-btn .preset-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.export-preset-btn .preset-name {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.export-divider {
    display: flex;
    align-items: center;
    margin: 15px 0;
}

.export-divider::before,
.export-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.export-divider span {
    padding: 0 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.export-progress {
    margin-bottom: 20px;
}

.export-progress.hidden {
    display: none;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00cccc, #00ffff);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#progress-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.checkbox-row {
    display: flex;
    align-items: center;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
}

.checkbox-row input[type="checkbox"] {
    accent-color: #00cccc;
    width: 16px;
    height: 16px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-buttons .action-btn {
    width: auto;
    margin-top: 0;
}

/* Server status indicator */
.server-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.server-status-dot.online {
    background: #00ff88;
    box-shadow: 0 0 6px #00ff88;
}
.server-status-dot.offline {
    background: #ff4444;
    box-shadow: 0 0 6px #ff4444;
}

/* ===========================================
   Loading States
   =========================================== */

.loading {
    opacity: 0.5;
    pointer-events: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #00ffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================================
   Animations
   =========================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% {
        text-shadow:
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 20px var(--glow-color, #00ffff),
            0 0 30px var(--glow-color, #00ffff);
    }
    50% {
        text-shadow:
            0 0 10px #fff,
            0 0 20px #fff,
            0 0 40px var(--glow-color, #00ffff),
            0 0 60px var(--glow-color, #00ffff);
    }
}

.map-label.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Motion blur effect for labels during camera movement */
.map-label.motion-blur {
    filter: blur(3px);
    transition: filter 0.15s ease-out;
}

/* Smooth transform origin for GSAP scale animations */
.map-label {
    transform-origin: center center;
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Character animation for type-on effect */
.map-label .char {
    display: inline-block;
    will-change: transform, opacity;
}

/* Label float animation enhancement + GPU compositing hints */
.map-label {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Subtle glow animation for labels */
@keyframes labelGlowPulse {
    0%, 100% { filter: drop-shadow(0 0 8px var(--glow-color)); }
    50% { filter: drop-shadow(0 0 15px var(--glow-color)); }
}

/* Screen flash effect - vignette pulse */
#vignette-overlay {
    transition: opacity 0.15s ease-out;
}

/* Timeline progress indicator */
#timeline-scrubber {
    transition: width 0.05s linear;
}

/* Playhead glow when playing */
#playhead.playing {
    box-shadow: 0 0 15px rgba(0, 255, 255, 1), 0 0 25px rgba(0, 255, 255, 0.6);
}

/* Active keyframe pulse */
.keyframe.active {
    animation: keyframePulse 1s ease-in-out infinite;
}

@keyframes keyframePulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 204, 0, 0.9), 0 0 30px rgba(255, 204, 0, 0.5);
    }
}

/* Label float animation - uses CSS variables to preserve scale/rotation */
.map-label {
    --label-float-y: 0px;
}

.map-label.floating {
    animation: labelFloat 3s ease-in-out infinite;
}

/* Note: The floating animation now only affects the filter/opacity
   to avoid conflicting with JavaScript-controlled transforms */
@keyframes labelFloat {
    0%, 100% {
        filter: drop-shadow(0 0 calc(8px * var(--glow-intensity, 1)) var(--glow-color, #00ffff));
    }
    50% {
        filter: drop-shadow(0 0 calc(12px * var(--glow-intensity, 1)) var(--glow-color, #00ffff))
                drop-shadow(0 0 calc(20px * var(--glow-intensity, 1)) var(--glow-color, #00ffff));
    }
}

/* ===========================================
   Multi-Track Timeline
   =========================================== */

.timeline-tracks-container {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.2);
}

.timeline-tracks-container::-webkit-scrollbar {
    width: 6px;
}

.timeline-tracks-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.timeline-tracks {
    display: flex;
    flex-direction: column;
    min-height: 60px;
}

.timeline-track-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    height: 28px;
    min-height: 28px;
}

.timeline-track-row:last-child {
    border-bottom: none;
}

.timeline-track-row:hover {
    background: rgba(255,255,255,0.03);
}

.timeline-track-row.selected {
    background: rgba(0,255,255,0.1);
}

.track-label {
    width: 100px;
    min-width: 100px;
    padding: 0 8px;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.2);
}

.track-icon {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.track-icon.camera { background: #00ffff; }
.track-icon.region { background: #ff6666; }
.track-icon.river { background: #66ccff; }
.track-icon.landmark { background: #ffcc00; }
.track-icon.label { background: #ff66ff; }

.track-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-keyframes {
    flex: 1;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.track-keyframes:hover {
    background: rgba(255,255,255,0.02);
}

.track-keyframe {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    background: #ffcc00;
    border: 2px solid #fff;
    border-radius: 2px;
    transform: translate(-50%, -50%) rotate(45deg);
    cursor: grab;
    z-index: 10;
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

.track-keyframe:hover {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.3);
    box-shadow: 0 0 10px #ffcc00;
    background: #ffdd44;
}

.track-keyframe:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.2);
}

.track-keyframe.selected {
    background: #00ffff;
    box-shadow: 0 0 12px #00ffff;
    border-color: #fff;
}

.track-keyframe.selected:hover {
    background: #44ffff;
    box-shadow: 0 0 15px #00ffff;
}

/* Keyframe tooltip on hover */
.track-keyframe::after {
    content: attr(data-time);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) rotate(-45deg);
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    margin-bottom: 8px;
}

.track-keyframe:hover::after {
    opacity: 1;
}

/* Timeline empty state */
.timeline-tracks-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    color: rgba(255,255,255,0.3);
    font-size: 12px;
}

/* Scrubber track */
.timeline-scrubber-track {
    position: relative;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    overflow: visible;
}

/* Scrubber keyframe markers (After Effects style) */
.scrubber-keyframe {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: var(--kf-color, #00ffff);
    border: 1px solid rgba(255, 255, 255, 0.6);
    cursor: pointer;
    z-index: 5;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 0 4px var(--kf-color, #00ffff);
}

.scrubber-keyframe:hover {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.2);
    box-shadow: 0 0 8px var(--kf-color, #00ffff), 0 0 15px var(--kf-color, #00ffff);
    z-index: 10;
}

.scrubber-keyframe.selected {
    background: #fff;
    border-color: var(--kf-color, #00ffff);
    box-shadow: 0 0 10px var(--kf-color, #00ffff), 0 0 20px var(--kf-color, #00ffff);
    transform: translate(-50%, -50%) rotate(45deg) scale(1.3);
    z-index: 15;
}

/* Ensure scrubber bar and playhead are above keyframes */
#timeline-scrubber {
    z-index: 1;
}

#playhead {
    z-index: 20;
}

/* Small button variant */
.action-btn.small {
    padding: 6px 12px;
    font-size: 11px;
    width: auto;
    margin-top: 0;
}

/* Update timeline labels for 30s */
.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 2px;
}

/* ===========================================
   Keyframe Editor Panel
   =========================================== */

.editor-panel {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    max-height: 80vh;
    background: linear-gradient(180deg, rgba(15,15,25,0.98) 0%, rgba(10,10,18,0.98) 100%);
    border: 1px solid rgba(0,255,255,0.2);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px rgba(0,255,255,0.1);
    z-index: 1000;
    overflow: hidden;
    display: none;
}

.editor-panel.visible {
    display: block;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.editor-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #00ffff;
    margin: 0;
}

.editor-section {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.editor-section:last-child {
    border-bottom: none;
}

.editor-section > label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}

.editor-section select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.5);
}

/* Track Info */
.track-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.track-type-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.track-type-badge.camera { background: #00ffff; color: #000; }
.track-type-badge.region { background: #ff6666; color: #fff; }
.track-type-badge.river { background: #66ccff; color: #000; }
.track-type-badge.landmark { background: #ffcc00; color: #000; }
.track-type-badge.label { background: #ff66ff; color: #000; }

#editor-track-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.keyframe-count {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* Keyframe List */
.keyframe-list {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.keyframe-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.15s;
}

.keyframe-list-item:last-child {
    border-bottom: none;
}

.keyframe-list-item:hover {
    background: rgba(255,255,255,0.05);
}

.keyframe-list-item.selected {
    background: rgba(0,255,255,0.15);
    border-left: 3px solid #00ffff;
}

.kf-item-time {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.kf-item-easing {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
}

.kf-item-actions {
    display: flex;
    gap: 4px;
}

.kf-item-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.kf-item-btn:hover {
    background: rgba(255,255,255,0.2);
}

.kf-item-btn.delete:hover {
    background: rgba(255,100,100,0.3);
}

/* Property Groups */
.prop-group {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.prop-group-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0,255,255,0.7);
    margin-bottom: 10px;
}

.prop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.prop-row label {
    flex: 0 0 80px;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}

.prop-row input[type="number"],
.prop-row input[type="text"] {
    flex: 1;
    padding: 6px 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
}

.prop-row input[type="range"] {
    flex: 1;
}

.prop-row input[type="color"] {
    flex: 1;
    height: 28px;
    padding: 2px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    cursor: pointer;
}

.prop-row select {
    flex: 1;
    padding: 6px 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
}

.prop-row span {
    flex: 0 0 40px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-align: right;
}

.prop-row.actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

/* Action buttons */
.action-btn.tiny {
    padding: 4px 10px;
    font-size: 10px;
}

.action-btn.danger {
    background: rgba(255,100,100,0.2);
    color: #ff6666;
}

.action-btn.danger:hover {
    background: rgba(255,100,100,0.4);
}

.action-btn.secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.action-btn.secondary:hover {
    background: rgba(255,255,255,0.2);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Icon button variants */
.icon-btn.small {
    width: 24px;
    height: 24px;
    font-size: 14px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scrollbar styling for editor */
.keyframe-list::-webkit-scrollbar {
    width: 6px;
}

.keyframe-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.keyframe-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* ===========================================
   Responsive - Now handled by layout.css
   =========================================== */

/* REMOVED: Old absolute positioning responsive rules
   New CSS Grid responsive rules are in layout.css */

/* Keep component-level responsive adjustments */
@media (max-width: 900px) {
    .panel-section {
        padding: 12px 14px;
    }

    .timeline-controls {
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .zoom-controls {
        display: none;
    }

    .view-toggle {
        display: none;
    }

    .timeline-controls .action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* ===========================================
   Timeline v2 Styles
   =========================================== */

/* Track Controls */
.track-controls {
    display: flex;
    gap: 2px;
    margin-right: 6px;
    flex-shrink: 0;
}

.track-control-btn {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 3px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.track-control-btn:hover {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}

.track-control-btn.active {
    background: rgba(0,255,255,0.3);
    color: #00ffff;
}

.track-control-btn.muted {
    background: rgba(255,100,100,0.3);
    color: #ff6666;
}

.track-control-btn.visibility:not(.active) {
    color: rgba(255,255,255,0.3);
}

.track-control-btn.lock.active {
    background: rgba(255,200,100,0.3);
    color: #ffcc66;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 0 8px;
    border-left: 1px solid rgba(255,255,255,0.1);
}

#zoom-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
}

#zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 2px;
    margin-left: 8px;
    padding: 0 8px;
    border-left: 1px solid rgba(255,255,255,0.1);
}

.view-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.view-btn:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

.view-btn.active {
    background: rgba(0,255,255,0.2);
    border-color: rgba(0,255,255,0.4);
    color: #00ffff;
}

/* Selection Count */
.selection-count {
    font-size: 11px;
    color: rgba(0,255,255,0.8);
    margin-right: 8px;
    padding: 4px 8px;
    background: rgba(0,255,255,0.1);
    border-radius: 4px;
    border: 1px solid rgba(0,255,255,0.2);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.selection-count:not(:empty) {
    opacity: 1;
}

.selection-count .hint {
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    margin-left: 6px;
}

/* Delete selection button */
.delete-selection-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: rgba(255, 80, 80, 0.2);
    border: 1px solid rgba(255, 80, 80, 0.4);
    color: #ff8080;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    transition: all 0.2s ease;
    display: none;
}

.delete-selection-btn:hover {
    background: rgba(255, 80, 80, 0.3);
    border-color: rgba(255, 80, 80, 0.6);
}

.delete-selection-btn.visible {
    display: inline-block;
}

/* Work Area Bar */
.work-area-bar {
    position: absolute;
    top: 4px;
    height: 6px;
    background: rgba(0,255,255,0.3);
    border-radius: 3px;
    z-index: 50;
    cursor: move;
}

.work-area-handle {
    position: absolute;
    top: -2px;
    width: 8px;
    height: 10px;
    background: #00ffff;
    border-radius: 2px;
    cursor: ew-resize;
}

.work-area-handle.left {
    left: -4px;
}

.work-area-handle.right {
    right: -4px;
}

/* Graph Editor */
.graph-editor {
    background: rgba(10,10,20,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.graph-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.graph-toolbar label {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.graph-toolbar select {
    padding: 4px 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    margin: 0 5px;
}

.snap-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.snap-label input[type="checkbox"] {
    accent-color: #00cccc;
}

#graph-editor-canvas {
    width: 100%;
    height: 200px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    display: block;
}

/* Multi-select highlight */
.track-keyframe.in-selection {
    background: rgba(0,255,255,0.5) !important;
    box-shadow: 0 0 8px rgba(0,255,255,0.8) !important;
}

/* Selection box (drag to select) */
.selection-box {
    position: absolute;
    border: 1px dashed #00ffff;
    background: rgba(0,255,255,0.1);
    pointer-events: none;
    z-index: 100;
}

/* Locked track visual indicator */
.timeline-track-row.locked {
    opacity: 0.6;
}

.timeline-track-row.locked .track-keyframes {
    pointer-events: none;
}

/* Muted track visual indicator */
.timeline-track-row.muted .track-keyframes {
    opacity: 0.4;
}

/* Soloed track highlight */
.timeline-track-row.solo {
    background: rgba(0,255,255,0.05);
    border-left: 2px solid #00ffff;
}

/* Track label expanded for controls */
.track-label {
    width: 160px;
    min-width: 160px;
}

/* Small icon button variant */
.icon-btn.small {
    width: 24px;
    height: 24px;
    font-size: 12px;
}

/* Timeline panel position adjustment for work area */
/* REMOVED: position: relative override - now using CSS Grid layout */

.timeline-tracks-container {
    position: relative;
}

/* ===========================================
   Notification Toast System
   =========================================== */

.notification-container {
    position: fixed;
    bottom: 220px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.notification-toast {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: 10px 16px;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.notification-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-toast.success {
    border-color: rgba(0, 255, 100, 0.5);
}

.notification-toast.error {
    border-color: rgba(255, 100, 100, 0.5);
}

.notification-toast.warning {
    border-color: rgba(255, 200, 0, 0.5);
}

/* ===========================================
   Undo/Redo Button States
   =========================================== */

.action-btn.undo,
.action-btn.redo {
    width: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.undo:disabled,
.action-btn.redo:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===========================================
   History Panel (optional future feature)
   =========================================== */

.history-panel {
    position: fixed;
    right: 320px;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    max-height: 300px;
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    display: none;
}

.history-panel.visible {
    display: block;
}

.history-panel-header {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    max-height: 250px;
    overflow-y: auto;
}

.history-item {
    padding: 8px 12px;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item.current {
    background: rgba(0, 255, 255, 0.1);
    border-left: 2px solid #00ffff;
}

.history-item .timestamp {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* ===========================================
   Template Gallery Modal
   =========================================== */

.template-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-modal.active {
    opacity: 1;
}

.template-modal-content {
    background: #1a1a1f;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.template-modal.active .template-modal-content {
    transform: scale(1);
}

.template-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.template-modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.template-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.template-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.template-modal-tabs {
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.template-tab {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 12px 20px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.template-tab:hover {
    color: rgba(255, 255, 255, 0.8);
}

.template-tab.active {
    color: #00ffff;
    border-bottom-color: #00ffff;
}

.template-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.template-card {
    background: #252530;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    position: relative;
}

.template-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(0, 255, 255, 0.1);
}

.template-preview {
    height: 100px;
    background: linear-gradient(135deg, #1a1a25 0%, #252535 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-preview-icon {
    font-size: 32px;
    opacity: 0.5;
}

.template-info {
    padding: 12px;
}

.template-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.template-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.template-category {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    background: rgba(0, 255, 255, 0.15);
    color: #00cccc;
    font-size: 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.template-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 50, 50, 0.2);
    border: none;
    border-radius: 4px;
    color: #ff5555;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.template-card:hover .template-delete {
    opacity: 1;
}

.template-delete:hover {
    background: rgba(255, 50, 50, 0.4);
}

.template-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    line-height: 1.6;
}

/* Palette Cards */
.palette-card {
    padding: 12px;
}

.palette-swatches {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.palette-swatch {
    flex: 1;
    height: 40px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Template Buttons in Panel */
.template-btn-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.template-btn-row button {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-btn-row button:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
}

/* ===========================================
   Scrub Input
   =========================================== */

.scrub-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.scrub-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    cursor: ew-resize;
    user-select: none;
    transition: all 0.15s ease;
}

.scrub-label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
}

.scrub-label.scrubbing {
    background: rgba(0, 255, 255, 0.15);
    border-color: #00ffff;
    color: #00ffff;
}

.scrub-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 4px 8px;
    background: #1a1a1f;
    border: 1px solid #00ffff;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    text-align: center;
    outline: none;
}

.scrub-input::-webkit-inner-spin-button,
.scrub-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===========================================
   Context Menu (app-wide .ctx-menu)
   =========================================== */

.ctx-menu {
    position: fixed;
    z-index: 10000;
    min-width: 180px;
    max-width: 260px;
    background: rgba(18, 18, 24, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    padding: 4px 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    user-select: none;
}

.ctx-menu-item {
    display: flex;
    align-items: center;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.1s ease;
    white-space: nowrap;
}

.ctx-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ctx-menu-item.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.ctx-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 8px;
}

.ctx-menu-item .ctx-menu-label {
    flex: 1;
}

.ctx-menu-item .ctx-shortcut {
    margin-left: auto;
    padding-left: 24px;
    font-size: 11px;
    opacity: 0.4;
}

/* ===========================================
   Enhanced Sliders
   =========================================== */

.slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-value-label {
    min-width: 36px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #ffffff;
    font-size: 11px;
    text-align: center;
    cursor: pointer;
}

.slider-value-label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
}

.slider-value-input {
    width: 50px;
    padding: 2px 4px;
    background: #1a1a1f;
    border: 1px solid #00ffff;
    border-radius: 4px;
    color: #ffffff;
    font-size: 11px;
    text-align: center;
    outline: none;
}

/* Range slider enhancements */
input[type="range"].enhanced {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

input[type="range"].enhanced::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    transition: transform 0.15s ease;
}

input[type="range"].enhanced::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"].enhanced::-webkit-slider-thumb:active {
    transform: scale(1.1);
    background: #00cccc;
}

/* ===========================================
   Enhanced Color Picker
   =========================================== */

.color-picker-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.color-picker-toggle {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.color-picker-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
    color: #00ffff;
}

.color-picker-panel {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    padding: 12px;
    background: #1a1a1f;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
}

.color-picker-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.color-section {
    margin-bottom: 12px;
}

.color-section:last-child {
    margin-bottom: 0;
}

.color-section-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.color-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.color-empty {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    padding: 8px;
}

/* ===========================================
   Route Time Labels & Icons
   =========================================== */

.route-time-label {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: none;
    z-index: 100;
    text-align: center;
    padding: 8px 14px;
    background: rgba(10, 10, 20, 0.9);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 8px;
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 15px rgba(0, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-top: -10px;
}

.route-time-label.highlighted {
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.5),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    transform: translate(-50%, -100%) scale(1.1);
}

.route-time-main {
    font-size: 16px;
    font-weight: 600;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    line-height: 1.2;
}

.route-time-distance {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.route-icon {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 99;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

.route-icon svg {
    width: 32px;
    height: 32px;
}

/* ===========================================
   Travel Markers (Johnny Harris / Vox Style)
   =========================================== */

.route-travel-marker {
    position: absolute;
    pointer-events: none;
    z-index: 150;
    transition: opacity 0.3s ease;
}

.travel-marker-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: markerPulse 1.5s ease-in-out infinite;
}

.travel-marker-emoji {
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

.travel-marker-svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.travel-marker-svg svg {
    filter: drop-shadow(0 0 8px currentColor);
}

@keyframes markerPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
}

/* Route Logo */
.route-logo {
    position: absolute;
    pointer-events: none;
    z-index: 140;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.route-logo img {
    display: block;
    border-radius: 8px;
    background: rgba(10, 10, 20, 0.8);
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.route-logo.logo-animated {
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-5px);
    }
}

/* Enhanced Info Card (Professional Styling) */
.route-info-card {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: none;
    z-index: 100;
    text-align: center;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--route-color, #00ffff);
    border-radius: 10px;
    box-shadow:
        0 0 25px rgba(var(--route-color-rgb, 0, 255, 255), 0.3),
        inset 0 0 20px rgba(var(--route-color-rgb, 0, 255, 255), 0.05);
    backdrop-filter: blur(12px);
    margin-top: -15px;
}

.route-info-card .duration {
    font-family: 'Bebas Neue', 'Oswald', 'Impact', sans-serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--route-color, #00ffff);
    text-shadow: 0 0 15px var(--route-color, #00ffff);
    letter-spacing: 0.05em;
    line-height: 1;
}

.route-info-card .distance {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 4px;
}

.route-info-card .mode-icon {
    margin-top: 6px;
    font-size: 16px;
}

/* Route Style Preset Buttons */
.route-style-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.route-style-preset-btn {
    padding: 6px 12px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-style-preset-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.4);
    color: #00ffff;
}

.route-style-preset-btn.active {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ffff;
    color: #00ffff;
}

/* Marker Type Buttons */
.marker-type-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.marker-type-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.marker-type-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.4);
    transform: scale(1.05);
}

.marker-type-btn.active {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Trail Effect */
.route-trail {
    position: absolute;
    pointer-events: none;
    z-index: 145;
}

/* Custom Marker Upload */
.custom-marker-upload {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    text-align: center;
}

.custom-marker-upload.visible {
    display: block;
}

.custom-marker-upload input[type="file"] {
    width: 100%;
    padding: 8px;
    font-size: 11px;
}

.custom-marker-preview {
    margin-top: 8px;
    max-width: 60px;
    max-height: 60px;
    margin-left: auto;
    margin-right: auto;
}

.custom-marker-preview img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

/* Route Prompt Dialog */
.route-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.route-prompt-overlay.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.route-prompt-dialog {
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    max-width: 400px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

.route-prompt-icon {
    margin-bottom: 16px;
}

.route-prompt-dialog h3 {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
}

.route-prompt-dialog p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin-bottom: 24px;
}

.route-prompt-dialog p strong {
    color: #00ffff;
}

.route-prompt-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.route-prompt-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.route-prompt-btn.primary {
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: #ffffff;
    border-color: rgba(0, 255, 255, 0.3);
}

.route-prompt-btn.primary:hover {
    background: linear-gradient(135deg, #00c4e8 0%, #0087c6 100%);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    transform: translateY(-1px);
}

.route-prompt-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
}

.route-prompt-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Route Dialog Form */
.route-dialog-form {
    margin: 20px 0;
    text-align: left;
}

.route-dialog-form .form-group {
    margin-bottom: 16px;
}

.route-dialog-form label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.route-dialog-form select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.route-dialog-form select:hover,
.route-dialog-form select:focus {
    border-color: rgba(0, 255, 255, 0.4);
    outline: none;
}

.route-dialog-form select option {
    background: #1a1a2e;
    color: #ffffff;
}

/* Layer item with meta info */
.layer-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layer-item-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   Quick Animations / Preset Panel
   =========================================== */

.preset-category-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 6px;
}

.preset-tab {
    flex: 1;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-tab:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.preset-tab.active {
    background: rgba(0, 255, 255, 0.15);
    color: #00ffff;
}

/* Preset Grid */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
    padding: 2px;
}

.preset-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.preset-card.selected {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

.preset-card-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.preset-card-name {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-card-duration {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* Preset Options */
.preset-options {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.preset-options .style-row {
    margin-bottom: 6px;
}

.preset-options .style-row:last-child {
    margin-bottom: 0;
}

/* Apply Button Primary */
.action-btn.primary {
    background: linear-gradient(135deg, #00cccc 0%, #00aaaa 100%);
    color: #000;
    font-weight: 600;
    border: none;
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #00dddd 0%, #00bbbb 100%);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

/* Scene Preset List */
.scene-preset-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scene-preset-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.scene-preset-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 255, 255, 0.3);
    transform: translateX(4px);
}

.scene-preset-btn:active {
    transform: translateX(2px);
    background: rgba(0, 255, 255, 0.1);
}

.scene-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.scene-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.scene-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    display: block;
}

/* Animation for selected card */
@keyframes presetPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 255, 255, 0.15); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.3); }
}

.preset-card.selected {
    animation: presetPulse 2s ease-in-out infinite;
}

/* Scrollbar for preset grid */
.preset-grid::-webkit-scrollbar {
    width: 4px;
}

.preset-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.preset-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.3);
    border-radius: 2px;
}

.preset-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.5);
}

/* ===========================================
   Professional Typography System
   =========================================== */

/* Text Style Presets */
.map-label.label-cinematic {
    font-family: 'Bebas Neue', 'Oswald', sans-serif;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-shadow:
        0 0 5px #fff,
        0 0 10px var(--glow-color, #00ffff),
        0 0 20px var(--glow-color, #00ffff),
        0 0 40px var(--glow-color, #00ffff),
        3px 3px 0 #000;
}

.map-label.label-military-stencil {
    font-family: 'Black Ops One', 'Impact', sans-serif;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    text-shadow:
        2px 2px 0 #000,
        4px 4px 0 rgba(0, 0, 0, 0.3);
}

.map-label.label-news-ticker {
    font-family: 'Roboto Condensed', 'Arial Narrow', sans-serif;
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--glow-color, #00ffff);
    padding-bottom: 2px;
}

.map-label.label-coordinates {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: 12px !important;
    letter-spacing: 0.15em;
    color: rgba(0, 255, 255, 0.9) !important;
    text-shadow:
        0 0 5px var(--glow-color, #00ffff),
        1px 1px 0 #000;
}

.map-label.label-subtitle {
    font-family: 'Inter', 'Source Sans 3', sans-serif;
    font-weight: 400;
    letter-spacing: 0.1em;
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.8);
}

.map-label.label-callout {
    font-family: 'Rajdhani', 'Oswald', sans-serif;
    font-weight: 600;
    letter-spacing: 0.1em;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--glow-color, #00ffff);
}

.map-label.label-futuristic {
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-shadow:
        0 0 10px var(--glow-color, #00ffff),
        0 0 20px var(--glow-color, #00ffff),
        0 0 30px var(--glow-color, #00ffff);
}

.map-label.label-vintage {
    font-family: 'Oswald', 'Georgia', serif;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: #f5deb3 !important;
    text-shadow:
        2px 2px 0 #3a2a1a,
        3px 3px 4px rgba(0, 0, 0, 0.5);
}

/* Text Decoration Styles */
.map-label.decoration-underline::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 2px;
    background: var(--glow-color, #00ffff);
    box-shadow: 0 0 8px var(--glow-color, #00ffff);
}

.map-label.decoration-underline-dashed::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--glow-color, #00ffff) 0,
        var(--glow-color, #00ffff) 6px,
        transparent 6px,
        transparent 10px
    );
}

.map-label.decoration-box {
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 14px;
    border-radius: 4px;
}

.map-label.decoration-box-outline {
    background: transparent;
    padding: 6px 14px;
    border: 2px solid var(--glow-color, #00ffff);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--glow-color, #00ffff);
}

.map-label.decoration-bracket {
    padding: 8px 16px;
    position: relative;
}

.map-label.decoration-bracket::before,
.map-label.decoration-bracket::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--glow-color, #00ffff);
    border-style: solid;
}

.map-label.decoration-bracket::before {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
}

.map-label.decoration-bracket::after {
    bottom: 0;
    right: 0;
    border-width: 0 2px 2px 0;
}

/* Glow Style Variants */
.map-label.glow-neon {
    text-shadow:
        0 0 5px #fff,
        0 0 10px var(--glow-color, #00ffff),
        0 0 20px var(--glow-color, #00ffff),
        0 0 40px var(--glow-color, #00ffff);
    filter: drop-shadow(0 0 10px var(--glow-color, #00ffff));
}

.map-label.glow-soft {
    text-shadow:
        0 0 10px var(--glow-color, #00ffff),
        0 0 20px var(--glow-color, #00ffff);
    filter: drop-shadow(0 0 5px var(--glow-color, #00ffff));
}

.map-label.glow-hard-shadow {
    text-shadow:
        3px 3px 0 #000,
        4px 4px 2px rgba(0, 0, 0, 0.5);
    filter: none;
}

.map-label.glow-double-shadow {
    text-shadow:
        2px 2px 0 var(--glow-color, #00ffff),
        4px 4px 0 #000,
        5px 5px 5px rgba(0, 0, 0, 0.3);
    filter: none;
}

.map-label.glow-outline {
    -webkit-text-stroke: 1px var(--glow-color, #00ffff);
    text-shadow: none;
    filter: none;
}

.map-label.glow-none {
    text-shadow:
        1px 1px 0 #000,
        -1px -1px 0 #000;
    filter: none;
}

/* ===========================================
   Color Grading Presets (Applied to viewport)
   =========================================== */

/* hq86: softened from contrast(1.3) brightness(0.9) — the old values were
   tuned to compensate for the flat ungraded basemap; with the GL-side
   imagery grade now supplying baseline contrast/saturation, the heavy
   preset double-graded into mud. These rules bake into exports via the
   hq80 ctx.filter pass in js/export.js. */
.main-viewport.grading-cinematic-teal-orange #map canvas {
    filter: contrast(1.12) brightness(0.97) saturate(1.15) sepia(0.08) hue-rotate(-6deg);
}

.main-viewport.grading-military-green #map canvas {
    filter: contrast(1.2) brightness(0.8) saturate(0.8) hue-rotate(70deg);
}

.main-viewport.grading-blueprint #map canvas {
    filter: contrast(1.1) brightness(1.1) saturate(0.3) sepia(0.2) hue-rotate(180deg);
}

.main-viewport.grading-vintage-sepia #map canvas {
    filter: contrast(1.1) brightness(0.95) saturate(0.6) sepia(0.4);
}

.main-viewport.grading-high-contrast #map canvas {
    filter: contrast(1.5) brightness(0.85) saturate(1.3);
}

/* hq128: Cinematic LUT system. The active grade is now driven by
   js/color-grade-luts.js, which writes a single rule into a dedicated
   <style id="earths-grade-style"> element:
       .main-viewport.earths-grade-active #map canvas { filter: <look> }
   where <look> is either CSS filter functions or url(#earths-lut-active)
   (a generated SVG feColorMatrix + feComponentTransfer split-tone filter).
   The rules above are legacy presets, kept only for older saved projects;
   the picker no longer adds those classes. Imported .cube/.3dl LUTs render
   through the WebGL #lut-canvas overlay instead of a CSS filter. */

/* WebGL 3D-LUT preview overlay — sits just above the map canvas, below
   labels (z-index 2). JS sets size/visibility; this is a safety baseline. */
#lut-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* hq131: Frame FX — cinematic edge effects anchored to the EXPORT FRAME.
   JS (frame-fx.js) positions #frame-fx-overlay to the export-frame rect and
   sets the vignette gradient on it; the blur/chroma children are masked so
   they only act at the edges. z-index 6 keeps it above the map/labels/grain
   but below the export-frame UI (z-index 100). Hidden during export — the
   accurate bake runs as a canvas post-pass (FrameFX.applyToCanvas). */
#frame-fx-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 6;
    overflow: hidden;
}
.frame-fx-blur {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    -webkit-mask-image: radial-gradient(ellipse 78% 78% at 50% 50%, rgba(0,0,0,0) 52%, rgba(0,0,0,1) 100%);
            mask-image: radial-gradient(ellipse 78% 78% at 50% 50%, rgba(0,0,0,0) 52%, rgba(0,0,0,1) 100%);
}
.frame-fx-chroma {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    opacity: 0;
    mix-blend-mode: screen;
    background:
        radial-gradient(ellipse 80% 80% at 47% 47%, rgba(255,40,40,0) 60%, rgba(255,40,40,0.55) 100%),
        radial-gradient(ellipse 80% 80% at 53% 53%, rgba(40,210,255,0) 60%, rgba(40,210,255,0.55) 100%);
}

/* Dark-theme readability for the grouped LUT dropdown list. */
#fx-color-grading optgroup {
    background: #15171c;
    color: rgba(255, 255, 255, 0.55);
    font-style: normal;
    font-size: 11px;
}
#fx-color-grading option {
    background: #1c1f26;
    color: #fff;
}

/* ===========================================
   Marching Ants Animation for Borders
   =========================================== */

@keyframes marchingAnts {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 24; }
}

/* ===========================================
   Effects Overlay (Film Grain, Scanlines)
   =========================================== */

#effects-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

#effects-overlay.film-grain::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    animation: grain 0.5s steps(10) infinite;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}

#effects-overlay.scanlines::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
}

#effects-overlay.chromatic-aberration {
    /* Applied via JS with separate RGB layers */
}

/* ===========================================
   Input Label Style
   =========================================== */

.input-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

/* Film Grain Animation */
@keyframes filmGrain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(-10%, 5%); }
    30% { transform: translate(5%, -10%); }
    40% { transform: translate(-5%, 15%); }
    50% { transform: translate(-10%, 5%); }
    60% { transform: translate(15%, 0); }
    70% { transform: translate(0, 10%); }
    80% { transform: translate(-15%, 0); }
    90% { transform: translate(10%, 5%); }
}

#effects-overlay.film-grain::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)"/></svg>');
    opacity: var(--grain-intensity, 0.05);
    animation: filmGrain 0.5s steps(10) infinite;
    pointer-events: none;
}

/* =========================================
   SCENES SYSTEM STYLES
   ========================================= */

/* Scene List */
.scenes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.scene-list-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.scene-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 255, 255, 0.3);
}

.scene-list-item .scene-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
}

.scene-list-item .scene-info {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.scene-list-item .scene-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.scene-action-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.scene-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.scene-action-btn.play-btn:hover {
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
}

.scene-action-btn.delete-btn:hover {
    background: rgba(255, 68, 68, 0.3);
    border-color: #ff4444;
}

/* Scene Regions List */
.scene-regions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
    max-height: 200px;
    overflow-y: auto;
}

.scene-region-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scene-region-item .region-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.scene-region-item .region-name {
    flex: 1;
    font-size: 13px;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-region-item .region-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
}

.scene-region-item .remove-region-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    transition: color 0.2s;
}

.scene-region-item .remove-region-btn:hover {
    color: #ff4444;
}

/* Camera Preview */
.camera-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 12px;
}

/* Playback Controls */
.playback-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px 0;
}

.playback-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.playback-btn svg {
    width: 16px;
    height: 16px;
}

.playback-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.playback-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.playback-btn.primary {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    width: 50px;
    height: 50px;
}

.playback-btn.primary:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.4);
}

/* Progress Bar */
.progress-bar-container {
    padding: 0 12px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #00ff88);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.playback-time {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 8px 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Share Tech Mono', monospace;
}

/* Button Rows */
.button-row {
    display: flex;
    gap: 8px;
}

.action-btn.half {
    flex: 1;
}

.action-btn.full-width {
    width: 100%;
}

/* Divider */
.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

/* Section Close Button */
.section-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: color 0.2s;
}

.section-btn:hover {
    color: #ffffff;
}

/* Search Results for Scenes */
#scene-region-search-results .search-result-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin: 4px 0;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

#scene-region-search-results .search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

#scene-region-search-results .search-result-item.selected {
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.5);
    color: #ffffff;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00ffff;
}

/* =========================================
   ARROW LABEL STYLES
   ========================================= */

/* Arrow Label Text */
.map-label.arrow-label {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    text-shadow:
        0 0 10px var(--glow-color, #ffffff),
        0 0 20px var(--glow-color, #ffffff),
        2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Centroid Label (Inside Region) */
.map-label.centroid-label {
    font-family: 'Bebas Neue', 'Oswald', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow:
        0 0 8px var(--glow-color, #ffffff),
        0 0 16px var(--glow-color, #ffffff),
        2px 2px 4px rgba(0, 0, 0, 0.9);
}

/* Time Card Label (Route duration/distance badge) */
.map-label.time-card-label {
    background: rgba(34, 140, 50, 0.85);
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-transform: none;
    white-space: nowrap;
    box-shadow: 0 0 12px rgba(34, 200, 60, 0.4), 0 0 24px rgba(34, 200, 60, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-shadow:
        0 1px 3px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 0 8px rgba(34, 200, 60, 0.5));
}

/* SVG Arrow Container */
#labels-arrows-svg,
#scene-arrows-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: visible;
}

/* Arrow Glow Effect */
#labels-arrows-svg path,
#scene-arrows-svg path {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

/* Primary Action Button */
.action-btn.primary {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.3), rgba(0, 255, 255, 0.2));
    border-color: #00ff88;
    color: #00ff88;
    font-weight: 600;
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.5), rgba(0, 255, 255, 0.3));
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.action-btn.primary:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* ===========================================
   Interactive Map Editor
   =========================================== */

/* Editor Sections */
.editor-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.editor-section h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

/* Add Element Buttons */
.editor-add-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.editor-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-btn:hover {
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.4);
    color: #ffffff;
}

.editor-btn .btn-icon {
    font-size: 20px;
    color: #00ffff;
}

.editor-btn.full-width {
    grid-column: 1 / -1;
    flex-direction: row;
    padding: 10px 16px;
}

.editor-btn.danger {
    border-color: rgba(255, 85, 85, 0.3);
    color: #ff5555;
}

.editor-btn.danger:hover {
    background: rgba(255, 85, 85, 0.2);
    border-color: #ff5555;
}

/* Property Groups */
.property-group {
    margin-bottom: 12px;
}

.property-group label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.editor-input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.editor-input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.15);
}

.editor-textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
    font-family: inherit;
    line-height: 1.4;
}

.editor-select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
}

.editor-select:focus {
    outline: none;
    border-color: #00ffff;
}

.editor-select option {
    background: #1a1a1e;
    color: #ffffff;
}

.editor-color {
    width: 100%;
    height: 36px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
}

.editor-color::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.editor-color::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

/* Slider Row */
.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #00ffff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.slider-row input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.slider-row span {
    min-width: 45px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

/* Editor Actions */
.editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

/* Selection Box */
.editor-selection-box {
    position: absolute;
    border: 2px solid #00ffff;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1001;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

/* hq119: the map-label/shield scale box — distinct amber so it reads differently
   from the cyan element box. */
#map-label-scale-box {
    border-color: #ffcc33;
    box-shadow: 0 0 10px rgba(255, 204, 51, 0.45);
}
#map-label-scale-box .selection-handle {
    background: #ffcc33;
}

.editor-selection-box.hidden {
    display: none;
}

/* Selection Handles */
.selection-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #00ffff;
    border: 2px solid #ffffff;
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

.selection-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.selection-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.selection-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.selection-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.selection-handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.selection-handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.selection-handle.e { top: 50%; right: -5px; transform: translateY(-50%); cursor: e-resize; }
.selection-handle.w { top: 50%; left: -5px; transform: translateY(-50%); cursor: w-resize; }

/* Selected Label Style */
.map-label.selected {
    outline: 2px dashed rgba(0, 255, 255, 0.5);
    outline-offset: 4px;
    cursor: grab !important;
}

.map-label.selected:active {
    cursor: grabbing !important;
}

/* Custom Image Styles */
.custom-image {
    z-index: 1000;
}

.custom-image.selected {
    outline: 2px dashed rgba(0, 255, 255, 0.5);
    outline-offset: 4px;
}

.custom-image.selected:active {
    cursor: grabbing !important;
}

.custom-image img {
    pointer-events: none;
    user-select: none;
}

body.editor-mode .custom-image {
    pointer-events: auto;
    cursor: pointer;
}

body.editor-mode .custom-image:hover {
    outline: 1px dashed rgba(0, 255, 255, 0.3);
    outline-offset: 2px;
}

/* Editor Mode Body Class */
body.editor-mode .map-label {
    pointer-events: auto;
    cursor: pointer;
}

body.editor-mode .map-label:hover {
    outline: 1px dashed rgba(0, 255, 255, 0.3);
    outline-offset: 2px;
}

/* Crosshair cursor when adding elements */
body.editor-mode.add-mode {
    cursor: crosshair;
}

/* Editor Toggle Button */
.editor-toggle-btn {
    position: fixed;
    right: 20px;
    top: calc(var(--toolbar-height) + 20px);
    width: 44px;
    height: 44px;
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    color: #00ffff;
    font-size: 18px;
    cursor: pointer;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.editor-toggle-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.editor-toggle-btn.active {
    background: #00ffff;
    color: #0a0a0f;
}

/* Custom Arrow SVG Container */
#custom-arrows-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
    overflow: visible;
}

/* Add Mode Status */
.add-mode-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-top: 8px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 12px;
    color: #00ffff;
}

.cancel-add-btn {
    background: rgba(255, 85, 85, 0.2);
    border: 1px solid rgba(255, 85, 85, 0.4);
    color: #ff5555;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-add-btn:hover {
    background: rgba(255, 85, 85, 0.4);
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00ffff;
    cursor: pointer;
}

/* Motion Blur Toggle Button */
.motion-blur-toggle-btn {
    position: fixed;
    right: 20px;
    top: calc(var(--toolbar-height) + 80px);
    width: 44px;
    height: 44px;
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 50%;
    color: #8a2be2;
    font-size: 18px;
    cursor: pointer;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.motion-blur-toggle-btn:hover {
    background: rgba(138, 43, 226, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
}

.motion-blur-toggle-btn.active {
    background: #8a2be2;
    color: #ffffff;
    border-color: #8a2be2;
}

/* Motion Blur Overlay */
#motion-blur-overlay {
    pointer-events: none;
    z-index: 1;
}

/* ===========================================
   Export Frame Preview Overlay
   Shows the exact export bounds while editing
   =========================================== */

.export-frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.export-frame-overlay.hidden {
    display: none;
}

/* Mask areas (darkened outside export frame) */
.export-frame-mask {
    position: absolute;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(1px);
}

.export-frame-mask.top {
    top: 0;
    left: 0;
    right: 0;
    height: 0;
}

.export-frame-mask.bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
}

.export-frame-mask.left {
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
}

.export-frame-mask.right {
    top: 0;
    right: 0;
    bottom: 0;
    width: 0;
}

/* Export frame border */
.export-frame-border {
    position: absolute;
    border: 2px dashed rgba(255, 255, 255, 0.7);
    box-shadow:
        0 0 10px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 255, 255, 0.1);
    pointer-events: none;
}

/* Export frame label */
.export-frame-label {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #00ffff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* Export Frame Preview Toggle Button */
.export-frame-toggle-btn {
    position: fixed;
    right: calc(var(--right-panel-width, 300px) + 16px);
    top: calc(var(--toolbar-height, 48px) + 12px);
    width: 44px;
    height: 44px;
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid rgba(255, 165, 0, 0.5);
    border-radius: 50%;
    color: #ffa500;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.export-frame-toggle-btn:hover {
    background: rgba(255, 165, 0, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.3);
}

.export-frame-toggle-btn.active {
    background: #ffa500;
    color: #0a0a0f;
    border-color: #ffa500;
}

/* ============================================
   REDESIGN: Glassmorphism UI Components
   ============================================ */

/* --- Toggle Switch --- */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.toggle-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.toggle-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
    background: var(--accent-primary, #00ffff);
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.5);
}

/* --- Map Style Grid --- */
.map-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.map-style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 11px;
    font-family: inherit;
}

.map-style-btn svg {
    width: 24px;
    height: 24px;
}

.map-style-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.map-style-btn.active {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
    color: var(--accent-primary, #00ffff);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.1);
}

/* --- FX Slider Row --- */
.fx-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.fx-slider-row label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    min-width: 80px;
    flex-shrink: 0;
}

.fx-slider-row input[type="range"] {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.fx-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary, #00ffff);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.4);
    transition: box-shadow 0.2s ease;
}

.fx-slider-row input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.6);
}

.fx-slider-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary, #00ffff);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.4);
}

.fx-value {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    min-width: 30px;
    text-align: right;
    font-family: 'Share Tech Mono', monospace;
}

/* --- Road Label Importance Checkboxes --- */
.importance-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 8px;
    flex: 1;
}

.importance-checkboxes label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    margin: 0;
    min-width: 0;
    padding: 0;
}

.importance-checkboxes input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: var(--accent-primary, #00ffff);
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

/* --- Glass Select --- */
.glass-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.glass-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

.glass-select:focus {
    outline: none;
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.1);
}

.glass-select option {
    background: #1a1a2e;
    color: #fff;
}

/* --- Enhanced Section Headers --- */
.panel-section .section-header-row {
    border-bottom: 1px solid transparent;
    background-image: none;
    transition: background 0.15s ease;
}

.panel-section .section-header-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* --- Glass Buttons Enhancement --- */
.action-btn {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.1);
}

/* --- Scrollbar Styling for Glassmorphism --- */
.left-panel-content::-webkit-scrollbar {
    width: 4px;
}

.left-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.left-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.left-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* --- Enhanced Modal Glassmorphism --- */
.modal .modal-content {
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 255, 255, 0.05);
}

/* --- Keyframe Editor Panel Glassmorphism --- */
.editor-panel {
    background: rgba(15, 15, 20, 0.85) !important;
    backdrop-filter: blur(25px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(25px) saturate(1.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

/* ===========================================
   Right Panel Sections
   =========================================== */
.right-panel .panel-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.right-panel .panel-section:last-child {
    border-bottom: none;
}

.right-panel .panel-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.right-panel .property-group {
    margin-bottom: 10px;
}

.right-panel .property-group:last-child {
    margin-bottom: 0;
}

.right-panel .property-group label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.right-panel .slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.right-panel .slider-row input[type="range"] {
    flex: 1;
}

.right-panel .slider-row span {
    font-size: 11px;
    color: var(--accent-primary);
    min-width: 36px;
    text-align: right;
}

.right-panel .editor-color {
    width: 100%;
    height: 28px;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
}

.right-panel .editor-input,
.right-panel .editor-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 6px 8px;
    resize: vertical;
}

.right-panel .editor-input:focus,
.right-panel .editor-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.15);
}

.right-panel .editor-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 6px 8px;
    cursor: pointer;
}

.right-panel .editor-select option {
    background: #1a1a1e;
    color: #ffffff;
}

/* Add Elements buttons in right panel */
.right-panel .editor-add-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.right-panel .editor-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.right-panel .editor-btn:hover {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
    border-color: rgba(0, 255, 255, 0.3);
}

.right-panel .editor-btn .btn-icon {
    font-size: 18px;
}

.right-panel .editor-btn.full-width {
    flex-direction: row;
    justify-content: center;
    width: 100%;
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 11px;
}

.right-panel .editor-btn.danger {
    border-color: rgba(255, 85, 85, 0.3);
    color: var(--accent-danger);
}

.right-panel .editor-btn.danger:hover {
    background: rgba(255, 85, 85, 0.15);
}

.right-panel .editor-actions {
    display: flex;
    gap: 8px;
}

.right-panel .editor-actions .editor-btn {
    flex: 1;
    flex-direction: row;
    justify-content: center;
}

.right-panel .add-mode-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
    color: var(--accent-primary);
}

.right-panel .cancel-add-btn {
    background: rgba(255, 85, 85, 0.2);
    border: 1px solid rgba(255, 85, 85, 0.3);
    border-radius: 4px;
    color: var(--accent-danger);
    font-size: 10px;
    padding: 2px 8px;
    cursor: pointer;
}

.right-panel .checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.right-panel .checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-primary);
}

/* ===========================================
   Road Highlight System
   =========================================== */

/* Search row */
.road-search-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.road-search-row .glass-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 10px;
    color: #ffffff;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s ease;
}

.road-search-row .glass-input:focus {
    border-color: rgba(255, 215, 0, 0.5);
}

.road-search-row .glass-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.action-btn.small {
    padding: 6px 12px;
    font-size: 11px;
    min-width: auto;
}

/* Search result card */
#road-search-result {
    margin-bottom: 8px;
}

.road-search-found {
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.road-search-info {
    font-size: 12px;
    color: #ffffff;
}

.road-search-info strong {
    color: #ffd700;
}

.road-search-class {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    margin-left: 4px;
}

.road-search-highlight-btn {
    white-space: nowrap;
    background: rgba(255, 215, 0, 0.15) !important;
    border-color: rgba(255, 215, 0, 0.4) !important;
    color: #ffd700 !important;
}

.road-search-highlight-btn:hover {
    background: rgba(255, 215, 0, 0.25) !important;
}

.road-search-loading {
    padding: 8px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.road-search-error {
    padding: 8px;
    color: rgba(255, 150, 150, 0.8);
    font-size: 12px;
}

/* Road shield badges */
.road-shield-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7));
}

.road-shield-interstate {
    background: linear-gradient(180deg, #003da5 0%, #003da5 35%, #bf0a30 65%, #bf0a30 100%);
    color: #ffffff;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 10px 6px;
    border-radius: 4px;
    border: 2px solid #ffffff;
    min-width: 32px;
    text-align: center;
    line-height: 1.1;
    clip-path: polygon(50% 0%, 100% 20%, 100% 100%, 0% 100%, 0% 20%);
    padding-top: 8px;
}

.road-shield-us-highway {
    background: #ffffff;
    color: #000000;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 700;
    font-size: 13px;
    padding: 3px 8px;
    border: 2px solid #000000;
    border-radius: 50%;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.road-shield-generic {
    background: rgba(10, 10, 20, 0.9);
    color: #ffd700;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 600;
    font-size: 13px;
    padding: 4px 10px;
    border: 2px solid #ffd700;
    border-radius: 6px;
    text-align: center;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.road-shield-text {
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* Sprite-based shield with text overlay */
.road-shield-container img {
    display: block;
}

.road-shield-sprite-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-family: 'Inter', 'Arial Narrow', Arial, sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.3px;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
    padding-top: 1px;
}

/* Start point marker for road highlight mode */
.road-highlight-start-marker {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.road-highlight-start-marker .start-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffd700;
    border: 2px solid #ffffff;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 24px rgba(255, 215, 0, 0.4);
    animation: roadStartPulse 1.2s ease-in-out infinite;
}

@keyframes roadStartPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(255, 215, 0, 0.8); }
    50% { transform: scale(1.3); box-shadow: 0 0 20px rgba(255, 215, 0, 1); }
}

/* Radius slider row */
.road-radius-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.road-radius-row label {
    flex-shrink: 0;
    min-width: 40px;
}

.road-radius-row input[type="range"] {
    flex: 1;
}

.road-radius-row span {
    flex-shrink: 0;
    min-width: 36px;
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
}

/* Radius overlay on map */
#road-radius-overlay {
    position: absolute;
    border: 2px dashed rgba(255, 215, 0, 0.35);
    border-radius: 50%;
    background: radial-gradient(circle, transparent 95%, rgba(255, 215, 0, 0.06) 100%);
    pointer-events: none;
    z-index: 5;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

/* ===========================================
   Road List (Discovered Roads)
   =========================================== */

#road-list-container {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}

#road-list-container::-webkit-scrollbar {
    width: 4px;
}

#road-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 2px;
}

.road-list-header {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 0 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

.road-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.road-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.road-list-shield {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}

/* Mini shield badges for road list */
.mini-shield-interstate {
    background: linear-gradient(180deg, #003da5 0%, #003da5 40%, #bf0a30 60%, #bf0a30 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px 3px;
    border-radius: 2px;
    border: 1px solid #fff;
    clip-path: polygon(50% 0%, 100% 18%, 100% 100%, 0% 100%, 0% 18%);
    padding-top: 5px;
    line-height: 1;
    min-width: 22px;
    text-align: center;
}

.mini-shield-us-highway {
    background: #fff;
    color: #000;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border: 1.5px solid #000;
    border-radius: 50%;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mini-shield-generic {
    background: rgba(10, 10, 20, 0.85);
    color: #ffd700;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 5px;
    border: 1.5px solid #ffd700;
    border-radius: 3px;
    text-align: center;
    line-height: 1;
    min-width: 22px;
}

.road-list-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.road-list-class {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: capitalize;
    flex-shrink: 0;
}

.road-list-add {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    color: #ffd700;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.road-list-add:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.6);
    transform: scale(1.1);
}

.road-list-empty {
    padding: 12px 8px;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    font-style: italic;
}

/* ===========================================
   Road Highlight Editor (Right Panel)
   =========================================== */

#rp-road-highlight h3 {
    color: #ffd700;
    border-bottom-color: rgba(255, 215, 0, 0.2);
}

#rp-road-highlight .property-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

#rp-road-highlight .property-group label {
    flex-shrink: 0;
    min-width: 65px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

#rp-road-highlight .slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

#rp-road-highlight .slider-row input[type="range"] {
    flex: 1;
}

#rp-road-highlight .slider-row span {
    min-width: 36px;
    text-align: right;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

.prop-value-display {
    font-size: 12px;
    color: #ffd700;
    font-weight: 500;
}

#rp-road-highlight .editor-color {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

#rp-road-highlight .glass-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 4px 8px;
    color: #ffffff;
    font-size: 11px;
    outline: none;
    cursor: pointer;
}

#rp-road-highlight .glass-select:focus {
    border-color: rgba(255, 215, 0, 0.4);
}

#rp-road-highlight .glass-select option {
    background: #1a1a2e;
    color: #ffffff;
}

/* =============================================================================
   Stopwatch Auto-Keyframe Buttons
   After Effects-style icons next to every animatable control
   ============================================================================= */

.sw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0 4px 0 0;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: rgba(255, 255, 255, 0.25);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s ease, text-shadow 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    vertical-align: middle;
    line-height: 1;
    position: relative;
}

.sw-btn:hover {
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
}

.sw-btn.armed {
    color: #00e5ff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6), 0 0 16px rgba(0, 229, 255, 0.3);
}

.sw-btn.armed:hover {
    color: #40efff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.8), 0 0 20px rgba(0, 229, 255, 0.4);
}

/* Pulsing dot indicator when armed */
.sw-btn.armed::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00e5ff;
    animation: sw-pulse 2s ease-in-out infinite;
}

@keyframes sw-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

/* Layout adjustment: make fx-slider-row accommodate stopwatch */
.fx-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fx-slider-row .sw-btn {
    order: -1;  /* Place before label */
}

/* Stopwatch in region/route/label/path/marker editor rows */
.editor-row .sw-btn,
.prop-row .sw-btn,
.slider-row .sw-btn {
    margin-right: 4px;
}

/* Stopwatch in toggle-row (screen effects, etc.) — must stay OUTSIDE the
   .toggle-switch container so it doesn't overlap the slider and steal clicks. */
.toggle-row .sw-btn {
    order: -1;       /* Render visually first, before the label */
    margin-right: 6px;
    margin-left: -4px; /* Pull left so it aligns with the row edge */
}
.toggle-row .toggle-label {
    margin-right: auto; /* Push the .toggle-switch to the far right */
}

/* Sub-Highlight Compass Grid */
.sub-highlight-compass {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 6px;
}

.compass-btn {
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.2);
    color: #0ff;
    padding: 6px 2px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.compass-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #0ff;
}

.compass-btn:active {
    background: rgba(0, 255, 255, 0.35);
    transform: scale(0.95);
}

.sub-highlight-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* ========================================
   Top-bar search (Google Places autocomplete)
   ======================================== */

.top-bar-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 280px;
    max-width: 400px;
    height: 32px;
    padding: 0 10px;
    margin: 0 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 150ms ease, background 150ms ease;
}

.top-bar-search:focus-within {
    border-color: #00bcd4;
    background: rgba(0, 188, 212, 0.08);
}

.top-bar-search .search-icon {
    width: 14px;
    height: 14px;
    color: rgba(255, 255, 255, 0.55);
    flex-shrink: 0;
}

.top-bar-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
}

.top-bar-search input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.top-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(20, 25, 30, 0.95);
    border: 1px solid rgba(0, 188, 212, 0.25);
    border-radius: 6px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.top-search-dropdown .search-result {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 100ms ease;
}

.top-search-dropdown .search-result:last-child {
    border-bottom: none;
}

.top-search-dropdown .search-result:hover,
.top-search-dropdown .search-result.active {
    background: rgba(0, 188, 212, 0.15);
}

.top-search-dropdown .search-result-main {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

.top-search-dropdown .search-result-secondary {
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    margin-top: 2px;
}

.top-search-dropdown .search-empty,
.top-search-dropdown .search-error {
    padding: 12px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    text-align: center;
}

.top-search-dropdown .search-error {
    color: #ff6b6b;
}

/* ========================================
   Search result floating card on map
   ======================================== */

.search-floating-card {
    background: rgba(20, 25, 30, 0.96);
    border: 1px solid rgba(0, 188, 212, 0.35);
    border-radius: 8px;
    padding: 12px 14px;
    min-width: 220px;
    max-width: 300px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
}

.search-floating-card .card-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.search-floating-card .card-coords {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}

.search-floating-card .card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.search-floating-card .card-btn-primary {
    flex: 1;
    padding: 6px 10px;
    background: #00bcd4;
    color: #000;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 100ms ease;
}

.search-floating-card .card-btn-primary:hover {
    background: #00d4ee;
}

.search-floating-card .card-btn-close {
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-floating-card .card-btn-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ============================================================
   Map Layers — Basic / Advanced view toggle (Phase A)
   ============================================================ */
.map-layers-view-toggle {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    margin-bottom: 10px;
}
.view-toggle-btn {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover { color: rgba(255, 255, 255, 0.9); }
.view-toggle-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.map-layers-view { display: none; }
.map-layers-view.active { display: block; }

/* Basic view — categories grid + defaults row */
.basic-categories-header {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 6px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.basic-categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    margin-bottom: 12px;
}
.basic-cat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    padding: 4px 2px;
    cursor: pointer;
    user-select: none;
}
.basic-cat-chip input { margin: 0; cursor: pointer; }
.basic-defaults-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.basic-default-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.basic-default-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.basic-default-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
 * Export modal — Turbo-only, glassy (hq74)
 * ============================================================
 * Replaces the old multi-button export panel (Quick Presets + Local MP4 +
 * Turbo) with a single glassy panel locked to 4K UHD / 30 fps Turbo render.
 * Frosted background, subtle white border, soft shadow — matches the rest
 * of the editor's chrome.
 */
.export-modal-glass {
    background: rgba(20, 22, 28, 0.78);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    color: #f0f0f0;
    padding: 22px 22px 18px;
    min-width: 380px;
    max-width: 460px;
}
.export-title {
    margin: 0 0 16px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
    color: #fff;
}
.export-fixed-spec {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.export-spec-pill {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}
.export-spec-pill .spec-key {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
}
.export-spec-pill .spec-val {
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}
.export-debug-btn {
    margin-top: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.export-debug-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}
.turbo-render-btn {
    background: linear-gradient(135deg, #6b2fb5 0%, #4a1f8f 100%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(107, 47, 181, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.turbo-render-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(107, 47, 181, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
}

/* ============================================================
 * Per-category Mapbox label font dropdowns (hq74)
 * ============================================================
 * Six dropdowns in the World tab — Country / State / City / Road / Water /
 * Nature — each setting the text-font on its corresponding Mapbox symbol
 * layer group via setMapLabelFontForGroup. Styled to match the inline-styled
 * Master Font dropdown above them so the row visually flows.
 */
.map-label-font-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}
.map-label-font-select option {
    background: #1a1a1a;
    color: #fff;
}

/* ============================================================
 * Region Selection Box (hq74)
 * ============================================================
 * Screen-space dashed outline around the bbox of the currently-selected
 * region. Replaces the old hardcoded line-width swap (which clobbered the
 * user's stored borderWidth on every click). Mirrors the pattern used for
 * label selection (.editor-selection-box) but simpler — no resize handles,
 * since regions aren't resized by dragging.
 */
.region-selection-box {
    position: absolute;
    pointer-events: none;
    border: 1.5px dashed #00d4ff;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45) inset, 0 0 8px rgba(0, 212, 255, 0.35);
    z-index: 5;
    transition: opacity 0.12s ease;
}
.region-selection-box.hidden {
    display: none;
}

/* ============================================================
 * Region Blend Overlay (hq73)
 * ============================================================
 * One SVG element per region per kind (fill / stroke), each pinned over
 * the Mapbox WebGL canvas with `mix-blend-mode` set on the SVG element
 * itself (NOT on inner paths — see js/region-blend-overlay.js header for
 * why that distinction matters). JS sets the same positioning inline at
 * mount time; this rule is a safety net so the overlay sits in the right
 * place even if the inline style is stripped. pointer-events:none lets
 * all map clicks pass through to Mapbox underneath.
 */
.region-blend-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* hq75: drifting cloud overlay — slow horizontal pan, slight vertical breath */
#cloud-overlay-root {
    overflow: visible;
}
#cloud-overlay-root .cloud-group {
    animation: cloud-drift 90s linear infinite,
               cloud-breath 40s ease-in-out infinite alternate;
    transform-origin: center;
}
@keyframes cloud-drift {
    from { transform: translateX(-5%); }
    to   { transform: translateX(5%); }
}
@keyframes cloud-breath {
    from { transform: scale(1) translateY(0); }
    to   { transform: scale(1.04) translateY(2%); }
}

/* hq75: per-lightPreset color grade overlays. Applied to #map so the
 * basemap (and our overlays) all receive the same tonal treatment. */
/* hq75-fix12: per-preset CSS filter (subtle saturation/contrast adjustment).
 * The HEAVY lifting is done by #lightbox-tint below — a colored blend
 * overlay that genuinely tints the ground via mix-blend-mode. The filter
 * here just supplements with saturation/contrast tweaks. */
/* hq86: DISABLED — these rules were dead code. EffectsOverlay's
 * applyViewportFilter() writes an inline `filter` onto #map at startup
 * (wireInitialDefaults dispatches the fx sliders), and inline style beats
 * these selectors, so they never rendered. Per-preset tone now comes from
 * the GL-side fog + imagery grade in js/map.js (which also exports
 * correctly), so re-enabling these would double-grade.
body.dawn-grade #map  { filter: saturate(1.05) contrast(1.04); }
body.day-grade  #map  { filter: saturate(1.05) contrast(1.02); }
body.dusk-grade #map  { filter: saturate(1.20) contrast(1.06); }
body.night-grade #map { filter: saturate(0.85) contrast(1.20); }
*/

/* hq75-fix12: Blender-HDRI-style atmospheric tint overlay. A colored
 * div blends with the WebGL canvas using mix-blend-mode, so terrain,
 * buildings, water, and roads all look LIT by the preset's environment
 * (warm peach at dawn, neutral at day, saturated orange at dusk, deep
 * blue at night). Pointer-events:none so it doesn't block map clicks.
 * Updated by MapModule.applyLightPreset() — backgroundColor + opacity
 * are set inline per preset. */
#lightbox-tint {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3; /* above region-blend-svg, below editor chrome */
    mix-blend-mode: multiply;
    transition: background-color 0.6s ease, opacity 0.6s ease, mix-blend-mode 0.6s ease;
    background-color: transparent;
    opacity: 0;
    /* Reset the body.*-grade #map filter so it doesn't double-apply
     * to the tint overlay (the tint LIVES inside #map). */
    filter: none !important;
}

/* hq75: gentle radial vignette over the entire map. Soft enough to be
 * subliminal — not a visible black ring, just a 6-8% darkening at the
 * extreme edges. Applied via ::after pseudo-element so it sits above
 * the canvas but below the editor chrome. */
#map::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        rgba(0,0,0,0) 60%,
        rgba(0,0,0,0.18) 100%
    );
    z-index: 4; /* above region-blend-svg (no z-index), below editor UI */
}

/* hq75-fix4: When on Mapbox Standard family, hide ONLY the controls that
 * can't be made to work via Standard's hydrated layers — currently just
 * Theme & Palette (its presets hardcode v12-namespaced paint properties
 * that would silently fail or miscolor Standard layers).
 *
 * Master Opacity / Freeze Roads / Borders chip / density-borders are
 * KEPT visible: once categorizeLoadedLayers() populates layerRegistry
 * with Standard's hydrated layer IDs (via the backoff-retry loop in
 * MapLayersModule.init()), these controls work via direct setPaintProperty
 * / setFilter calls on Standard's classified layers. May lag a few
 * seconds while Standard's import hydrates. */
body.basemap-standard .panel-section[data-section="theme-palette"] {
    display: none !important;
}

/* hq88: while an export is running (export.js adds body.earths-exporting),
 * freeze every CSS transition inside the captured viewport AND on the
 * cloud overlay (it pins an inline `transition: opacity 0.6s ease`).
 * Per-frame keyframed opacities (clouds, region blends, HTML labels) were
 * being captured mid-ease, so exported fades lagged the timeline by up to
 * 600ms and adjacent frames never matched the keyframed values. */
body.earths-exporting .main-viewport,
body.earths-exporting .main-viewport *,
body.earths-exporting #cloud-overlay-root,
body.earths-exporting #cloud-overlay-root * {
    transition: none !important;
}

/* hq88: surface the Standard-only limitations note when Standard is the
 * active base (body class set at boot in map.js). */
body.basemap-standard .standard-base-note {
    display: block !important;
}

/* hq90: controls that only make sense on the Standard basemap (e.g. the
 * Custom Map Labels toggle). body.basemap-standard is set at boot in map.js. */
body.basemap-standard .standard-only-control {
    display: block !important;
}
