/* =============================================================================
   SYNTHWAVE SUNSET - pathfindr
   Inspired by: VHS warmth, sunset horizons, analog glow, 80s nostalgia
   ============================================================================= */

/* Google Fonts - Warm Retro Display */
@import url('https://fonts.googleapis.com/css2?family=Righteous&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* CSS Variables - Warm Synthwave Palette */
:root {
    /* Core Colors - Deep purple-navy with warmth */
    --void: #0d0a14;
    --abyss: #12101a;
    --deep: #1a1625;
    --surface: #221d2e;
    --elevated: #2a2438;

    /* Synthwave Accents - Warm neons */
    --neon-cyan: #41d9d9;
    --neon-pink: #ff6b9d;
    --neon-orange: #ff8c69;
    --neon-purple: #c678dd;
    --neon-green: #7dea7d;

    /* Sunset Gradient Colors */
    --sunset-hot: #ff6188;
    --sunset-warm: #fc9867;
    --sunset-gold: #ffd866;

    /* Semantic Colors */
    --start-color: #7dea7d;
    --end-color: #ff6b9d;
    --user-route: #ff8c69;
    --explored-color: #c678dd;
    --optimal-color: #41d9d9;

    /* Text - Warmer tones */
    --text-bright: #fef8f4;
    --text-primary: #d4cde0;
    --text-dim: #8a7fa0;
    --text-muted: #5a5170;

    /* Soft Glows - Diffused, warm bloom */
    --glow-cyan: 0 0 20px rgba(65, 217, 217, 0.35), 0 0 40px rgba(65, 217, 217, 0.15), 0 0 60px rgba(65, 217, 217, 0.08);
    --glow-pink: 0 0 20px rgba(255, 107, 157, 0.4), 0 0 40px rgba(255, 107, 157, 0.2), 0 0 60px rgba(255, 107, 157, 0.1);
    --glow-orange: 0 0 20px rgba(255, 140, 105, 0.4), 0 0 40px rgba(255, 140, 105, 0.2), 0 0 60px rgba(255, 140, 105, 0.1);

    /* Typography */
    --font-display: 'Righteous', cursive;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

    /* Spacing & Sizing - Slightly softer corners */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;

    /* Transitions - Slightly slower for smoothness */
    --transition-fast: 180ms ease-out;
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================================
   ATMOSPHERIC EFFECTS
   ============================================================================= */

/* Warm CRT glow with subtle flicker */
@keyframes warm-flicker {
    0%, 100% { opacity: 0.98; }
    25% { opacity: 1; }
    50% { opacity: 0.97; }
    75% { opacity: 0.99; }
}

/* Soft breathing glow - slower, more organic */
@keyframes pulse-glow {
    0%, 100% {
        filter: drop-shadow(0 0 4px currentColor) brightness(1);
        opacity: 0.9;
    }
    50% {
        filter: drop-shadow(0 0 12px currentColor) drop-shadow(0 0 24px currentColor) brightness(1.1);
        opacity: 1;
    }
}

/* Gentle marker pulse */
@keyframes marker-pulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1) saturate(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.15) saturate(1.1);
    }
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fade-in {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Sunset horizon pulse for ambient elements */
@keyframes sunset-pulse {
    0%, 100% {
        background-position: 0% 50%;
        filter: saturate(1) brightness(1);
    }
    50% {
        background-position: 100% 50%;
        filter: saturate(1.1) brightness(1.05);
    }
}


/* =============================================================================
   RESET & BASE
   ============================================================================= */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-mono);
    background: var(--void);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Subtle static grain overlay - no animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.018;
}

/* Warm vignette with purple/magenta tint at edges */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(
        ellipse 110% 110% at 50% 50%,
        transparent 0%,
        transparent 45%,
        rgba(30, 15, 40, 0.35) 70%,
        rgba(20, 10, 30, 0.6) 100%
    );
}

/* =============================================================================
   APP LAYOUT
   ============================================================================= */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* =============================================================================
   FLOATING GAMEPLAY HUD - Zen Cyberpunk Style
   ============================================================================= */

#gameplay-hud {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(18, 16, 26, 0.8);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 107, 157, 0.12);
    border-radius: 50px;
    padding: 0.5rem 0.5rem;
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.3),
        0 0 50px rgba(255, 107, 157, 0.04),
        0 0 80px rgba(65, 217, 217, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Soft warm glow underneath */
#gameplay-hud::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 15%;
    right: 15%;
    height: 24px;
    background: radial-gradient(ellipse, rgba(255, 107, 157, 0.12) 0%, rgba(65, 217, 217, 0.06) 50%, transparent 70%);
    filter: blur(12px);
    pointer-events: none;
}

.hud-section {
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.hud-brand {
    padding-left: 1.25rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--neon-pink), var(--sunset-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 12px rgba(255, 107, 157, 0.3));
}

.hud-stats {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Extra stats (distance, score) - hidden in visualizer/explorer mode */
.mode-visualizer .stat-extra,
.mode-explorer .stat-extra {
    display: none !important;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0.75rem;
    min-width: 70px;
}

.hud-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 0.15rem;
}

.hud-value {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
}

.hud-value.hud-score {
    color: var(--sunset-gold);
    text-shadow: 0 0 15px rgba(255, 216, 102, 0.4), 0 0 30px rgba(255, 216, 102, 0.2);
}

.hud-dim {
    color: var(--text-muted);
    font-weight: 400;
}

.hud-unit {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-left: 0.15rem;
    font-weight: 400;
}

.hud-divider {
    width: 1px;
    height: 24px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* Round Legend - shows completed rounds with colors */
.hud-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-title {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.legend-items {
    display: flex;
    gap: 0.35rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.4rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.legend-dot.solid {
    /* Solid = optimal path indicator */
}

.legend-dot.dashed {
    /* Could add a visual indicator for user path */
    border: 2px dashed currentColor;
    background: transparent;
    width: 6px;
    height: 6px;
}

.legend-score {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-primary);
    font-weight: 500;
}

.legend-round {
    font-size: 0.5rem;
    color: var(--text-dim);
    margin-right: 0.15rem;
}

.hud-controls {
    display: flex;
    gap: 0.25rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.25s ease-out;
}

.hud-btn:hover {
    background: rgba(255, 107, 157, 0.1);
    border-color: rgba(255, 107, 157, 0.25);
    color: var(--neon-pink);
    box-shadow: 0 0 16px rgba(255, 107, 157, 0.15);
}

.hud-btn:active {
    transform: scale(0.95);
}

.hud-btn svg {
    width: 16px;
    height: 16px;
}

.hud-btn.muted {
    color: var(--sunset-warm);
}

.hud-btn.muted:hover {
    background: rgba(252, 152, 103, 0.1);
    border-color: rgba(252, 152, 103, 0.25);
    box-shadow: 0 0 16px rgba(252, 152, 103, 0.15);
}

/* HUD Location Section */
.hud-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 220px;
    min-width: 0;
    overflow: hidden;
}

.location-icon {
    width: 14px;
    height: 14px;
    color: var(--neon-pink);
    flex-shrink: 0;
}

.hud-location #current-location {
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Location Display - Clickable to search */
.location-display {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    margin: -0.25rem -0.4rem;
    border-radius: 4px;
    transition: background 0.15s ease;
    min-width: 0;
    overflow: hidden;
}

.location-display:hover {
    background: rgba(255, 255, 255, 0.05);
}

.location-display:active {
    background: rgba(255, 255, 255, 0.08);
}

.search-icon {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    opacity: 0.5;
    flex-shrink: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.location-display:hover .search-icon {
    opacity: 1;
    color: var(--neon-cyan);
}

/* Inline Location Search */
.location-search-inline {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
}

.location-search-inline.hidden {
    display: none;
}

.inline-search-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 4px;
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    outline: none;
    min-width: 120px;
}

.inline-search-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.inline-search-input::placeholder {
    color: var(--text-muted);
}

.close-search-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.close-search-btn:hover {
    color: var(--neon-pink);
    background: rgba(255, 42, 109, 0.1);
}

.close-search-btn svg {
    width: 14px;
    height: 14px;
}

/* Inline search results dropdown */
.inline-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: rgba(15, 15, 25, 0.98);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.inline-search-results.hidden {
    display: none;
}

.inline-search-result {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.1s ease;
}

.inline-search-result:last-child {
    border-bottom: none;
}

.inline-search-result:hover {
    background: rgba(0, 240, 255, 0.1);
}

/* City indicator - overlays on round counter during continuous play */
.city-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    padding: 0.25rem 0.5rem;
    background: rgba(18, 16, 26, 0.95);
    border: 1px solid rgba(255, 42, 109, 0.5);
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    backdrop-filter: blur(4px);
}

@keyframes city-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* =============================================================================
   HUD MODE SYSTEM - Visualizer/Explorer Integration
   ============================================================================= */

