:root {
    --primary-color: #4a6bff;
    --secondary-color: #ff6b6b;
    --background-color: #f8f9fa;
    --text-color: #333;
    --success-color: #28a745;
    --error-color: #dc3545;
}

/* 返回链接样式 */
.back-link {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.back-link:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary-color);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
    touch-action: manipulation;
}

#game-container {
    text-align: center;
    max-width: 100%;
    width: 100%;
    padding: 15px;
    box-sizing: border-box;
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Start Screen Styles */
#start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.5s ease;
}

#start-screen h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#start-screen p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.difficulty-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.difficulty-btn.active {
    background-color: var(--primary-color);
    color: white;
}

#start-btn, #restart-btn, #home-btn, #pause-btn {
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.2rem;
    cursor: pointer;
    margin: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#start-btn:hover, #restart-btn:hover, #home-btn:hover, #pause-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

#start-btn:active, #restart-btn:active, #home-btn:active, #pause-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Game Screen Styles */
#game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1rem;
    font-weight: bold;
    flex-wrap: wrap;
    gap: 10px;
}

#emoji-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin: 0 auto;
    width: 100%;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.emoji {
    font-size: 1.5rem;
    cursor: pointer;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Makes it square */
    position: relative;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    user-select: none;
    touch-action: manipulation;
}

.emoji-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.emoji.correct {
    background-color: var(--success-color);
    color: white;
    animation: pulse 0.5s;
}

.emoji.wrong {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes jitter {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(var(--jx1), var(--jy1)); }
    20% { transform: translate(var(--jx2), var(--jy2)); }
    30% { transform: translate(var(--jx3), var(--jy3)); }
    40% { transform: translate(var(--jx4), var(--jy4)); }
    50% { transform: translate(var(--jx5), var(--jy5)); }
    60% { transform: translate(var(--jx6), var(--jy6)); }
    70% { transform: translate(var(--jx7), var(--jy7)); }
    80% { transform: translate(var(--jx8), var(--jy8)); }
    90% { transform: translate(var(--jx9), var(--jy9)); }
}

.moving {
    animation: jitter 0.5s linear infinite;
}

#message {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 15px 0;
    height: 30px;
    color: var(--primary-color);
}

/* Game Over Screen Styles */
#game-over-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.5s ease;
}

#game-over-screen h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

#final-score {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: bold;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #game-info {
        font-size: 0.9rem;
    }

    .emoji {
        font-size: 1.3rem;
    }

    #message {
        font-size: 1rem;
    }

    #start-screen h1 {
        font-size: 2rem;
    }

    #game-over-screen h2 {
        font-size: 1.8rem;
    }

    #final-score {
        font-size: 1.3rem;
    }

    #emoji-container {
        grid-template-columns: repeat(10, 1fr);
        gap: 3px;
    }
}

@media (max-width: 480px) {
    #game-info {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    .emoji {
        font-size: 1.1rem;
    }

    #emoji-container {
        grid-template-columns: repeat(8, 1fr);
        gap: 2px;
    }

    .difficulty-btn, #start-btn, #restart-btn, #home-btn, #pause-btn {
        padding: 8px 16px;
        font-size: 1rem;
    }
}