* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    overflow: hidden;
    /* 优化字体栈: 优先使用苹方、思源黑体等高清晰度中文字体 */
    font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Heiti SC", sans-serif;
    color: white;
    -webkit-font-smoothing: antialiased; /* 抗锯齿优化 */
    -moz-osx-font-smoothing: grayscale;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#debug-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 240px;
    height: 180px;
    z-index: 10;
    opacity: 0.7;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    background: #111;
}

#input-video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* 镜像翻转 */
    opacity: 0; /* 使用不透明度隐藏而非 display:none，确保某些浏览器下视频帧正常更新 */
    pointer-events: none;
    z-index: -1;
}

#debug-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* 镜像翻转 */
}

#ui-overlay {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    text-align: center;
    pointer-events: none;
}

#status-text {
    font-size: clamp(1rem, 2vw, 1.5rem); /* 响应式字体大小，确保移动端不小于 14pt (约 18.6px) */
    font-weight: 500;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.6); /* 增加背景不透明度以提升对比度 */
    padding: 8px 20px;
    border-radius: 20px;
    letter-spacing: 0.05em; /* 增加字间距 */
    line-height: 1.4;
}

#gesture-icon {
    font-size: 3rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    font-size: 1.5rem;
    color: #aaa;
}

.hidden {
    display: none !important;
}

/* Immersive Mode Enhancements */
body.immersive-mode #ui-overlay,
body.immersive-mode #debug-container,
body.immersive-mode #loading {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

body.immersive-mode #particle-canvas {
    z-index: 9999; /* Ensure it's on top */
    background: radial-gradient(circle at center, #1a0b2e 0%, #000000 100%); /* Subtle background gradient */
}

/* Auto Hide Cursor */
body.hide-cursor,
body.hide-cursor * {
    cursor: none !important;
}