/* Mode Section in HUD */
.hud-mode {
    padding: 0 0.5rem 0 0.75rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-mode.hidden {
    display: none;
}

/* Mode Badge - Electric Neon Style */
.mode-badge {
    position: relative;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    border-radius: 4px;
    overflow: hidden;
    animation: badge-breathe 3s ease-in-out infinite;
}

/* VISUALIZER Mode - Purple/Pink Gradient */
.mode-badge.visualizer {
    background: linear-gradient(135deg, #b829dd 0%, #ff2a6d 100%);
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    box-shadow:
        0 0 12px rgba(184, 41, 221, 0.5),
        0 0 24px rgba(255, 42, 109, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* EXPLORER Mode - Cyan/Teal Gradient */
.mode-badge.explorer {
    background: linear-gradient(135deg, #00f0ff 0%, #00d4aa 100%);
    color: #0a1a1a;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
    box-shadow:
        0 0 12px rgba(0, 240, 255, 0.5),
        0 0 24px rgba(0, 212, 170, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Scanline overlay effect */
.mode-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.05) 2px,
        rgba(0, 0, 0, 0.05) 4px
    );
    pointer-events: none;
}

/* Traveling light effect */
.mode-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    animation: badge-shine 4s ease-in-out infinite;
}

@keyframes badge-breathe {
    0%, 100% {
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
    50% {
        filter: brightness(1.1) saturate(1.15);
        transform: scale(1.02);
    }
}

@keyframes badge-shine {
    0%, 100% {
        left: -100%;
    }
    50% {
        left: 200%;
    }
}

/* Mode Stats Section */
.hud-mode-stats {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.hud-mode-stats.hidden {
    display: none;
}

/* Competitive controls hide in non-competitive modes */
.competitive-control.hidden {
    display: none;
}

/* Mode Exit Button */
.mode-exit-btn {
    width: auto !important;
    padding: 0 0.75rem !important;
    gap: 0.35rem;
    background: rgba(255, 42, 109, 0.1) !important;
    border: 1px solid rgba(255, 42, 109, 0.3) !important;
    color: var(--neon-pink) !important;
    font-family: var(--font-mono);
    border-radius: 20px !important;
}

.mode-exit-btn svg {
    width: 12px !important;
    height: 12px !important;
}

.mode-exit-btn .exit-text {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mode-exit-btn:hover {
    background: rgba(255, 42, 109, 0.2) !important;
    border-color: rgba(255, 42, 109, 0.5) !important;
    box-shadow:
        0 0 16px rgba(255, 42, 109, 0.3),
        0 0 32px rgba(255, 42, 109, 0.15) !important;
    transform: scale(1.05);
}

.mode-exit-btn.hidden {
    display: none !important;
}

/* =============================================================================
   MODE SELECTOR OVERLAY
   ============================================================================= */

.mode-select {
    max-width: 440px;
}

.mode-select h2 {
    color: #fff;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.mode-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Mode button base - warm frosted glass */
.mode-btn {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.12),
        0 1px 2px rgba(255, 255, 255, 0.06) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn .mode-bg {
    position: absolute;
    inset: 0;
    opacity: 0.4;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mode-btn .mode-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem;
}

.mode-btn:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.2),
        0 1px 3px rgba(255, 255, 255, 0.1) inset;
    border-color: rgba(255, 255, 255, 0.25);
}

.mode-btn:hover .mode-bg {
    opacity: 0.55;
    transform: scale(1.05);
}

.mode-btn:active {
    transform: translateY(-2px);
}

/* Mode icon - warm and soft */
.mode-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mode-icon svg {
    width: 26px;
    height: 26px;
    transition: transform 0.3s ease;
}

.mode-btn:hover .mode-icon {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mode-btn:hover .mode-icon svg {
    transform: scale(1.1);
}

.mode-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mode-desc {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    line-height: 1.4;
}

/* Classic mode - warm amber/gold sunrise */
.mode-btn.mode-classic {
    background: linear-gradient(145deg,
        rgba(255, 183, 77, 0.2) 0%,
        rgba(255, 138, 101, 0.15) 50%,
        rgba(255, 107, 107, 0.1) 100%);
}

.mode-btn.mode-classic .mode-bg {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 200, 87, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 138, 101, 0.3) 0%, transparent 50%);
}

.mode-btn.mode-classic .mode-icon {
    background: rgba(255, 183, 77, 0.25);
}

.mode-btn.mode-classic .mode-icon svg {
    color: #ffd54f;
    filter: drop-shadow(0 0 6px rgba(255, 213, 79, 0.4));
}

.mode-btn.mode-classic:hover {
    border-color: rgba(255, 183, 77, 0.4);
    box-shadow:
        0 12px 40px rgba(255, 152, 0, 0.2),
        0 1px 3px rgba(255, 255, 255, 0.1) inset;
}

/* Explorer mode - soft sage/teal adventure */
.mode-btn.mode-explorer {
    background: linear-gradient(145deg,
        rgba(129, 199, 132, 0.15) 0%,
        rgba(77, 182, 172, 0.12) 50%,
        rgba(79, 195, 247, 0.1) 100%);
}

.mode-btn.mode-explorer .mode-bg {
    background:
        radial-gradient(circle at 20% 30%, rgba(129, 199, 132, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(77, 182, 172, 0.25) 0%, transparent 50%);
}

.mode-btn.mode-explorer .mode-icon {
    background: rgba(129, 199, 132, 0.2);
}

.mode-btn.mode-explorer .mode-icon svg {
    color: #81c784;
    filter: drop-shadow(0 0 6px rgba(129, 199, 132, 0.4));
}

.mode-btn.mode-explorer:hover {
    border-color: rgba(129, 199, 132, 0.4);
    box-shadow:
        0 12px 40px rgba(76, 175, 80, 0.15),
        0 1px 3px rgba(255, 255, 255, 0.1) inset;
}

/* Visualizer mode - soft lavender/periwinkle */
.mode-btn.mode-visualizer {
    background: linear-gradient(145deg,
        rgba(179, 157, 219, 0.15) 0%,
        rgba(149, 158, 255, 0.12) 50%,
        rgba(130, 177, 255, 0.1) 100%);
}

.mode-btn.mode-visualizer .mode-bg {
    background:
        radial-gradient(circle at 70% 20%, rgba(179, 157, 219, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 30% 80%, rgba(149, 158, 255, 0.25) 0%, transparent 50%);
}

.mode-btn.mode-visualizer .mode-icon {
    background: rgba(179, 157, 219, 0.2);
}

.mode-btn.mode-visualizer .mode-icon svg {
    color: #b39ddb;
    filter: drop-shadow(0 0 6px rgba(179, 157, 219, 0.4));
}

.mode-btn.mode-visualizer:hover {
    border-color: rgba(179, 157, 219, 0.4);
    box-shadow:
        0 12px 40px rgba(149, 117, 205, 0.15),
        0 1px 3px rgba(255, 255, 255, 0.1) inset;
}

/* Premium styling - subtle lock feel */
.mode-btn.premium-mode {
    opacity: 0.9;
}

.mode-btn.premium-mode:not(:hover) .mode-icon {
    opacity: 0.85;
}

/* PRO tag - warm and friendly */
.premium-tag {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #555;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

/* Hide premium tags for Pro users */
body.pro-user .premium-tag {
    display: none;
}

body.pro-user .mode-btn.premium-mode {
    opacity: 1;
}

body.pro-user .mode-btn.premium-mode .mode-icon {
    opacity: 1;
}

/* Difficulty Selector - warm and friendly */
.difficulty-selector {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.difficulty-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.85rem;
}

.difficulty-options {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.6rem 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 75px;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: rgba(255, 183, 77, 0.15);
    border-color: rgba(255, 183, 77, 0.4);
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.15);
}

.difficulty-btn.active .diff-name {
    color: #ffd54f;
}

.diff-name {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.diff-desc {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.03em;
}

/* Color variations for difficulty - warmer palette */
.difficulty-btn[data-difficulty="hard"].active {
    background: rgba(255, 138, 101, 0.15);
    border-color: rgba(255, 138, 101, 0.4);
    box-shadow: 0 4px 16px rgba(255, 87, 34, 0.15);
}

.difficulty-btn[data-difficulty="hard"].active .diff-name {
    color: #ff8a65;
}

.difficulty-btn[data-difficulty="easy"].active {
    background: rgba(129, 199, 132, 0.15);
    border-color: rgba(129, 199, 132, 0.4);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.15);
}

.difficulty-btn[data-difficulty="easy"].active .diff-name {
    color: #81c784;
}

/* =============================================================================
   EXPLORER FLOATING BADGE
   ============================================================================= */

.explorer-floating-badge {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: rgba(13, 10, 20, 0.85);
    border: 1px solid rgba(65, 217, 217, 0.2);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    z-index: 500;
}

.explorer-floating-badge.hidden { display: none; }

.badge-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(65, 217, 217, 0.4);
}

.badge-hint {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* =============================================================================
   EXPLORER CONTEXT MENU - Unified Command Center
   ============================================================================= */

.explorer-context-menu {
    position: fixed;
    z-index: 1000;
    pointer-events: auto;
    transform: translate(-50%, -100%) translateY(-10px);
}

.explorer-context-menu.hidden { display: none; }

.explorer-context-menu.visible {
    animation: contextPop 0.12s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

@keyframes contextPop {
    0% { opacity: 0; transform: translate(-50%, -100%) translateY(-10px) scale(0.92); }
    100% { opacity: 1; transform: translate(-50%, -100%) translateY(-10px) scale(1); }
}

.context-menu-inner {
    background: rgba(13, 10, 20, 0.94);
    border: 1px solid rgba(65, 217, 217, 0.2);
    border-radius: 8px;
    padding: 6px;
    backdrop-filter: blur(12px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 1px rgba(65, 217, 217, 0.2);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
}

.context-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.context-section:first-child {
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.context-divider {
    height: 1px;
    margin: 4px 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(65, 217, 217, 0.15) 20%,
        rgba(65, 217, 217, 0.15) 80%,
        transparent 100%
    );
}

.context-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.1s ease;
    white-space: nowrap;
}

.context-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.context-option:active {
    transform: scale(0.97);
}

/* Marker options - horizontal in first row */
.context-section:first-child .context-option {
    flex: 1;
    justify-content: center;
    padding: 10px 14px;
}

.context-option[data-action="start"]:hover {
    border-color: rgba(125, 234, 125, 0.25);
    background: rgba(125, 234, 125, 0.06);
}

.context-option[data-action="end"]:hover {
    border-color: rgba(255, 107, 157, 0.25);
    background: rgba(255, 107, 157, 0.06);
}

.context-option[data-action="challenge"]:hover {
    border-color: rgba(255, 215, 0, 0.25);
    background: rgba(255, 215, 0, 0.06);
}

.context-option[data-action="showroute"]:hover {
    border-color: rgba(65, 217, 217, 0.25);
    background: rgba(65, 217, 217, 0.06);
}

/* Pips */
.option-pip {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.start-pip {
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

.end-pip {
    background: var(--neon-pink);
    box-shadow: 0 0 6px var(--neon-pink);
}

.challenge-pip {
    background: var(--sunset-gold);
    box-shadow: 0 0 6px var(--sunset-gold);
}

.route-pip {
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
}

/* Labels */
.option-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    transition: color 0.1s ease;
}

.option-label.dim {
    color: var(--text-muted);
}

.context-option[data-action="start"]:hover .option-label { color: var(--neon-green); }
.context-option[data-action="end"]:hover .option-label { color: var(--neon-pink); }
.context-option[data-action="challenge"]:hover .option-label { color: var(--sunset-gold); }
.context-option[data-action="showroute"]:hover .option-label { color: var(--neon-cyan); }
.context-option[data-action="reset"]:hover .option-label,
.context-option[data-action="exit"]:hover .option-label { color: var(--text-primary); }

/* Utility options - smaller */
.util-option {
    padding: 6px 12px;
}

.util-option .option-label {
    font-size: 0.55rem;
}

/* Actions section - hidden when no markers */
.context-actions.hidden { display: none; }

/* Pointer arrow */
.explorer-context-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(13, 10, 20, 0.94);
}

/* =============================================================================
   EXPLORER MODE CONTROLS
   ============================================================================= */

.explorer-controls {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(13, 10, 20, 0.95);
    border: 1px solid rgba(125, 234, 125, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4),
                0 0 40px rgba(125, 234, 125, 0.05);
}

.explorer-controls.hidden {
    display: none;
}

.explorer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.explorer-badge {
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--void);
}

.explorer-city {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-bright);
}

.explorer-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.explorer-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.explorer-btn svg {
    width: 14px;
    height: 14px;
}

.explorer-btn:hover:not(:disabled) {
    background: rgba(125, 234, 125, 0.1);
    border-color: rgba(125, 234, 125, 0.3);
    color: var(--neon-green);
}

.explorer-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.explorer-btn.primary {
    background: rgba(65, 217, 217, 0.15);
    border-color: rgba(65, 217, 217, 0.3);
    color: var(--neon-cyan);
}

.explorer-btn.primary:hover:not(:disabled) {
    background: rgba(65, 217, 217, 0.25);
    border-color: rgba(65, 217, 217, 0.5);
}

.explorer-btn.secondary {
    background: rgba(255, 107, 157, 0.1);
    border-color: rgba(255, 107, 157, 0.2);
    color: var(--neon-pink);
}

.explorer-btn.secondary:hover {
    background: rgba(255, 107, 157, 0.2);
    border-color: rgba(255, 107, 157, 0.4);
}

.explorer-btn.active {
    background: rgba(125, 234, 125, 0.2);
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 10px rgba(125, 234, 125, 0.2);
}

.explorer-exit {
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.explorer-exit:hover {
    border-color: rgba(255, 50, 50, 0.3);
    color: #ff6b6b;
}

/* =============================================================================
   CITY TRANSITION OVERLAY
   ============================================================================= */

.city-transition {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 10, 20, 0.95);
    z-index: 2000;
    animation: transition-fade-in 0.3s ease-out;
}

.city-transition.hidden {
    display: none;
}

@keyframes transition-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.city-transition-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.transition-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(65, 217, 217, 0.5);
}

.transition-city {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--text-bright);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    animation: city-name-pulse 1.5s ease-in-out infinite;
}

@keyframes city-name-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.02); }
}

