    <style>
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; padding: 20px; background: #1a1a1a; color: #fff; }
        #video { width: 100%; max-width: 1280px; background: #000; border: 1px solid #444; border-radius: 8px; margin-top: 20px; }
        #status { padding: 15px; margin: 15px 0; background: #2a2a2a; border-left: 5px solid #0078d4; border-radius: 4px; }
        #stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 15px 0; }
        .stat-box { background: #2a2a2a; padding: 10px; border-radius: 4px; text-align: center; }
        .stat-box .label { font-size: 12px; color: #888; }
        .stat-box .value { font-size: 20px; font-weight: bold; color: #00ff88; }
        #log { font-family: 'Consolas', monospace; font-size: 12px; color: #aaa; white-space: pre-wrap; max-height: 200px; overflow-y: auto; background: #111; padding: 10px; border-radius: 4px; margin-top: 20px; }
        .controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
        button { padding: 10px 20px; cursor: pointer; background: #0078d4; color: white; border: none; border-radius: 4px; font-weight: bold; }
        button:hover { background: #005a9e; }
        input { padding: 10px; width: 220px; background: #333; border: 1px solid #444; color: white; border-radius: 4px; }
        .tuning-panel { background: #2a2a2a; padding: 15px; border-radius: 8px; margin: 15px 0; border: 1px solid #444; }
        .tuning-panel h3 { margin: 0 0 15px 0; color: #0078d4; }
        .tuning-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
        .tuning-row label { min-width: 120px; color: #ccc; }
        .tuning-row input[type="range"] { flex: 1; min-width: 200px; }
        .tuning-row .value-display { min-width: 60px; text-align: right; font-weight: bold; color: #00ff88; }
        .btn-group { display: flex; gap: 10px; flex-wrap: wrap; }
        .btn-danger { background: #d43f00; }
        .btn-danger:hover { background: #a83200; }
        .btn-success { background: #00a84d; }
        .btn-success:hover { background: #00803b; }
        .btn-secondary { background: #555; }
        .btn-secondary:hover { background: #444; }
        .btn-active { background: #00a84d !important; }
        .audio-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; width: 100%; }
        .audio-result { background: #202020; border: 1px solid #3a3a3a; border-radius: 6px; padding: 8px; font-size: 12px; color: #ddd; }
        .audio-result.best { border-color: #00ff88; box-shadow: inset 0 0 0 1px rgba(0,255,136,0.25); }
        .audio-result.fail { border-color: #d43f00; }
        .audio-result.selectable { cursor: pointer; }
        .audio-result.selectable:hover { border-color: #0078d4; background: #252525; }
        .audio-result strong { display: block; color: #fff; margin-bottom: 4px; }
        .auto-test-plan { width: 100%; padding: 8px; background: #202020; border: 1px solid #3a3a3a; border-radius: 6px; color: #bbb; font-size: 12px; line-height: 1.35; }
        .auto-test-plan strong { color: #fff; }
        .parallel-test-grid { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 8px; width: 100%; }
        .parallel-test-card { background: #171717; border: 1px solid #343434; border-radius: 6px; overflow: hidden; min-width: 0; }
        .parallel-test-card.active { border-color: #0078d4; }
        .parallel-test-card.best { border-color: #00ff88; box-shadow: inset 0 0 0 1px rgba(0,255,136,0.25); }
        .parallel-test-card.fail { border-color: #d43f00; }
        .parallel-test-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
        .parallel-test-meta { padding: 6px 7px; color: #ccc; font-size: 11px; line-height: 1.3; min-height: 46px; }
        .parallel-test-meta strong { color: #fff; display: block; margin-bottom: 2px; }

        /* Gamepad Wizard Custom Styles */
        :root {
            --gp-bg: #050505;
            --gp-accent: #007bff;
            --gp-panel: #121212;
            --gp-success: #00c851;
            --gp-off: #444;
        }

        #gp-wizard {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.95);
            z-index: 5000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: #fff;
        }

        .wizard-card {
            background: var(--gp-panel);
            padding: 25px;
            border-radius: 20px;
            border: 2px solid var(--gp-accent);
            text-align: center;
            width: 90%;
            max-width: 500px;
            box-shadow: 0 10px 30px rgba(0, 123, 255, 0.2);
        }

        .target-name {
            font-size: 22px;
            color: var(--gp-accent);
            margin: 10px 0;
            font-weight: bold;
        }

        #controller-svg {
            width: 100%;
            max-width: 320px;
            margin: 15px auto;
            display: block;
        }

        .gp-part {
            fill: var(--gp-off);
            stroke: #222;
            stroke-width: 1;
            transition: fill 0.2s, stroke 0.2s;
        }

        .gp-active {
            fill: var(--gp-accent) !important;
            stroke: white !important;
        }

        .top-btn {
            padding: 10px 20px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 4px;
            border: 2px solid var(--gp-accent);
            cursor: pointer;
            color: var(--gp-accent);
            font-weight: bold;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
        }
        .top-btn:hover {
            background: var(--gp-accent);
            color: white;
        }

        body.immersive-video {
            padding: 0;
            overflow: hidden;
        }

        body.immersive-video #video-container {
            position: fixed !important;
            inset: 0 !important;
            width: 100vw !important;
            height: 100vh !important;
            max-width: none !important;
            margin: 0 !important;
            border: 0 !important;
            border-radius: 0 !important;
            z-index: 2400;
        }

        body.immersive-video #video {
            width: 100vw !important;
            height: 100vh !important;
            object-fit: contain;
        }

        #btnExitImmersive {
            position: absolute;
            right: 14px;
            top: 14px;
            z-index: 260;
            display: none;
            background: rgba(0,0,0,0.68);
            border: 1px solid rgba(255,255,255,0.38);
            border-radius: 6px;
            padding: 9px 12px;
            color: #fff;
            pointer-events: auto;
        }

        body.immersive-video #btnExitImmersive {
            display: block;
        }

        #btnCaptureMouseImmersive {
            position: absolute;
            left: 14px;
            top: 14px;
            z-index: 260;
            display: none;
            background: rgba(0,0,0,0.68);
            border: 1px solid rgba(255,255,255,0.38);
            border-radius: 6px;
            padding: 9px 12px;
            color: #fff;
            pointer-events: auto;
        }

        body.immersive-video #btnCaptureMouseImmersive {
            display: block;
        }

        #virtual-pad-layer {
            position: absolute;
            inset: 0;
            z-index: 170;
            pointer-events: none;
            display: none;
        }

        #virtual-pad-layer.enabled {
            display: block;
        }

        .vpad-control {
            position: absolute;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            background: rgba(8, 18, 28, 0.44);
            border: 2px solid rgba(255,255,255,0.24);
            box-shadow: 0 12px 24px rgba(0,0,0,0.32);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            pointer-events: auto;
            touch-action: none;
            user-select: none;
            overflow: hidden;
        }

        .vpad-control.active {
            border-color: #00ff88;
            background: rgba(0, 120, 212, 0.34);
        }

        .vpad-control.editing {
            border-style: dashed;
            border-color: #ffd84d;
        }

        .vpad-control .vpad-label {
            pointer-events: none;
            font-size: 11px;
            font-weight: 800;
            line-height: 1.15;
            text-shadow: 0 1px 3px #000;
            padding: 8px;
        }

        .vpad-stick-knob {
            position: absolute;
            width: 36%;
            height: 36%;
            border-radius: 50%;
            background: #00ff88;
            box-shadow: 0 0 18px rgba(0,255,136,0.45);
            pointer-events: none;
        }

        #vpad-panel {
            position: fixed;
            left: 50%;
            bottom: -520px;
            transform: translateX(-50%);
            width: min(720px, calc(100vw - 20px));
            max-height: 520px;
            background: rgba(18,18,18,0.98);
            border: 1px solid #333;
            border-bottom: 0;
            border-radius: 10px 10px 0 0;
            z-index: 5200;
            transition: bottom .2s ease;
            box-shadow: 0 -14px 34px rgba(0,0,0,.42);
        }

        #vpad-panel.open {
            bottom: 0;
        }

        .vpad-panel-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 12px;
            border-bottom: 1px solid #333;
        }

        #vpad-list {
            padding: 12px;
            max-height: 370px;
            overflow-y: auto;
        }

        .vpad-item {
            background: #1f1f1f;
            border: 1px solid #3a3a3a;
            border-radius: 7px;
            padding: 10px;
            margin-bottom: 10px;
        }

        .vpad-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .vpad-item input,
        .vpad-item select {
            width: 100%;
            box-sizing: border-box;
            padding: 8px;
            background: #303030;
            color: #fff;
            border: 1px solid #4a4a4a;
            border-radius: 5px;
        }

        #vpad-picker {
            position: fixed;
            inset: 0;
            z-index: 6100;
            background: rgba(0,0,0,0.92);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }

        .vpad-picker-card {
            width: min(620px, 96vw);
            max-height: 88vh;
            overflow-y: auto;
            background: #151515;
            border: 1px solid #444;
            border-radius: 10px;
            padding: 14px;
        }

        .vpad-picker-tabs {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
        }

        .vpad-choice-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
            gap: 7px;
        }

        .vpad-choice {
            padding: 10px 6px;
            background: #2f2f2f;
            border: 1px solid #555;
            border-radius: 6px;
            color: #fff;
            font-size: 12px;
        }

        .vpad-choice.selected {
            background: #0078d4;
            border-color: #fff;
        }

        body.game-client {
            margin: 0;
            padding: 0;
            overflow: hidden;
            background: #050607;
            color: #fff;
        }

        .game-client button {
            min-height: 38px;
            padding: 8px 13px;
            border-radius: 6px;
            white-space: nowrap;
        }

        .game-topbar {
            position: fixed;
            top: 10px;
            left: 50%;
            z-index: 5600;
            width: min(1180px, calc(100vw - 20px));
            transform: translateX(-50%);
            display: flex;
            justify-content: center;
            pointer-events: none;
        }

        .game-actionbar,
        .connection-fields,
        .game-volume,
        #status,
        #gamePanels,
        #log {
            background: rgba(10, 12, 14, 0.82);
            border: 1px solid rgba(255,255,255,0.16);
            box-shadow: 0 12px 32px rgba(0,0,0,0.38);
            backdrop-filter: blur(16px);
        }

        .game-actionbar {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            max-width: 100%;
            padding: 8px;
            border-radius: 8px;
            overflow-x: auto;
            pointer-events: auto;
            scrollbar-width: thin;
        }

        .connection-fields {
            position: fixed;
            top: 68px;
            left: 12px;
            z-index: 5601;
            display: none;
            align-items: center;
            gap: 8px;
            width: min(880px, calc(100vw - 24px));
            padding: 10px;
            border-radius: 8px;
            flex-wrap: wrap;
            pointer-events: auto;
        }

        .game-client.show-connection .connection-fields {
            display: flex;
        }

        .connection-fields label {
            color: #d9e1ea;
            font-size: 12px;
            font-weight: 700;
        }

        .connection-fields input {
            width: min(260px, calc(100vw - 70px));
        }

        .game-volume {
            position: fixed;
            left: 50%;
            bottom: 16px;
            z-index: 5600;
            transform: translateX(-50%);
            display: flex !important;
            align-items: center;
            gap: 12px;
            width: min(460px, calc(100vw - 24px));
            box-sizing: border-box;
            padding: 11px 14px;
            border-radius: 8px;
            color: #fff;
            font-weight: 800;
            pointer-events: auto;
        }

        .game-volume input[type="range"] {
            flex: 1;
            min-width: 0;
            padding: 0;
        }

        .game-volume #audioVolumeLabel {
            min-width: 48px;
            color: #00ff88;
            text-align: right;
        }

        .game-client #status {
            position: fixed;
            top: 68px;
            right: 12px;
            z-index: 5500;
            max-width: min(520px, calc(100vw - 24px));
            margin: 0;
            padding: 10px 12px;
            border-left: 4px solid #00ff88;
            border-radius: 8px;
            color: #fff;
            font-size: 13px;
            line-height: 1.35;
        }

        .game-client #gamePanels {
            position: fixed;
            top: 120px;
            right: 12px;
            bottom: 82px;
            z-index: 5450;
            display: none;
            width: min(500px, calc(100vw - 24px));
            overflow-y: auto;
            padding: 10px;
            border-radius: 8px;
        }

        .game-client.show-settings #gamePanels {
            display: block;
        }

        .game-client #gamePanels .tuning-panel,
        .game-client.show-settings #gamePanels .manual-tuning {
            display: block !important;
            margin: 0 0 10px 0;
            padding: 12px;
            border-radius: 8px;
            background: rgba(24, 27, 30, 0.94);
        }

        .game-client #gamePanels .tuning-panel h3 {
            margin-bottom: 10px;
            font-size: 14px;
        }

        .game-client #gamePanels .tuning-row {
            gap: 10px;
            margin: 8px 0;
        }

        .game-client #gamePanels #stats {
            display: grid !important;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            margin: 0 0 10px 0;
        }

        .game-client #video-container {
            position: fixed !important;
            inset: 0 !important;
            z-index: 2400;
            width: 100vw !important;
            height: 100vh !important;
            width: 100dvw !important;
            height: 100dvh !important;
            max-width: none !important;
            max-height: none !important;
            margin: 0 !important;
            border: 0 !important;
            border-radius: 0 !important;
            background: #000 !important;
        }

        .game-client #video {
            width: 100vw !important;
            height: 100vh !important;
            width: 100dvw !important;
            height: 100dvh !important;
            max-width: none !important;
            max-height: none !important;
            object-fit: cover;
            margin: 0 !important;
            border: 0 !important;
            border-radius: 0 !important;
            background: #000;
        }

        .game-client #btnExitImmersive,
        .game-client #btnCaptureMouseImmersive {
            display: none !important;
        }

        .game-client #log {
            position: fixed;
            left: 12px;
            bottom: 82px;
            z-index: 5450;
            display: none;
            width: min(620px, calc(100vw - 24px));
            max-height: min(42vh, 360px);
            margin: 0;
            border-radius: 8px;
        }

        .game-client.show-log #log {
            display: block;
        }

        .game-client #testVideo {
            width: 100% !important;
            height: auto !important;
            aspect-ratio: 16 / 9;
        }

        @media (max-width: 760px) {
            .game-topbar {
                top: 6px;
                width: calc(100vw - 10px);
            }

            .game-actionbar {
                justify-content: flex-start;
            }

            .game-client #status {
                top: 62px;
                left: 8px;
                right: 8px;
                max-width: none;
            }

            .game-client #gamePanels {
                top: 118px;
                left: 8px;
                right: 8px;
                width: auto;
            }

            .connection-fields {
                top: 62px;
                left: 8px;
                width: calc(100vw - 16px);
            }

            .game-volume {
                bottom: 10px;
                width: calc(100vw - 16px);
            }
        }
    </style>
