body {
    margin: 0;
    overflow: hidden;
    background-color: #000000;
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
#canvas-container {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0; left: 0; z-index: 1;
    background: #000000;
}

/* --- 视频窗口 --- */
#video-wrapper {
    position: absolute; top: 20px; left: 20px;
    width: 160px; height: 120px; z-index: 2;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
    background: #000; transition: opacity 0.5s ease;
}
#webcam {
    width: 100%; height: 100%; object-fit: cover;
    transform: scaleX(-1); filter: contrast(1.1) saturate(1.2); opacity: 0.8;
}

/* --- 顶部 UI --- */
#top-hud {
    position: absolute; top: 30px; left: 50%;
    transform: translateX(-50%); z-index: 10;
    text-align: center; width: 90%; max-width: 600px;
    pointer-events: none;
}
.status-pill {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 25px; background: rgba(20, 5, 5, 0.6);
    backdrop-filter: blur(10px); border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 50px; color: #ffcc00; font-size: 14px;
    letter-spacing: 1px; box-shadow: 0 0 20px rgba(255, 100, 0, 0.2);
    transition: all 0.3s ease;
}
.status-pill.active {
    background: rgba(255, 69, 0, 0.2); border-color: #ffdd00;
    box-shadow: 0 0 30px rgba(255, 69, 0, 0.4);
}
.icon-gesture { margin-right: 10px; font-size: 18px; }

/* --- 底部 UI --- */
#ui-layer {
    position: absolute; bottom: 40px; width: 100%; z-index: 3;
    text-align: center; color: white; pointer-events: none;
    display: flex; flex-direction: column; align-items: center; gap: 15px;
}
h1 {
    font-weight: 300; letter-spacing: 6px; margin: 0; font-size: 24px;
    opacity: 0.95; background: linear-gradient(to right, #ffcc00, #ff5500, #ffcc00);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 69, 0, 0.4);
}
.sub-text {
    font-size: 12px; color: #ffccaa; opacity: 0.7;
    letter-spacing: 2px; margin-top: -10px; text-transform: uppercase;
}
#dimension-indicator {
    font-family: monospace; color: #00ffff; font-size: 12px;
    opacity: 0.8; margin-bottom: 5px; text-shadow: 0 0 5px #00ffff;
}
#controls-row { pointer-events: auto; display: flex; gap: 15px; }
.ui-btn {
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 200, 100, 0.3);
    color: #ffeebb; padding: 8px 22px; border-radius: 20px;
    cursor: pointer; font-size: 14px; transition: all 0.3s;
    backdrop-filter: blur(5px); display: inline-flex; align-items: center;
    gap: 8px; outline: none;
}
.ui-btn:hover { background: rgba(255, 69, 0, 0.3); color: #fff; border-color: #ffaa00; }
.ui-btn.active { background: rgba(255, 215, 0, 0.2); border-color: #ffdd00; color: #ffdd00; }

/* --- Loading --- */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 100;
    transition: opacity 1s ease;
}
.spinner {
    width: 50px; height: 50px; border: 2px solid rgba(255,200,0,0.1);
    border-top-color: #ffcc00; border-radius: 50%;
    animation: spin 1s infinite linear; box-shadow: 0 0 20px rgba(255, 200, 0, 0.2);
}
.loading-text { margin-top: 15px; color: #ffcc00; letter-spacing: 2px; }
@keyframes spin { 100% { transform: rotate(360deg); } }

#overlay-dimmer {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0); pointer-events: none; transition: background 0.5s ease; z-index: 0;
}
#back-btn {
    position: absolute; top: 80px; left: 50%; transform: translateX(-50%);
    padding: 8px 25px; background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ffff; color: #00ffff; border-radius: 30px;
    cursor: pointer; z-index: 20; display: none; font-size: 14px;
    letter-spacing: 2px; box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}