.transition-fact {
    max-width: 400px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-dim);
    font-style: italic;
    padding: 0.75rem 1rem;
    background: rgba(255, 216, 102, 0.05);
    border-left: 2px solid var(--sunset-gold);
    text-align: left;
    animation: fact-slide-in 0.5s ease-out 0.3s both;
}

.transition-fact:empty {
    display: none;
}

@keyframes fact-slide-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.transition-stats {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.transition-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.transition-stat .stat-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.transition-stat .stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--sunset-gold);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* =============================================================================
   VISUALIZER MODE UI
   ============================================================================= */

.visualizer-ui {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: rgba(13, 10, 20, 0.9);
    border: 1px solid rgba(198, 120, 221, 0.3);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(198, 120, 221, 0.1);
}

.visualizer-ui.hidden {
    display: none;
}

.visualizer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.visualizer-badge {
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: white;
}

.visualizer-city {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-bright);
}

.visualizer-count {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.visualizer-exit {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 50, 50, 0.1);
    border: 1px solid rgba(255, 50, 50, 0.3);
    border-radius: 20px;
    color: #ff6b6b;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.visualizer-exit:hover {
    background: rgba(255, 50, 50, 0.2);
    border-color: rgba(255, 50, 50, 0.5);
}

.visualizer-exit svg {
    width: 14px;
    height: 14px;
}

/* =============================================================================
   LOCATION SELECTOR OVERLAY
   ============================================================================= */

.location-select {
    max-width: 420px;
}

.location-subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.location-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.location-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.location-option:hover {
    background: rgba(255, 107, 157, 0.06);
    border-color: rgba(255, 107, 157, 0.25);
    transform: translateX(4px);
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.08);
}

.location-option:active {
    transform: translateX(2px);
}

.option-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(65, 217, 217, 0.08);
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.25s ease-out;
}

.option-icon svg {
    width: 24px;
    height: 24px;
    color: var(--neon-cyan);
}

.location-option:hover .option-icon {
    background: rgba(65, 217, 217, 0.15);
    box-shadow: 0 0 12px rgba(65, 217, 217, 0.2);
}

.location-option[data-mode="local"] .option-icon {
    background: rgba(125, 234, 125, 0.08);
}

.location-option[data-mode="local"] .option-icon svg {
    color: var(--neon-green);
}

.location-option[data-mode="local"]:hover .option-icon {
    background: rgba(125, 234, 125, 0.15);
    box-shadow: 0 0 12px rgba(125, 234, 125, 0.2);
}

.location-option[data-mode="local"]:hover {
    background: rgba(125, 234, 125, 0.05);
    border-color: rgba(125, 234, 125, 0.25);
    box-shadow: 0 0 20px rgba(125, 234, 125, 0.08);
}

.location-option[data-mode="global"] .option-icon {
    background: rgba(198, 120, 221, 0.08);
}

.location-option[data-mode="global"] .option-icon svg {
    color: var(--neon-purple);
}

.location-option[data-mode="global"]:hover .option-icon {
    background: rgba(198, 120, 221, 0.15);
    box-shadow: 0 0 12px rgba(198, 120, 221, 0.2);
}

.location-option[data-mode="global"]:hover {
    background: rgba(198, 120, 221, 0.05);
    border-color: rgba(198, 120, 221, 0.25);
    box-shadow: 0 0 20px rgba(198, 120, 221, 0.08);
}

.option-label {
    display: block;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 0.15rem;
}

.option-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Hide old elements */
#header {
    display: none;
}

/* =============================================================================
   MAIN GAME CONTAINER - Full Screen
   ============================================================================= */

#game-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 100vh;
}

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

/* =============================================================================
   MAP CONTAINER
   ============================================================================= */

#map-container {
    flex: 1;
    position: relative;
    background: var(--void);
}

#map {
    width: 100%;
    height: 100%;
    background: var(--void);
}

/* Marker container - sits above canvases */
#marker-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 800;
}

/* WebGL Canvas - Road network rendering */
#webgl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
}

/* Drawing Canvas */
#draw-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 400;
}

#draw-canvas.drawing-ready {
    pointer-events: auto;
    cursor: crosshair;
}

#draw-canvas.drawing-active {
    pointer-events: auto;
    cursor: crosshair;
}

/* Distance rejection feedback - red flash when clicking too far */
#draw-canvas.distance-rejected {
    animation: distance-reject-flash 0.3s ease-out;
}

@keyframes distance-reject-flash {
    0%, 100% {
        box-shadow: inset 0 0 0 transparent;
    }
    50% {
        box-shadow: inset 0 0 60px rgba(255, 50, 50, 0.25),
                    inset 0 0 120px rgba(255, 50, 50, 0.1);
    }
}

/* Visualization Canvas - BELOW draw-canvas */
#viz-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 350;
}

/* Custom road view mode - enhanced map texture underneath roads */
#map-container.custom-roads-mode #map {
    background: var(--void) !important;
}

#map-container.custom-roads-mode .leaflet-tile-pane {
    opacity: 0.45;
    filter:
        saturate(0.08)
        brightness(0.5)
        contrast(1.4)
        sepia(0.3)
        hue-rotate(-20deg);
    mix-blend-mode: screen;
}

/* Vignette overlay for map - warm purple edges */
#map-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 600;
    background: radial-gradient(
        ellipse 85% 75% at 50% 50%,
        transparent 0%,
        transparent 40%,
        rgba(18, 12, 28, 0.3) 60%,
        rgba(13, 10, 20, 0.55) 80%,
        rgba(10, 8, 16, 0.75) 100%
    );
    box-shadow: inset 0 0 100px rgba(255, 107, 157, 0.02),
                inset 0 0 200px rgba(13, 10, 20, 0.35);
}

/* =============================================================================
   LEAFLET CUSTOMIZATION - Warm Synthwave Style
   ============================================================================= */

.leaflet-container {
    background: var(--void);
    font-family: var(--font-mono);
}

/* Ensure markers appear above canvases and vignette */
.leaflet-marker-pane,
.leaflet-shadow-pane {
    z-index: 700 !important;
}

/* Warm processed map tiles - visible texture with synthwave treatment */
.leaflet-tile-pane {
    filter:
        saturate(0.12)
        brightness(0.45)
        contrast(1.35)
        sepia(0.25)
        hue-rotate(-15deg);
    opacity: 0.65;
    mix-blend-mode: screen;
}

/* Add a color overlay effect via the tile container */
.leaflet-tile-container {
    position: relative;
}

/* Individual tiles get subtle processing */
.leaflet-tile {
    image-rendering: auto;
}

/* Zoom Controls */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 107, 157, 0.05) !important;
    overflow: hidden;
    border-radius: var(--radius-md) !important;
}

.leaflet-control-zoom a {
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--elevated) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-family: var(--font-mono) !important;
    transition: var(--transition-fast);
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: var(--elevated) !important;
    color: var(--neon-pink) !important;
}

/* Attribution - Minimal, hide Ukraine flag/heart from Leaflet prefix */
.leaflet-control-attribution {
    background: rgba(10, 14, 18, 0.8) !important;
    color: var(--text-muted) !important;
    font-size: 0.6rem !important;
    padding: 2px 6px !important;
}

.leaflet-control-attribution a {
    color: var(--text-dim) !important;
}

/* Hide Leaflet prefix (includes Ukraine flag/heart) */
.leaflet-control-attribution .leaflet-attribution-flag,
.leaflet-control-attribution svg {
    display: none !important;
}

/* Hide separator and any text before our attribution */
.leaflet-control-attribution span[aria-hidden="true"] {
    display: none !important;
}

/* =============================================================================
   MARKERS
   ============================================================================= */

/* Override Leaflet default div icon styles */
.leaflet-div-icon {
    background: transparent;
    border: none;
}

/* Marker core - small and subtle */
#marker-container .custom-marker {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

/* Orbiting ring animation */
#marker-container .custom-marker::before {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: marker-orbit 3s linear infinite;
}

#marker-container .custom-marker::after {
    content: '';
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid transparent;
    animation: marker-orbit 2s linear infinite reverse;
}

@keyframes marker-orbit {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#marker-container .start-marker {
    background: rgba(125, 234, 125, 0.85);
    color: #0d0a14;
    box-shadow: 0 0 12px rgba(125, 234, 125, 0.5);
}

#marker-container .start-marker::before {
    border-top-color: rgba(125, 234, 125, 0.7);
    border-right-color: rgba(125, 234, 125, 0.3);
    box-shadow: 0 0 8px rgba(125, 234, 125, 0.3);
}

#marker-container .start-marker::after {
    border-bottom-color: rgba(125, 234, 125, 0.5);
    border-left-color: rgba(125, 234, 125, 0.2);
}

#marker-container .end-marker {
    background: rgba(255, 107, 157, 0.85);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.5);
}

#marker-container .end-marker::before {
    border-top-color: rgba(255, 107, 157, 0.7);
    border-right-color: rgba(255, 107, 157, 0.3);
    box-shadow: 0 0 8px rgba(255, 107, 157, 0.3);
}

#marker-container .end-marker::after {
    border-bottom-color: rgba(255, 107, 157, 0.5);
    border-left-color: rgba(255, 107, 157, 0.2);
}

.marker-label {
    pointer-events: none;
}

/* =============================================================================
   OVERLAYS - Full Screen Modals
   ============================================================================= */

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 10, 20, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(12px) saturate(1.1);
    animation: fade-in 0.35s ease-out;
}

/* =============================================================================
   LOADING OVERLAY - Shows map with elegant floating card
   ============================================================================= */

#loading-overlay {
    background: rgba(13, 10, 20, 0.4) !important;
    backdrop-filter: blur(2px) !important;
}

/* Hide unused elements */
#transition-map,
#globe-canvas {
    display: none !important;
}

.overlay.hidden {
    display: none;
}

/* Loading card - clean, elegant floating panel */
.globe-overlay-content {
    background: rgba(18, 16, 26, 0.95);
    border: 1px solid rgba(255, 107, 157, 0.25);
    padding: 1.5rem 2.5rem;
    border-radius: 16px;
    min-width: 300px;
    text-align: center;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(255, 107, 157, 0.08);
    backdrop-filter: blur(20px);
    animation: card-float-in 0.4s ease-out;
}

@keyframes card-float-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.globe-overlay-content::before,
.globe-overlay-content::after {
    display: none !important;
}

#loading-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.loading-city-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--neon-pink), var(--sunset-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
}

.loading-city-name:empty {
    display: none;
}

.overlay-content {
    background: linear-gradient(145deg, var(--surface), var(--deep));
    border: 1px solid rgba(255, 107, 157, 0.15);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 480px;
    position: relative;
    box-shadow:
        0 0 50px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(255, 107, 157, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Accent corner decorations - warm gradient */
.overlay-content::before,
.overlay-content::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid;
    border-image: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan)) 1;
    opacity: 0.4;
}

.overlay-content::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.overlay-content::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.overlay-content h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--neon-pink), var(--sunset-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 107, 157, 0.3));
}

/* =============================================================================
   SPINNER - Loading Animation (Calming)
   ============================================================================= */

@keyframes gentle-spin {
    to { transform: rotate(360deg); }
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.spinner {
    width: 44px;
    height: 44px;
    border: 2px solid var(--elevated);
    border-top-color: var(--neon-pink);
    border-right-color: var(--sunset-warm);
    border-radius: 50%;
    animation: gentle-spin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin: 0 auto 1.25rem;
    box-shadow:
        0 0 25px rgba(255, 107, 157, 0.2),
        0 0 50px rgba(252, 152, 103, 0.08);
}

#loading-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    animation: breathe 3s ease-in-out infinite;
    line-height: 1.6;
}

