        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background: #001F3F;
            overflow: hidden;
            position: relative;
            height: 100vh;
            width: 100vw;
            margin: 0;
            padding: 0;
            /* Add padding top for fixed header */
            padding-top: calc(env(safe-area-inset-top, 0px) + 64px);
        }
        
        /* Main Map Container */
        #map {
            height: calc(100vh - env(safe-area-inset-top, 0px) - 64px);
            width: 100vw;
            z-index: 1;
            margin-top: calc(env(safe-area-inset-top, 0px) + 64px);
        }
        
        /* Floating UI Elements */
        .floating-ui {
            position: absolute;
            z-index: 1000;
            pointer-events: none;
        }
        
        .floating-ui * {
            pointer-events: auto;
        }
        
        /* Mobile-First Header Design */
        .top-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: rgba(0,31,63,0.98);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255,255,255,0.1);
            z-index: 1000;
            height: auto;
            min-height: calc(env(safe-area-inset-top, 0px) + 64px);
            padding: env(safe-area-inset-top, 0px) 0 0 0;
            box-shadow: 0 2px 20px rgba(0,31,63,0.8);
        }
        
        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            min-height: 64px;
            gap: 12px;
        }
        
        /* Header Text - Flexible Center */
        .header-text {
            flex: 1;
            text-align: center;
            min-width: 0; /* Allows text to shrink */
        }
        
        .logo-text {
            color: white;
            font-size: 16px;
            font-weight: 700;
            text-shadow: 0 1px 3px rgba(0,0,0,0.3);
            line-height: 1.3;
            margin-bottom: 2px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .subtitle {
            color: rgba(255,255,255,0.85);
            font-size: 12px;
            font-weight: 400;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        /* Button Containers - Left and Right Sides */
        .primary-buttons {
            display: flex;
            flex-direction: row;
            gap: 8px;
            align-items: center;
            flex-shrink: 0;
        }
        
        .secondary-buttons {
            display: flex;
            flex-direction: row;
            gap: 6px;
            align-items: center;
            flex-shrink: 0;
        }
        
        /* Primary Buttons (Settings, Reverse) */
        .settings-btn.primary, .reverse-btn.primary {
            padding: 8px 10px;
            background: rgba(255,255,255,0.15);
            border: 1px solid rgba(255,255,255,0.3);
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 11px;
            font-weight: 600;
            color: white;
            cursor: pointer;
            transition: all 0.2s;
            backdrop-filter: blur(10px);
            box-shadow: 0 1px 4px rgba(0,0,0,0.2);
            white-space: nowrap;
            min-height: 32px;
        }
        
        .reverse-btn.primary {
            background: rgba(16,185,129,0.15);
            border-color: rgba(16,185,129,0.4);
        }
        
        /* Secondary Buttons (History, Language) */
        .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
            padding: 6px 8px;
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 6px;
            display: flex;
            align-items: center;
            gap: 3px;
            font-size: 10px;
            font-weight: 500;
            color: rgba(255,255,255,0.8);
            cursor: pointer;
            transition: all 0.2s;
            backdrop-filter: blur(8px);
            white-space: nowrap;
            min-height: 28px;
        }
        
        .history-btn.secondary, .about-btn.secondary {
            background: rgba(16,185,129,0.1);
            border-color: rgba(16,185,129,0.3);
        }
        
        /* Button Text Sizing */
        .btn-text {
            font-size: 12px;
            font-weight: 600;
        }
        
        .btn-text-small {
            font-size: 10px;
            font-weight: 500;
        }
        
        /* Button States */
        .settings-btn.primary:hover, .reverse-btn.primary:hover {
            background: rgba(255,255,255,0.25);
            transform: translateY(-1px);
        }
        
        .settings-btn.primary:active, .reverse-btn.primary:active {
            background: rgba(255,255,255,0.3);
            transform: translateY(0);
        }
        
        .history-btn.secondary:hover, .share-btn.secondary:hover {
            background: rgba(255,255,255,0.2);
            transform: translateY(-1px);
        }
        
        .history-btn.secondary:active, .share-btn.secondary:active {
            background: rgba(255,255,255,0.25);
            transform: translateY(0);
        }
        
        /* Language Switcher Integration */
        .secondary-buttons .language-switcher .language-button {
            padding: 6px 8px !important;
            font-size: 10px !important;
            min-width: 35px !important;
            border-radius: 6px !important;
            border-width: 1px !important;
            border-color: rgba(255,255,255,0.2) !important;
            background: rgba(255,255,255,0.1) !important;
            color: rgba(255,255,255,0.8) !important;
            min-height: 28px !important;
            transition: all 0.2s !important;
        }
        
        .secondary-buttons .language-switcher .language-button:hover {
            background: rgba(255,255,255,0.2) !important;
            transform: translateY(-1px) !important;
        }
        
        /* Responsive Design */
        @media (max-width: 480px) {
            .header-content {
                gap: 8px;
                padding: 10px 12px;
            }
            
            .logo-text {
                font-size: 15px;
            }
            
            .subtitle {
                font-size: 11px;
            }
            
            .primary-buttons, .secondary-buttons {
                gap: 4px;
            }
            
            .settings-btn.primary, .reverse-btn.primary {
                padding: 6px 8px;
                font-size: 10px;
                min-height: 30px;
            }
            
            .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
                padding: 5px 6px;
                font-size: 9px;
                min-height: 26px;
            }
        }
        
        /* Very Small Screens - Icon Only Mode */
        @media (max-width: 380px) {
            .header-content {
                gap: 6px;
                padding: 8px 10px;
            }
            
            .btn-text, .btn-text-small {
                display: none;
            }
            
            .settings-btn.primary, .reverse-btn.primary {
                min-width: 32px;
                padding: 6px;
                justify-content: center;
                min-height: 32px;
            }
            
            .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
                min-width: 28px;
                padding: 5px;
                justify-content: center;
                min-height: 28px;
            }
            
            .secondary-buttons .language-switcher .language-button {
                min-width: 28px !important;
                padding: 5px !important;
                justify-content: center;
            }
            
            .logo-text {
                font-size: 14px;
            }
            
            .subtitle {
                font-size: 10px;
            }
        }
        
        /* Extra Small Screens */
        @media (max-width: 320px) {
            .header-content {
                gap: 4px;
                padding: 8px;
            }
            
            .primary-buttons, .secondary-buttons {
                gap: 3px;
            }
            
            .logo-text {
                font-size: 13px;
            }
            
            .subtitle {
                font-size: 9px;
            }
            
            .settings-btn.primary, .reverse-btn.primary {
                min-width: 30px;
                padding: 5px;
                min-height: 30px;
            }
            
            .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
                min-width: 26px;
                padding: 4px;
                min-height: 26px;
            }
        }
        
        /* Desktop/Large Screen Breakpoints */
        @media (min-width: 768px) {
            .header-content {
                padding: 16px 24px;
                gap: 16px;
            }
            
            .logo-text {
                font-size: 18px;
            }
            
            .subtitle {
                font-size: 14px;
            }
            
            .primary-buttons, .secondary-buttons {
                gap: 12px;
            }
            
            .settings-btn.primary, .reverse-btn.primary {
                padding: 10px 16px;
                font-size: 12px;
                min-height: 36px;
            }
            
            .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
                padding: 8px 12px;
                font-size: 11px;
                min-height: 32px;
            }
        }
        
        @media (min-width: 1024px) {
            .header-content {
                padding: 20px 32px;
                gap: 20px;
            }
            
            .logo-text {
                font-size: 20px;
            }
            
            .subtitle {
                font-size: 15px;
            }
            
            .primary-buttons, .secondary-buttons {
                gap: 16px;
            }
            
            .settings-btn.primary, .reverse-btn.primary {
                padding: 12px 20px;
                font-size: 13px;
                min-height: 40px;
            }
            
            /* Run button desktop positioning - avoid header overlap */
            .run-button {
                top: calc(env(safe-area-inset-top, 0px) + 220px);
                max-width: 400px;
            }
            
            .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
                padding: 10px 16px;
                font-size: 12px;
                min-height: 36px;
            }
        }
        
        /* Ultra-wide screens - Ensure buttons don't get too large */
        @media (min-width: 1200px) {
            .header-content {
                max-width: 1200px;
                margin: 0 auto;
                padding: 20px 40px;
            }
        }
        
        /* Overlap Prevention - If buttons get too close to center text */
        @media (max-width: 768px) and (min-width: 481px) {
            /* Medium screens where overlap is most likely */
            .header-text {
                min-width: 200px; /* Ensure center text has minimum space */
            }
            
            .primary-buttons, .secondary-buttons {
                min-width: 0;
                flex-shrink: 1; /* Allow buttons to shrink if needed */
            }
            
            /* If text is too long, prioritize icons */
            .btn-text, .btn-text-small {
                display: none;
            }
            
            .settings-btn.primary, .reverse-btn.primary {
                min-width: 40px;
                padding: 8px 12px;
                justify-content: center;
            }
            
            .history-btn.secondary, .about-btn.secondary, .share-btn.secondary {
                min-width: 36px;
                padding: 6px 10px;
                justify-content: center;
            }
            
            .secondary-buttons .language-switcher .language-button {
                min-width: 32px !important;
                padding: 6px !important;
                justify-content: center;
            }
        }
        
        /* Dynamic Header Compact Mode - Activated by JavaScript when overlap detected */
        .header-compact-mode .btn-text,
        .header-compact-mode .btn-text-small {
            display: none !important;
        }
        
        .header-compact-mode .settings-btn.primary,
        .header-compact-mode .reverse-btn.primary {
            min-width: 36px;
            padding: 8px !important;
            justify-content: center;
        }
        
        .header-compact-mode .history-btn.secondary,
        .header-compact-mode .share-btn.secondary {
            min-width: 32px;
            padding: 6px !important;
            justify-content: center;
        }
        
        .header-compact-mode .secondary-buttons .language-switcher .language-button {
            min-width: 28px !important;
            padding: 6px !important;
            justify-content: center;
        }
        
        .settings-icon {
            font-size: 16px;
        }
        
        /* App Description */
        .app-description {
            top: calc(env(safe-area-inset-top, 0px) + 100px);
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 124, 186, 0.95);
            color: white;
            padding: 16px 24px;
            border-radius: 12px;
            font-size: 15px;
            text-align: center;
            box-shadow: 0 3px 15px rgba(0, 124, 186, 0.3);
            backdrop-filter: blur(10px);
            max-width: 320px;
            z-index: 80; /* Between step instructions and container picker */
        }
        
        .description-text {
            line-height: 1.4;
            word-wrap: break-word;
        }

        /* Container Picker Button - positioned when standalone */
        .container-picker-btn {
            bottom: 40%;
            left: 50%;
            transform: translateX(-50%);
            z-index: 200;
        }
        
        /* Container Picker Button - no positioning when in instructions container */
        .instructions-container .container-picker-btn {
            position: static;
            bottom: auto;
            left: auto;
            transform: none;
        }

        .pick-container-btn {
            background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
            color: white;
            border: none;
            padding: 16px 32px;
            border-radius: 25px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
        }

        .pick-container-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
        }

        /* Instructions Container - Natural stacking */
        .instructions-container {
            bottom: 50%;
            left: 50%;
            transform: translate(-50%, 50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 16px;
            max-width: 320px;
            z-index: 100;
        }
        
        /* Step Instructions - no positioning when in container */
        .instructions-container .step-instructions {
            background: rgba(255, 255, 255, 0.95);
            color: #333;
            padding: 20px 24px;
            border-radius: 16px;
            font-size: 14px;
            text-align: center;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            backdrop-filter: blur(10px);
            border: 2px solid rgba(0, 124, 186, 0.2);
            width: 100%;
        }
        
        .steps-title {
            font-size: 16px;
            font-weight: 600;
            color: #007cba;
            margin-bottom: 12px;
        }
        
        .steps-list {
            margin-bottom: 12px;
        }
        
        .step {
            margin-bottom: 6px;
            font-weight: 500;
            text-align: left;
        }
        
        .step:last-child {
            margin-bottom: 0;
        }
        
        .step.alternative-step {
            color: rgba(255,255,255,0.7);
            font-size: 13px;
            cursor: pointer;
            padding: 4px 8px;
            margin: 2px 0 6px 0;
            border-radius: 6px;
            transition: all 0.2s ease;
        }
        
        .step.alternative-step:hover {
            background: rgba(255,255,255,0.1);
            color: rgba(255,255,255,0.9);
        }
        
        .settings-hint {
            font-size: 12px;
            color: #666;
            font-style: italic;
            border-top: 1px solid #eee;
            padding-top: 8px;
            margin-top: 8px;
        }
        
        /* Science Footer */
        .science-footer {
            bottom: env(safe-area-inset-bottom, 20px);
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0,0,0,0.7);
            color: rgba(255,255,255,0.9);
            padding: 6px 12px;
            border-radius: 15px;
            font-size: 11px;
            backdrop-filter: blur(10px);
        }
        
        .science-footer a {
            color: #4ECDC4;
            text-decoration: none;
            font-weight: 500;
        }
        
        .science-footer a:hover {
            text-decoration: underline;
        }
        
        /* Drawing Instructions - For reverse analysis */
        .drawing-instructions {
            top: calc(env(safe-area-inset-top, 0px) + 200px);
            left: 50%;
            transform: translateX(-50%);
            background: rgba(52, 152, 219, 0.95);
            color: white;
            padding: 15px 20px;
            border-radius: 15px;
            text-align: center;
            max-width: 90%;
            backdrop-filter: blur(10px);
            z-index: 300;
        }
        
        .instruction-text {
            margin-bottom: 15px;
        }
        
        .drawing-buttons {
            display: flex;
            gap: 10px;
            justify-content: center;
        }
        
        .draw-btn {
            padding: 8px 16px;
            border: none;
            border-radius: 20px;
            background: white;
            color: #3498db;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .draw-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(255,255,255,0.3);
        }
        
        .draw-btn.active {
            background: #f39c12;
            color: white;
            animation: pulse 2s infinite;
        }
        
        .draw-btn.secondary {
            background: rgba(231, 76, 60, 0.9);
            color: white;
        }
        
        .draw-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* Run Simulation Button - Positioned at top to avoid map interference */
        .run-button {
            top: calc(env(safe-area-inset-top, 0px) + 200px);
            left: 50%;
            transform: translateX(-50%);
            width: calc(100% - 40px);
            max-width: 320px;
            text-align: center;
            z-index: 1200;
        }
        
        .run-simulation-btn {
            background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
            color: white;
            border: none;
            padding: 16px 32px;
            border-radius: 25px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 20px rgba(255,107,53,0.4);
            transition: all 0.3s;
            backdrop-filter: blur(10px);
        }
        
        .run-simulation-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 25px rgba(255,107,53,0.5);
        }
        
        .run-simulation-btn:active {
            transform: translateY(0);
        }
        
        .coordinates-section {
            margin-top: 8px;
        }
        
        .coordinates-display {
            background: rgba(0,0,0,0.7);
            color: white;
            padding: 6px 12px;
            border-radius: 15px;
            font-size: 11px;
            font-family: monospace;
            backdrop-filter: blur(10px);
            cursor: pointer;
            transition: background 0.2s ease;
        }
        
        .coordinates-display:hover {
            background: rgba(0,0,0,0.8);
        }
        
        .coordinates-display .edit-hint {
            color: rgba(255,255,255,0.6);
            font-size: 9px;
            margin-left: 4px;
        }
        
        .coordinates-inputs {
            background: rgba(255,255,255,0.95);
            border-radius: 12px;
            padding: 12px;
            margin-top: 6px;
            backdrop-filter: blur(10px);
            box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        }
        
        .coordinate-input-group {
            margin-bottom: 10px;
        }
        
        .coordinate-input-group:last-of-type {
            margin-bottom: 12px;
        }
        
        .coordinate-input-group label {
            display: block;
            font-size: 12px;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
        }
        
        .coordinate-input-group input {
            width: 100%;
            padding: 8px 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            font-family: monospace;
            transition: border-color 0.2s ease;
        }
        
        .coordinate-input-group input:focus {
            outline: none;
            border-color: #007cba;
            box-shadow: 0 0 0 3px rgba(0,124,186,0.1);
        }
        
        .coordinate-buttons {
            display: flex;
            gap: 8px;
            margin-top: 8px;
        }
        
        .coordinate-buttons .btn-secondary,
        .coordinate-buttons .btn-primary {
            flex: 1;
            padding: 8px 16px;
            border: none;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .coordinate-buttons .btn-secondary {
            background: #f5f5f5;
            color: #666;
        }
        
        .coordinate-buttons .btn-secondary:hover {
            background: #e0e0e0;
        }
        
        .coordinate-buttons .btn-primary {
            background: #007cba;
            color: white;
        }
        
        .coordinate-buttons .btn-primary:hover {
            background: #005a8a;
            box-shadow: 0 2px 8px rgba(0,124,186,0.3);
        }
        
        /* Object Selection Bottom Sheet */
        .object-sheet {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(10px);
            border-radius: 20px 20px 0 0;
            padding: 0 0 env(safe-area-inset-bottom, 0) 0;
            transform: translateY(100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            max-height: 70vh;
            overflow: hidden;
            box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
            z-index: 1000;
            pointer-events: auto;
        }
        
        .object-sheet.show {
            transform: translateY(0);
        }
        
        .object-sheet.minimized {
            transform: translateY(calc(100% - 60px));
        }
        
        .sheet-handle {
            width: 40px;
            height: 4px;
            background: #ddd;
            margin: 12px auto 8px;
            border-radius: 2px;
        }
        
        .sheet-toggle {
            position: absolute;
            top: 8px;
            right: 16px;
            width: 32px;
            height: 32px;
            background: rgba(0, 119, 190, 0.1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 16px;
            color: #0077BE;
        }
        
        .sheet-toggle:hover {
            background: rgba(0, 119, 190, 0.2);
            transform: scale(1.1);
        }
        
        /* Settings Panel */
        .settings-panel {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(5px);
            z-index: 2000;
            display: none;
            align-items: flex-start;
            justify-content: center;
            padding: env(safe-area-inset-top, 20px) 20px 20px 20px;
            overflow-y: auto;
        }
        
        .settings-panel.show {
            display: flex;
        }
        
        .settings-content {
            background: white;
            border-radius: 16px;
            width: 100%;
            max-width: 500px;
            max-height: 90vh;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0,0,0,0.3);
            margin-top: 60px;
            display: flex;
            flex-direction: column;
        }
        
        .settings-header {
            background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
            color: white;
            padding: 20px;
            border-radius: 16px 16px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }
        
        .settings-scroll-area {
            flex: 1;
            overflow-y: auto;
        }
        
        .settings-title {
            font-size: 18px;
            font-weight: 600;
        }
        
        .settings-close {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: rgba(255,255,255,0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 16px;
            font-weight: bold;
            transition: background-color 0.2s;
        }
        
        .settings-close:hover {
            background: rgba(255,255,255,0.3);
        }
        
        .setting-group {
            padding: 20px;
            border-bottom: 1px solid #f0f0f0;
        }
        
        .setting-group:last-child {
            border-bottom: none;
        }
        
        .setting-group h3 {
            margin: 0 0 16px 0;
            color: #333;
            font-size: 16px;
            font-weight: 600;
        }
        
        .setting-item {
            margin-bottom: 16px;
        }
        
        .setting-item:last-child {
            margin-bottom: 0;
        }
        
        .setting-item label {
            display: block;
            margin-bottom: 6px;
            font-weight: 500;
            color: #555;
        }
        
        .setting-item input,
        .setting-item select {
            width: 100%;
            padding: 10px 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.2s;
            box-sizing: border-box;
        }
        
        .setting-item input:focus,
        .setting-item select:focus {
            outline: none;
            border-color: #007cba;
        }
        
        .setting-item input[type="range"] {
            padding: 0;
            margin: 8px 0;
        }
        
        .range-display {
            text-align: center;
            font-weight: 600;
            color: #007cba;
            font-size: 14px;
        }
        
        .setting-help {
            margin-top: 4px;
            font-size: 12px;
            color: #888;
            line-height: 1.4;
        }
        
        .data-sources-info {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 16px;
        }
        
        .data-source {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
            font-size: 14px;
        }
        
        .data-source:last-child {
            margin-bottom: 0;
        }
        
        .source-icon {
            font-size: 16px;
        }
        
        .data-source-note {
            margin-top: 12px;
            font-style: italic;
            color: #666;
            font-size: 13px;
            text-align: center;
        }
        
        .settings-actions {
            display: flex;
            gap: 12px;
            padding: 20px;
        }
        
        .btn-primary,
        .btn-secondary {
            flex: 1;
            padding: 12px 20px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
        }
        
        .btn-primary {
            background: #007cba;
            color: white;
        }
        
        .btn-primary:hover {
            background: #005a87;
        }
        
        .btn-secondary {
            background: #f5f5f5;
            color: #666;
        }
        
        .btn-secondary:hover {
            background: #e0e0e0;
        }

        /* Results Panel */
        .results-panel {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(10px);
            border-radius: 16px 16px 0 0;
            padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
            transform: translateY(100%);
            transition: transform 0.3s ease;
            z-index: 1001;
            max-height: 250px;
            overflow-y: auto;
            box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
        }
        
        .results-panel.show {
            transform: translateY(0);
        }
        
        .results-panel.minimized {
            transform: translateY(calc(100% - 50px));
        }
        
        .results-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }
        
        .results-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .results-toggle {
            width: 28px;
            height: 28px;
            background: rgba(0, 119, 190, 0.1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 14px;
            color: #0077BE;
        }
        
        .results-content {
            font-size: 14px;
            line-height: 1.4;
            color: #666;
        }
        
        .sheet-title {
            font-size: 18px;
            font-weight: 600;
            text-align: center;
            margin: 8px 0 20px;
            color: #333;
        }
        
        .object-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            gap: 16px;
            padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
            overflow-y: auto;
            max-height: calc(60vh - 80px); /* Account for header space */
        }
        
        .object-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 16px 8px;
            border: 2px solid #f0f0f0;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s;
            background: white;
        }
        
        .object-item:hover,
        .object-item:active {
            border-color: #0077BE;
            background: #f8fcff;
            transform: scale(0.98);
        }
        
        .object-emoji {
            font-size: 32px;
            margin-bottom: 8px;
            line-height: 1;
        }
        
        .object-name {
            font-size: 12px;
            font-weight: 500;
            text-align: center;
            color: #333;
            line-height: 1.2;
        }
        
        /* Progress Dot Animation */
        .pulse-dot {
            animation: pulse 1.5s infinite;
        }
        
        @keyframes pulse {
            0% { 
                transform: scale(1); 
                filter: drop-shadow(0 0 8px #00FF00);
            }
            50% { 
                transform: scale(1.3); 
                filter: drop-shadow(0 0 16px #00FF00);
            }
            100% { 
                transform: scale(1); 
                filter: drop-shadow(0 0 8px #00FF00);
            }
        }
        
        /* Zoom Controls - Move lower to avoid header overlap */
        .leaflet-control-zoom {
            margin-top: 110px !important; /* Push below header with extra clearance */
            margin-left: 10px !important;
        }
        
        .leaflet-control-zoom a {
            background: rgba(255,255,255,0.95) !important;
            border: 1px solid #007cba !important;
            color: #007cba !important;
            font-weight: bold !important;
            font-size: 18px !important;
            width: 34px !important;
            height: 34px !important;
            line-height: 32px !important;
            backdrop-filter: blur(10px) !important;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
        }
        
        .leaflet-control-zoom a:hover {
            background: #007cba !important;
            color: white !important;
        }
        
        .speed-controls.active {
            opacity: 1;
            pointer-events: auto;
        }
        
        .speed-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: rgba(255,255,255,0.9);
            color: #333;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            backdrop-filter: blur(10px);
        }
        
        .speed-btn.active {
            background: #0077BE;
            color: white;
        }
        
        .speed-btn:hover {
            transform: scale(1.1);
        }

        .replay-btn {
            padding: 8px 12px;
            border: none;
            border-radius: 20px;
            background: rgba(76, 175, 80, 0.9);
            color: white;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            backdrop-filter: blur(10px);
            white-space: nowrap;
        }
        
        .replay-btn:hover {
            background: rgba(76, 175, 80, 1);
            transform: scale(1.05);
        }
        
        
        .btn-primary {
            background: #0077BE;
            color: white;
        }
        
        .btn-secondary {
            background: #f0f0f0;
            color: #333;
        }
        
        .action-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        
        /* Science Attribution */
        .science-attribution {
            margin-top: 20px;
            padding: 16px;
            background: #f8f9fa;
            border-radius: 8px;
            border-left: 4px solid #0077BE;
        }
        
        .science-title {
            font-size: 14px;
            font-weight: 600;
            color: #0077BE;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .science-text {
            font-size: 12px;
            color: #555;
            line-height: 1.4;
            margin-bottom: 8px;
        }
        
        .science-links {
            font-size: 11px;
        }
        
        .science-links a {
            color: #0077BE;
            text-decoration: none;
            font-weight: 500;
        }
        
        .science-links a:hover {
            text-decoration: underline;
        }
        
        /* Loading States */
        .loading-spinner {
            width: 24px;
            height: 24px;
            border: 3px solid #f0f0f0;
            border-top: 3px solid #0077BE;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            display: inline-block;
            vertical-align: middle;
            margin-right: 8px;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* Responsive Adjustments */
        @media (max-height: 600px) {
            .object-grid {
                max-height: 40vh;
            }
        }
        
        
        .end-marker {
            background: none !important;
            border: none !important;
            filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-3px); }
        }
        
        /* Hide elements initially */
        .hidden {
            display: none !important;
        }

        /* Simulation Progress Bar */
        #progress-container {
          position: absolute;
          bottom: 20px;
          left: 50%;
          transform: translateX(-50%);
          width: 80%;
          max-width: 400px;
          background: rgba(0, 0, 0, 0.7);
          border-radius: 10px;
          padding: 10px;
          z-index: 1001;
          text-align: center;
          color: white;
          font-size: 14px;
          backdrop-filter: blur(10px);
          box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
        }

        #progress-bar {
          width: 0%;
          height: 10px;
          background: linear-gradient(90deg, #4caf50, #81c784);
          border-radius: 5px;
          transition: width 0.5s ease-in-out;
          margin-top: 5px;
        }

        #progress-text {
          margin-top: 5px;
        }

        /* Enhanced Drawing Crosshairs */
        .leaflet-container.leaflet-crosshair {
            cursor: crosshair !important;
        }
        
        /* More visible crosshair cursor for drawing mode */
        .leaflet-draw-tooltip {
            background: rgba(0, 0, 0, 0.8) !important;
            color: white !important;
            border: 2px solid #3498db !important;
            border-radius: 8px !important;
            padding: 8px 12px !important;
            font-size: 14px !important;
            font-weight: 500 !important;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        }
        
        /* Disable arrow pointer that interferes with drawing */
        .leaflet-draw-tooltip:before {
            display: none !important;
        }
        
        @keyframes pointToCursor {
            0%, 100% { 
                transform: translateY(-50%) scale(1); 
                opacity: 1;
            }
            50% { 
                transform: translateY(-50%) scale(1.2); 
                opacity: 0.8;
            }
        }
        
        /* Enhanced crosshair overlay */
        .leaflet-container.leaflet-crosshair:after {
            content: '+';
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 32px;
            color: #3498db;
            text-shadow: 
                0 0 4px rgba(52, 152, 219, 0.8),
                0 0 8px rgba(52, 152, 219, 0.6);
            pointer-events: none;
            z-index: 10000;
            font-weight: bold;
            animation: crosshairPulse 2s ease-in-out infinite;
        }
        
        @keyframes crosshairPulse {
            0%, 100% { 
                opacity: 0.7;
                transform: translate(-50%, -50%) scale(1);
            }
            50% { 
                opacity: 1;
                transform: translate(-50%, -50%) scale(1.1);
            }
        }
        
        /* Drawing instruction enhancement */
        .leaflet-draw-actions {
            background: rgba(52, 152, 219, 0.9) !important;
            border-radius: 8px !important;
            padding: 8px !important;
        }
        
        .leaflet-draw-actions a {
            background: rgba(255, 255, 255, 0.9) !important;
            color: #333 !important;
            border-radius: 6px !important;
            padding: 6px 12px !important;
            margin: 2px !important;
            font-weight: 500 !important;
        }
        
        /* Ensure settings panel has proper z-index and styling */
        .settings-panel {
            z-index: 10001 !important;
        }
        
        .settings-content {
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
        }
        
        /* Fix any potential settings form styling issues */
        .settings-panel .setting-group {
            margin-bottom: 16px;
        }
        
        .settings-panel .setting-label {
            font-weight: 600;
            margin-bottom: 8px;
            color: #333;
        }
        
        .settings-panel .setting-select,
        .settings-panel input[type="number"] {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
        }
        
        /* Enhanced settings styling for reverse page */
        .settings-scroll-area {
            padding: 20px;
            max-height: 60vh;
            overflow-y: auto;
        }
        
        .setting-group {
            padding: 16px 0 !important;
            border-bottom: 1px solid #eee !important;
            margin-bottom: 0 !important;
        }
        
        .setting-group:last-child {
            border-bottom: none !important;
        }
        
        .setting-label {
            font-size: 16px !important;
            font-weight: 600 !important;
            color: #333 !important;
            margin-bottom: 8px !important;
            display: block !important;
        }
        
        .setting-content {
            padding-left: 0 !important;
        }
        
        .duration-input {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }
        
        .duration-input input {
            width: 80px !important;
            padding: 8px 12px !important;
            border: 1px solid #ddd !important;
            border-radius: 6px !important;
            font-size: 14px !important;
        }
        
        .duration-unit {
            font-size: 14px;
            color: #666;
            font-weight: 500;
        }
        
        .setting-description {
            font-size: 13px !important;
            color: #666 !important;
            line-height: 1.4 !important;
            margin-top: 4px !important;
        }
        
        .setting-select {
            width: 100% !important;
            padding: 10px 12px !important;
            border: 1px solid #ddd !important;
            border-radius: 6px !important;
            font-size: 14px !important;
            background: white !important;
            margin-bottom: 8px !important;
        }
        
        .settings-actions {
            padding: 16px 20px !important;
            border-top: 1px solid #eee !important;
            background: #f8f9fa !important;
        }
        
        .settings-actions button {
            padding: 12px 20px !important;
            font-size: 14px !important;
            font-weight: 600 !important;
            border-radius: 8px !important;
            border: none !important;
            cursor: pointer !important;
        }