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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff9a56, #ff6a88);
    color: white;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-header {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.game-header h1 {
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-board {
    display: flex;
    gap: 20px;
    font-size: 18px;
}

.score, .high-score, .lives {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.game-main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87ceeb, #98d8e8);
    cursor: crosshair;
    touch-action: none;
}

.game-overlay, .game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.overlay-content, .game-over-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.overlay-content h2, .game-over-content h2 {
    font-size: 36px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay-content p, .game-over-content p {
    font-size: 18px;
    margin-bottom: 25px;
}

button {
    background: linear-gradient(45deg, #ff6a88, #ff9a56);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

button:active {
    transform: translateY(0);
}

/* 难度选择样式 */
.difficulty-selection {
    margin: 20px 0;
}

.difficulty-selection h3 {
    font-size: 24px;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.difficulty-btn {
    background: linear-gradient(45deg, #4a90e2, #7b68ee);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.difficulty-btn:active {
    transform: translateY(0);
}

.difficulty-btn.selected {
    background: linear-gradient(45deg, #ff6a88, #ff9a56);
    box-shadow: 0 0 15px rgba(255, 106, 136, 0.5);
}

/* 难度和等级显示样式 */
.difficulty, .level {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    font-weight: bold;
    color: #ff9800;
    display: none; /* 默认隐藏，仅在进阶模式下显示 */
}

/* 游戏结束按钮样式 */
.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.game-over-buttons button {
    flex: 1;
    min-width: 120px;
}

/* 升级提示样式 */
.level-up-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    font-size: 36px;
    font-weight: bold;
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: levelUpAnimation 2s ease-out forwards;
    text-align: center;
}

@keyframes levelUpAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

.game-footer {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    border-radius: 0 0 10px 10px;
}

.controls {
    display: flex;
    gap: 15px;
}

.controls button {
    padding: 8px 15px;
    font-size: 16px;
}

/* 水果样式 */
.fruit {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.1s ease;
}

.fruit.sliced {
    animation: fruitSlice 0.5s ease-out forwards;
}

@keyframes fruitSlice {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* 炸弹样式 */
.bomb {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.bomb.exploded {
    animation: bombExplode 0.5s ease-out forwards;
}

@keyframes bombExplode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .game-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .game-header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .game-header h1 {
        font-size: 24px;
    }
    
    .score-board {
        gap: 10px;
        font-size: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .score, .high-score, .lives {
        padding: 5px 10px;
    }
    
    .game-main {
        flex: 1;
        position: relative;
        overflow: hidden;
    }
    
    #game-canvas {
        cursor: default;
        touch-action: none;
    }
    
    .overlay-content, .game-over-content {
        padding: 20px;
        width: 90%;
        max-width: 300px;
    }
    
    .overlay-content h2, .game-over-content h2 {
        font-size: 28px;
    }
    
    .overlay-content p, .game-over-content p {
        font-size: 16px;
    }
    
    button {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .game-footer {
        padding: 10px 15px;
    }
    
    .controls {
        gap: 10px;
    }
    
    .controls button {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* 小屏幕手机适配 */
@media (max-width: 480px) {
    .game-header h1 {
        font-size: 20px;
    }
    
    .score-board {
        font-size: 14px;
    }
    
    .score, .high-score, .lives {
        padding: 4px 8px;
    }
    
    .overlay-content, .game-over-content {
        padding: 15px;
    }
    
    .overlay-content h2, .game-over-content h2 {
        font-size: 24px;
    }
    
    .overlay-content p, .game-over-content p {
        font-size: 14px;
    }
    
    button {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .controls button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 横屏模式适配 */
@media (max-height: 500px) and (orientation: landscape) {
    .game-header {
        padding: 5px 10px;
    }
    
    .game-header h1 {
        font-size: 18px;
    }
    
    .score-board {
        font-size: 12px;
        gap: 5px;
    }
    
    .score, .high-score, .lives {
        padding: 2px 6px;
    }
    
    .game-footer {
        padding: 5px 10px;
    }
    
    .controls {
        gap: 5px;
    }
    
    .controls button {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* 切割轨迹 */
.slice-trail {
    position: absolute;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,1), rgba(255,255,255,0));
    transform-origin: left center;
    pointer-events: none;
    z-index: 5;
}

/* 得分弹出动画 */
.score-popup {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: scorePopup 1s ease-out forwards;
    z-index: 10;
}

.score-popup.combo {
    font-size: 32px;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: comboPopup 1.2s ease-out forwards;
}

@keyframes scorePopup {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-60px) scale(1);
        opacity: 0;
    }
}

@keyframes comboPopup {
    0% {
        transform: translateY(0) scale(0.5) rotate(-5deg);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) scale(1.3) rotate(5deg);
        opacity: 1;
    }
    40% {
        transform: translateY(-30px) scale(1.1) rotate(-3deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-80px) scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 24px;
    }
    
    .score-board {
        font-size: 16px;
        gap: 10px;
    }
    
    .score, .high-score, .lives {
        padding: 3px 10px;
    }
    
    .overlay-content h2, .game-over-content h2 {
        font-size: 28px;
    }
    
    .overlay-content p, .game-over-content p {
        font-size: 16px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 16px;
    }
}