/* Style for the retry button inside loading */
#loading-text .btn {
    margin-top: 0.5rem;
}

/* =============================================================================
   INSTRUCTIONS OVERLAY
   ============================================================================= */

.instructions ol {
    text-align: left;
    margin: 1.5rem 0;
    padding-left: 0;
    list-style: none;
    counter-reset: step;
}

.instructions li {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    counter-increment: step;
}

.instructions li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--elevated);
    border: 1px solid var(--neon-pink);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--neon-pink);
    box-shadow: 0 0 8px rgba(255, 107, 157, 0.15);
}

.instructions .start-marker,
.instructions .end-marker {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.instructions .start-marker {
    background: var(--start-color);
    color: #0d0a14;
    box-shadow: 0 0 12px rgba(125, 234, 125, 0.35);
}

.instructions .end-marker {
    background: var(--end-color);
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.35);
}

/* =============================================================================
   RESULTS PANEL - Bottom Slide-Up (Warm Synthwave)
   ============================================================================= */

#results-panel {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 90%;
    max-width: 480px;
    background: rgba(18, 16, 26, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 107, 157, 0.12);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 1rem 1.5rem 1.25rem;
    z-index: 900;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

#results-panel.visible {
    transform: translateX(-50%) translateY(0);
}

/* Warm sunset gradient line on top */
#results-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--sunset-warm) 25%,
        var(--neon-pink) 50%,
        var(--neon-purple) 75%,
        transparent
    );
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.35), 0 0 24px rgba(252, 152, 103, 0.2);
}

/* Soft warm glow behind panel */
#results-panel::after {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: radial-gradient(ellipse at center bottom, rgba(255, 107, 157, 0.08) 0%, rgba(252, 152, 103, 0.04) 50%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.results-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Hero Score Section - Compact */
.results-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hero-score-container {
    display: flex;
    flex-direction: column;
}

.hero-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 0.1rem;
}

.hero-score {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 400;
    background: linear-gradient(135deg, var(--sunset-gold), var(--sunset-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(255, 216, 102, 0.4)) drop-shadow(0 0 40px rgba(252, 152, 103, 0.2));
    line-height: 1;
}

.hero-efficiency {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.efficiency-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--neon-green);
    text-shadow: 0 0 12px rgba(125, 234, 125, 0.4), 0 0 24px rgba(125, 234, 125, 0.2);
    line-height: 1;
}

.efficiency-label {
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

/* Route Comparison Bars - Compact */
.results-comparison {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.comparison-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comparison-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.comparison-item.yours .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sunset-warm), var(--neon-pink));
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 140, 105, 0.35), 0 0 20px rgba(255, 107, 157, 0.2);
}

.comparison-item.optimal .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(65, 217, 217, 0.35), 0 0 20px rgba(198, 120, 221, 0.2);
}

.comparison-data {
    display: flex;
    flex-direction: column;
    min-width: 75px;
    text-align: right;
}

.comparison-label {
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.comparison-value {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-bright);
}

/* Location Fact - Results Panel */
.location-fact {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin: 0.5rem 0;
    background: linear-gradient(135deg, rgba(255, 216, 102, 0.08), rgba(255, 140, 105, 0.05));
    border: 1px solid rgba(255, 216, 102, 0.15);
    border-radius: var(--radius-md);
    animation: fact-fade-in 0.5s ease-out;
}

.location-fact.hidden {
    display: none;
}

.fact-icon {
    color: var(--sunset-gold);
    font-size: 0.9rem;
    line-height: 1.4;
    text-shadow: 0 0 8px rgba(255, 216, 102, 0.5);
}

.fact-text {
    font-family: var(--font-display);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-bright);
}

@keyframes fact-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   STREAMING FACTS TICKER (Explorer/Visualizer)
   ============================================================================= */

.facts-ticker {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: auto;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg,
        rgba(13, 10, 20, 0.95) 0%,
        rgba(26, 22, 37, 0.9) 50%,
        rgba(40, 30, 55, 0.85) 100%);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-left: 3px solid var(--neon-cyan);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    z-index: 500;
    animation: ticker-slide-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 240, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Subtle glow underneath */
.facts-ticker::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 10%;
    right: 10%;
    height: 16px;
    background: radial-gradient(ellipse, rgba(0, 240, 255, 0.15) 0%, transparent 70%);
    filter: blur(8px);
    pointer-events: none;
}

.facts-ticker.hidden {
    display: none;
}

@keyframes ticker-slide-in {
    from {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.ticker-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(198, 120, 221, 0.15));
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 50%;
    color: var(--neon-cyan);
    animation: ticker-icon-pulse 3s ease-in-out infinite;
}

.ticker-icon svg {
    width: 18px;
    height: 18px;
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.8));
}

@keyframes ticker-icon-pulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 16px rgba(0, 240, 255, 0.5), 0 0 24px rgba(0, 240, 255, 0.2);
        transform: scale(1.05);
    }
}

.ticker-content {
    flex: 1;
    overflow: hidden;
}

/* Label above the fact */
.ticker-content::before {
    content: 'DID YOU KNOW?';
    display: block;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
    margin-bottom: 0.35rem;
    opacity: 0.9;
}

.ticker-text {
    display: block;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-bright);
    line-height: 1.5;
    animation: ticker-text-fade 0.5s ease-out;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes ticker-text-fade {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .facts-ticker {
        left: 12px;
        right: 12px;
        max-width: none;
        bottom: 16px;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .ticker-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .ticker-content::before {
        font-size: 0.5rem;
    }

    .ticker-text {
        font-size: 0.8rem;
    }
}

/* =============================================================================
   FULLSCREEN BUTTON (Visualizer/Explorer)
   ============================================================================= */

.fullscreen-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        rgba(13, 10, 20, 0.95) 0%,
        rgba(26, 22, 37, 0.9) 100%);
    border: 1px solid rgba(198, 120, 221, 0.3);
    border-radius: 50%;
    color: var(--neon-purple);
    cursor: pointer;
    z-index: 500;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 0 12px rgba(198, 120, 221, 0.1);
    backdrop-filter: blur(8px);
}

.fullscreen-btn svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 0 4px rgba(198, 120, 221, 0.6));
    transition: transform 0.3s ease;
}

.fullscreen-btn:hover {
    background: linear-gradient(135deg,
        rgba(198, 120, 221, 0.2) 0%,
        rgba(26, 22, 37, 0.95) 100%);
    border-color: rgba(198, 120, 221, 0.5);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(198, 120, 221, 0.25),
        0 0 40px rgba(198, 120, 221, 0.1);
    transform: scale(1.08);
}

.fullscreen-btn:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(198, 120, 221, 0.8));
}

.fullscreen-btn:active {
    transform: scale(0.95);
}

.fullscreen-btn.hidden {
    display: none;
}

/* Fullscreen active state - hide UI elements */
body.fullscreen-mode #gameplay-hud,
body.fullscreen-mode .facts-ticker,
body.fullscreen-mode .fullscreen-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Show exit hint briefly when entering fullscreen */
.fullscreen-exit-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 2.5rem;
    background: rgba(13, 10, 20, 0.95);
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 12px;
    color: var(--text-bright);
    font-family: var(--font-display);
    font-size: 1.1rem;
    text-align: center;
    z-index: 10000;
    animation: hint-fade 3s ease-in-out forwards;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(255, 107, 157, 0.1);
}

.fullscreen-exit-hint span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
    letter-spacing: 0.1em;
}

@keyframes hint-fade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    85% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
        pointer-events: none;
    }
}

/* Meta Info (Round & Total) - Inline */
.results-meta {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.meta-value {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.meta-value.meta-total {
    color: var(--sunset-gold);
    text-shadow: 0 0 10px rgba(255, 216, 102, 0.35), 0 0 20px rgba(255, 216, 102, 0.15);
}

/* Next Round Button - Warm Pulsing Glow */
@keyframes btn-pulse {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(255, 107, 157, 0.25),
            0 0 30px rgba(198, 120, 221, 0.12);
    }
    50% {
        box-shadow:
            0 0 25px rgba(255, 107, 157, 0.4),
            0 0 45px rgba(198, 120, 221, 0.25);
    }
}

.btn-next {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    border: none;
    border-radius: 10px;
    color: var(--text-bright);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.3s ease-out;
    animation: btn-pulse 2.5s ease-in-out infinite;
}

.btn-next:hover {
    transform: translateY(-2px);
    animation: none;
    box-shadow:
        0 6px 25px rgba(255, 107, 157, 0.45),
        0 0 40px rgba(198, 120, 221, 0.3);
}

.btn-next:active {
    transform: translateY(0);
}

.btn-next svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease-out;
}

.btn-next:hover svg {
    transform: translateX(4px);
}

/* Next Round Button Wrapper with Rotating Glow */
.next-round-wrapper {
    position: relative;
    width: 100%;
    margin-top: 0.5rem;
}

.glow-border {
    position: absolute;
    inset: -3px;
    border-radius: 13px;
    background: conic-gradient(
        from var(--glow-angle, 0deg),
        transparent 0deg,
        rgba(0, 240, 255, 0.8) 30deg,
        rgba(255, 107, 157, 0.9) 90deg,
        rgba(198, 120, 221, 0.8) 150deg,
        transparent 180deg,
        transparent 360deg
    );
    animation: rotateGlow 3s linear infinite;
    opacity: 0.9;
    filter: blur(2px);
    z-index: 0;
}

.glow-border::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 11px;
    background: var(--bg-darker);
}

@keyframes rotateGlow {
    0% { --glow-angle: 0deg; }
    100% { --glow-angle: 360deg; }
}

@property --glow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.next-round-wrapper .btn-next {
    position: relative;
    z-index: 1;
}

.next-round-wrapper:hover .glow-border {
    opacity: 1;
    filter: blur(3px);
}

/* =============================================================================
   LEGACY RESULTS OVERLAY (for Game Over)
   ============================================================================= */

.results #results-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.stat {
    background: var(--elevated);
    padding: 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.stat.highlight {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    border: none;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.stat.highlight .stat-label {
    color: rgba(255, 255, 255, 0.7);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-bright);
}

/* =============================================================================
   GAME OVER OVERLAY - Celebration Mode
   ============================================================================= */

#gameover-overlay {
    background: rgba(13, 10, 20, 0.92);
}

#gameover-overlay .overlay-content {
    display: none;
}

.gameover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
    max-width: 500px;
    animation: gameover-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gameover-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.gameover-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gameover-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.gameover-score-container {
    position: relative;
    display: inline-block;
}

.gameover-score {
    font-family: var(--font-display);
    font-size: 5rem;
    font-weight: 400;
    background: linear-gradient(135deg, var(--sunset-gold), var(--sunset-warm), var(--neon-pink));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: sunset-pulse 4s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 216, 102, 0.4)) drop-shadow(0 0 60px rgba(255, 107, 157, 0.25));
    line-height: 1;
    position: relative;
    z-index: 1;
}

.score-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255, 107, 157, 0.15) 0%, rgba(255, 216, 102, 0.08) 40%, transparent 60%);
    animation: score-breathe 3.5s ease-in-out infinite;
    z-index: 0;
}

@keyframes score-breathe {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* Round Summary */
.gameover-rounds {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 107, 157, 0.1);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.rounds-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 1rem;
    text-align: center;
}

.rounds-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.round-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.round-row:hover {
    background: rgba(255, 107, 157, 0.04);
}

.round-row-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.round-row-score {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 400;
    color: var(--sunset-gold);
    text-shadow: 0 0 8px rgba(255, 216, 102, 0.3);
}

