:root {
            --bg-dark: #0f172a;
            --bg-card: #1e293b;
            --accent-cyan: #06b6d4;
            --accent-yellow: #eab308;
            --accent-red: #ef4444;
            --accent-green: #10b981;
            --accent-purple: #a855f7;
            --accent-blue: #38bdf8;
            --text-light: #f8fafc;
            --text-muted: #94a3b8;
            --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body, html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            background-color: var(--bg-dark);
            color: var(--text-light);
            font-family: var(--font-family);
            overflow: hidden;
        }

        #login-overlay {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background-color: var(--bg-dark);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            box-sizing: border-box;
        }

        #app-layout {
            display: grid;
            grid-template-columns: 400px 1fr;
            width: 100vw;
            height: 100vh;
        }

        #sidebar {
            background-color: var(--bg-dark);
            border-right: 1px solid #334155;
            display: flex;
            flex-direction: column;
            height: 100%;
            box-sizing: border-box;
            overflow: hidden;
        }

        #sidebar-tabs {
            display: flex;
            flex-wrap: wrap;
            border-bottom: 1px solid #334155;
            background-color: #0f172a;
        }

        .tab-btn {
            flex: 1 1 22%;
            background: none;
            border: none;
            color: var(--text-muted);
            padding: 10px 4px;
            font-size: 10px;
            font-weight: bold;
            cursor: pointer;
            text-transform: uppercase;
            text-align: center;
            border-bottom: 2px solid transparent;
            transition: all 0.2s ease;
        }

        .tab-btn.active {
            color: var(--accent-cyan);
            border-bottom: 2px solid var(--accent-cyan);
            background-color: var(--bg-card);
        }

        #sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 14px;
            box-sizing: border-box;
        }

        #map-container {
            position: relative;
            width: 100%;
            height: 100%;
            min-width: 0;
            min-height: 0;
            overflow: hidden;
        }

        #map {
            width: 100%;
            height: 100%;
            min-width: 0;
            min-height: 0;
            background-color: #0f172a;
        }

        @media (max-width: 768px) {
            #app-layout {
                grid-template-columns: 1fr;
                grid-template-rows: 48vh 52vh;
                height: 100vh;
            }
            #sidebar {
                border-right: none;
                border-top: 1px solid #334155;
                height: 100%;
            }
        }

        .hud-panel {
            background-color: var(--bg-card);
            border-radius: 8px;
            border: 1px solid #334155;
            padding: 12px;
            margin-bottom: 12px;
        }

        .hud-title {
            font-weight: bold;
            color: var(--accent-yellow);
            margin-bottom: 8px;
            text-transform: uppercase;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .btn {
            background-color: var(--accent-cyan);
            color: var(--bg-dark);
            border: none;
            padding: 6px 10px;
            border-radius: 4px;
            font-weight: bold;
            cursor: pointer;
            font-size: 11px;
            transition: all 0.2s ease;
            text-transform: uppercase;
        }

        .btn:hover {
            opacity: 0.9;
        }

        .btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            filter: grayscale(0.7);
        }

        .btn-block {
            display: block;
            width: 100%;
            margin-bottom: 6px;
        }

        .btn-green { background-color: var(--accent-green); color: white; }
        .btn-red { background-color: var(--accent-red); color: white; }
        .btn-yellow { background-color: var(--accent-yellow); color: #000; }
        .btn-purple { background-color: var(--accent-purple); color: white; }
        .btn-cyan { background-color: var(--accent-cyan); color: #000; }

        .leaflet-popup-content-wrapper {
            background-color: var(--bg-card) !important;
            color: var(--text-light) !important;
            border: 1px solid #475569;
            border-radius: 8px;
        }
        .leaflet-popup-tip {
            background-color: var(--bg-card) !important;
        }

        .badge {
            display: inline-block;
            padding: 2px 4px;
            border-radius: 3px;
            font-size: 10px;
            font-weight: bold;
            background-color: #475569;
            color: #fff;
        }
        
        .badge-cyan { background-color: var(--accent-cyan); color: #000; }
        .badge-yellow { background-color: var(--accent-yellow); color: #000; }
        .badge-green { background-color: var(--accent-green); }
        .badge-red { background-color: var(--accent-red); }
        .badge-purple { background-color: var(--accent-purple); }

        #controls-tip {
            position: absolute;
            bottom: 20px;
            left: 20px;
            background-color: rgba(15, 23, 42, 0.95);
            padding: 6px 14px;
            border-radius: 99px;
            border: 1px solid var(--accent-cyan);
            z-index: 1000;
            pointer-events: none;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
        }

        /* Floating Recenter Map Button */
        #btn-recenter-map {
            position: absolute;
            bottom: 20px;
            right: 20px;
            z-index: 1000;
            background-color: var(--accent-yellow);
            color: #000;
            border: none;
            border-radius: 99px;
            padding: 8px 16px;
            font-size: 12px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 4px 10px rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            gap: 6px;
            transition: transform 0.1s ease;
        }
        #btn-recenter-map:hover {
            transform: scale(1.05);
        }

        /* Floating Deploy Structure Deck */
        #deploy-deck {
            position: absolute;
            top: 20px;
            right: 20px;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        /* Off-screen Companion Radar Edge Container */
        #companion-radar-container {
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none;
            z-index: 1100;
            overflow: hidden;
        }

        .radar-pill {
            position: absolute;
            pointer-events: auto;
            background: rgba(15, 23, 42, 0.92);
            border: 2px solid var(--accent-green);
            color: var(--text-light);
            border-radius: 99px;
            padding: 4px 8px;
            font-size: 10px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 4px 10px rgba(0,0,0,0.7);
            display: flex;
            align-items: center;
            gap: 4px;
            transform: translate(-50%, -50%);
            white-space: nowrap;
            transition: transform 0.15s ease, border-color 0.2s ease;
        }
        .radar-pill:hover {
            transform: translate(-50%, -50%) scale(1.1);
            border-color: var(--accent-cyan);
        }

        .progress-bar {
            width: 100%;
            height: 6px;
            background-color: #475569;
            border-radius: 99px;
            overflow: hidden;
            margin-top: 4px;
        }
        
        .progress-fill {
            height: 100%;
            background-color: var(--accent-cyan);
        }

        .companion-card {
            background: #0f172a;
            border: 1px solid #334155;
            border-radius: 6px;
            padding: 10px;
            margin-bottom: 10px;
        }

        /* Log Sub-tabs */
        .log-filter-btn {
            flex: 1;
            background: #0f172a;
            border: 1px solid #334155;
            color: var(--text-muted);
            padding: 6px 4px;
            font-size: 10px;
            font-weight: bold;
            border-radius: 4px;
            cursor: pointer;
            text-align: center;
        }
        .log-filter-btn.active {
            background: var(--accent-cyan);
            color: #000;
            border-color: var(--accent-cyan);
        }

        /* Resizable Action Log Box (Doubled 2x size to 800px) */
        .action-log-box {
            font-family: monospace;
            background-color: #090d16;
            color: #38bdf8;
            padding: 10px;
            border-radius: 6px;
            height: 800px;
            min-height: 480px;
            max-height: 90vh;
            overflow-y: auto;
            border: 1px solid #1e293b;
            font-size: 11px;
            resize: vertical;
            line-height: 1.4;
        }

        .log-entry {
            margin-bottom: 6px;
            padding-bottom: 4px;
            border-bottom: 1px solid rgba(51, 65, 85, 0.4);
        }

        .recipe-item {
            background-color: #0f172a;
            border: 1px solid #334155;
            padding: 8px;
            border-radius: 6px;
            margin-bottom: 8px;
        }

        /* Full Screen Modals */
        .game-modal {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background-color: rgba(10, 15, 29, 0.97);
            z-index: 1500;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 16px;
            box-sizing: border-box;
        }

        .modal-container {
            background-color: var(--bg-card);
            border: 2px solid var(--accent-cyan);
            border-radius: 12px;
            width: 100%;
            max-width: 540px;
            max-height: 90vh;
            overflow-y: auto;
            padding: 18px;
            box-sizing: border-box;
            box-shadow: 0 0 30px rgba(0,0,0,0.8);
        }

        .battle-arena {
            position: relative;
            background: linear-gradient(180deg, #111827 0%, #0a0f1d 100%);
            border: 1px solid #334155;
            border-radius: 8px;
            height: 130px;
            margin: 10px 0;
            overflow: hidden;
            display: flex;
            align-items: center;
        }

        .player-fighter {
            position: absolute;
            left: 20px;
            bottom: 20px;
            font-size: 44px;
            filter: drop-shadow(0 0 8px rgba(6,182,212,0.6));
        }

        .monster-fighter {
            position: absolute;
            right: 20px;
            bottom: 20px;
            font-size: 44px;
            filter: drop-shadow(0 0 8px rgba(239,68,68,0.6));
            transition: right 0.15s linear;
        }

        .intent-banner {
            background: rgba(239, 68, 68, 0.2);
            border: 1px solid var(--accent-red);
            border-radius: 6px;
            padding: 6px;
            font-size: 11px;
            font-weight: bold;
            color: #fca5a5;
            margin-bottom: 8px;
            text-align: center;
        }

        /* Draggable HUD Floating Notification Window */
        #floating-alert {
            position: absolute;
            top: 70px;
            right: 20px;
            width: 320px;
            background-color: rgba(30, 41, 59, 0.95);
            border: 1px solid var(--accent-cyan);
            border-radius: 8px;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
            z-index: 1200;
            display: none;
            overflow: hidden;
        }

        #floating-alert-header {
            background-color: #0f172a;
            padding: 8px 12px;
            font-weight: bold;
            font-size: 11px;
            color: var(--accent-cyan);
            cursor: move;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #334155;
        }

        #floating-alert-body {
            padding: 12px;
            font-size: 12px;
            color: var(--text-light);
            line-height: 1.4;
        }

        /* Switch Toggles in Admin Panel */
        .switch-container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            font-size: 12px;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 40px;
            height: 20px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: #475569;
            transition: .3s;
            border-radius: 20px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 14px;
            width: 14px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: .3s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: var(--accent-green);
        }

        input:checked + .slider:before {
            transform: translateX(20px);
        }

        .gear-slot-box {
            background: #0f172a;
            border: 1px solid #475569;
            border-radius: 6px;
            padding: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .gear-slot-box:hover {
            border-color: var(--accent-cyan);
        }

        .conflict-card {
            background: #0f172a;
            border: 2px solid #334155;
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 12px;
            transition: all 0.2s ease;
        }
        .conflict-card:hover {
            border-color: var(--accent-cyan);
        }
