/*
 * 儿童体感游戏系统 - 主样式表
 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Comic Sans MS', 'Segoe UI', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ==================== 主容器 ==================== */
.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ==================== 标题 ==================== */
.title {
    font-size: 2.5rem;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    text-align: center;
}

.title span {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

.title span:nth-child(2) { animation-delay: 0.1s; }
.title span:nth-child(3) { animation-delay: 0.2s; }
.title span:nth-child(4) { animation-delay: 0.3s; }
.title span:nth-child(5) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================== 游戏区域 ==================== */
.game-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

/* ==================== 视频预览 ==================== */
.video-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: #000;
}

.video-container video {
    display: block;
    width: 320px;
    height: 240px;
    object-fit: cover;
    transform: scaleX(-1); /* 镜像显示 */
}

.video-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

/* ==================== 游戏画布 ==================== */
.canvas-container {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    display: block;
    background: #87CEEB;
}

/* ==================== 状态栏 ==================== */
.status-bar {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    color: #555;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ==================== 加载界面 ==================== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 1.5rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* ==================== 错误界面 ==================== */
.error-content {
    text-align: center;
    color: white;
}

.error-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.error-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

.error-message {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.error-content button {
    padding: 15px 40px;
    font-size: 1.2rem;
    background: white;
    color: #764ba2;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.error-content button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

/* ==================== 说明面板 ==================== */
.instructions {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 25px;
    border-radius: 15px;
    color: white;
    max-width: 600px;
    text-align: center;
}

.instructions h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.instructions ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.instructions li {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

/* ==================== 响应式布局 ==================== */
@media (max-width: 900px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }

    .title {
        font-size: 1.8rem;
    }

    .video-container video {
        width: 280px;
        height: 210px;
    }

    #gameCanvas {
        width: 100%;
        max-width: 600px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .title {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .video-container {
        display: none; /* 手机上隐藏视频预览，节省空间 */
    }

    .status-bar {
        padding: 8px 20px;
        font-size: 14px;
    }

    .instructions {
        padding: 10px 15px;
    }

    .instructions ul {
        gap: 8px;
    }

    .instructions li {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* ==================== 全屏模式提示 ==================== */
.fullscreen-tip {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    z-index: 100;
}

.fullscreen-tip:hover {
    background: rgba(0, 0, 0, 0.9);
}