.round-row-efficiency {
    font-size: 0.75rem;
    color: var(--neon-green);
}

.gameover-rank {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    font-style: italic;
}

/* Play Again Button - Warm Glowing */
.btn-glow {
    padding: 1.25rem 3rem;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    border: none;
    border-radius: 16px;
    color: var(--text-bright);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease-out;
    animation: btn-pulse 2.5s ease-in-out infinite;
}

.btn-glow:hover {
    transform: translateY(-3px) scale(1.02);
    animation: none;
    box-shadow:
        0 10px 40px rgba(255, 107, 157, 0.45),
        0 0 60px rgba(198, 120, 221, 0.35);
}

/* Legacy compatibility */
#rank-message {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* =============================================================================
   SIDEBAR - Hidden (Legacy)
   ============================================================================= */

#sidebar {
    display: none;
}

.hidden {
    display: none !important;
}

/* Legacy sidebar styles kept for reference */
#sidebar-legacy {
    width: 280px;
    background: var(--abyss);
    border-left: 1px solid var(--elevated);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    position: relative;
}

/* Decorative data stream - warm gradient */
#sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent,
        var(--sunset-warm) 20%,
        var(--neon-pink) 50%,
        var(--neon-purple) 80%,
        transparent
    );
    opacity: 0.25;
}

.sidebar-section {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--elevated);
    position: relative;
}

.sidebar-section h3 {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--neon-pink);
    border-radius: 1px;
    box-shadow: 0 0 8px var(--neon-pink);
}

/* =============================================================================
   LOCATION INPUT
   ============================================================================= */

#location-info {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

#location-search {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--deep);
    border: 1px solid var(--elevated);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

#location-search::placeholder {
    color: var(--text-muted);
}

#location-search:focus {
    outline: none;
    border-color: var(--neon-pink);
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.2);
}

#current-location {
    font-size: 0.8rem;
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(255, 107, 157, 0.3);
}

/* =============================================================================
   ROUTE INFO
   ============================================================================= */

#route-info {
    margin-bottom: 0.875rem;
    padding: 0.75rem;
    background: var(--deep);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--sunset-warm);
}

#route-info p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
    display: flex;
    justify-content: space-between;
}

#route-info p:last-child {
    margin-bottom: 0;
}

#route-info span {
    color: var(--sunset-warm);
    font-family: var(--font-display);
    font-weight: 400;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    padding: 0.6rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    color: var(--text-bright);
    border: none;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
        0 4px 20px rgba(255, 107, 157, 0.4),
        0 0 30px rgba(198, 120, 221, 0.25);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--elevated);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    background: var(--surface);
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.15);
}

.btn-large {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.button-group .btn {
    flex: 1;
}

#center-btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* =============================================================================
   LEGEND
   ============================================================================= */

.legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.legend-color {
    width: 24px;
    height: 3px;
    border-radius: 2px;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    opacity: 0.9;
}

.legend-color.start {
    background: var(--start-color);
    color: var(--start-color);
    height: 10px;
    width: 10px;
    border-radius: 50%;
}

.legend-color.end {
    background: var(--end-color);
    color: var(--end-color);
    height: 10px;
    width: 10px;
    border-radius: 50%;
}

.legend-color.user-route {
    background: var(--user-route);
    color: var(--user-route);
}

.legend-color.explored {
    background: var(--explored-color);
    color: var(--explored-color);
}

.legend-color.optimal {
    background: var(--optimal-color);
    color: var(--optimal-color);
}

/* =============================================================================
   SOUND TOGGLE
   ============================================================================= */

.sound-section {
    padding: 0.75rem 1rem;
}

.mute-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--deep);
    border: 1px solid var(--elevated);
    border-radius: var(--radius-sm);
    color: var(--neon-pink);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.mute-btn:hover {
    border-color: var(--neon-pink);
    background: var(--surface);
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.15);
}

.mute-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mute-btn.muted {
    color: var(--sunset-warm);
    border-color: var(--sunset-warm);
}

.mute-btn.muted:hover {
    background: var(--surface);
    box-shadow: 0 0 12px rgba(252, 152, 103, 0.15);
}

.sound-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 900px) {
    #gameplay-hud {
        width: 95%;
        max-width: none;
        padding: 0.4rem;
    }

    .hud-brand {
        display: none;
    }

    .hud-stat {
        min-width: 55px;
        padding: 0.2rem 0.5rem;
    }

    .hud-value {
        font-size: 0.9rem;
    }

    .hud-btn {
        width: 32px;
        height: 32px;
    }

    #results-panel {
        width: 95%;
        padding: 1.25rem 1.5rem 1.5rem;
    }

    .hero-score {
        font-size: 2.5rem;
    }

    .efficiency-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    #gameplay-hud {
        top: 0.5rem;
        border-radius: 30px;
    }

    .hud-controls {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        gap: 0.15rem;
    }

    .hud-stat {
        min-width: 45px;
        padding: 0.15rem 0.35rem;
    }

    .hud-label {
        font-size: 0.5rem;
    }

    .hud-value {
        font-size: 0.8rem;
    }

    #results-panel {
        width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 1rem 1.25rem 1.5rem;
    }

    .results-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .hero-efficiency {
        align-items: flex-start;
    }

    .hero-score {
        font-size: 2.25rem;
    }

    .efficiency-value {
        font-size: 1.25rem;
    }

    .comparison-data {
        min-width: 70px;
    }

    .gameover-score {
        font-size: 3.5rem;
    }

    .gameover-content {
        padding: 2rem 1.5rem;
    }

    #location-display {
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.35rem 0.75rem;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

.text-cyan { color: var(--neon-cyan); }
.text-pink { color: var(--neon-pink); }
.text-orange { color: var(--neon-orange); }
.text-green { color: var(--neon-green); }
.text-gold { color: var(--sunset-gold); }
.text-warm { color: var(--sunset-warm); }

.glow-cyan { text-shadow: var(--glow-cyan); }
.glow-pink { text-shadow: var(--glow-pink); }
.glow-gold { text-shadow: 0 0 15px rgba(255, 216, 102, 0.4), 0 0 30px rgba(255, 216, 102, 0.2); }
.glow-warm { text-shadow: 0 0 15px rgba(252, 152, 103, 0.4), 0 0 30px rgba(252, 152, 103, 0.2); }

/* =============================================================================
   AUTH MODAL & USER SECTION
   ============================================================================= */

.hud-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.username-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(65, 217, 217, 0.4);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-modal {
    max-width: 380px;
    width: 90%;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    transition: color var(--transition-fast);
    z-index: 100;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--neon-pink);
}

.auth-subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    background: var(--abyss);
    border: 1px solid var(--elevated);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-bright);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(65, 217, 217, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.auth-error {
    color: var(--neon-pink);
    font-size: 0.8rem;
    min-height: 1.2em;
    margin: 0;
}

.auth-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--elevated);
}

.auth-switch span {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    transition: color var(--transition-fast);
}

.btn-link:hover {
    color: var(--sunset-warm);
}

/* Social Login */
.social-login {
    margin-top: 1.5rem;
}

.social-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
}

.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--elevated);
}

.social-divider span {
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.social-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.social-btn:hover {
    transform: translateY(-2px);
}

.social-btn.google {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.social-btn.google:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-btn.apple {
    background: #000;
    border: 1px solid #000;
    color: #fff;
}

.social-btn.apple:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.social-btn.facebook {
    background: #1877f2;
    border: 1px solid #1877f2;
    color: #fff;
}

.social-btn.facebook:hover {
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

.social-btn.discord {
    background: #5865f2;
    border: 1px solid #5865f2;
    color: #fff;
}

.social-btn.discord:hover {
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

/* Logged-in user profile */
.auth-logged-in {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--elevated);
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(65, 217, 217, 0.25);
}

.user-avatar svg {
    width: 24px;
    height: 24px;
    color: var(--neon-cyan);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-bright);
}

.user-status {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.user-stats {
    display: flex;
    justify-content: space-around;
    padding: 1rem 0;
    border-top: 1px solid var(--elevated);
    border-bottom: 1px solid var(--elevated);
}

.user-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(65, 217, 217, 0.3);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-upgrade {
    background: linear-gradient(135deg, var(--sunset-warm), var(--neon-pink));
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 0 20px rgba(255, 140, 105, 0.3);
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 140, 105, 0.5);
}

.btn-upgrade:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-dim);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.btn-secondary:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* =============================================================================
   LEADERBOARD MODAL
   ============================================================================= */

.leaderboard-modal {
    max-width: 450px;
    width: 90%;
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--abyss);
    margin-bottom: 0.5rem;
    transition: background var(--transition-fast);
}

.leaderboard-entry:hover {
    background: var(--elevated);
}

.leaderboard-rank {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--sunset-gold);
    min-width: 2rem;
    text-align: center;
}

.leaderboard-entry:nth-child(1) .leaderboard-rank {
    color: var(--sunset-gold);
    text-shadow: 0 0 10px rgba(255, 216, 102, 0.5);
}

.leaderboard-entry:nth-child(2) .leaderboard-rank {
    color: var(--text-dim);
}

.leaderboard-entry:nth-child(3) .leaderboard-rank {
    color: var(--sunset-warm);
}

.leaderboard-name {
    flex: 1;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.leaderboard-score {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--neon-cyan);
}

/* =============================================================================
   AD BANNER
   ============================================================================= */

.ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--abyss);
    border-top: 1px solid var(--elevated);
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + var(--safe-area-bottom, 0px));
    z-index: 1000;
    text-align: center;
    /* Constrain height to prevent unfilled ads from expanding */
    max-height: 100px;
    overflow: hidden;
}

.ad-banner .adsbygoogle {
    max-height: 90px;
    overflow: hidden;
}

.ad-placeholder {
    background: var(--surface);
    color: var(--text-muted);
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: var(--radius-sm);
}

/* Adjust game UI when ad banner is visible */
body.has-ad-banner #results-panel {
    bottom: 60px;
}

/* Mobile: Results panel needs more space for ad + safe area */
@media (max-width: 768px) {
    body.has-ad-banner #results-panel {
        bottom: calc(70px + var(--safe-area-bottom, env(safe-area-inset-bottom, 0px)));
        padding: 0.75rem 1rem 1rem;
        max-height: calc(100vh - 150px - var(--safe-area-bottom, env(safe-area-inset-bottom, 0px)));
    }

    body.has-ad-banner #results-panel .results-hero {
        gap: 0.5rem;
    }

    body.has-ad-banner #results-panel .hero-score {
        font-size: 2rem;
    }

    body.has-ad-banner #results-panel .btn-next {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

body.has-ad-banner #gameplay-hud {
    /* No adjustment needed - it's at top */
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS FOR AUTH
   ============================================================================= */

@media (max-width: 480px) {
    .auth-modal {
        padding: 1.5rem;
    }

    .user-stats {
        padding: 0.75rem 0;
    }

    .stat-value {
        font-size: 1rem;
    }

    .leaderboard-modal {
        padding: 1.5rem;
    }

    .leaderboard-list {
        max-height: 300px;
    }
}

/* =============================================================================
   CALLSIGN MODAL - New User Welcome
   ============================================================================= */

.callsign-modal {
    max-width: 400px;
    width: 90%;
    padding: 2.5rem 2rem;
}

.callsign-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.callsign-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.15), rgba(65, 217, 217, 0.15));
    border: 1px solid rgba(255, 107, 157, 0.25);
    border-radius: 50%;
    margin-bottom: 1.25rem;
    position: relative;
    animation: callsign-glow 3s ease-in-out infinite;
}

