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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* 水果背景装饰 */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 167, 38, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 60% 80%, rgba(156, 39, 176, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 10% 70%, rgba(76, 175, 80, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 60%, rgba(255, 235, 59, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 25px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* 水果装饰边框 */
.game-container::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, 
        #ff6b6b, #ffa726, #ffeb3b, #9c27b0, 
        #4caf50, #f44336, #ffab91, #e91e63);
    border-radius: 30px;
    z-index: -1;
    opacity: 0.7;
    animation: fruitGlow 3s ease-in-out infinite alternate;
}

@keyframes fruitGlow {
    0% { opacity: 0.5; }
    100% { opacity: 0.8; }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.game-header h1 {
    color: #fff;
    font-size: 2.8rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #ffa726, #ffeb3b, #4caf50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fruitText 2s ease-in-out infinite alternate;
}

@keyframes fruitText {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(45deg); }
}

.score-board {
    display: flex;
    gap: 30px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
}

.score, .lives {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.game-area {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 50%, #90EE90 100%);
    cursor: crosshair;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* 水果图案背景 */
#gameCanvas::before {
    content: '🍎🍊🍌🍇🍉🍓🍋🍑🍒🥝';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    opacity: 0.1;
    pointer-events: none;
    animation: floatingFruits 8s linear infinite;
}

@keyframes floatingFruits {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.game-over-screen, .start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.game-over-screen h2, .start-screen h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #ff6b6b;
}

.game-over-screen p, .start-screen p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

#restartBtn, #startBtn {
    background: linear-gradient(45deg, #ff6b6b, #ffa726, #ffeb3b);
    color: white;
    border: none;
    padding: 18px 35px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    position: relative;
    overflow: hidden;
}

#restartBtn::before, #startBtn::before {
    content: '🍎🍊🍌';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#restartBtn:hover::before, #startBtn:hover::before {
    opacity: 0.3;
}

#restartBtn:hover, #startBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.game-over-screen {
    display: none;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

#pauseBtn, #muteBtn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    backdrop-filter: blur(5px);
}

#pauseBtn:hover, #muteBtn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* 屏幕大小控制 */
.screen-size-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.screen-size-controls span {
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
}

.size-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 30px;
}

.size-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.size-btn.active {
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 屏幕大小样式 */
.game-container.size-small {
    max-width: 650px;
    transform: scale(0.8);
    transform-origin: center;
}

.game-container.size-small #gameCanvas {
    width: 600px;
    height: 450px;
}

.game-container.size-medium {
    max-width: 850px;
    transform: scale(1);
    transform-origin: center;
}

.game-container.size-medium #gameCanvas {
    width: 800px;
    height: 600px;
}

.game-container.size-large {
    max-width: 1050px;
    transform: scale(1.2);
    transform-origin: center;
}

.game-container.size-large #gameCanvas {
    width: 1000px;
    height: 750px;
}

.game-container.size-fullscreen {
    max-width: 98vw;
    max-height: 90vh;
    transform: scale(1);
    transform-origin: center;
    margin: 10px;
}

.game-container.size-fullscreen #gameCanvas {
    width: 90vw;
    height: 80vh;
    max-width: 1200px;
    max-height: 800px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        margin: 10px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .score-board {
        gap: 20px;
        font-size: 1rem;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 600px;
    }
    
    .game-over-screen, .start-screen {
        padding: 30px 20px;
        width: 90%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .score-board {
        flex-direction: column;
        gap: 10px;
    }
    
    .score, .lives {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    #gameCanvas {
        max-width: 350px;
    }
}

/* 动画效果 */
@keyframes fruitSlice {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(0.8) rotate(360deg); opacity: 0; }
}

@keyframes scorePopup {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}

/* 浮动水果装饰 */
.floating-fruit {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.floating-fruit:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.floating-fruit:nth-child(2) { top: 20%; right: 10%; animation-delay: 1s; }
.floating-fruit:nth-child(3) { bottom: 30%; left: 8%; animation-delay: 2s; }
.floating-fruit:nth-child(4) { bottom: 15%; right: 5%; animation-delay: 3s; }
.floating-fruit:nth-child(5) { top: 50%; left: 2%; animation-delay: 4s; }
.floating-fruit:nth-child(6) { top: 60%; right: 3%; animation-delay: 5s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

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

.score-popup {
    position: absolute;
    color: #ffeb3b;
    font-size: 24px;
    font-weight: bold;
    pointer-events: none;
    animation: scorePopup 1s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 5;
}