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

body {
    font-family: 'Comic Sans MS', 'Chalkboard', cursive, sans-serif;
    background: #87CEEB;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
}

/* 开始界面 */
#start-screen {
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    padding: 20px;
    text-align: center;
}

#start-screen h1 {
    font-size: 3rem;
    color: #2E7D32;
    text-shadow: 3px 3px 0 #1B5E20, -1px -1px 0 #fff;
    margin-bottom: 10px;
}

#start-screen .subtitle {
    font-size: 1.5rem;
    color: #4CAF50;
    margin-bottom: 30px;
}

.btn {
    background: #4CAF50;
    color: white;
    border: 3px solid #2E7D32;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-family: inherit;
    border-radius: 25px;
    cursor: pointer;
    margin: 10px;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 0 #2E7D32;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2E7D32;
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2E7D32;
}

.btn-secondary {
    background: #78909C;
    border-color: #546E7A;
    box-shadow: 0 4px 0 #546E7A;
}

.btn-secondary:hover {
    box-shadow: 0 6px 0 #546E7A;
}

.btn-secondary:active {
    box-shadow: 0 2px 0 #546E7A;
}

#control-select {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255,255,255,0.5);
    border-radius: 15px;
}

#control-select label {
    display: block;
    margin: 10px 0;
    font-size: 1.1rem;
    cursor: pointer;
}

#control-select input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.3);
}

.instructions {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.5);
    border-radius: 15px;
    font-size: 0.9rem;
    color: #555;
}

.instructions p {
    margin: 5px 0;
}

#high-score-display {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #FF9800;
}

/* 游戏界面 */
#game-screen {
    background: #F5F5DC;
}

#game-canvas {
    background: linear-gradient(180deg, #F5F5DC 0%, #FFFEF0 100%);
    border: 3px solid #8B4513;
    border-radius: 5px;
    max-width: 100%;
    max-height: 100%;
}

#score-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: #333;
    text-shadow: 2px 2px 0 #fff;
    z-index: 10;
}

/* 触摸控制按钮 */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 20px;
    pointer-events: none;
}

.touch-btn {
    width: 80px;
    height: 80px;
    background: rgba(76, 175, 80, 0.6);
    border: 3px solid rgba(46, 125, 50, 0.8);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: white;
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.1s;
}

.touch-btn:active, .touch-btn.active {
    background: rgba(76, 175, 80, 0.9);
}

/* 结束界面 */
#end-screen {
    background: rgba(0, 0, 0, 0.7);
    color: white;
}

#end-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #FF5722;
    text-shadow: 2px 2px 0 #BF360C;
}

#final-score {
    font-size: 2rem;
    margin-bottom: 10px;
}

#best-score {
    font-size: 1.5rem;
    color: #FFD700;
    margin-bottom: 30px;
}

/* 手机端样式 */
.mobile-only {
    display: none;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .mobile-only {
        display: block;
    }

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

    .btn {
        padding: 12px 30px;
        font-size: 1.1rem;
    }

    .instructions {
        font-size: 0.8rem;
    }
}

/* 横屏提示 */
@media (orientation: landscape) and (max-height: 500px) {
    #game-container::before {
        content: '请旋转设备至竖屏模式';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.9);
        color: white;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.5rem;
        z-index: 1000;
    }
}