@keyframes callsign-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 107, 157, 0.2), 0 0 40px rgba(65, 217, 217, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 107, 157, 0.35), 0 0 60px rgba(65, 217, 217, 0.2);
    }
}

.callsign-icon svg {
    width: 36px;
    height: 36px;
    color: var(--neon-pink);
}

.callsign-header h2 {
    margin-bottom: 0.5rem;
}

.callsign-subtitle {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.callsign-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.callsign-input-wrapper {
    position: relative;
}

.callsign-input-wrapper input {
    width: 100%;
    background: var(--abyss);
    border: 2px solid var(--elevated);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1.25rem;
    text-align: center;
    color: var(--text-bright);
    letter-spacing: 0.05em;
    transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.callsign-input-wrapper input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(65, 217, 217, 0.25);
}

.callsign-input-wrapper input::placeholder {
    color: var(--text-muted);
    font-size: 1rem;
}

.callsign-input-glow {
    position: absolute;
    bottom: -8px;
    left: 10%;
    right: 10%;
    height: 16px;
    background: radial-gradient(ellipse, rgba(65, 217, 217, 0.15) 0%, transparent 70%);
    filter: blur(8px);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.callsign-input-wrapper input:focus + .callsign-input-glow {
    opacity: 1;
}

.callsign-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.callsign-error {
    color: var(--neon-pink);
    font-size: 0.8rem;
    text-align: center;
    min-height: 1.2em;
    margin: 0;
}

#callsign-submit {
    margin-top: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1rem;
}

#callsign-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#callsign-submit span {
    position: relative;
    z-index: 1;
}

/* Callsign modal responsive */
@media (max-width: 480px) {
    .callsign-modal {
        padding: 2rem 1.5rem;
    }

    .callsign-icon {
        width: 60px;
        height: 60px;
    }

    .callsign-icon svg {
        width: 28px;
        height: 28px;
    }

    .callsign-input-wrapper input {
        font-size: 1.1rem;
        padding: 0.875rem 1rem;
    }
}

/* =============================================================================
   PILOT ID CARD - Holographic Navigator License
   ============================================================================= */

.auth-modal {
    max-width: 400px;
    padding: 1.5rem;
}

.auth-logged-in {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* The ID Card Container */
.pilot-id-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(18, 16, 26, 0.95) 0%,
        rgba(26, 22, 37, 0.9) 50%,
        rgba(18, 16, 26, 0.95) 100%
    );
    border: 1px solid rgba(65, 217, 217, 0.2);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 107, 157, 0.1),
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(65, 217, 217, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Animated scanline effect */
.id-card-scanline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    opacity: 0.6;
    animation: scanline-move 4s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes scanline-move {
    0%, 100% { top: 0; opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { top: 100%; opacity: 0; }
}

/* Noise texture overlay */
.id-card-noise {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* Header band */
.id-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    background: linear-gradient(90deg, rgba(255, 107, 157, 0.15), rgba(65, 217, 217, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 2;
}

.id-card-type {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(255, 107, 157, 0.5);
}

.id-card-serial {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Identity Section */
.id-card-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1rem;
    position: relative;
    z-index: 2;
}

/* Hexagonal Avatar Frame */
.pilot-avatar-frame {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.avatar-hex-border {
    position: absolute;
    inset: 0;
    background: conic-gradient(
        from 0deg,
        var(--neon-cyan),
        var(--neon-pink),
        var(--neon-purple),
        var(--neon-cyan)
    );
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: avatar-border-spin 8s linear infinite;
}

@keyframes avatar-border-spin {
    to { transform: rotate(360deg); }
}

.avatar-glow {
    position: absolute;
    inset: -8px;
    background: radial-gradient(circle, rgba(65, 217, 217, 0.3) 0%, transparent 70%);
    filter: blur(8px);
    animation: avatar-pulse 3s ease-in-out infinite;
}

@keyframes avatar-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.avatar-inner {
    position: absolute;
    inset: 2px;
    background: var(--abyss);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-inner svg {
    width: 28px;
    height: 28px;
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 6px rgba(65, 217, 217, 0.5));
}

.avatar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid;
    animation: ring-rotate 6s linear infinite;
}

.avatar-ring-1 {
    inset: -6px;
    border-color: rgba(255, 107, 157, 0.3);
    border-style: dashed;
}

.avatar-ring-2 {
    inset: -12px;
    border-color: rgba(65, 217, 217, 0.2);
    border-style: dotted;
    animation-direction: reverse;
    animation-duration: 10s;
}

@keyframes ring-rotate {
    to { transform: rotate(360deg); }
}

/* Pilot Details */
.pilot-details {
    flex: 1;
    min-width: 0;
}

.callsign-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.5rem;
}

.callsign-label {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.callsign-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-bright);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    background: rgba(125, 234, 125, 0.1);
    border: 1px solid rgba(125, 234, 125, 0.25);
    border-radius: 20px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neon-green);
    animation: status-blink 2s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--neon-green);
    letter-spacing: 0.05em;
}

/* Premium status */
.status-badge.premium {
    background: rgba(255, 216, 102, 0.1);
    border-color: rgba(255, 216, 102, 0.3);
}

.status-badge.premium .status-dot {
    background: var(--sunset-gold);
    box-shadow: 0 0 8px var(--sunset-gold);
}

.status-badge.premium .status-text {
    color: var(--sunset-gold);
}

/* =============================================================================
   PILOT STATS GRID
   ============================================================================= */

.pilot-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 0 1rem 1rem;
    position: relative;
    z-index: 2;
}

.pilot-stat {
    position: relative;
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.pilot-stat:hover {
    background: rgba(255, 255, 255, 0.04);
}

.pilot-stat:hover .stat-icon-glow {
    opacity: 1;
}

.stat-bar-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
}

.stat-bar-fill {
    height: 100%;
    width: var(--fill-percent, 0%);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.pilot-stat[data-stat="cities"] .stat-bar-fill {
    background: linear-gradient(90deg, var(--neon-pink), rgba(255, 107, 157, 0.5));
    box-shadow: 0 0 10px var(--neon-pink);
}

.pilot-stat[data-stat="regions"] .stat-bar-fill {
    background: linear-gradient(90deg, var(--neon-purple), rgba(198, 120, 221, 0.5));
    box-shadow: 0 0 10px var(--neon-purple);
}

.pilot-stat[data-stat="distance"] .stat-bar-fill {
    background: linear-gradient(90deg, var(--neon-cyan), rgba(65, 217, 217, 0.5));
    box-shadow: 0 0 10px var(--neon-cyan);
}

.pilot-stat[data-stat="efficiency"] .stat-bar-fill {
    background: linear-gradient(90deg, var(--neon-green), rgba(125, 234, 125, 0.5));
    box-shadow: 0 0 10px var(--neon-green);
}

.stat-icon-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.pilot-stat[data-stat="cities"] .stat-icon-glow {
    background: radial-gradient(circle, rgba(255, 107, 157, 0.3) 0%, transparent 70%);
}

.pilot-stat[data-stat="regions"] .stat-icon-glow {
    background: radial-gradient(circle, rgba(198, 120, 221, 0.3) 0%, transparent 70%);
}

.pilot-stat[data-stat="distance"] .stat-icon-glow {
    background: radial-gradient(circle, rgba(65, 217, 217, 0.3) 0%, transparent 70%);
}

.pilot-stat[data-stat="efficiency"] .stat-icon-glow {
    background: radial-gradient(circle, rgba(125, 234, 125, 0.3) 0%, transparent 70%);
}

.stat-content {
    position: relative;
    z-index: 1;
}

.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 1.25rem;
    line-height: 1.2;
}

.pilot-stat[data-stat="cities"] .stat-number { color: var(--neon-pink); }
.pilot-stat[data-stat="regions"] .stat-number { color: var(--neon-purple); }
.pilot-stat[data-stat="distance"] .stat-number { color: var(--neon-cyan); }
.pilot-stat[data-stat="efficiency"] .stat-number { color: var(--neon-green); }

.stat-number .stat-unit {
    font-size: 0.6rem;
    font-family: var(--font-mono);
    opacity: 0.7;
    margin-left: 1px;
}

.stat-name {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
}

/* =============================================================================
   NAVIGATION LOG - Visited Locations List
   ============================================================================= */

.navigation-log {
    position: relative;
    margin: 0 1rem 1rem;
    border-radius: 8px;
    overflow: hidden;
    z-index: 2;
    background: linear-gradient(180deg, rgba(13, 10, 20, 0.9) 0%, rgba(18, 16, 26, 0.95) 100%);
}

.nav-log-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.nav-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--neon-cyan);
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.nav-corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.nav-corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.nav-corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.nav-corner-br { bottom: 0; right: 0; border-left: none; border-top: none; }

.nav-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(65, 217, 217, 0.15);
}

.nav-log-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--neon-cyan);
}

.nav-log-label svg {
    opacity: 0.7;
}

.nav-log-count {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    background: rgba(65, 217, 217, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

/* Scrollable list container */
.nav-log-list {
    max-height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(65, 217, 217, 0.3) transparent;
}

.nav-log-list::-webkit-scrollbar {
    width: 4px;
}

.nav-log-list::-webkit-scrollbar-track {
    background: transparent;
}

.nav-log-list::-webkit-scrollbar-thumb {
    background: rgba(65, 217, 217, 0.3);
    border-radius: 2px;
}

.nav-log-list::-webkit-scrollbar-thumb:hover {
    background: rgba(65, 217, 217, 0.5);
}

/* Individual location entry */
.nav-log-entry {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    transition: background var(--transition-fast);
}

.nav-log-entry:hover {
    background: rgba(65, 217, 217, 0.05);
}

.nav-log-entry .entry-marker {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
    flex-shrink: 0;
}

.nav-log-entry:nth-child(3n+1) .entry-marker {
    background: var(--neon-pink);
    box-shadow: 0 0 6px var(--neon-pink);
}

.nav-log-entry:nth-child(3n+2) .entry-marker {
    background: var(--neon-purple);
    box-shadow: 0 0 6px var(--neon-purple);
}

.nav-log-entry .entry-info {
    flex: 1;
    min-width: 0;
}

.nav-log-entry .entry-name {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-log-entry .entry-coords {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* Empty state */
.nav-log-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    gap: 0.5rem;
}

.nav-log-empty svg {
    width: 32px;
    height: 32px;
    color: var(--neon-cyan);
    opacity: 0.25;
}

.nav-log-empty span {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* Fade out effect at bottom */
.nav-log-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, rgba(18, 16, 26, 0.95) 0%, transparent 100%);
    pointer-events: none;
    z-index: 3;
}

/* Scanline animation */
.nav-log-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(65, 217, 217, 0.3), transparent);
    animation: nav-scan 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 4;
}

@keyframes nav-scan {
    0%, 100% { top: 30px; opacity: 0; }
    50% { top: calc(100% - 10px); opacity: 0.6; }
}

/* Hover effect on container */
.navigation-log:hover .nav-corner {
    opacity: 1;
    border-color: var(--neon-pink);
}

.navigation-log:hover .nav-log-label {
    color: var(--neon-pink);
}

/* =============================================================================
   PROFILE MODE SWITCHING
   ============================================================================= */

.profile-mode-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
}

