        * { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
        html, body { margin: 0; background: #fff; font-family: sans-serif; overflow: hidden; touch-action: manipulation; }
        #menu-screen {
            position: fixed; inset: 0; z-index: 1000; background: white;
            display: flex; flex-direction: column; align-items: center;
            padding: max(50px, env(safe-area-inset-top)) 20px 20px;
            overflow-y: auto; -webkit-overflow-scrolling: touch;
        }
        .song-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: 30px; max-width: 960px; }
        .song-card {
            width: min(220px, 42vw); border: 2px solid #eee; border-radius: 20px;
            text-align: center; background: #fff; touch-action: manipulation;
            user-select: none; -webkit-user-select: none;
        }
        .song-card:active { transform: scale(0.97); border-color: #007bff; }
        .song-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 18px 18px 0 0; pointer-events: none; }
        .song-card h3 { pointer-events: none; margin: 12px 8px; font-size: 18px; }

        #game-stage { display: none; position: relative; width: 100vw; height: 100vh; height: 100dvh; background: #fff; }
        canvas#mainCanvas { position: absolute; inset: 0; z-index: 10; touch-action: none; }
        canvas#bgCanvas { position: absolute; inset: 0; z-index: 5; pointer-events: none; }

        #status-panel {
            position: absolute; top: max(20px, env(safe-area-inset-top)); left: max(20px, env(safe-area-inset-left)); z-index: 100;
        }
        #score-val { font-size: clamp(48px, 10vw, 72px); font-weight: 900; color: #333; margin: 0; line-height: 1; }
        #score-label { font-size: 14px; color: #888; margin-top: 4px; }
        #live-detect {
            margin-top: 12px; font-size: clamp(15px, 2.2vw, 18px); font-weight: bold; color: #444;
            background: rgba(255,255,255,0.85); padding: 10px 14px; border-radius: 12px; border: 2px solid #eee;
            line-height: 1.6;
        }
        .detect-ok { color: #28a745; }
        .detect-wait { color: #999; }
        .touch-btn {
            margin-top: 12px; padding: 14px 22px; min-height: 48px; min-width: 48px;
            border-radius: 12px; border: 2px solid #ddd; background: #fff;
            font-weight: 700; font-size: 16px; touch-action: manipulation; user-select: none;
        }
        .touch-btn:active { background: #f0f0f0; border-color: #007bff; }

        #lane-hint {
            position: absolute; bottom: env(safe-area-inset-bottom, 0); left: 50%; transform: translateX(-50%);
            width: min(480px, 90vw); pointer-events: none; z-index: 20;
        }
        #judge-banner {
            text-align: center; font-size: clamp(12px, 2.2vw, 15px); font-weight: 800;
            color: #333; background: #fff3cd; border: 2px solid #ffc107;
            border-radius: 10px 10px 0 0; padding: 6px 10px;
        }
        .lane-row { display: flex; border: 2px solid #333; border-top: none; border-radius: 0 0 12px 12px; overflow: hidden; }
        .hint-box {
            flex: 1; display: flex; flex-direction: row; align-items: center; justify-content: center;
            gap: 8px; min-height: 56px; padding: 6px 8px;
        }
        .left-hint { background: rgba(0, 123, 255, 0.1); border-right: 2px dashed rgba(0,0,0,0.15); }
        .right-hint { background: rgba(255, 20, 147, 0.1); }
        .lane-title { font-weight: 900; font-size: clamp(16px, 3vw, 20px); }
        .left-hint .lane-title { color: #007bff; }
        .right-hint .lane-title { color: #ff1493; }
        .lane-sub { font-size: 12px; color: #666; }
        .lane-preview {
            width: 44px; height: 44px; object-fit: contain;
            display: none; border-radius: 8px; background: rgba(255,255,255,0.85);
            border: 2px solid rgba(0,0,0,0.1);
        }
        .lane-preview.show { display: block; }

        #hit-toast {
            display: none; position: absolute; right: max(16px, env(safe-area-inset-right));
            top: max(80px, env(safe-area-inset-top)); z-index: 90; pointer-events: none;
            font-size: 22px; font-weight: 900; padding: 10px 18px;
            border-radius: 14px; color: #fff; text-align: center;
            box-shadow: 0 4px 16px rgba(0,0,0,0.2);
            animation: toastPop 0.3s ease-out;
        }
        #hit-toast.show-hit { display: block; background: rgba(40,167,69,0.9); }
        #hit-toast.show-miss { display: block; background: rgba(220,53,69,0.85); }
        @keyframes toastPop {
            0% { transform: scale(0.85); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        #pip-camera {
            position: absolute;
            bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px));
            left: max(12px, env(safe-area-inset-left));
            width: min(160px, 28vw); height: min(120px, 21vw);
            border: 2px solid #333; border-radius: 12px; overflow: hidden; z-index: 80;
            background: #111; box-shadow: 0 2px 12px rgba(0,0,0,0.2);
        }
        /* 真正显示摄像头；隐藏到屏外会导致部分平板采到黑帧 */
        #v-in {
            width: 100%; height: 100%; object-fit: cover;
            transform: scaleX(-1); display: block;
            background: #111; pointer-events: none;
        }

        #result-screen { display: none; position: fixed; inset: 0; z-index: 2000; background: white; flex-direction: column; align-items: center; justify-content: center; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
        .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; margin: 20px; max-width: 90vw; }
        .stat-box { background: #f4f4f4; padding: 10px; border-radius: 10px; text-align: center; min-width: 80px; }

