* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    position: relative;
}

.screen {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.hidden {
    display: none;
}

/* 首页菜单样式优化 */
.menu-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 20px;
}

.game-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 3px;
    background: linear-gradient(90deg, #FF416C, #FF4B2B);
    border-radius: 3px;
}

.game-title h1 {
    font-size: 52px;
    background: linear-gradient(135deg, #6366F1, #FF416C);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 800;
}

.game-title i {
    font-size: 48px;
    background: linear-gradient(135deg, #FF416C, #FF4B2B);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

/* 游戏说明样式优化 */
.game-instructions {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-top: 40px;
}

.game-instructions h2 {
    color: #2D3748;
    font-size: 28px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.game-instructions h2 i {
    color: #FF416C;
    font-size: 32px;
}

.instruction-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    padding: 10px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.instruction-item:hover {
    transform: translateY(-5px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.instruction-item i {
    font-size: 28px;
    background: linear-gradient(135deg, #6366F1, #FF416C);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

.instruction-item p {
    color: #4A5568;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
}

/* 菜单按钮样式优化 */
.menu-buttons {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 40px 0;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366F1, #FF416C);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.menu-btn i {
    font-size: 20px;
}

/* 排行榜样式优化 */
.leaderboard-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
}

.leaderboard-title {
    color: #2D3748;
    font-size: 36px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.leaderboard-title i {
    color: #FFD700;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.leaderboard-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    margin-bottom: 30px;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 100px minmax(200px, 1fr) 120px 150px;
    padding: 20px;
    background: linear-gradient(135deg, #6366F1, #FF416C);
    color: white;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 16px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.5) transparent;
}

.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background-color: rgba(99, 102, 241, 0.5);
    border-radius: 3px;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 100px minmax(200px, 1fr) 120px 150px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.7);
}

.rank-cell, .player-cell, .score-cell, .date-cell {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.rank-cell {
    justify-content: center;
    font-weight: bold;
}

.player-cell {
    justify-content: flex-start;
}

.score-cell {
    justify-content: flex-end;
    font-weight: bold;
    color: #6366F1;
}

.date-cell {
    justify-content: center;
    color: #718096;
}

.leaderboard-item:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(5px);
}

/* 前三名特殊样式 */
.leaderboard-item.rank-1 {
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-item.rank-2 {
    background: rgba(192, 192, 192, 0.1);
}

.leaderboard-item.rank-3 {
    background: rgba(205, 127, 50, 0.1);
}

.leaderboard-item.rank-1 .rank-cell {
    color: #FFD700;
}

.leaderboard-item.rank-2 .rank-cell {
    color: #C0C0C0;
}

.leaderboard-item.rank-3 .rank-cell {
    color: #CD7F32;
}

/* 空记录样式 */
.empty-leaderboard {
    padding: 40px;
    text-align: center;
    color: #718096;
}

.empty-leaderboard .sub-text {
    font-size: 14px;
    margin-top: 10px;
    opacity: 0.8;
}

.leaderboard-item.empty {
    opacity: 0.5;
    pointer-events: none;
}

/* 返回按钮容器 */
.back-button-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* 游戏容器和状态面板样式 */
.game-container {
    position: relative;
    width: 100%;
    height: 80vh;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    min-width: 300px;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    touch-action: none;
}

/* 游戏状态面板样式 */
.game-stats {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    z-index: 1;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    min-width: 150px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

.stat-label {
    color: #ccc;
    font-size: 14px;
}

.stat-value {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* 摄像头预览样式 */
.camera-preview {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#video, #faceCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.emotion-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    text-align: center;
    font-size: 14px;
    backdrop-filter: blur(4px);
}

/* 游戏结束界面样式 */
.final-score {
    font-size: 28px;
    margin: 25px 0;
    color: #2D3748;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.submit-score {
    margin: 25px 0;
}

input {
    padding: 12px 20px;
    margin: 10px;
    border-radius: 8px;
    border: 2px solid #ddd;
    width: 220px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

input:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

button {
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    margin: 10px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #6366F1, #FF416C);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* 加载屏幕样式 */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.loading-content {
    text-align: center;
    color: white;
    padding: 30px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.1);
    border-top: 6px solid #6366F1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 版权信息区域 */
.footer-info {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border-radius: 20px;
    padding: 25px;
    margin-top: 40px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
}

.footer-info-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 20px;
}

.footer-item {
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.footer-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.footer-item h3 {
    color: #2D3748;
    font-size: 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-item h3 i {
    color: #FF416C;
}

.footer-item p {
    color: #4A5568;
    font-size: 14px;
    line-height: 1.6;
}

.copyright {
    margin-top: 20px;
    color: #2D3748;
    font-size: 14px;
    opacity: 0.8;
}

/* 响应式设计优化 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .menu-container {
        padding: 20px;
    }

    .game-title h1 {
        font-size: 36px;
    }

    .instruction-content {
        grid-template-columns: 1fr;
    }

    .menu-buttons {
        flex-direction: column;
    }

    .menu-btn {
        width: 100%;
    }

    .game-container {
        height: 70vh;
    }

    .camera-preview {
        width: 150px;
        height: 112.5px;
        bottom: 10px;
        right: 10px;
    }

    .game-stats {
        top: 10px;
        right: 10px;
        padding: 10px;
        min-width: 120px;
    }

    .stat-item {
        padding: 3px 8px;
    }

    .stat-label {
        font-size: 12px;
    }

    .stat-value {
        font-size: 16px;
    }

    .leaderboard-container {
        max-width: 100%;
    }

    .leaderboard-header,
    .leaderboard-item {
        grid-template-columns: 80px minmax(120px, 1fr) 100px 120px;
        padding: 10px;
        font-size: 14px;
    }

    .footer-info-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-item {
        padding: 12px;
    }

    .footer-item h3 {
        font-size: 16px;
    }

    .footer-item p {
        font-size: 13px;
    }
}

/* 高分辨率屏幕支持 */
@media (min-resolution: 2dppx) {
    .game-container {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    button {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .screen {
        background: rgba(30, 30, 30, 0.9);
        color: white;
    }

    input {
        background: rgba(45, 45, 45, 0.9);
        color: white;
        border-color: #444;
    }

    input:focus {
        border-color: #6366F1;
    }

    .instruction-item {
        background: rgba(45, 45, 45, 0.9);
    }

    .instruction-item p {
        color: #e2e8f0;
    }

    .footer-info {
        background: linear-gradient(135deg, rgba(45, 45, 45, 0.9), rgba(35, 35, 35, 0.7));
    }

    .footer-item {
        background: rgba(45, 45, 45, 0.9);
    }

    .footer-item h3 {
        color: #e2e8f0;
    }

    .footer-item p {
        color: #cbd5e0;
    }

    .copyright {
        color: #e2e8f0;
    }
}