.mode-actions-label {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.mode-action-buttons {
    display: flex;
    gap: 0.4rem;
}

.mode-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-action-btn:hover {
    background: rgba(65, 217, 217, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.mode-action-btn svg {
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.mode-action-btn:hover svg {
    opacity: 1;
}

/* Premium mode button styling */
.premium-mode-btn {
    position: relative;
}

.mode-premium-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.4rem;
    font-weight: 600;
    padding: 1px 4px;
    background: linear-gradient(135deg, var(--sunset-gold), var(--neon-orange));
    color: var(--void);
    border-radius: 3px;
    letter-spacing: 0.05em;
}

/* Hide badge when user has premium */
.profile-actions.has-premium .mode-premium-badge {
    display: none;
}

/* =============================================================================
   PROFILE ACTION BUTTONS
   ============================================================================= */

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0;
}

/* Holographic Upgrade Button */
.btn-holo-upgrade {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--transition-fast);
}

.btn-holo-upgrade:hover {
    transform: translateY(-2px);
}

.btn-holo-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 216, 102, 0.2) 0%,
        rgba(255, 140, 105, 0.15) 50%,
        rgba(255, 107, 157, 0.2) 100%
    );
    border: 1px solid rgba(255, 216, 102, 0.3);
    border-radius: 12px;
    transition: all var(--transition-fast);
}

.btn-holo-upgrade:hover .btn-holo-bg {
    background: linear-gradient(
        135deg,
        rgba(255, 216, 102, 0.3) 0%,
        rgba(255, 140, 105, 0.25) 50%,
        rgba(255, 107, 157, 0.3) 100%
    );
    border-color: rgba(255, 216, 102, 0.5);
    box-shadow: 0 0 30px rgba(255, 216, 102, 0.2), 0 0 60px rgba(255, 107, 157, 0.1);
}

.btn-holo-text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--sunset-gold);
    text-shadow: 0 0 15px rgba(255, 216, 102, 0.4);
    letter-spacing: 0.02em;
}

.btn-holo-text svg {
    filter: drop-shadow(0 0 4px currentColor);
}

/* Secondary button */
.btn-holo-secondary {
    padding: 0.625rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-holo-secondary:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

/* Hide elements from old design */
.auth-logged-in .user-stats,
.auth-logged-in .user-profile {
    display: none;
}

/* =============================================================================
   PROFILE RESPONSIVE
   ============================================================================= */

@media (max-width: 400px) {
    .auth-modal {
        padding: 1rem;
    }

    .pilot-id-card {
        border-radius: 12px;
    }

    .id-card-identity {
        padding: 1rem 0.75rem;
        gap: 0.75rem;
    }

    .pilot-avatar-frame {
        width: 52px;
        height: 52px;
    }

    .avatar-inner svg {
        width: 22px;
        height: 22px;
    }

    .callsign-value {
        font-size: 1.2rem;
    }

    .pilot-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
        padding: 0 0.75rem 0.75rem;
    }

    .pilot-stat {
        padding: 0.625rem 0.4rem;
    }

    .stat-number {
        font-size: 1.1rem;
    }

    .journey-holo-map {
        margin: 0 0.75rem 0.75rem;
    }

    .journey-holo-map .journey-map-canvas {
        height: 80px;
    }
}

/* =============================================================================
   JOURNEY ANIMATION OVERLAY - Full Screen Map Animation
   ============================================================================= */

#journey-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: journey-fade-in 0.3s ease-out;
}

@keyframes journey-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#journey-animation-overlay.fade-out {
    animation: journey-fade-out 0.3s ease-out forwards;
}

@keyframes journey-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

#journey-animation-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.journey-animation-header {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    animation: journey-header-in 0.5s ease-out 0.3s both;
}

@keyframes journey-header-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.journey-title {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    filter: drop-shadow(0 0 20px rgba(255, 107, 157, 0.4));
    margin-bottom: 0.5rem;
}

.journey-stats {
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.journey-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.journey-close-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-dim);
    transition: color var(--transition-fast);
}

.journey-close-btn:hover {
    background: rgba(255, 107, 157, 0.1);
    border-color: rgba(255, 107, 157, 0.3);
}

.journey-close-btn:hover svg {
    color: var(--neon-pink);
}

