        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: Arial, sans-serif;
            background: #1a1a1a;
            color: #fff;
            overflow: hidden;
        }
        
        #canvas {
            display: block;
            width: 100%;
            height: calc(100vh - 180px);
        }
        
        .ui-panel {
            position: absolute;
            background: rgba(0, 0, 0, 0.8);
            border: 2px solid #d4af37;
            border-radius: 5px;
            padding: 15px;
            color: #fff;
            font-size: 12px;
        }
        
        .controls {
            top: 10px;
            left: 10px;
            width: 150px;
            max-height: 90vh;
            overflow-y: auto;
        }
        
        .info {
            top: 10px;
            right: 10px;
            width: 250px;
        }
        
        .section {
            margin-bottom: 15px;
            border-bottom: 1px solid #d4af37;
            padding-bottom: 10px;
        }
        
        .section:last-child {
            border-bottom: none;
        }
        
        h3 {
            color: #d4af37;
            margin-bottom: 10px;
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        
        .button-group {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 10px;
        }
        
        button {
            background: #333;
            border: 1px solid #d4af37;
            color: #fff;
            padding: 8px;
            cursor: pointer;
            border-radius: 3px;
            font-size: 11px;
            transition: all 0.2s;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        
        button:hover {
            background: #d4af37;
            color: #000;
        }
        
        button.active {
            background: #d4af37;
            color: #000;
            font-weight: bold;
        }
        
        .slider-group {
            margin: 8px 0;
        }
        
        label {
            display: block;
            margin-bottom: 5px;
            font-size: 11px;
            text-transform: uppercase;
        }
        
        input[type="range"] {
            width: 100%;
            cursor: pointer;
            accent-color: #d4af37;
            margin-top: 4px;
        }

        #timeLabel {
            color: #fff;
            font-weight: bold;
        }
        
        input[type="color"] {
            width: 40px;
            height: 30px;
            cursor: pointer;
        }
        
        .grid-size-options {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }
        
        .grid-size-options button {
            padding: 10px;
            font-size: 10px;
        }
        
        .stats {
            font-size: 11px;
            line-height: 1.6;
        }
        
        .stat-line {
            display: flex;
            justify-content: space-between;
            margin: 5px 0;
        }
        
        .stat-label {
            color: #d4af37;
        }
        
        .stat-value {
            font-weight: bold;
        }
        
        .instructions {
            font-size: 10px;
            line-height: 1.5;
            color: #aaa;
            margin-top: 10px;
        }
        
        .instructions p {
            margin: 5px 0;
        }

        /* ===== MODEL PANEL ===== */
        #model-panel {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 180px;
            background: rgba(0, 0, 0, 0.93);
            border-top: 2px solid #d4af37;
            display: flex;
            flex-direction: column;
            z-index: 100;
            overflow: hidden;
        }

        #faction-tabs {
            display: flex;
            gap: 4px;
            padding: 5px 10px 3px;
            border-bottom: 1px solid #3a3a2a;
            overflow-x: auto;
            flex-shrink: 0;
            scrollbar-width: thin;
            scrollbar-color: #d4af37 #1a1a1a;
        }

        .faction-tab {
            background: #2a2a2a;
            border: 1px solid #555;
            color: #bbb;
            padding: 3px 12px;
            cursor: pointer;
            border-radius: 3px;
            font-size: 11px;
            white-space: nowrap;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            transition: all 0.15s;
        }

        .faction-tab:hover { background: #3a3a1a; color: #d4af37; border-color: #d4af37; }
        .faction-tab.active { background: #d4af37; color: #000; border-color: #d4af37; font-weight: bold; }

        #group-filter {
            display: flex;
            gap: 4px;
            padding: 3px 10px;
            border-bottom: 1px solid #2a2a2a;
            overflow-x: auto;
            flex-shrink: 0;
            scrollbar-width: thin;
            align-items: center;
        }

        .group-btn {
            background: transparent;
            border: 1px solid #444;
            color: #888;
            padding: 2px 9px;
            cursor: pointer;
            border-radius: 10px;
            font-size: 10px;
            white-space: nowrap;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            transition: all 0.15s;
        }

        .group-btn:hover { border-color: #d4af37; color: #d4af37; }
        .group-btn.active { background: #d4af37; color: #000; border-color: #d4af37; }

        #model-grid {
            display: flex;
            gap: 6px;
            padding: 5px 10px;
            overflow-x: auto;
            flex: 1;
            align-items: center;
            scrollbar-width: thin;
            scrollbar-color: #d4af37 #111;
        }

        #model-grid::-webkit-scrollbar { height: 5px; }
        #model-grid::-webkit-scrollbar-track { background: #111; }
        #model-grid::-webkit-scrollbar-thumb { background: #d4af37; border-radius: 3px; }

        .model-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            cursor: pointer;
            padding: 3px;
            border: 1px solid #3a3a3a;
            border-radius: 4px;
            background: #111;
            min-width: 66px;
            max-width: 66px;
            transition: all 0.15s;
            flex-shrink: 0;
        }

        .model-card:hover { border-color: #888; background: #222; }

        .model-card.selected {
            border-color: #d4af37;
            background: #1e1700;
            box-shadow: 0 0 8px rgba(212,175,55,0.35);
        }

        .model-card img {
            width: 56px;
            height: 56px;
            object-fit: contain;
            background: #0a0a0a;
            border-radius: 2px;
            display: block;
        }

        .model-card .model-name {
            font-size: 8px;
            color: #777;
            text-align: center;
            margin-top: 2px;
            max-width: 62px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 1.2;
        }

        .model-card.selected .model-name { color: #d4af37; }

        .model-empty {
            color: #555;
            font-size: 12px;
            padding: 10px 20px;
            white-space: nowrap;
        }

        .model-loading-msg {
            color: #555;
            font-size: 11px;
            padding: 10px 20px;
        }

        #toast {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(-80px);
            background: rgba(180, 40, 40, 0.92);
            color: #fff;
            padding: 10px 22px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 500;
            pointer-events: none;
            z-index: 9999;
            transition: transform 0.25s ease, opacity 0.25s ease;
            opacity: 0;
            white-space: nowrap;
        }
        #toast.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }

        /* ─── Limits panel ─────────────────────────────────── */
        #limits-panel {
            position: absolute;
            top: 10px;
            right: 270px;
            width: 220px;
            background: rgba(5, 5, 10, 0.88);
            border: 1px solid #d4af37;
            border-radius: 5px;
            padding: 10px 14px;
            font-size: 12px;
            color: #fff;
            pointer-events: none;
        }

        .lim-title {
            color: #d4af37;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 8px;
            font-weight: bold;
            border-bottom: 1px solid rgba(212,175,55,0.3);
            padding-bottom: 5px;
        }

        .lim-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 3px 0;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }

        .lim-row:last-child { border-bottom: none; }

        .lim-label {
            color: #d4af37;
            font-size: 11px;
        }

        .lim-val {
            font-weight: bold;
            font-size: 11px;
            color: #fff;
        }

        .lim-row.lim-warn .lim-val { color: #f0c040; }
        .lim-row.lim-over  .lim-val { color: #e04040; }
