body {
    margin: 0;
    overflow: hidden;
    background-color: #000;
    font-family: 'Arial', sans-serif;
    user-select: none;
}

#scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* 让点击穿透到 canvas */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#title {
    position: absolute;
    top: 5%;
    width: 100%;
    text-align: center;
    font-family: 'Brush Script MT', cursive; /* 模拟手写体 */
    font-size: 80px;
    color: #ffd700;
    text-shadow: 0 0 10px #ffaa00, 0 0 20px #ffaa00;
    z-index: 5;
    opacity: 0; /* 初始隐藏，加载完显示 */
    /* 已移除闪烁动画 */
}


#loading {
    font-size: 24px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

#instruction {
    position: absolute;
    top: 20px;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    transition: opacity 0.5s;
}

#gesture-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #fff;
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.2);
}

#hint-icon {
    display: block;
    font-size: 40px;
    margin-bottom: 5px;
}

#hint-text {
    font-size: 16px;
    text-shadow: 0 0 5px #ff0000;
}

/* 设置菜单样式 */
#settings-menu {
    position: absolute;
    top: 20px; /* 右上角 */
    right: 20px;
    z-index: 25;
    pointer-events: auto; /* 允许点击 */
}

.settings-toggle {
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    font-weight: normal;
    opacity: 0.6; /* 降低可见性 */
}

.settings-toggle:hover {
    opacity: 1; /* 悬停时完全显示 */
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.settings-panel {
    position: absolute;
    top: 40px; /* 按钮下方 */
    right: 0;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 20px;
    border-radius: 15px;
    min-width: 280px;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-height: 400px;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    color: #ffd700;
    font-size: 18px;
    margin-bottom: 12px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.settings-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.5);
}

.title-input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.title-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.title-input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.15);
}

.photos-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.photos-preview .photo-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.photos-preview .photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photos-preview .photo-preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#camera-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 240px;
    height: 180px;
    z-index: 20;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    transform: scaleX(-1); /* 镜像显示，让用户感觉像照镜子 */
    background: #000;
}

.input_video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; /* 隐藏视频，只显示 canvas 上的绘制结果 */
    pointer-events: none;
}

.output_canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 照片选择模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-content h2 {
    color: #ffd700;
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.modal-content p {
    color: #fff;
    font-size: 16px;
    margin-bottom: 30px;
}

.select-btn, .confirm-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.select-btn:hover, .confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(255, 107, 107, 0.6);
}

.confirm-btn:disabled {
    background: #666;
    cursor: not-allowed;
    box-shadow: none;
}

.confirm-btn:disabled:hover {
    transform: none;
}

#selected-photos-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin: 30px 0;
    max-height: 300px;
    overflow-y: auto;
}

.photo-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