/* Make journey map preview clickable */
.journey-map-preview {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.journey-map-preview:hover {
    border-color: rgba(65, 217, 217, 0.2);
    background: rgba(65, 217, 217, 0.03);
}

.journey-map-preview:hover .journey-map-label {
    color: var(--neon-cyan);
}

/* =============================================================================
   MOBILE-SPECIFIC STYLES - Safe Areas, Touch Targets, Responsive Layout
   ============================================================================= */

/* Safe area insets for notched devices (iPhone X+, Android with punch-holes) */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

/* Prevent pull-to-refresh and overscroll effects */
html, body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* Prevent text selection during gameplay on mobile */
.game-container,
#map,
.draw-canvas,
.viz-canvas {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Ensure minimum touch target sizes (44x44px as per Apple HIG) */
.btn,
.speed-btn,
.replay-btn,
.location-option,
.mode-card,
.search-result-item,
.auth-btn,
.premium-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Mobile-first HUD adjustments */
@media (max-width: 768px) {
    /* Account for safe areas in fixed elements */
    .game-hud {
        top: calc(1rem + var(--safe-area-top));
        left: calc(1rem + var(--safe-area-left));
        right: calc(1rem + var(--safe-area-right));
    }

    .game-hud-bottom {
        bottom: calc(1rem + var(--safe-area-bottom));
        left: calc(1rem + var(--safe-area-left));
        right: calc(1rem + var(--safe-area-right));
    }

    /* Larger touch targets for mobile */
    .btn {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .speed-btn {
        width: 48px;
        height: 48px;
        font-size: 0.9rem;
    }

    /* Stack HUD elements vertically on narrow screens */
    .game-hud {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .hud-group {
        width: 100%;
        justify-content: space-between;
    }

    /* Make stats more compact */
    .hud-stat {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Results panel adjustments */
    .results-panel {
        padding: calc(1.5rem + var(--safe-area-top)) 1.5rem calc(1.5rem + var(--safe-area-bottom));
    }

    /* Modals and overlays respect safe areas */
    .modal,
    .overlay,
    .gameover-overlay,
    .instructions-overlay {
        padding: var(--safe-area-top) var(--safe-area-right) var(--safe-area-bottom) var(--safe-area-left);
    }

    /* Location selector adjustments */
    .location-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .location-option {
        padding: 1.25rem;
    }
}

/* Small phone screens */
@media (max-width: 480px) {
    .game-hud {
        top: calc(0.5rem + var(--safe-area-top));
        left: calc(0.5rem + var(--safe-area-left));
        right: calc(0.5rem + var(--safe-area-right));
    }

    .hud-stat {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }

    .hud-stat-label {
        font-size: 0.55rem;
    }

    /* Compact buttons */
    .btn {
        padding: 12px 18px;
        font-size: 0.9rem;
    }

    .btn-primary {
        width: 100%;
    }

    /* Search results need good touch targets */
    .search-result-item {
        padding: 14px 16px;
        min-height: 48px;
    }

    /* Mode cards stack on small screens */
    .mode-cards {
        flex-direction: column;
    }

    .mode-card {
        padding: 1.25rem;
    }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
    /* Minimize HUD in landscape */
    .game-hud {
        flex-direction: row;
        top: calc(0.5rem + var(--safe-area-top));
        gap: 0.5rem;
    }

    .hud-stat {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Hide non-essential elements in landscape */
    .hud-round-legend {
        display: none;
    }

    /* Compact results panel */
    .results-panel {
        padding: 1rem;
    }

    .results-panel h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    /* Overlay content scrollable */
    .instructions-content,
    .gameover-content {
        max-height: calc(100vh - var(--safe-area-top) - var(--safe-area-bottom) - 2rem);
        overflow-y: auto;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-hud {
        top: calc(1.25rem + var(--safe-area-top));
    }

    .location-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ad banner spacing for mobile */
@media (max-width: 768px) {
    /* When banner ad is visible, add bottom padding */
    body.ad-visible {
        padding-bottom: calc(60px + var(--safe-area-bottom));
    }

    /* Adjust bottom-positioned elements when ad is showing */
    body.ad-visible .game-hud-bottom,
    body.ad-visible .fullscreen-btn,
    body.ad-visible .facts-ticker {
        bottom: calc(70px + var(--safe-area-bottom));
    }
}

/* High contrast mode for outdoor visibility */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-dim: #cccccc;
    }

    .btn {
        border-width: 2px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode is default, but ensure system dark mode works */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* =============================================================================
   MOBILE HUD - Compact Top Bar (Everything at top, map fully visible)
   ============================================================================= */

/* Hide Leaflet zoom controls on mobile */
@media (max-width: 768px) {
    .leaflet-control-zoom {
        display: none !important;
    }
}

/* Hide the mobile bottom bar completely */
#mobile-bottom-bar {
    display: none !important;
}

/* Hide menu button on desktop */
.hud-menu-btn {
    display: none;
}

/* ============================================================================
   MOBILE HUD - CSS Grid two-row layout
   Row 1: [Location........................] [Profile]
   Row 2: [Controls] [Mode] [Stats...........]
   ============================================================================ */
@media (max-width: 600px) {

    /* ===== GRID CONTAINER ===== */
    #gameplay-hud {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: none;
        border-radius: 0;

        /* Use CSS Grid for reliable two-row layout */
        display: grid !important;
        grid-template-columns: auto auto 1fr auto;
        grid-template-rows: auto auto;
        gap: 10px 8px;
        align-items: center;

        padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 10px;
        background: rgba(13, 10, 20, 0.95);
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    }

    #gameplay-hud::before,
    #gameplay-hud::after {
        display: none;
    }

    /* ===== HIDDEN ELEMENTS ===== */
    .hud-brand,
    .hud-legend,
    .hud-menu-btn,
    .mobile-menu {
        display: none !important;
    }

    /* ===== ROW 1 ===== */

    /* Location: Row 1, spans columns 1-3 */
    .hud-location {
        grid-row: 1;
        grid-column: 1 / 4;
        padding: 0;
        border: none;
        min-width: 0;
    }

    .location-display {
        display: flex !important;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        margin: 0;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        min-height: 42px;
        cursor: pointer;
    }

    .location-display:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .location-display.hidden {
        display: none !important;
    }

    .location-display .location-icon {
        width: 16px;
        height: 16px;
        color: #ff6b9d;
        flex-shrink: 0;
    }

    .hud-location #current-location {
        font-size: 0.85rem;
        font-weight: 500;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    .location-display .search-icon {
        width: 14px;
        height: 14px;
        color: rgba(255, 255, 255, 0.35);
        flex-shrink: 0;
    }

    /* Profile: Row 1, column 4 */
    .hud-user {
        grid-row: 1;
        grid-column: 4;
        display: flex !important;
        padding: 0;
        border: none;
    }

    .hud-user .hud-btn {
        width: 42px;
        height: 42px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 8px;
        color: rgba(255, 255, 255, 0.7);
    }

    .hud-user .hud-btn:active {
        background: rgba(255, 255, 255, 0.12);
    }

    .hud-user .username-label {
        display: none;
    }

    /* ===== ROW 2 ===== */

    /* Controls: Row 2, column 1 */
    .hud-controls {
        grid-row: 2;
        grid-column: 1;
        display: flex !important;
        align-items: center;
        gap: 6px;
        padding: 0;
        border: none;
    }

    .hud-btn {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 6px;
        color: rgba(255, 255, 255, 0.7);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hud-btn:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .hud-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Clear button - pink tint */
    #clear-btn {
        color: rgba(255, 107, 157, 0.85);
        border-color: rgba(255, 107, 157, 0.12);
    }

    #clear-btn:active {
        background: rgba(255, 107, 157, 0.1);
    }

    /* Mode badge: Row 2, column 2 */
    .hud-mode {
        grid-row: 2;
        grid-column: 2;
        padding: 0;
        border: none;
        justify-self: start;
    }

    .hud-mode.hidden {
        display: none !important;
    }

    .mode-badge {
        font-size: 0.6rem !important;
        padding: 4px 8px !important;
        letter-spacing: 0.05em;
    }

    /* Stats: Row 2, column 3 */
    .hud-stats {
        grid-row: 2;
        grid-column: 3;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        padding: 0;
        border: none;
    }

    /* Hide distance and dividers */
    #stat-distance,
    .hud-divider {
        display: none !important;
    }

    /* Hide labels */
    .hud-label {
        display: none !important;
    }

    .hud-stat {
        display: flex;
        align-items: center;
        gap: 0;
        padding: 0;
        min-width: auto;
    }

    .hud-stat .hud-value {
        font-size: 1.05rem;
        font-weight: 600;
        color: #fff;
    }

    .hud-stat .hud-dim {
        font-size: 0.9rem;
        opacity: 0.45;
    }

    /* Score - gold */
    #stat-score .hud-value {
        color: #ffd866;
    }

    /* Mode exit button - hidden by default */
    .mode-exit-btn {
        display: none !important;
    }

    /* ===== SEARCH OVERLAY ===== */
    .location-search-inline {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10000;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 10px;
        background: rgba(13, 10, 20, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        gap: 8px;
        align-items: center;
    }

    .location-search-inline.hidden {
        display: none !important;
    }

    .inline-search-input {
        flex: 1;
        height: 46px;
        font-size: 1rem;
        padding: 0 14px;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: #fff;
    }

    .inline-search-input:focus {
        border-color: rgba(255, 255, 255, 0.25);
        outline: none;
    }

    .inline-search-input::placeholder {
        color: rgba(255, 255, 255, 0.35);
    }

    .close-search-btn {
        width: 46px;
        height: 46px;
        background: rgba(255, 107, 157, 0.08);
        border: 1px solid rgba(255, 107, 157, 0.15);
        border-radius: 8px;
        color: #ff6b9d;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .close-search-btn svg {
        width: 18px;
        height: 18px;
    }

    .inline-search-results {
        position: fixed;
        top: calc(70px + env(safe-area-inset-top, 0px));
        left: 12px;
        right: 12px;
        max-height: 50vh;
        background: rgba(20, 16, 30, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        z-index: 10001;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .inline-search-result {
        padding: 14px 16px;
        font-size: 0.9rem;
        color: rgba(255, 255, 255, 0.85);
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        cursor: pointer;
    }

    .inline-search-result:last-child {
        border-bottom: none;
    }

    .inline-search-result:active {
        background: rgba(255, 255, 255, 0.08);
    }

}

/* Small phones - tighter spacing */
@media (max-width: 380px) {
    #gameplay-hud {
        padding: calc(10px + env(safe-area-inset-top, 0px)) 8px 8px;
        gap: 8px 6px;
    }

    .location-display {
        padding: 8px 10px;
        min-height: 38px;
    }

    .hud-location #current-location {
        font-size: 0.8rem;
    }

    .hud-user .hud-btn {
        width: 38px;
        height: 38px;
    }

    .hud-btn {
        width: 32px;
        height: 32px;
    }

    .hud-btn svg {
        width: 14px;
        height: 14px;
    }

    .hud-stat .hud-value {
        font-size: 0.95rem;
    }
}

/* ============================================================================
   MOBILE LANDSCAPE - Phone held horizontally
   Detected by short height + landscape orientation
   ============================================================================ */
@media (max-height: 500px) and (orientation: landscape) {

    /* Main HUD Bar - Full width, single row */
    #gameplay-hud {
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: none;
        border-radius: 0;
        padding: 0.4rem 1rem;
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
        background: linear-gradient(180deg,
            rgba(8, 6, 14, 0.92) 0%,
            rgba(12, 10, 20, 0.88) 100%);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: none;
        border-bottom: 1px solid rgba(65, 217, 217, 0.1);
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
        flex-wrap: nowrap;
        gap: 1rem;
        justify-content: space-between;
        align-items: center;
    }

    /* Remove decorative elements */
    #gameplay-hud::before,
    #gameplay-hud::after {
        display: none;
    }

    /* Hide brand and legend */
    .hud-brand,
    .hud-legend {
        display: none !important;
    }

    /* Location - Compact, left side */
    .hud-location {
        order: 1;
        flex: 0 1 auto;
        max-width: 200px;
        padding: 0;
        border: none;
    }

    .location-display {
        display: flex !important;
        align-items: center;
        gap: 0.4rem;
        padding: 0.3rem 0.5rem;
        margin: 0;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.06);
        min-height: 34px;
        cursor: pointer;
    }

    .location-display:active {
        background: rgba(65, 217, 217, 0.1);
    }

    .location-display .location-icon {
        width: 12px;
        height: 12px;
        color: var(--neon-pink);
        flex-shrink: 0;
    }

    .hud-location #current-location {
        font-family: var(--font-mono);
        font-size: 0.7rem;
        font-weight: 500;
        color: var(--text-bright);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .location-display .search-icon {
        width: 10px;
        height: 10px;
        color: var(--neon-cyan);
        opacity: 0.5;
    }

    /* Mode Badge - Small, inline */
    .hud-mode {
        order: 2;
        padding: 0;
        border: none;
    }

    .hud-mode.hidden {
        display: none !important;
    }

    .mode-badge {
        font-size: 0.45rem !important;
        padding: 0.15rem 0.4rem !important;
        letter-spacing: 0.08em;
    }

    /* Stats - Show all, horizontal */
    .hud-stats {
        order: 3;
        display: flex !important;
        align-items: center;
        gap: 1rem;
        padding: 0;
        border: none;
        flex: 1;
        justify-content: center;
    }

    .hud-stat {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.35rem;
        padding: 0;
        min-width: auto;
    }

    /* Show labels in landscape */
    .hud-label {
        display: block !important;
        font-size: 0.5rem;
        font-weight: 500;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .hud-stat .hud-value {
        font-family: var(--font-display);
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-bright);
    }

    .hud-stat .hud-dim {
        font-size: 0.7rem;
        opacity: 0.5;
    }

    /* Score styling */
    #stat-score .hud-value {
        color: var(--sunset-gold);
        text-shadow: 0 0 6px rgba(255, 216, 102, 0.3);
    }

    /* Show distance in landscape */
    #stat-distance {
        display: flex !important;
    }

    .hud-divider {
        display: block !important;
        height: 20px;
        width: 1px;
        background: rgba(255, 255, 255, 0.1);
    }

    /* Controls - Show inline */
    .hud-controls {
        order: 4;
        display: flex !important;
        align-items: center;
        gap: 0.35rem;
        padding: 0;
        border: none;
    }

    .hud-btn {
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 6px;
    }

    .hud-btn:active {
        background: rgba(65, 217, 217, 0.15);
        border-color: rgba(65, 217, 217, 0.25);
    }

    .hud-btn svg {
        width: 14px;
        height: 14px;
    }

    /* User section - Compact */
    .hud-user {
        order: 5;
        display: flex !important;
        padding: 0;
        border: none;
    }

    .hud-user .hud-btn {
        width: 32px;
        height: 32px;
    }

    .hud-user .username-label {
        display: none;
    }

    /* Hide menu button in landscape - show controls inline */
    .hud-menu-btn {
        display: none !important;
    }

    .mobile-menu {
        display: none !important;
    }

    /* Inline search overlay - landscape optimized */
    .location-search-inline {
        padding: 0.35rem 1rem;
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
    }

    .inline-search-input {
        height: 38px;
        font-size: 0.9rem;
    }

    .close-search-btn {
        width: 38px;
        height: 38px;
    }

    .inline-search-results {
        top: 50px;
        max-height: 40vh;
    }

    .inline-search-result {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* End of mobile styles - hide mobile-only elements on desktop */
@media (min-width: 601px) and (min-height: 501px) {
    .hud-menu-btn,
    .mobile-menu {
        display: none !important;
    }
}

/* ============================================================================
   END MOBILE
   ============================================================================ */

/* Ensure mode classes work for hiding stats */
.mode-visualizer .stat-extra,
.mode-explorer .stat-extra {
    display: none !important;
}

/* Mode-specific mobile adjustments */
@media (max-width: 600px) {
    /* In visualizer/explorer, hide score too - only show pathfind count */
    .mode-visualizer #stat-score,
    .mode-explorer #stat-score {
        display: none !important;
    }
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
    .hud-btn:active {
        background: rgba(65, 217, 217, 0.2) !important;
        border-color: rgba(65, 217, 217, 0.4) !important;
        transform: scale(0.95);
    }
}

/* =============================================================================
   ACHIEVEMENT TOAST - Unlocked achievement notification
   ============================================================================= */

.achievement-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 10000;

    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;

    background: linear-gradient(135deg,
        rgba(26, 22, 37, 0.95) 0%,
        rgba(34, 29, 46, 0.95) 100%);
    border: 1px solid rgba(65, 217, 217, 0.3);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(65, 217, 217, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);

    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.achievement-toast-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
    animation: achievementBounce 0.6s ease-out;
}

@keyframes achievementBounce {
    0% { transform: scale(0) rotate(-15deg); }
    50% { transform: scale(1.3) rotate(5deg); }
    70% { transform: scale(0.9) rotate(-2deg); }
    100% { transform: scale(1) rotate(0); }
}

.achievement-toast-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.achievement-toast-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.achievement-toast-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-bright);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Rarity variations */
.achievement-toast.rarity-common {
    border-color: rgba(65, 217, 217, 0.4);
}

.achievement-toast.rarity-uncommon {
    border-color: rgba(125, 234, 125, 0.5);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(125, 234, 125, 0.25);
}

.achievement-toast.rarity-uncommon .achievement-toast-label {
    color: var(--neon-green);
}

.achievement-toast.rarity-rare {
    border-color: rgba(198, 120, 221, 0.5);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(198, 120, 221, 0.3);
}

.achievement-toast.rarity-rare .achievement-toast-label {
    color: var(--neon-purple);
}

.achievement-toast.rarity-epic {
    border-color: rgba(255, 107, 157, 0.5);
    background: linear-gradient(135deg,
        rgba(40, 22, 37, 0.95) 0%,
        rgba(50, 29, 46, 0.95) 100%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 107, 157, 0.35);
}

.achievement-toast.rarity-epic .achievement-toast-label {
    color: var(--neon-pink);
}

.achievement-toast.rarity-legendary {
    border-color: rgba(255, 215, 0, 0.6);
    background: linear-gradient(135deg,
        rgba(45, 35, 20, 0.95) 0%,
        rgba(55, 45, 25, 0.95) 100%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 35px rgba(255, 215, 0, 0.4),
        0 0 60px rgba(255, 215, 0, 0.15);
    animation: legendaryPulse 2s ease-in-out infinite;
}

.achievement-toast.rarity-legendary .achievement-toast-label {
    color: #ffd866;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.achievement-toast.rarity-legendary .achievement-toast-name {
    background: linear-gradient(90deg, #ffd866, #ffb347, #ffd866);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: legendaryShine 3s ease-in-out infinite;
}

@keyframes legendaryPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 35px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 50px rgba(255, 215, 0, 0.6); }
}

@keyframes legendaryShine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .achievement-toast {
        top: 60px;
        padding: 10px 16px;
        gap: 10px;
        max-width: calc(100vw - 40px);
    }

    .achievement-toast-icon {
        font-size: 1.6rem;
    }

    .achievement-toast-label {
        font-size: 0.55rem;
    }

    .achievement-toast-name {
        font-size: 0.95rem;
    }
}