#back-btn:hover { background: rgba(0, 255, 255, 0.2); }
#click-hint {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: rgba(255,255,255,0.7); font-size: 12px; pointer-events: none;
    opacity: 0; transition: opacity 0.5s; text-shadow: 0 0 5px black;
}

/* --- AI Chat UI --- */
#ai-chat-container {
    position: fixed; bottom: 25px; right: 25px; z-index: 50;
    display: flex; flex-direction: column; align-items: flex-end; pointer-events: none;
}
#ai-chat-window {
    width: 360px; height: 480px; background: rgba(10, 15, 20, 0.85);
    backdrop-filter: blur(15px); border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 12px; box-shadow: 0 0 30px rgba(0, 255, 255, 0.15);
    display: flex; flex-direction: column; margin-bottom: 15px;
    transform: scale(0.9) translateY(20px); opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto; transform-origin: bottom right;
}
#ai-chat-window.open { transform: scale(1) translateY(0); opacity: 1; }
.chat-header {
    padding: 12px 15px; border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    display: flex; justify-content: space-between; align-items: center;
    color: #00ffff; font-size: 16px; letter-spacing: 1px;
    background: rgba(0, 255, 255, 0.05); border-top-left-radius: 12px; border-top-right-radius: 12px;
}
.chat-header button {
    background: none; border: none; color: rgba(255, 255, 255, 0.6);
    cursor: pointer; font-size: 20px; line-height: 1; padding: 0 5px;
}
.chat-header button:hover { color: #ff5555; }
.chat-messages {
    flex-grow: 1; padding: 15px; overflow-y: auto; display: flex;
    flex-direction: column; gap: 12px; font-size: 14px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(0, 255, 255, 0.3); border-radius: 4px; }
.chat-msg {
    max-width: 85%; padding: 10px 14px; border-radius: 12px;
    line-height: 1.5; word-wrap: break-word; animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from{opacity:0; transform:translateY(5px)} to{opacity:1; transform:translateY(0)} }
.chat-msg.user {
    align-self: flex-end; background: rgba(0, 255, 255, 0.15);
    color: #e0ffff; border: 1px solid rgba(0, 255, 255, 0.3); border-bottom-right-radius: 2px;
}
.chat-msg.ai {
    align-self: flex-start; background: rgba(255, 215, 0, 0.1);
    color: #ffddbb; border: 1px solid rgba(255, 215, 0, 0.2); border-bottom-left-radius: 2px;
}
.chat-input-area {
    padding: 12px; border-top: 1px solid rgba(0, 255, 255, 0.2);
    display: flex; gap: 10px; background: rgba(0,0,0,0.3);
    border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
}
.chat-input-area input {
    flex-grow: 1; background: rgba(20, 30, 40, 0.8); border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 10px 14px; border-radius: 20px; color: white; outline: none; transition: border-color 0.3s;
}
.chat-input-area input:focus { border-color: #00ffff; box-shadow: 0 0 10px rgba(0, 255, 255, 0.2); }
.chat-input-area button {
    background: rgba(0, 255, 255, 0.2); border: 1px solid rgba(0, 255, 255, 0.5);
    color: #00ffff; border-radius: 50%; width: 40px; height: 40px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; font-size: 16px;
}
.chat-input-area button:hover { background: rgba(0, 255, 255, 0.5); color: white; transform: scale(1.05); }
#ai-toggle-btn {
    background: rgba(10, 15, 20, 0.9); border: 2px solid #00ffff; color: #00ffff;
    width: 56px; height: 56px; border-radius: 50%; cursor: pointer; font-size: 26px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3); pointer-events: auto;
    transition: all 0.3s; display: flex; align-items: center; justify-content: center;
}
#ai-toggle-btn:hover {
    transform: scale(1.1) rotate(5deg); box-shadow: 0 0 30px rgba(0, 255, 255, 0.6);
    background: rgba(0, 255, 255, 0.15);
}