        :root {
            --bg-color: #1a1d21;
            --panel-bg: rgba(30, 39, 46, 0.95);
            --accent: #0984e3;
            --success: #00b894;
            --danger: #d63031;
            --warning: #fdcb6e;
            --text: #dfe6e9;
            --ad-height: 60px; /* Defined height for the ad bar */
        }

        body {
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            color: var(--text);
            font-family: 'Exo 2', sans-serif;
            overflow: hidden;
            user-select: none;
            -webkit-user-select: none;
            touch-action: none;
            width: 100vw; 
            height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* Game Area Wrapper */
        #game-container {
            position: relative;
            width: 100%;
            /* Calculate height minus ad bar */
            height: calc(100vh - var(--ad-height)); 
            overflow: hidden;
            flex-grow: 1;
        }

        canvas { 
            display: block; 
            background-color: #2d3436; 
            cursor: crosshair; 
            touch-action: none; 
        }

        /* Ad Wrapper Fixed at Bottom */
        #ad-wrapper {
            width: 100vw; /* Explicit viewport width to prevent 0-width errors */
            height: var(--ad-height);
            background-color: #000;
            /* Use block display to ensure width is communicated to children immediately */
            display: block; 
            z-index: 2000;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
            box-sizing: border-box;
            overflow: hidden;
            position: relative;
        }

        #ui-layer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%; /* Relative to game-container */
            pointer-events: none;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 10px; /* Reduced overall padding */
            box-sizing: border-box;
        }

        #top-bar {
            background: var(--panel-bg);
               /* background: var(--panel-bg); */
            backdrop-filter: blur(10px);
            padding: 8px 15px; /* Compact padding */
            border-radius: 12px;
            display: flex;
            gap: 15px; /* Reduced gap */
            pointer-events: auto;
            border: 1px solid rgba(255,255,255,0.1);
            box-shadow: 0 8px 32px rgba(0,0,0,0.3);
            align-items: center;
            flex-wrap: wrap; 
            min-height: 50px; /* Reduced height */
            margin-top: 45px;
        }

        .airport-name {
            font-size: 1.1rem; /* Slightly smaller */
            font-weight: 700;
            color: white;
            border-bottom: 2px solid var(--accent);
            padding-bottom: 2px;
            margin-right: 10px;
        }
        .airport-name:focus { outline: none; border-color: var(--success); }

        .stat { display: flex; flex-direction: column; }
        .stat-label { font-size: 0.65rem; color: #b2bec3; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
        .stat-val { font-size: 1.1rem; font-weight: 700; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
        .money { color: var(--success); }
        .pax-count { color: var(--accent); }
        
        .status-badge {
            padding: 4px 10px;
            border-radius: 6px;
            font-weight: bold;
            font-size: 0.8rem;
            text-transform: uppercase;
        }
        .status-ok { background: rgba(0, 184, 148, 0.2); color: var(--success); border: 1px solid var(--success); }
        .status-bad { background: rgba(214, 48, 49, 0.2); color: var(--danger); border: 1px solid var(--danger); animation: pulse 2s infinite; }

        #toolbar {
            background: var(--panel-bg);
            backdrop-filter: blur(10px);
            padding: 8px; /* Compact padding */
            border-radius: 16px;
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 8px; /* Tighter gap */
            pointer-events: auto;
            border: 1px solid rgba(255,255,255,0.1);
            box-shadow: 0 10px 40px rgba(0,0,0,0.4);
            margin: 0 auto;
            max-width: 98%;
            overflow-x: auto;
            max-height: 30vh;
            margin-bottom: 5px; 
        }

        .tool-btn {
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.1);
            color: #bdc3c7;
            padding: 8px 10px; /* Smaller padding */
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 60px; /* Narrower buttons */
            position: relative;
            overflow: hidden;
            flex-shrink: 0; 
        }

        .tool-btn.active { 
            background: var(--accent); 
            color: white;
            border-color: rgba(255,255,255,0.3);
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(9, 132, 227, 0.4);
        }

        .tool-icon { font-size: 1.4rem; margin-bottom: 3px; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3)); }
        .tool-name { font-size: 0.7rem; font-weight: 600; }
        .tool-cost { font-size: 0.65rem; color: var(--warning); margin-top: 1px; font-weight: bold; }

        #msg-container {
            position: absolute;
            top: 80px;
            right: 20px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            pointer-events: none;
            align-items: flex-end;
            z-index: 10;
        }
        .msg {
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(4px);
            color: white;
            padding: 8px 15px;
            border-radius: 6px;
            font-size: 0.85rem;
            border-right: 4px solid var(--warning);
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        @keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

        #tutorial {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: linear-gradient(135deg, #2c3e50, #1e272e);
            padding: 30px;
            border-radius: 20px;
            border: 1px solid rgba(255,255,255,0.1);
            text-align: center;
            pointer-events: auto;
            max-width: 500px;
            width: 85%;
            box-shadow: 0 20px 60px rgba(0,0,0,0.6);
            z-index: 100;
        }
        #tutorial h2 { color: var(--warning); margin: 0 0 10px 0; font-size: 1.8rem; }
        #tutorial ul { text-align: left; color: #dfe6e9; font-size: 0.95rem; line-height: 1.5; background: rgba(0,0,0,0.2); padding: 15px 30px; border-radius: 10px; }
        #tutorial button {
            background: var(--success); border: none; padding: 12px 35px;
            color: white; font-weight: bold; font-size: 1rem;
            border-radius: 50px; cursor: pointer; margin-top: 15px;
            box-shadow: 0 5px 15px rgba(0, 184, 148, 0.4);
            transition: transform 0.2s;
        }
        #tutorial button:hover { transform: scale(1.05); }

        /* Aggressive Mobile Optimization */
        @media (max-width: 768px) {
            #ui-layer { padding: 5px; }
            
            #top-bar { 
                padding: 5px 10px; 
                gap: 8px; 
                justify-content: space-between; 
                border-radius: 8px; 
                width: 100%; 
                min-height: 40px;
            }
            
            .stat { align-items: center; margin: 0 2px; }
            .stat-val { font-size: 0.9rem; }
            .stat-label { font-size: 0.5rem; letter-spacing: 0.5px; }
            
            /* Hide status detail on mobile to save space */
            #status-detail { display: none !important; }
            
            .airport-name { 
                font-size: 0.9rem; 
                margin-right: 5px; 
                max-width: 80px; 
                white-space: nowrap; 
                overflow: hidden; 
                text-overflow: ellipsis; 
            }
            
            .status-badge {
                padding: 2px 6px;
                font-size: 0.7rem;
            }

            #toolbar { 
                padding: 6px 4px; 
                gap: 6px; 
                width: 100%; 
                max-width: 100%; 
                border-radius: 10px; 
                justify-content: flex-start; 
                flex-wrap: nowrap; 
                overflow-x: auto; 
                -webkit-overflow-scrolling: touch; 
                margin-bottom: 2px; 
            }
            #toolbar::-webkit-scrollbar { display: none; }
            
            .tool-btn { 
                min-width: 50px; 
                padding: 5px 2px; 
            }
            .tool-icon { font-size: 1.2rem; margin-bottom: 1px; }
            .tool-name { font-size: 0.6rem; }
            .tool-cost { font-size: 0.55rem; margin-top: 0; }
            
            #msg-container { top: 60px; right: 5px; }
            
            #tutorial { width: 90%; padding: 20px; }
            #tutorial h2 { font-size: 1.4rem; }
            #tutorial ul { padding: 10px 15px; font-size: 0.85rem; }
        }