        :root {
            --primary: #2563eb;
            --primary-dark: #1d4ed8;
            --primary-light: #3b82f6;
            --secondary: #64748b;
            --secondary-dark: #475569;
            --secondary-light: #94a3b8;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --info: #06b6d4;
            --bg-primary: #0f172a;
            --bg-secondary: #1e293b;
            --bg-tertiary: #334155;
            --text-primary: #f8fafc;
            --text-secondary: #94a3b8;
            --border: #334155;
        }

        * {
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            margin: 0;
            padding: 0;
            height: 100vh;
            overflow: hidden;
        }

        .header {
            height: 60px;
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            padding: 0 1.5rem;
            justify-content: space-between;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .logo {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            text-decoration: none;
        }

        .connection-status {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.25rem 0.75rem;
            background: var(--bg-tertiary);
            border-radius: 1rem;
            font-size: 0.875rem;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--success);
        }

        .status-dot.offline {
            background: var(--danger);
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .header-btn {
            width: 36px;
            height: 36px;
            border-radius: 0.5rem;
            border: 1px solid var(--border);
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .header-btn:hover {
            background: var(--bg-secondary);
            color: var(--text-primary);
        }

        .main-container {
            display: flex;
            height: calc(100vh - 60px - 40px);
            width: 100%;
        }

        .device-panel {
            width: 250px;
            background: var(--bg-secondary);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
        }

        .device-panel-header {
            padding: 1rem;
            border-bottom: 1px solid var(--border);
        }

        .device-panel-title {
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--text-secondary);
            margin-bottom: 0.75rem;
        }

        .device-search {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .device-search-input {
            position: relative;
            flex: 1;
        }

        .device-search input {
            width: 100%;
            padding: 0.5rem 0.75rem 0.5rem 2rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.5rem;
            color: var(--text-primary);
            font-size: 0.875rem;
        }

        .device-search input::placeholder {
            color: var(--text-secondary);
        }

        .device-search-input i {
            position: absolute;
            left: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }

        .device-refresh-btn {
            width: 2rem;
            height: 2rem;
            border: 1px solid var(--border);
            border-radius: 0.5rem;
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .device-refresh-btn.refreshing {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
            cursor: wait;
        }

        .device-refresh-btn.refreshing i {
            animation: spin 0.8s linear infinite;
        }

        .device-refresh-btn:hover {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }

        .device-list {
            flex: 1;
            overflow-y: auto;
            padding: 0.5rem;
            position: relative;
            transition: opacity 0.2s ease;
        }

        .device-list.refreshing {
            opacity: 0.45;
            pointer-events: none;
        }

        .device-list.refreshing::after {
            content: "正在刷新设备列表...";
            position: absolute;
            top: 0.75rem;
            right: 0.75rem;
            padding: 0.2rem 0.5rem;
            border-radius: 999px;
            background: rgba(59, 130, 246, 0.18);
            border: 1px solid rgba(59, 130, 246, 0.35);
            color: var(--text-primary);
            font-size: 0.75rem;
            opacity: 1;
        }

        .device-card {
            padding: 0.75rem;
            background: var(--bg-tertiary);
            border-radius: 0.5rem;
            margin-bottom: 0.5rem;
            cursor: pointer;
            transition: all 0.2s;
            border: 2px solid transparent;
        }

        .device-card:hover {
            background: var(--bg-primary);
        }

        .device-card.selected {
            border-color: var(--primary);
            background: rgba(37, 99, 235, 0.1);
        }

        .device-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.5rem;
        }

        .device-name {
            font-weight: 600;
            font-size: 0.875rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            min-width: 0;
        }

        .device-status {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--success);
        }

        .btn-edit-name {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
            transition: all 0.2s;
            opacity: 0;
            flex-shrink: 0;
        }

        .device-card:hover .btn-edit-name {
            opacity: 1;
        }

        .btn-edit-name:hover {
            color: var(--primary);
            background: var(--bg-tertiary);
        }

        .device-display-name {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .device-status.offline {
            background: var(--secondary);
        }

        .device-stream-icon {
            color: var(--danger);
            font-size: 0.75rem;
            flex-shrink: 0;
            animation: stream-pulse 1.5s ease-in-out infinite;
            position: relative;
        }

        .device-stream-icon::after {
            content: attr(data-title);
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            padding: 2px 6px;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            font-size: 0.65rem;
            border-radius: 4px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
            z-index: 10;
        }

        .device-stream-icon:hover::after {
            opacity: 1;
        }

        @keyframes stream-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.4; }
        }

        .device-camera-lock-icon {
            color: var(--warning);
            font-size: 0.75rem;
            flex-shrink: 0;
            position: relative;
        }

        .device-camera-lock-icon::after {
            content: attr(data-title);
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            padding: 2px 6px;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            font-size: 0.65rem;
            border-radius: 4px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
            z-index: 10;
        }

        .device-camera-lock-icon:hover::after {
            opacity: 1;
        }

        .device-overlay-icon {
            color: #a855f7;
            font-size: 0.75rem;
            flex-shrink: 0;
            position: relative;
        }

        .device-overlay-icon::after {
            content: attr(data-title);
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            padding: 2px 6px;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            font-size: 0.65rem;
            border-radius: 4px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
            z-index: 10;
        }

        .device-overlay-icon:hover::after {
            opacity: 1;
        }

        .device-info {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .device-info span {
            margin-right: 0.5rem;
        }

        .main-content {
            flex: 1;
            display: flex;
            gap: 1rem;
            padding: 1rem;
            overflow: auto;
        }

        .phone-container {
            display: flex;
            gap: 1rem;
            flex: 1;
            align-items: flex-start;
            flex-shrink: 0;
        }

        .preview-area {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            flex: 0 0 auto;
            --frame-width: 290px;
            --frame-min-height: 550px;
            --frame-padding: 0.75rem;
            --frame-radius: 1.5rem;
            --screen-bg: #000;
            --screen-radius: 1rem;
            --screen-min-height: 400px;
            transition: width 0.3s ease;
        }

        .preview-area.mode-original {
            width: auto;
        }

        .preview-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            padding: 0 0.25rem;
        }

        .preview-mode-toggle {
            display: flex;
            gap: 0.25rem;
            background: var(--bg-tertiary);
            border-radius: 0.5rem;
            padding: 0.2rem;
        }

        .preview-mode-btn {
            padding: 0.3rem 0.6rem;
            font-size: 0.75rem;
            border: none;
            border-radius: 0.375rem;
            background: transparent;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .preview-mode-btn:hover {
            color: var(--text-primary);
        }

        .preview-mode-btn.active {
            background: var(--primary);
            color: white;
        }

        .preview-toolbar-right {
            display: flex;
            gap: 0.35rem;
            align-items: center;
            flex: 1;
            justify-content: flex-end;
        }

        .header-divider {
            width: 1px;
            height: 20px;
            background: var(--border-color);
            margin: 0 4px;
        }

        .toolbar-device-info {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 2px 8px;
            border-radius: 6px;
            transition: background 0.15s;
            background: var(--bg-secondary);
        }

        .toolbar-device-info:hover {
            background: var(--bg-tertiary);
        }

        .toolbar-device-name {
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--text-primary);
            max-width: 180px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .toolbar-edit-name-btn {
            display: none;
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 2px 4px;
            font-size: 0.7rem;
            border-radius: 4px;
        }

        .toolbar-device-info:hover .toolbar-edit-name-btn:not([style*="display: none"]) {
            display: inline-flex;
        }

        .toolbar-edit-name-btn:hover {
            color: var(--primary);
            background: rgba(37, 99, 235, 0.1);
        }

        .toolbar-device-status-icons,
        .toolbar-status-badges {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .toolbar-status-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 26px;
            height: 26px;
            border-radius: 6px;
            font-size: 0.85rem;
            cursor: default;
            position: relative;
            animation: badge-in 0.3s ease;
        }

        @keyframes badge-in {
            from { opacity: 0; transform: scale(0.85); }
            to { opacity: 1; transform: scale(1); }
        }

        .toolbar-status-badge i {
            font-size: 0.85rem;
            animation: badge-breathe 2s ease-in-out infinite;
        }

        .toolbar-badge-stream {
            background: rgba(239,68,68,0.12);
            color: #ef4444;
        }
        .toolbar-badge-stream i { animation-name: badge-breathe-stream; }

        .toolbar-badge-recording {
            background: rgba(239,68,68,0.12);
            color: #ef4444;
        }
        .toolbar-badge-recording i { animation-name: badge-breathe-stream; }

        .toolbar-badge-overlay {
            background: rgba(245,158,11,0.12);
            color: #f59e0b;
        }
        .toolbar-badge-overlay i { animation-name: badge-breathe-overlay; }

        .toolbar-badge-camera {
            background: rgba(168,85,247,0.12);
            color: #a855f7;
        }
        .toolbar-badge-camera i { animation-name: badge-breathe-camera; }

        .toolbar-badge-audio {
            background: rgba(16,185,129,0.12);
            color: #10b981;
        }
        .toolbar-badge-audio i { animation-name: badge-breathe-audio; }

        .toolbar-badge-webrtc {
            background: rgba(59,130,246,0.12);
            color: #3b82f6;
        }
        .toolbar-badge-webrtc i { animation-name: badge-breathe-webrtc; }

        @keyframes badge-breathe-stream {
            0%, 100% { opacity: 0.7; text-shadow: 0 0 4px rgba(239,68,68,0.3); }
            50% { opacity: 1; text-shadow: 0 0 10px rgba(239,68,68,0.6); }
        }
        @keyframes badge-breathe-overlay {
            0%, 100% { opacity: 0.7; text-shadow: 0 0 4px rgba(245,158,11,0.3); }
            50% { opacity: 1; text-shadow: 0 0 10px rgba(245,158,11,0.6); }
        }
        @keyframes badge-breathe-camera {
            0%, 100% { opacity: 0.7; text-shadow: 0 0 4px rgba(168,85,247,0.3); }
            50% { opacity: 1; text-shadow: 0 0 10px rgba(168,85,247,0.6); }
        }
        @keyframes badge-breathe-audio {
            0%, 100% { opacity: 0.7; text-shadow: 0 0 4px rgba(16,185,129,0.3); }
            50% { opacity: 1; text-shadow: 0 0 10px rgba(16,185,129,0.6); }
        }
        @keyframes badge-breathe-webrtc {
            0%, 100% { opacity: 0.7; text-shadow: 0 0 4px rgba(59,130,246,0.3); }
            50% { opacity: 1; text-shadow: 0 0 10px rgba(59,130,246,0.6); }
        }

        .toolbar-status-badge[data-tooltip]:hover::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: calc(100% + 6px);
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-secondary);
            color: var(--text-primary);
            font-size: 0.68rem;
            font-weight: 500;
            padding: 3px 8px;
            border-radius: 4px;
            white-space: nowrap;
            border: 1px solid var(--border);
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            z-index: 10;
            pointer-events: none;
        }

        .dual-preview {
            display: flex;
            gap: 0.5rem;
        }

        .preview-pane {
            flex: 0 0 auto;
            min-width: 0;
        }

        .preview-pane.hidden {
            display: none;
        }

        .preview-pane.expanded {
            flex: none;
            width: 100%;
        }

        .phone-frame {
            width: var(--frame-width);
            height: auto;
            min-height: var(--frame-min-height);
            flex-shrink: 0;
            background: var(--bg-secondary);
            border-radius: var(--frame-radius);
            padding: var(--frame-padding);
            display: flex;
            flex-direction: column;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
        }

        .node-ops-panel {
            display: none;
            width: 266px;
            flex-shrink: 0;
            flex-direction: column;
            gap: 0.5rem;
            overflow-y: auto;
            padding-right: 0.25rem;
        }

        .node-ops-panel.visible {
            display: flex;
        }

        .node-side-panel-full {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .mirror-cursor {
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 2px solid rgba(255, 165, 0, 0.8);
            background: rgba(255, 165, 0, 0.15);
            pointer-events: none;
            transform: translate(-50%, -50%);
            z-index: 20;
            opacity: 0;
            transition: opacity 0.15s;
            box-shadow: 0 0 6px rgba(255, 165, 0, 0.4);
        }

        .mirror-cursor.visible {
            opacity: 1;
        }

        .phone-screen {
            flex: 1;
            min-height: var(--screen-min-height);
            background: var(--screen-bg);
            border-radius: var(--screen-radius);
            overflow: hidden;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        @media (max-width: 1180px) {
            .node-layout {
                grid-template-columns: 1fr;
            }

            .node-preview-stage {
                min-height: 360px;
            }
        }

        @media (max-width: 768px) {
            .node-toolbar {
                padding: 0.75rem;
            }

            .node-toolbar-actions,
            .node-toolbar-meta {
                width: 100%;
            }

            .node-preview-stage {
                min-height: 280px;
            }

            .node-preview-viewport {
                width: min(100%, 300px);
            }

            .node-summary-grid {
                grid-template-columns: 1fr 1fr;
            }

            .node-action-row {
                flex-wrap: wrap;
            }
        }

        .screen-placeholder {
            text-align: center;
            color: var(--text-secondary);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            z-index: 1;
        }

        .screen-placeholder i {
            font-size: 3rem;
            margin-bottom: 0.5rem;
            opacity: 0.5;
        }

        .screen-placeholder p {
            font-size: 0.875rem;
            margin: 0.5rem 0;
        }

        .screen-preview {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            display: none;
        }

        .screen-preview-container {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .node-workspace {
            display: grid;
            gap: 1rem;
        }

        .node-toolbar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            padding: 0.85rem 1rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.85rem;
        }

        .node-toolbar-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .node-toolbar-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            align-items: center;
        }

        .node-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.35rem 0.65rem;
            border-radius: 999px;
            font-size: 0.75rem;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(30, 41, 59, 0.82);
            color: var(--text-secondary);
        }

        .node-status-neutral {
            color: var(--text-secondary);
        }

        .node-status-loading {
            color: #f8fafc;
            border-color: rgba(96, 165, 250, 0.35);
            background: rgba(37, 99, 235, 0.18);
        }

        .node-status-success {
            color: #d1fae5;
            border-color: rgba(16, 185, 129, 0.35);
            background: rgba(16, 185, 129, 0.18);
        }

        .node-status-error {
            color: #fee2e2;
            border-color: rgba(239, 68, 68, 0.35);
            background: rgba(239, 68, 68, 0.16);
        }

        .node-layout {
            display: grid;
            grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 0.9fr);
            gap: 1rem;
            align-items: start;
        }

        .node-panel {
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.9rem;
            overflow: hidden;
        }

        .node-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            padding: 0.9rem 1rem;
            border-bottom: 1px solid rgba(148, 163, 184, 0.12);
            background: rgba(15, 23, 42, 0.35);
        }

        .node-panel-title {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
        }

        .node-panel-subtitle {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .node-preview-body {
            padding: 1rem;
        }

        .ui-overlay-frame {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.96));
            border-radius: 1rem;
            border: 1px solid rgba(148, 163, 184, 0.12);
            padding: 0.85rem;
        }

        .node-preview-stage {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 420px;
        }

        .node-preview-viewport {
            position: relative;
            width: min(100%, 360px);
            min-height: 240px;
            margin: 0 auto;
            background:
                linear-gradient(45deg, rgba(30, 41, 59, 0.72) 25%, transparent 25%),
                linear-gradient(-45deg, rgba(30, 41, 59, 0.72) 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, rgba(30, 41, 59, 0.72) 75%),
                linear-gradient(-45deg, transparent 75%, rgba(30, 41, 59, 0.72) 75%);
            background-size: 18px 18px;
            background-position: 0 0, 0 9px, 9px -9px, -9px 0;
            border-radius: 1rem;
            overflow: hidden;
            box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.1);
        }

        .node-preview-image {
            display: block;
            width: 100%;
            height: auto;
            min-height: 240px;
            background: #020617;
        }

        .node-overlay-canvas {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            cursor: crosshair;
            z-index: 2;
            transition: opacity 0.15s ease;
        }

        .node-preview-empty {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.65rem;
            min-height: 420px;
            text-align: center;
            color: var(--text-secondary);
            border: 1px dashed rgba(148, 163, 184, 0.24);
            border-radius: 1rem;
            background: rgba(15, 23, 42, 0.3);
        }

        .node-preview-empty i {
            font-size: 2.3rem;
            color: var(--primary);
        }

        .node-side-panel {
            display: grid;
            gap: 1rem;
        }

        .node-card {
            padding: 1rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.9rem;
        }

        .node-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            margin-bottom: 0.75rem;
        }

        .node-card-title {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .node-card-subtitle {
            font-size: 0.72rem;
            color: var(--text-secondary);
        }

        .node-summary-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 0.6rem;
            margin-bottom: 0.85rem;
        }

        .node-summary-card {
            padding: 0.7rem 0.75rem;
            background: rgba(15, 23, 42, 0.65);
            border: 1px solid rgba(148, 163, 184, 0.12);
            border-radius: 0.75rem;
        }

        .node-summary-label {
            font-size: 0.72rem;
            color: var(--text-secondary);
            margin-bottom: 0.2rem;
        }

        .node-summary-value {
            font-size: 1.15rem;
            font-weight: 700;
            color: var(--text-primary);
        }

        .node-detail-list {
            display: grid;
            gap: 0.55rem;
        }

        .node-detail-item {
            display: grid;
            gap: 0.18rem;
        }

        .node-detail-key {
            font-size: 0.7rem;
            color: var(--text-secondary);
        }

        .node-detail-value {
            font-size: 0.82rem;
            color: var(--text-primary);
            line-height: 1.4;
            word-break: break-word;
        }

        .node-tag-list {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin-bottom: 0.85rem;
        }

        .node-tag {
            display: inline-flex;
            align-items: center;
            padding: 0.26rem 0.55rem;
            border-radius: 999px;
            background: rgba(51, 65, 85, 0.9);
            color: var(--text-secondary);
            font-size: 0.72rem;
            border: 1px solid rgba(148, 163, 184, 0.12);
        }

        .node-tag-primary {
            background: rgba(37, 99, 235, 0.18);
            color: #dbeafe;
            border-color: rgba(96, 165, 250, 0.25);
        }

        .node-empty-inline {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            color: var(--text-secondary);
            font-size: 0.78rem;
        }

        .node-empty-state {
            padding: 1rem 0.25rem;
        }

        .node-action-row {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.65rem;
        }

        .node-action-row .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
        }

        .node-input {
            width: 100%;
            padding: 0.6rem 0.75rem;
            border: 1px solid rgba(148, 163, 184, 0.18);
            border-radius: 0.65rem;
            background: rgba(15, 23, 42, 0.72);
            color: var(--text-primary);
            font-size: 0.8rem;
        }

        .node-input::placeholder {
            color: var(--text-secondary);
        }

        .node-child-list {
            display: grid;
            gap: 0.5rem;
            max-height: 220px;
            overflow-y: auto;
        }

        .node-child-item {
            display: grid;
            gap: 0.15rem;
            width: 100%;
            text-align: left;
            padding: 0.65rem 0.75rem;
            border-radius: 0.75rem;
            border: 1px solid rgba(148, 163, 184, 0.12);
            background: rgba(15, 23, 42, 0.55);
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .node-child-item:hover {
            border-color: rgba(96, 165, 250, 0.32);
            background: rgba(30, 41, 59, 0.72);
        }

        .node-child-title {
            font-size: 0.8rem;
        }

        .node-child-meta {
            font-size: 0.7rem;
            color: var(--text-secondary);
        }

        .screen-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            cursor: crosshair;
            display: none;
            pointer-events: none;
        }

        .screen-overlay.active {
            display: block;
            pointer-events: auto;
        }

        .touch-point {
            position: absolute;
            width: 30px;
            height: 30px;
            border: 2px solid var(--primary);
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            animation: touch-pulse 0.5s ease-out forwards;
        }

        @keyframes touch-pulse {
            0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
        }

        .screen-metrics {
            display: flex;
            gap: 1.5rem;
            font-size: 0.75rem;
            color: var(--text-secondary);
            padding: 0.5rem 1rem;
            justify-content: center;
            background: var(--bg-secondary);
            border-radius: 0.5rem;
            margin-top: 0.5rem;
        }

        .control-panel {
            flex: 1;
            background: var(--bg-secondary);
            border-radius: 0.75rem;
            display: flex;
            flex-direction: column;
            overflow: auto;
        }

        .control-tabs {
            display: flex;
            border-bottom: 1px solid var(--border);
            padding: 0 1rem;
            overflow-x: auto;
        }

        .control-tab {
            padding: 0.75rem 1rem;
            font-size: 0.875rem;
            color: var(--text-secondary);
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .control-tab:hover {
            color: var(--text-primary);
        }

        .control-tab.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }

        .control-content {
            flex: 1;
            padding: 1rem;
            overflow-y: auto;
        }

        .control-section {
            display: none;
        }

        .control-section.active {
            display: block;
        }

        .quick-icon-row {
            display: flex;
            gap: 0.25rem;
            flex-wrap: wrap;
            margin-bottom: 0.5rem;
        }

        .icon-action-btn {
            width: 3rem;
            height: 3rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.375rem;
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .icon-action-btn:hover {
            background: var(--bg-primary);
            border-color: var(--primary);
        }

        .icon-action-btn:hover::after {
            content: attr(data-title);
            position: absolute;
            bottom: calc(100% + 4px);
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-primary);
            color: var(--text-primary);
            font-size: 0.65rem;
            padding: 0.15rem 0.4rem;
            border-radius: 0.25rem;
            white-space: nowrap;
            z-index: 100;
            border: 1px solid var(--border);
            pointer-events: none;
        }

        .icon-action-btn i {
            font-size: 1.1rem;
            color: var(--primary);
        }

        .quick-icon-row {
            padding-top: 1.5rem;
        }

        .quick-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.35rem;
        }

        .grid-action-btn {
            padding: 0.4rem 0.25rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.375rem;
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.2rem;
        }

        .grid-action-btn:hover {
            background: var(--bg-primary);
            border-color: var(--primary);
        }

        .grid-action-btn i {
            font-size: 0.9rem;
            color: var(--primary);
        }

        .grid-action-btn span {
            font-size: 0.65rem;
        }

        .touch-pad {
            width: 100%;
            max-width: 250px;
            aspect-ratio: 9/16;
            background: var(--bg-tertiary);
            border: 2px solid var(--border);
            border-radius: 0.5rem;
            position: relative;
            margin: 0 auto;
            cursor: crosshair;
        }

        .touch-pad-point {
            position: absolute;
            width: 20px;
            height: 20px;
            background: var(--primary);
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            opacity: 0.7;
        }

        .input-section {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }

        .input-section input {
            flex: 1;
            padding: 0.75rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.5rem;
            color: var(--text-primary);
        }

        .input-section button {
            padding: 0.75rem 1rem;
            background: var(--primary);
            border: none;
            border-radius: 0.5rem;
            color: white;
            cursor: pointer;
        }

        .node-finder {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }

        .node-finder input {
            padding: 0.5rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 0.5rem;
            color: var(--text-primary);
            font-size: 0.875rem;
        }

        .node-result {
            background: var(--bg-tertiary);
            border-radius: 0.5rem;
            padding: 0.75rem;
            max-height: 120px;
            overflow-y: auto;
            font-family: monospace;
            font-size: 0.75rem;
        }

        .status-bar {
            height: 40px;
            background: var(--bg-secondary);
            border-top: 1px solid var(--border);
            display: flex;
            align-items: center;
            padding: 0 1.5rem;
            font-size: 0.75rem;
            color: var(--text-secondary);
            gap: 2rem;
        }

        .status-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .toast-container {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            pointer-events: none;
            max-width: 360px;
        }

        .toast-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.6rem 1rem;
            border-radius: 0.5rem;
            font-size: 0.8125rem;
            font-weight: 500;
            color: #fff;
            box-shadow: 0 4px 16px rgba(0,0,0,0.25);
            pointer-events: auto;
            cursor: pointer;
            transform: translateX(110%);
            opacity: 0;
            transition: transform 0.3s ease, opacity 0.3s ease;
            word-break: break-word;
        }

        .toast-item.toast-show {
            transform: translateX(0);
            opacity: 1;
        }

        .toast-item.toast-hide {
            transform: translateX(110%);
            opacity: 0;
        }

        .toast-item .toast-icon {
            flex-shrink: 0;
            width: 1.25rem;
            height: 1.25rem;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            font-weight: 700;
            background: rgba(255,255,255,0.25);
        }

        .toast-item .toast-msg {
            flex: 1;
            line-height: 1.4;
        }

        .toast-success { background: linear-gradient(135deg, #10b981, #059669); }
        .toast-error   { background: linear-gradient(135deg, #ef4444, #dc2626); }
        .toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
        .toast-info    { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }


        .volume-control {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.5rem;
            background: var(--bg-tertiary);
            border-radius: 0.5rem;
            margin-top: 0.5rem;
        }

        .volume-slider {
            flex: 1;
            height: 4px;
            background: var(--border);
            border-radius: 2px;
            -webkit-appearance: none;
            appearance: none;
        }

        .volume-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            background: var(--primary);
            border-radius: 50%;
            cursor: pointer;
        }

        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 2rem;
            text-align: center;
            color: var(--text-secondary);
        }

        .empty-state i {
            font-size: 3rem;
            margin-bottom: 1rem;
            opacity: 0.5;
        }

        @media (max-width: 1024px) {
            .preview-area {
                --frame-width: 230px;
                --frame-min-height: 380px;
                --screen-min-height: 360px;
            }

            .phone-frame {
                width: var(--frame-width);
            }

            .control-tabs {
                font-size: 0.75rem;
            }

            .quick-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .device-panel {
                display: none;
            }

            .phone-container {
                flex-direction: column;
            }

            .preview-area {
                width: 100%;
                max-width: 580px;
            }

            .phone-frame {
                height: auto;
                min-height: 450px;
                aspect-ratio: 9/16;
            }

            .dual-preview {
                flex-direction: column;
            }

            .control-panel {
                height: 300px;
            }
        }

        .btn-sm {
            padding: 0.375rem 0.75rem;
            font-size: 0.75rem;
            border-radius: 0.375rem;
        }

        .btn-outline-primary {
            background: transparent;
            border: 1px solid var(--primary);
            color: var(--primary);
        }

        .btn-outline-primary:hover {
            background: var(--primary);
            color: white;
        }

        .btn-secondary {
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            color: var(--text-primary);
        }

        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            overflow: auto;
            padding: 2rem;
        }

        .modal-overlay.active {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-content {
            background: var(--bg-secondary);
            border-radius: 0.75rem;
            width: 90%;
            max-width: 1200px;
            max-height: 90vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1.5rem;
            border-bottom: 1px solid var(--border);
            background: var(--bg-tertiary);
        }

        .modal-header h3 {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .modal-close {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0.5rem;
            line-height: 1;
            transition: color 0.2s;
        }

        .modal-close:hover {
            color: var(--text-primary);
        }

        .modal-body {
            padding: 1.5rem;
            overflow-y: auto;
            flex: 1;
        }

        .image-modal-overlay {
            padding: 0.75rem;
            background: transparent;
            z-index: 11000;
            pointer-events: none;
        }

        .image-modal-content {
            width: auto;
            max-width: min(88vw, 920px);
            max-height: min(82vh, 760px);
            background: rgba(15, 23, 42, 0.98);
            border: 1px solid rgba(148, 163, 184, 0.14);
            border-radius: 0.7rem;
            box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
            pointer-events: auto;
        }

        .image-modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.8rem 0.95rem;
            border-bottom: 1px solid rgba(148, 163, 184, 0.1);
            background: rgba(30, 41, 59, 0.72);
        }

        .image-modal-toolbar {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            min-width: 0;
        }

        .image-modal-heading {
            display: flex;
            flex-direction: column;
            gap: 0.15rem;
            min-width: 0;
        }

        .image-modal-title {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            color: var(--text-primary);
            font-size: 0.92rem;
            font-weight: 600;
            line-height: 1.2;
        }

        .image-modal-subtitle {
            color: var(--text-secondary);
            font-size: 0.72rem;
            line-height: 1.25;
        }

        .image-modal-actions {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            flex-wrap: wrap;
            flex-shrink: 0;
        }

        .image-modal-download {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
            min-height: 2.35rem;
            padding: 0.5rem 0.9rem;
            border: 1px solid rgba(59, 130, 246, 0.28);
            border-radius: 0.6rem;
            background: rgba(37, 99, 235, 0.12);
            color: #dbeafe;
            font-size: 0.8rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .image-modal-download:hover {
            background: rgba(37, 99, 235, 0.28);
            border-color: rgba(96, 165, 250, 0.6);
            color: #eff6ff;
        }

        .image-modal-body {
            display: grid;
            grid-template-columns: minmax(240px, auto) 210px;
            min-height: 0;
            flex: 1;
            overflow: hidden;
            width: fit-content;
        }

        .image-modal-stage {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0.7rem;
            min-height: 180px;
            background:
                linear-gradient(45deg, rgba(30, 41, 59, 0.62) 25%, transparent 25%),
                linear-gradient(-45deg, rgba(30, 41, 59, 0.62) 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, rgba(30, 41, 59, 0.62) 75%),
                linear-gradient(-45deg, transparent 75%, rgba(30, 41, 59, 0.62) 75%);
            background-size: 18px 18px;
            background-position: 0 0, 0 9px, 9px -9px, -9px 0;
            overflow: auto;
        }

        .image-modal-stage img {
            display: block;
            max-width: min(60vw, 640px);
            max-height: min(68vh, 560px);
            width: auto;
            height: auto;
            border-radius: 0.45rem;
            object-fit: contain;
            background: rgba(15, 23, 42, 0.96);
            box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
        }

        .image-modal-info {
            padding: 0.7rem;
            border-left: 1px solid rgba(148, 163, 184, 0.1);
            background: rgba(15, 23, 42, 0.62);
            overflow-y: auto;
        }

        .image-info-section + .image-info-section {
            margin-top: 0.65rem;
        }

        .image-info-heading {
            display: flex;
            align-items: center;
            gap: 0.35rem;
            margin-bottom: 0.5rem;
            color: #bfdbfe;
            font-size: 0.78rem;
            font-weight: 600;
        }

        .image-info-card {
            display: grid;
            gap: 0.45rem;
            padding: 0.65rem;
            border: 1px solid rgba(148, 163, 184, 0.08);
            border-radius: 0.55rem;
            background: rgba(30, 41, 59, 0.52);
        }

        .image-info-item {
            display: grid;
            gap: 0.1rem;
        }

        .image-info-label {
            font-size: 0.66rem;
            color: var(--text-secondary);
        }

        .image-info-value {
            font-size: 0.76rem;
            color: var(--text-primary);
            word-break: break-word;
            line-height: 1.35;
        }

        .image-modal-content .modal-close {
            flex-shrink: 0;
            width: 2.35rem;
            height: 2.35rem;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 999px;
            background: rgba(148, 163, 184, 0.12);
            font-size: 1.2rem;
        }

        @media (max-width: 900px) {
            .image-modal-overlay {
                padding: 0.5rem;
            }

            .image-modal-body {
                grid-template-columns: 1fr;
                width: 100%;
            }

            .image-modal-stage {
                min-height: 160px;
                max-height: 48vh;
            }

            .image-modal-stage img {
                max-width: 100%;
                max-height: 42vh;
            }

            .image-modal-info {
                border-left: none;
                border-top: 1px solid rgba(148, 163, 184, 0.1);
            }
        }

        @media (max-width: 640px) {
            .image-modal-header {
                flex-direction: column;
                align-items: stretch;
            }

            .image-modal-toolbar {
                justify-content: space-between;
            }

            .image-modal-actions {
                justify-content: stretch;
            }

            .image-modal-download {
                flex: 1;
                min-width: 0;
            }
        }

        .tree-view {
            font-size: 0.85rem;
            line-height: 1.5;
            padding-right: 1rem;
        }

        .tree-node {
            display: grid;
            gap: 0.2rem;
        }

        .tree-node-row {
            display: flex;
            align-items: flex-start;
            gap: 0.35rem;
            margin-bottom: 0.2rem;
        }

        .tree-toggle,
        .tree-spacer {
            width: 1.2rem;
            flex: 0 0 1.2rem;
            margin-top: 0.35rem;
        }

        .tree-spacer {
            display: inline-block;
        }

        .tree-toggle {
            position: relative;
            height: 1.2rem;
            border: none;
            background: transparent;
            cursor: pointer;
            color: var(--text-secondary);
        }

        .tree-toggle::before {
            content: '▶';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 0.7rem;
            transition: transform 0.18s ease;
        }

        .tree-toggle.expanded::before {
            transform: translate(-50%, -50%) rotate(90deg);
        }

        .tree-node-select {
            display: grid;
            gap: 0.14rem;
            flex: 1;
            text-align: left;
            border: 1px solid rgba(148, 163, 184, 0.12);
            background: rgba(15, 23, 42, 0.58);
            color: var(--text-primary);
            border-radius: 0.7rem;
            padding: 0.55rem 0.7rem;
            cursor: pointer;
            transition: all 0.18s ease;
        }

        .tree-node-select:hover {
            border-color: rgba(96, 165, 250, 0.35);
            background: rgba(30, 41, 59, 0.82);
        }

        .tree-node-select.active {
            border-color: rgba(245, 158, 11, 0.46);
            background: rgba(245, 158, 11, 0.12);
            box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.12);
        }

        .tree-node-title {
            font-size: 0.82rem;
            font-weight: 600;
        }

        .tree-node-meta,
        .tree-node-flags {
            font-size: 0.72rem;
            color: var(--text-secondary);
            line-height: 1.35;
        }

        .ui-tree-children {
            margin-left: 1.35rem;
            padding-left: 0.55rem;
            border-left: 1px dashed rgba(148, 163, 184, 0.18);
        }

        .modal-resizable {
            resize: both;
            overflow: auto;
            min-width: 400px;
            min-height: 300px;
        }

        .resize-handle {
            position: absolute;
            width: 20px;
            height: 20px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 50%;
            cursor: se-resize;
            bottom: 10px;
            right: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 0.75rem;
            transition: background 0.2s;
        }

        .resize-handle:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .zoom-controls {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            z-index: 10;
        }

        .zoom-controls.left {
            left: -3rem;
        }

        .zoom-controls.right {
            right: -3rem;
        }

        .zoom-btn {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            color: var(--text-primary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
            transition: all 0.2s;
        }

        .zoom-btn:hover {
            background: var(--primary);
            color: white;
            transform: scale(1.1);
        }

        .zoom-level {
            text-align: center;
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .dashboard-device-card {
            background: var(--bg-primary, #0f172a);
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--border-color, rgba(255,255,255,0.1));
            transition: border-color 0.2s;
        }
        .dashboard-device-card:hover {
            border-color: var(--primary, #3b82f6);
        }
        .dashboard-device-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            background: rgba(0,0,0,0.2);
        }
        .dashboard-device-name {
            font-size: 13px;
            font-weight: 500;
            color: var(--text-primary, #e2e8f0);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 60%;
        }
        .dashboard-stream-badge {
            font-size: 11px;
            padding: 2px 8px;
            border-radius: 10px;
            background: rgba(100,116,139,0.3);
            color: var(--text-secondary, #94a3b8);
        }
        .dashboard-stream-badge.streaming {
            background: rgba(34,197,94,0.2);
            color: #22c55e;
        }
        .dashboard-device-preview {
            position: relative;
            width: 100%;
            aspect-ratio: 9/16;
            max-height: 35vh;
            background: #000;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }
        .dashboard-device-preview:hover {
            opacity: 0.9;
        }
        .dashboard-preview-img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }
        .dashboard-preview-placeholder {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            color: var(--text-secondary, #64748b);
        }
        .dashboard-preview-placeholder i {
            font-size: 32px;
        }
        .dashboard-preview-placeholder small {
            font-size: 12px;
        }

        .device-panel {
            transition: width 0.25s ease, min-width 0.25s ease, opacity 0.25s ease;
            overflow: hidden;
        }
        .device-panel.collapsed {
            width: 0 !important;
            min-width: 0 !important;
            padding: 0;
            border-right: none;
            opacity: 0;
            pointer-events: none;
        }
        .device-collapse-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 2px 4px;
            font-size: 14px;
            line-height: 1;
            border-radius: 4px;
            transition: background 0.15s, color 0.15s;
        }
        .device-collapse-btn:hover {
            background: rgba(255,255,255,0.08);
            color: var(--text-primary);
        }
        .device-panel-title {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .device-expand-btn {
            display: none;
            position: fixed;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            z-index: 100;
            background: var(--bg-secondary, #1e293b);
            border: 1px solid var(--border-color, rgba(255,255,255,0.1));
            border-left: none;
            border-radius: 0 6px 6px 0;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 12px 6px;
            font-size: 14px;
            transition: background 0.15s, color 0.15s;
        }
        .device-expand-btn:hover {
            background: var(--bg-primary, #0f172a);
            color: var(--text-primary);
        }
        .device-expand-btn.visible {
            display: block;
        }

        .camera-loading-spinner {
            width: 36px;
            height: 36px;
            border: 3px solid rgba(255,255,255,0.15);
            border-top-color: var(--primary, #3b82f6);
            border-radius: 50%;
            animation: camera-spin 0.8s linear infinite;
        }
        @keyframes camera-spin {
            to { transform: rotate(360deg); }
        }

        .login-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--bg-primary, #0f172a);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 99999;
        }
        .login-card {
            background: var(--bg-secondary, #1e293b);
            border: 1px solid var(--border, #334155);
            border-radius: 12px;
            padding: 2rem;
            width: 360px;
            max-width: 90vw;
        }
        .login-logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 1.5rem;
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text-primary, #f1f5f9);
        }
        .login-logo i {
            font-size: 1.5rem;
            color: var(--primary, #2563eb);
        }
        .login-field {
            margin-bottom: 1rem;
        }
        .login-field label {
            display: block;
            font-size: 0.8rem;
            color: var(--text-secondary, #94a3b8);
            margin-bottom: 0.35rem;
        }
        .login-field input {
            width: 100%;
            padding: 0.6rem 0.75rem;
            background: var(--bg-tertiary, #0f172a);
            border: 1px solid var(--border, #334155);
            border-radius: 6px;
            color: var(--text-primary, #f1f5f9);
            font-size: 0.9rem;
            outline: none;
            box-sizing: border-box;
        }
        .login-field input:focus {
            border-color: var(--primary, #2563eb);
        }
        .login-error {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid var(--danger, #ef4444);
            border-radius: 6px;
            padding: 0.5rem 0.75rem;
            font-size: 0.8rem;
            color: var(--danger, #ef4444);
            margin-bottom: 0.75rem;
        }
        .login-submit {
            width: 100%;
            padding: 0.65rem;
            background: var(--primary, #2563eb);
            color: #fff;
            border: none;
            border-radius: 6px;
            font-size: 0.9rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }
        .login-submit:hover {
            background: var(--primary-dark, #1d4ed8);
        }
        .login-hint {
            margin-top: 1rem;
            font-size: 0.8rem;
            color: var(--text-secondary, #94a3b8);
            text-align: center;
        }
        .login-setup {
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border, #334155);
        }

        .users-panel {
            position: fixed;
            top: 60px;
            right: 0;
            width: 380px;
            max-height: calc(100vh - 80px);
            background: var(--bg-secondary, #1e293b);
            border-left: 1px solid var(--border, #334155);
            border-bottom: 1px solid var(--border, #334155);
            border-radius: 0 0 0 12px;
            z-index: 1000;
            overflow-y: auto;
            padding: 16px;
            box-shadow: -4px 4px 20px rgba(0,0,0,0.3);
        }
        .users-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }
        .users-panel-header h3 {
            margin: 0;
            font-size: 1.1rem;
            color: var(--text-primary, #f1f5f9);
        }
        .btn-close-users {
            background: none;
            border: none;
            color: var(--text-secondary, #94a3b8);
            font-size: 1.4rem;
            cursor: pointer;
        }
        .users-panel-toolbar {
            margin-bottom: 12px;
        }
        .btn-create-user {
            background: var(--primary, #2563eb);
            color: #fff;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .btn-create-user:hover {
            background: var(--primary-dark, #1d4ed8);
        }
        .users-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .user-card {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: var(--bg-primary, #0f172a);
            border-radius: 8px;
            border: 1px solid var(--border, #334155);
        }
        .user-card.disabled {
            opacity: 0.5;
        }
        .user-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .user-name {
            font-weight: 600;
            color: var(--text-primary, #f1f5f9);
        }
        .user-username {
            font-size: 0.75rem;
            color: var(--text-secondary, #94a3b8);
        }
        .user-status {
            font-size: 0.7rem;
            padding: 1px 6px;
            border-radius: 4px;
            display: inline-block;
            width: fit-content;
        }
        .status-active { background: #16a34a33; color: #4ade80; }
        .status-disabled { background: #dc262633; color: #f87171; }
        .user-actions {
            display: flex;
            gap: 4px;
        }
        .user-actions button {
            background: none;
            border: 1px solid var(--border, #334155);
            border-radius: 4px;
            padding: 4px 6px;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .user-actions button:hover {
            background: var(--bg-hover, #334155);
        }
        .user-actions .btn-danger:hover {
            background: #dc262633;
        }
        .no-users {
            color: var(--text-secondary, #94a3b8);
            text-align: center;
            padding: 20px;
        }
        .user-device-panel {
            margin-top: 16px;
            padding-top: 12px;
            border-top: 1px solid var(--border, #334155);
        }
        .user-device-panel h4 {
            margin: 0 0 10px;
            color: var(--text-primary, #f1f5f9);
            font-size: 0.95rem;
        }
        .device-assign-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            max-height: 300px;
            overflow-y: auto;
        }
        .device-assign-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 8px;
            background: var(--bg-primary, #0f172a);
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
            color: var(--text-primary, #f1f5f9);
        }
        .device-assign-item:hover {
            background: var(--bg-hover, #334155);
        }
        .device-status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            margin-left: auto;
        }
        .device-status-dot.online { background: #4ade80; }
        .device-status-dot.offline { background: #64748b; }
        .device-assign-actions {
            margin-top: 12px;
            display: flex;
            gap: 8px;
        }
        .btn-save-assign {
            background: var(--primary, #2563eb);
            color: #fff;
            border: none;
            padding: 6px 14px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .btn-cancel-assign {
            background: var(--bg-primary, #0f172a);
            color: var(--text-primary, #f1f5f9);
            border: 1px solid var(--border, #334155);
            padding: 6px 14px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
        }

        .sidebar {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 0.25rem;
            flex: 1;
            justify-content: center;
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 14px;
            color: var(--text-secondary);
            text-decoration: none;
            transition: all 0.15s;
            white-space: nowrap;
            border-radius: 6px;
            font-size: 0.82rem;
        }

        .nav-item:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .nav-item.active {
            color: var(--primary);
            background: rgba(37, 99, 235, 0.1);
        }

        .nav-item i {
            font-size: 1rem;
        }

        .nav-item span {
            opacity: 1;
        }

        .view-area {
            height: calc(100vh - 60px - 40px);
            overflow: hidden;
        }

        .view-container {
            height: 100%;
            overflow: auto;
        }

        #view-device-list {
            overflow: hidden;
        }

        .header-btn {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 6px 10px;
            border-radius: 6px;
            font-size: 1rem;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .header-btn:hover {
            background: var(--bg-secondary);
            color: var(--text-primary);
        }


        .phone-container.layout-horizontal {
            flex-direction: row;
            height: 100%;
        }

        .layout-horizontal .preview-area {
            flex: 0 0 var(--frame-width);
            height: 100%;
            border-bottom: none;
        }

        .layout-horizontal .control-panel {
            flex: 1;
            height: 100%;
            border-left: 1px solid var(--border);
            border-top: none;
        }

        .layout-horizontal .phone-frame {
            height: 100%;
        }

        .layout-horizontal .control-content {
            max-height: calc(100vh - 160px);
            overflow-y: auto;
        }

        .device-list-view {
            padding: 1.25rem 1.5rem;
            max-width: 1280px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            height: 100%;
            overflow: hidden;
        }

        .dlv-topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            flex-shrink: 0;
            padding-bottom: 1rem;
            border-bottom: 1px solid rgba(148,163,184,0.08);
        }

        .dlv-topbar-left {
            display: flex;
            align-items: center;
            gap: 1rem;
            min-width: 0;
        }

        .dlv-heading {
            font-size: 1.15rem;
            font-weight: 700;
            margin: 0;
            white-space: nowrap;
            letter-spacing: -0.01em;
        }

        .dlv-stat-pills {
            display: flex;
            gap: 6px;
        }

        .dlv-pill {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 0.72rem;
            font-weight: 500;
            background: rgba(148,163,184,0.08);
            color: var(--text-secondary);
            white-space: nowrap;
        }

        .dlv-pill-on { color: var(--success); background: rgba(16,185,129,0.08); }
        .dlv-pill-off { color: var(--danger); background: rgba(239,68,68,0.08); }
        .dlv-pill-stream { color: var(--primary-light); background: rgba(59,130,246,0.08); }

        .dlv-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .dlv-dot-on { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
        .dlv-dot-off { background: var(--danger); }
        .dlv-dot-stream { background: var(--primary-light); animation: dlv-pulse 1.5s ease-in-out infinite; }

        @keyframes dlv-pulse {
            0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(59,130,246,0.4); }
            50% { opacity: 0.5; box-shadow: 0 0 8px rgba(59,130,246,0.7); }
        }

        .dlv-topbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-shrink: 0;
        }

        .dlv-search-wrap {
            position: relative;
            display: flex;
            align-items: center;
        }

        .dlv-search-wrap i {
            position: absolute;
            left: 10px;
            color: var(--text-secondary);
            font-size: 0.78rem;
            pointer-events: none;
        }

        .dlv-search-wrap input {
            width: 180px;
            padding: 0 10px 0 30px;
            background: rgba(148,163,184,0.06);
            border: 1px solid rgba(148,163,184,0.1);
            border-radius: 8px;
            color: var(--text-primary);
            font-size: 0.78rem;
            outline: none;
            transition: all 0.2s;
            height: 34px;
            line-height: 34px;
        }

        .dlv-search-wrap input:focus {
            border-color: rgba(59,130,246,0.4);
            background: rgba(148,163,184,0.1);
            width: 220px;
        }

        .dlv-search-wrap input::placeholder { color: rgba(148,163,184,0.5); }

        .dlv-filter-tabs {
            display: flex;
            background: rgba(148,163,184,0.06);
            border-radius: 8px;
            border: 1px solid rgba(148,163,184,0.08);
            overflow: hidden;
        }

        .dlv-tab {
            padding: 0 12px;
            background: transparent;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.72rem;
            font-weight: 500;
            transition: all 0.15s;
            white-space: nowrap;
            height: 34px;
            line-height: 34px;
        }

        .dlv-tab:hover { color: var(--text-primary); background: rgba(148,163,184,0.06); }

        .dlv-tab.active {
            background: var(--primary);
            color: #fff;
            font-weight: 600;
        }

        .dlv-divider {
            width: 1px;
            height: 20px;
            background: rgba(148,163,184,0.12);
            flex-shrink: 0;
        }

        .dlv-toolbar-btns {
            display: flex;
            gap: 4px;
        }

        .dlv-icon-btn {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            border: 1px solid rgba(148,163,184,0.1);
            background: rgba(148,163,184,0.06);
            color: var(--text-secondary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            transition: all 0.15s;
        }

        .dlv-icon-btn:hover {
            background: rgba(148,163,184,0.12);
            color: var(--text-primary);
            border-color: rgba(148,163,184,0.2);
        }

        .dlv-icon-btn-go:hover { background: rgba(16,185,129,0.15); color: var(--success); border-color: rgba(16,185,129,0.3); }
        .dlv-icon-btn-stop:hover { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.3); }

        .dlv-body {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            padding-top: 1rem;
        }

        .dlv-section {
            margin-bottom: 1.25rem;
        }

        .dlv-section-off .dlv-grid {
            grid-template-columns: 1fr;
            gap: 2px;
        }

        .dlv-section-off .dlv-grid .dlv-card:hover {
            opacity: 0.85;
            filter: grayscale(0);
        }

        .dlv-section-head {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 0.75rem;
            padding: 0 2px;
        }

        .dlv-collapsible .dlv-section-head {
            cursor: pointer;
            user-select: none;
        }

        .dlv-collapsible .dlv-section-head:hover .dlv-section-label {
            color: var(--text-primary);
        }

        .dlv-section-left {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .dlv-section-label {
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.04em;
            transition: color 0.15s;
        }

        .dlv-section-count {
            font-size: 0.68rem;
            font-weight: 600;
            color: var(--text-secondary);
            background: rgba(148,163,184,0.08);
            padding: 1px 7px;
            border-radius: 10px;
        }

        .dlv-collapse-icon {
            font-size: 0.7rem;
            color: var(--text-secondary);
            margin-left: auto;
            transition: transform 0.2s;
        }

        .dlv-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 12px;
            align-content: start;
        }

        .dlv-grid-collapsed {
            display: none !important;
        }

        .dlv-card {
            border-radius: 14px;
            overflow: hidden;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            cursor: pointer;
            background: linear-gradient(160deg, rgba(15,23,42,0.98), rgba(30,41,59,0.85));
            border: 1px solid rgba(59,130,246,0.08);
            box-shadow: 0 2px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
        }

        .dlv-card:hover {
            border-color: rgba(59,130,246,0.35);
            box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 20px rgba(59,130,246,0.08);
            transform: translateY(-2px);
        }

        .dlv-card-streaming {
            border-color: rgba(239,68,68,0.3);
            background: linear-gradient(160deg, rgba(15,23,42,0.98), rgba(30,20,20,0.9));
            box-shadow: 0 2px 12px rgba(239,68,68,0.08), 0 0 20px rgba(239,68,68,0.05), inset 0 1px 0 rgba(255,255,255,0.03);
            animation: dlv-card-stream-border 3s ease-in-out infinite;
        }

        .dlv-card-streaming:hover {
            border-color: rgba(239,68,68,0.5);
            box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 30px rgba(239,68,68,0.15);
            transform: translateY(-2px);
        }

        @keyframes dlv-card-stream-border {
            0%, 100% { border-color: rgba(239,68,68,0.3); }
            50% { border-color: rgba(239,68,68,0.15); }
        }

        .dlv-card-off {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 12px;
            background: transparent;
            border: none;
            border-radius: 6px;
            opacity: 0.55;
            filter: grayscale(0.3);
        }

        .dlv-card-off:hover {
            opacity: 0.85;
            filter: grayscale(0);
            background: rgba(30,41,59,0.4);
        }

        .dlv-card-off .dlv-card-overlay {
            position: static;
            background: none;
            padding: 0;
            pointer-events: auto;
            flex-direction: row;
            align-items: center;
            gap: 8px;
            width: 100%;
        }

        .dlv-card-off .dlv-card-top {
            flex: 1;
            min-width: 0;
        }

        .dlv-card-off .dlv-card-name {
            color: var(--text-secondary);
            text-shadow: none;
            font-weight: 400;
            font-size: 0.78rem;
        }

        .dlv-card-off .dlv-card-bottom {
            flex-shrink: 0;
        }

        .dlv-card-off .dlv-card-meta {
            color: rgba(148,163,184,0.35);
            font-size: 0.72rem;
        }

        .dlv-card-off-icon {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            background: rgba(100,116,139,0.08);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 0.8rem;
            color: rgba(148,163,184,0.4);
        }

        .dlv-card-screen {
            aspect-ratio: 9 / 16;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            background: radial-gradient(ellipse at center, rgba(30,41,59,0.5) 0%, rgba(15,23,42,0.8) 100%);
        }

        .dlv-card-img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            background: #000;
        }

        .dlv-card-ph {
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(100,116,139,0.25);
            font-size: 2.5rem;
            width: 100%;
            height: 100%;
            transition: all 0.3s;
        }

        .dlv-card:hover .dlv-card-ph {
            color: rgba(59,130,246,0.35);
            text-shadow: 0 0 20px rgba(59,130,246,0.15);
        }

        .dlv-card-ph-off { color: rgba(148,163,184,0.12); }

        .dlv-card-overlay {
            position: absolute;
            inset: 0;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            pointer-events: none;
            padding: 10px;
            background: linear-gradient(180deg,
                rgba(0,0,0,0.55) 0%,
                rgba(0,0,0,0.15) 25%,
                transparent 45%,
                transparent 55%,
                rgba(0,0,0,0.15) 75%,
                rgba(0,0,0,0.7) 100%);
        }

        .dlv-card-top {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
        }

        .dlv-card-bottom {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: 6px;
        }

        .dlv-card-name {
            font-weight: 700;
            font-size: 0.8rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
            min-width: 0;
            color: #fff;
            text-shadow: 0 1px 6px rgba(0,0,0,0.6);
            letter-spacing: 0.01em;
        }

        .dlv-status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .dlv-status-dot.on {
            background: #10b981;
            box-shadow: 0 0 8px rgba(16,185,129,0.7), 0 0 16px rgba(16,185,129,0.3);
        }

        .dlv-status-dot.off {
            background: #64748b;
        }

        .dlv-stream-live {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.58rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            padding: 3px 8px 3px 6px;
            border-radius: 6px;
            background: linear-gradient(135deg, rgba(239,68,68,0.95), rgba(220,38,38,0.9));
            color: #fff;
            text-shadow: 0 1px 2px rgba(0,0,0,0.3);
            box-shadow: 0 2px 12px rgba(239,68,68,0.4), 0 0 20px rgba(239,68,68,0.15);
            flex-shrink: 0;
            animation: dlv-live-glow 2s ease-in-out infinite;
        }

        @keyframes dlv-live-glow {
            0%, 100% { box-shadow: 0 2px 12px rgba(239,68,68,0.4), 0 0 20px rgba(239,68,68,0.15); }
            50% { box-shadow: 0 2px 16px rgba(239,68,68,0.55), 0 0 30px rgba(239,68,68,0.25); }
        }

        .dlv-live-dot {
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background: #fff;
            animation: dlv-live-blink 1s ease-in-out infinite;
        }

        @keyframes dlv-live-blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }

        .dlv-card-meta {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 0.65rem;
            color: rgba(255,255,255,0.7);
            overflow: hidden;
            text-shadow: 0 1px 3px rgba(0,0,0,0.5);
        }

        .dlv-card-tag {
            padding: 1px 6px;
            border-radius: 4px;
            background: rgba(59,130,246,0.2);
            color: rgba(147,197,253,0.9);
            font-size: 0.6rem;
            font-weight: 500;
            text-shadow: none;
        }

        .dlv-card-tag-idle {
            background: rgba(148,163,184,0.15);
            color: rgba(148,163,184,0.8);
        }

        .dlv-offline-time {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            color: rgba(148,163,184,0.55);
            font-size: 0.6rem;
        }

        .dlv-offline-time i {
            font-size: 0.55rem;
        }

        .dlv-card-btns {
            display: flex;
            gap: 5px;
            pointer-events: auto;
            opacity: 0;
            transform: translateY(4px);
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .dlv-card:hover .dlv-card-btns {
            opacity: 1;
            transform: translateY(0);
        }

        .dlv-act-btn {
            width: 32px;
            height: 32px;
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 9px;
            background: rgba(0,0,0,0.5);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            color: rgba(255,255,255,0.85);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.85rem;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .dlv-act-btn:hover {
            background: linear-gradient(135deg, var(--primary), #4f46e5);
            border-color: transparent;
            color: #fff;
            transform: scale(1.12);
            box-shadow: 0 4px 16px rgba(59,130,246,0.35);
        }

        .dlv-empty {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 5rem 2rem;
            text-align: center;
        }

        .dlv-empty-icon {
            width: 64px;
            height: 64px;
            border-radius: 16px;
            background: rgba(148,163,184,0.06);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 1rem;
        }

        .dlv-empty-icon i {
            font-size: 1.5rem;
            color: var(--text-secondary);
            opacity: 0.5;
        }

        .dlv-empty-text {
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 4px;
        }

        .dlv-empty-hint {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .umv {
            padding: 1.5rem;
            max-width: 900px;
            margin: 0 auto;
        }

        .umv-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .umv-title {
            font-size: 1.25rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .umv-btn {
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            border: 1px solid var(--border);
            padding: 6px 14px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.15s;
        }

        .umv-btn:hover {
            background: var(--bg-secondary);
            color: var(--text-primary);
        }

        .umv-btn-primary {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        .umv-btn-primary:hover {
            background: var(--primary-dark);
        }

        .umv-list {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .umv-card {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 1rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.15s;
        }

        .umv-card.disabled {
            opacity: 0.6;
        }

        .umv-card-info {
            flex: 1;
        }

        .umv-card-name {
            font-weight: 600;
            font-size: 0.95rem;
        }

        .umv-card-meta {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 2px;
        }

        .umv-card-actions {
            display: flex;
            gap: 4px;
        }

        .umv-action-btn {
            background: var(--bg-tertiary);
            border: none;
            color: var(--text-secondary);
            padding: 6px 10px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.8rem;
            transition: all 0.15s;
        }

        .umv-action-btn:hover {
            background: var(--primary);
            color: #fff;
        }

        .umv-action-danger:hover {
            background: var(--danger);
        }

        .umv-empty {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 3rem;
            color: var(--text-secondary);
        }

        .umv-empty i {
            font-size: 2.5rem;
            opacity: 0.3;
            margin-bottom: 0.75rem;
        }

        .umv-forbidden {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--text-secondary);
        }

        .umv-forbidden i {
            font-size: 3rem;
            margin-bottom: 1rem;
        }

        .umv-device-panel {
            margin-top: 1.5rem;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 1rem;
        }

        .umv-dp-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            font-weight: 600;
        }

        .umv-dp-list {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            max-height: 300px;
            overflow-y: auto;
        }

        .umv-dp-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 8px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
        }

        .umv-dp-item:hover {
            background: var(--bg-tertiary);
        }

        .umv-dp-status {
            font-size: 0.75rem;
        }

        .umv-dp-status.online {
            color: var(--success);
        }

        .umv-dp-actions {
            margin-top: 1rem;
            display: flex;
            justify-content: flex-end;
        }

        .umv-loading {
            text-align: center;
            padding: 2rem;
            color: var(--text-secondary);
        }

        .ssv {
            padding: 1.5rem;
            max-width: 900px;
            margin: 0 auto;
        }

        .ssv-header {
            margin-bottom: 1.5rem;
        }

        .ssv-title {
            font-size: 1.25rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .ssv-section {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 10px;
            margin-bottom: 1rem;
            overflow: hidden;
        }

        .ssv-section-title {
            padding: 0.75rem 1rem;
            font-weight: 600;
            font-size: 0.9rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
        }

        .ssv-section-body {
            padding: 1rem;
        }

        .ssv-field {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.5rem 0;
        }

        .ssv-field label {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .ssv-field select,
        .ssv-field input {
            background: var(--bg-tertiary);
            color: var(--text-primary);
            border: 1px solid var(--border);
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.85rem;
        }

        .ssv-btn {
            background: var(--primary);
            color: #fff;
            border: none;
            padding: 6px 14px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.15s;
        }

        .ssv-btn:hover {
            background: var(--primary-dark);
        }

        .ssv-btn-sm {
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            border: 1px solid var(--border);
            padding: 3px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.75rem;
        }

        .ssv-btn-sm:hover {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        .ssv-btn-danger:hover {
            background: var(--danger);
            border-color: var(--danger);
        }

        .ssv-secrets-table {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .ssv-secrets-header {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr auto;
            gap: 8px;
            padding: 6px 8px;
            font-size: 0.75rem;
            color: var(--text-secondary);
            font-weight: 600;
        }

        .ssv-secrets-row {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr auto;
            gap: 8px;
            padding: 6px 8px;
            font-size: 0.8rem;
            border-radius: 4px;
        }

        .ssv-secrets-row:hover {
            background: var(--bg-tertiary);
        }

        .ssv-mono {
            font-family: monospace;
            font-size: 0.75rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .ssv-about {
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.85rem;
        }

        .ssv-about p {
            margin: 0.25rem 0;
        }

        .ssv-error {
            color: var(--danger);
            font-size: 0.85rem;
            padding: 0.5rem;
        }

        .ssv-loading {
            text-align: center;
            padding: 1rem;
            color: var(--text-secondary);
        }

.touch-ripple {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(59, 130, 246, 0.35);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: touch-ripple-out 0.8s ease-out forwards;
}

@keyframes touch-ripple-out {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(5); opacity: 0; }
}

.touch-point {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: touch-pulse 0.6s ease-out forwards;
    background: rgba(59, 130, 246, 0.15);
}

@keyframes touch-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

.phone-container.transitioning {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.phone-container.transitioned {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Gesture items */
.gesture-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
    border-radius: 0.375rem;
    transition: background 0.15s;
    gap: 0.5rem;
}
.gesture-item:hover {
    background: var(--bg-tertiary);
}
.gesture-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.gesture-item-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gesture-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.gesture-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.gesture-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    transition: color 0.15s, background 0.15s;
}
.gesture-action-btn:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}
.gesture-action-btn-danger:hover {
    color: var(--danger);
    background: rgba(244, 67, 54, 0.1);
}

/* Recording items */
.recording-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
    border-radius: 0.375rem;
    transition: background 0.15s;
    gap: 0.5rem;
}
.recording-item:hover {
    background: var(--bg-tertiary);
}
.recording-item-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
}
.recording-item-info i {
    color: var(--primary);
    font-size: 0.9rem;
    flex-shrink: 0;
}
.recording-item-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recording-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Recording dot animation */
.recording-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: recording-pulse 1s ease-in-out infinite;
    margin-right: 0.3rem;
}
@keyframes recording-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.grid-action-btn.recording {
    color: var(--danger);
    border-color: var(--danger);
}
.grid-action-btn.active {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btn-spinner 0.6s linear infinite;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes btn-spinner {
    to { transform: translateY(-50%) rotate(360deg); }
}

.device-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-info-row .device-latency {
    margin-left: 1rem;
}

.info-field {
    margin-bottom: 0.25rem;
}

.info-field strong {
    margin-right: 0.25rem;
}

.modal-form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-form-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    min-width: 340px;
    max-width: 460px;
    width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modal-slide-in 0.2s ease-out;
}

@keyframes modal-slide-in {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-form-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-form-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-form-field {
    margin-bottom: 12px;
}

.modal-form-field label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.modal-form-field input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}

.modal-form-field input:focus {
    border-color: var(--primary);
}

.modal-form-field .field-error {
    font-size: 0.72rem;
    color: var(--danger);
    margin-top: 4px;
    display: none;
}

.modal-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-form-btn {
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-form-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-form-btn-cancel:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-form-btn-confirm {
    background: var(--primary);
    color: #fff;
}

.modal-form-btn-confirm:hover {
    background: var(--primary-dark);
}

.clipboard-content-box {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.5rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    margin-bottom: 1rem;
}

.clipboard-actions {
    text-align: center;
    margin-top: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Gesture detail modal */
.gesture-detail-modal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.gesture-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(148,163,184,0.08);
}
.gesture-detail-row:last-child {
    border-bottom: none;
}
.gesture-detail-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.gesture-detail-value {
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

/* Gesture empty state */
.gesture-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    text-align: center;
}
.gesture-empty-state small {
    font-size: 0.78rem;
}
