        /* ── reset & base ── */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            overflow: hidden;
            max-width: 1400px;
            width: 100%;
        }

        .header {
            background: #2c3e50;
            color: white;
            padding: 20px;
            text-align: center;
        }

        .header h1 {
            font-size: 24px;
            margin-bottom: 10px;
        }

        .status {
            display: inline-block;
            padding: 5px 15px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: bold;
        }

        .status.connected {
            background: #27ae60;
        }

        .status.disconnected {
            background: #e74c3c;
        }

        .status.error {
            background: #e74c3c;
        }

        .content {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            align-items: stretch;
        }

        .main-panel {
            flex: 2;
            min-width: 500px;
            padding: 20px;
            background: #1a1a2e;
        }

        .info-panel {
            flex: 1;
            min-width: 280px;
            padding: 20px;
            background: #f5f6fa;
        }

        /* ── view tabs ── */
        .view-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
        }

        .tab-button {
            background: rgba(255, 255, 255, 0.08);
            color: #e5e7ff;
            border: 1px solid rgba(255, 255, 255, 0.12);
            padding: 10px 18px;
            border-radius: 999px;
            font-weight: 600;
            letter-spacing: 0.2px;
            cursor: pointer;
            transition: background 0.2s, box-shadow 0.2s;
        }

        .tab-button.active {
            background: linear-gradient(135deg, #667eea 0%, #7c4dff 100%);
            border-color: transparent;
            box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
        }

        .view-frame {
            position: relative;
        }

        .view-panel {
            display: none;
        }

        .view-panel.active {
            display: block;
        }

        canvas {
            width: 100%;
            height: auto;
            background: #0f0f1a;
            border-radius: 10px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
            display: block;
        }

        #mapCanvas {
            cursor: grab;
        }

        #mapCanvas:active {
            cursor: grabbing;
        }

        .map-toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 10px;
        }

        .map-toolbar button {
            padding: 8px 14px;
            font-size: 13px;
        }

        .map-hint {
            margin-top: 8px;
            color: #a8a8b6;
            font-size: 12px;
            text-align: right;
        }

        .visualization-panel {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-top: none;
            padding: 12px 15px;
            border-radius: 0 0 10px 10px;
        }

        .visualization-content {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .zoom-label {
            color: #a8a8b6;
            font-size: 12px;
            white-space: nowrap;
        }

        .zoom-range {
            color: #e5e7ff;
            font-size: 12px;
            font-weight: bold;
            font-family: 'Courier New', monospace;
            min-width: 40px;
        }

        .zoom-value {
            color: #e5e7ff;
            font-size: 12px;
            font-weight: bold;
            min-width: 30px;
        }

        #zoomSlider {
            width: 140px;
            cursor: pointer;
            background: rgba(255, 255, 255, 0.1);
            height: 4px;
            border-radius: 5px;
            -webkit-appearance: none;
            appearance: none;
        }

        #mapZoomSlider {
            flex: 1;
            min-width: 150px;
            cursor: pointer;
            background: rgba(255, 255, 255, 0.1);
            height: 4px;
            border-radius: 5px;
            -webkit-appearance: none;
            appearance: none;
        }

        #zoomSlider:focus,
        #mapZoomSlider:focus {
            outline: none;
        }

        #zoomSlider::-webkit-slider-thumb,
        #mapZoomSlider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            border: 2px solid white;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
            transition: transform 0.1s;
        }

        #zoomSlider::-webkit-slider-thumb:hover,
        #mapZoomSlider::-webkit-slider-thumb:hover {
            background: #5a67d8;
            transform: scale(1.15);
        }

        #zoomSlider::-moz-range-thumb,
        #mapZoomSlider::-moz-range-thumb {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            border: 2px solid white;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        .map-zoom-container {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 10px;
            padding: 10px 15px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 8px;
        }

        .info-section {
            margin-bottom: 20px;
            padding: 15px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .info-section h3 {
            color: #2c3e50;
            margin-bottom: 15px;
            font-size: 16px;
            border-bottom: 2px solid #667eea;
            padding-bottom: 5px;
        }

        .info-table {
            width: 100%;
            border-collapse: collapse;
        }

        .info-table tr {
            border-bottom: 1px solid #eee;
        }

        .info-table tr:last-child {
            border-bottom: none;
        }

        .info-table td {
            padding: 8px 0;
        }

        .info-label {
            color: #666;
            font-size: 14px;
            text-align: left;
            font-weight: normal;
        }

        .info-value {
            color: #667eea;
            font-size: 16px;
            font-weight: bold;
            text-align: right;
            font-family: 'Courier New', monospace;
        }

        /* ── MODE SELECTOR ── */
        .controls {
            margin-top: 20px;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 8px;
        }

        .mode-selector {
            display: flex;
            gap: 8px;
            justify-content: center;
        }

        .mode-btn {
            flex: 1;
            padding: 12px 8px;
            border: 2px solid transparent;
            border-radius: 10px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
            background: #e9ecef;
            color: #6c757d;
            opacity: 0.5;
            transform: scale(0.97);
            letter-spacing: 0.3px;
            box-shadow: none;
            text-align: center;
        }

        .mode-btn:hover:not(.active) {
            opacity: 0.75;
            transform: scale(1);
            background: #dee2e6;
        }

        .mode-btn.active {
            opacity: 1;
            transform: scale(1);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.20);
            border-color: rgba(255, 255, 255, 0.3);
            cursor: default;
        }

        /* idle */
        .mode-btn.idle-btn.active {
            background: #6c757d;
            color: #fff;
            border-color: #5a6268;
        }

        /* manual */
        .mode-btn.manual-btn.active {
            background: #ff8800;
            color: #fff;
            border-color: #e07c00;
        }

        /* auto */
        .mode-btn.auto-btn.active {
            background: #27ae60;
            color: #fff;
            border-color: #1e8449;
        }

        .keyboard-hint {
            color: #ff8800;
            font-size: 12px;
            margin-top: 4px;
            text-align: center;
            background: rgba(255, 136, 0, 0.08);
            padding: 6px 12px;
            border-radius: 6px;
            border: 1px solid rgba(255, 136, 0, 0.15);
            display: none;
        }

        .keyboard-hint.visible {
            display: block;
        }

        /* ── connection controls ── */
        .connection-controls {
            margin-top: 20px;
            padding: 15px;
            background: white;
            border-radius: 10px;
        }

        .connection-controls h3 {
            color: #2c3e50;
            margin-bottom: 10px;
            font-size: 16px;
        }

        input {
            width: 100%;
            padding: 10px;
            margin: 5px 0;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 14px;
        }

        input:focus {
            outline: none;
            border-color: #667eea;
        }

        .conn-buttons {
            display: flex;
            gap: 8px;
            margin-top: 6px;
        }

        .conn-buttons button {
            flex: 1;
        }

        button {
            background: #667eea;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            transition: transform 0.2s, background 0.2s;
        }

        button:hover {
            transform: translateY(-2px);
            background: #5a67d8;
        }

        button:active {
            transform: translateY(0);
        }

        /* ── responsive ── */
        @media (max-width: 1024px) {
            .main-panel {
                min-width: 400px;
            }
            .info-panel {
                min-width: 260px;
            }
            button {
                padding: 8px 16px;
                font-size: 13px;
            }
            .info-value {
                font-size: 14px;
            }
            .tab-button {
                padding: 8px 14px;
                font-size: 13px;
            }
        }

        @media (max-width: 768px) {
            body {
                padding: 10px;
            }
            .header h1 {
                font-size: 18px;
            }
            .content {
                flex-direction: column;
            }
            .main-panel {
                min-width: auto;
                padding: 15px;
            }
            .info-panel {
                min-width: auto;
                padding: 15px;
            }
            canvas {
                width: 100%;
                height: auto;
                min-height: 300px;
            }
            .controls {
                gap: 6px;
            }
            .mode-btn {
                font-size: 13px;
                padding: 10px 6px;
            }
            button {
                padding: 8px 12px;
                font-size: 12px;
            }
            .info-section {
                padding: 12px;
            }
            .info-section h3 {
                font-size: 14px;
                margin-bottom: 10px;
            }
            .view-tabs {
                gap: 8px;
            }
            .tab-button {
                padding: 8px 12px;
                font-size: 12px;
            }
            .map-toolbar {
                gap: 6px;
            }
            .map-toolbar button {
                padding: 7px 10px;
                font-size: 12px;
            }
            .info-table td {
                padding: 6px 0;
            }
            .info-label {
                font-size: 12px;
            }
            .info-value {
                font-size: 13px;
            }
            .conn-buttons {
                flex-direction: column;
            }
        }

        @media (max-width: 480px) {
            .header {
                padding: 12px;
            }
            .header h1 {
                font-size: 16px;
            }
            .status {
                font-size: 11px;
                padding: 3px 10px;
            }
            .mode-selector {
                gap: 6px;
            }
            .mode-btn {
                font-size: 12px;
                padding: 8px 4px;
                border-radius: 8px;
            }
            button {
                padding: 8px;
                font-size: 11px;
            }
            .tab-button {
                padding: 7px 10px;
            }
            .info-value {
                font-size: 12px;
            }
            .connection-controls input {
                font-size: 12px;
                padding: 8px;
            }
        }

        /* dark mode */
        @media (prefers-color-scheme: dark) {
            body {
                background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            }
            .container {
                background: #1e1e2e;
            }
            .info-panel {
                background: #2a2a3a;
            }
            .info-section {
                background: #1e1e2e;
                border: 1px solid #3a3a4a;
            }
            .info-section h3 {
                color: #e0e0e0;
                border-bottom-color: #667eea;
            }
            .info-label {
                color: #aaa;
            }
            .info-value {
                color: #8b9dff;
            }
            .connection-controls {
                background: #1e1e2e;
                border: 1px solid #3a3a4a;
            }
            .connection-controls h3 {
                color: #e0e0e0;
            }
            input {
                background: #2a2a3a;
                border-color: #4a4a5a;
                color: #e0e0e0;
            }
            input:focus {
                border-color: #667eea;
            }
            .mode-btn {
                background: #2a2a3a;
                color: #888;
            }
            .mode-btn:hover:not(.active) {
                background: #3a3a4a;
            }
            .mode-btn.idle-btn.active {
                background: #6c757d;
                color: #fff;
            }
            .mode-btn.manual-btn.active {
                background: #ff8800;
                color: #fff;
            }
            .mode-btn.auto-btn.active {
                background: #27ae60;
                color: #fff;
            }
            button {
                background: #5a67d8;
            }
            button:hover {
                background: #6b7cff;
            }
            .keyboard-hint {
                background: rgba(255, 136, 0, 0.12);
                border-color: rgba(255, 136, 0, 0.2);
            }
        }