body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Arial', sans-serif;
    padding: 20px;
    box-sizing: border-box;
    color: #333;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

canvas {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: linear-gradient(45deg, #f0f8ff 0%, #e6f3ff 100%);
    width: 100%;
    height: auto;
    max-width: 400px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.game-info {
    margin: 20px auto;
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 0 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.score {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: bold;
    color: #fff;
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.score span {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.difficulty {
    margin: 20px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.difficulty select {
    padding: 8px;
    font-size: clamp(14px, 3vw, 16px);
    border-radius: 4px;
    border: 1px solid #ddd;
    min-width: 100px;
}
.controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}
button {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    background: linear-gradient(45deg, #45a049, #3d8b40);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}
.difficulty {
    margin: 20px 0;
}
.difficulty select {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-left: 10px;
}
.difficulty select {
    padding: 8px;
    font-size: clamp(14px, 3vw, 16px);
    border-radius: 4px;
    border: 1px solid #ddd;
}
.touch-controls {
    display: none;
    margin-top: 20px;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: 10px;
    justify-content: center;
    width: 220px;
    margin-left: auto;
    margin-right: auto;
}
.touch-controls .touch-btn {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
}
.touch-controls .touch-btn:empty {
    visibility: hidden;
}
.touch-controls .touch-btn:active {
    transform: scale(0.9);
    background: linear-gradient(45deg, #45a049, #3d8b40);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}
.touch-controls button {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
#upBtn { grid-area: up; }
#leftBtn { grid-area: left; }
#rightBtn { grid-area: right; }
#downBtn { grid-area: down; }

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 20px;
    max-width: 90%;
    width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideIn 0.3s ease;
}

/* 游戏反馈样式 */
.game-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-align: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-feedback.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.game-feedback.info {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.9), rgba(41, 128, 185, 0.9));
}

.game-feedback.success {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.9), rgba(39, 174, 96, 0.9));
}

.game-feedback.warning {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.9), rgba(243, 156, 18, 0.9));
}

.game-feedback.error {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.9), rgba(192, 57, 43, 0.9));
}

/* 分数动画样式 */
.score-animation {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #2ecc71;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transform: translateY(0);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-animation.animate {
    opacity: 1;
    animation: scoreFloat 1s ease-out forwards;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.high-scores {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}
.high-scores table {
    width: 100%;
    border-collapse: collapse;
}
.high-scores th, .high-scores td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}
.high-scores th {
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
}

@media (max-width: 600px) {
    .touch-controls {
        display: grid;
    }
    .game-info {
        margin-top: 15px;
    }
    button {
        padding: 10px 20px;
    }
    .modal-content {
        padding: 15px;
        margin: 10px;
    }
    .high-scores {
        max-height: 250px;
    }
}

@media (max-width: 400px) {
    body {
        padding: 10px;
    }
    .score {
        flex-direction: column;
        gap: 10px;
    }
    .controls {
        gap: 8px;
    }
    button {
        padding: 8px 16px;
    }
}

@media (min-width: 601px) {
    .touch-controls {
        display: none;
    }
}

@media (hover: none) {
    button:hover {
        background-color: #4CAF50;
    }
}