* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    max-width: 500px;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(76, 175, 80, 0.3);
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    color: #aaa;
    font-size: 1rem;
    font-weight: 300;
}

.game-area {
    margin-bottom: 25px;
}

.score-board {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-item {
    text-align: center;
    flex: 1;
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.canvas-container {
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid rgba(76, 175, 80, 0.2);
    overflow: hidden;
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    background: #0a0a15;
    border-radius: 10px;
    border: 2px solid rgba(76, 175, 80, 0.3);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.2);
    width: 100%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 1/1;
}

.game-over, .start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    z-index: 10;
    padding: 20px;
    text-align: center;
}

.game-over h2, .start-screen h2 {
    color: #ff5252;
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 0 15px rgba(255, 82, 82, 0.5);
}

.start-screen h2 {
    color: #4CAF50;
    text-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.start-screen p {
    color: #aaa;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.instructions {
    margin-top: 30px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #4CAF50;
}

.instructions h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions ul {
    list-style: none;
    padding-left: 10px;
}

.instructions li {
    margin-bottom: 10px;
    color: #ccc;
    padding-left: 25px;
    position: relative;
}

.instructions li:before {
    content: "•";
    color: #4CAF50;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

.btn {
    background: linear-gradient(45deg, #4CAF50, #2E7D32);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn:hover, .btn:active {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.6);
    background: linear-gradient(45deg, #2E7D32, #4CAF50);
}

.start-btn {
    padding: 18px 40px;
    font-size: 1.4rem;
    margin-top: 20px;
}

.controls {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.speed-control {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.speed-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 2px solid transparent;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: bold;
}

.speed-btn.active {
    background: linear-gradient(45deg, #4CAF50, #2E7D32);
    color: white;
    border-color: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.touch-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.touch-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.touch-center {
    width: 60px;
    height: 60px;
}

.direction-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333, #222);
    border: 2px solid #4CAF50;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.direction-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.action-btn {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

.action-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.6);
}

#sound-btn {
    background: linear-gradient(45deg, #FF9800, #F57C00);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

#sound-btn:active {
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.6);
}

footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #777;
    font-size: 0.9rem;
}

.hint {
    color: #4CAF50;
    font-size: 0.8rem;
    margin-top: 5px;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
        border-radius: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .score-value {
        font-size: 1.7rem;
    }
    
    .direction-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .touch-center {
        width: 50px;
        height: 50px;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 1.1rem;
    }
    
    .start-btn {
        padding: 15px 35px;
        font-size: 1.2rem;
    }
}

@media (max-width: 360px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .score-board {
        padding: 10px;
    }
    
    .score-value {
        font-size: 1.5rem;
    }
    
    .direction-btn {
        width: 55px;
        height: 55px;
    }
    
    .action-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.5s ease;
}

@keyframes foodGlow {
    0% { box-shadow: 0 0 5px #ff5252; }
    50% { box-shadow: 0 0 20px #ff5252; }
    100% { box-shadow: 0 0 5px #ff5252; }
}

.food-glow {
    animation: foodGlow 1s infinite;
}