* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 优化触摸行为，防止误触复制 */
body {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

/* 特别为轮盘区域添加触摸优化 */
.joystick-container,
.joystick-base,
.joystick-handle,
.action-btn,
.game-btn {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

.game-container {
    text-align: center;
    background-color: rgba(52, 73, 94, 0.95);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(26, 188, 156, 0.3);
    max-width: 100%;
    box-sizing: border-box;
}

.game-title {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #f1c40f;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.game-header {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    font-size: 1rem;
    font-weight: bold;
    gap: 10px;
    flex-wrap: wrap;
}

.game-header div {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
    padding: 12px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    transition: all 0.3s ease;
}

.game-header div:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#gameCanvas {
    border: 4px solid #1abc9c;
    background-color: #2c3e50;
    border-radius: 10px;
    display: block;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    max-width: 100%;
    height: auto;
    width: 100%;
    max-height: 80vh;
}

/* 移动端控制按钮 */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    max-width: 500px;
    width: 100%;
}

.control-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.control-content .joystick-container {
    margin-right: 40px;
}

.control-content .action-btn {
    margin-left: 40px;
}

/* 方向轮盘样式 */
.joystick-container {
    position: relative;
    width: 120px;
    height: 120px;
    touch-action: none;
    user-select: none;
}

.joystick-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(52,152,219,0.8) 0%, rgba(41,128,185,0.9) 100%);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.joystick-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(236,240,241,0.8) 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: grab;
    transition: transform 0.1s ease;
}

.joystick-handle:active {
    cursor: grabbing;
}

/* 炸弹按钮样式 */
.action-btn {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.1s ease;
    touch-action: manipulation;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.action-btn:active {
    transform: scale(0.95);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mobile-controls {
        display: block;
    }
    
    .game-container {
        padding: 10px;
        margin: 10px;
    }
    
    .game-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .game-header {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .game-header div {
        min-width: 120px;
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .game-info {
        display: none;
    }
    
    .screen {
        width: 90%;
        padding: 30px 20px;
    }
    
    .start-screen h2,
    .game-over-screen h2 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .game-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
}

#gameCanvas:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

/* 游戏界面样式 */
.screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(52, 73, 94, 0.98);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 10;
    border: 3px solid #f1c40f;
}

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

.game-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    margin: 10px;
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}

.game-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.final-stats {
    margin: 20px 0;
    font-size: 1.3rem;
}

.final-stats p {
    margin: 10px 0;
    color: #ecf0f1;
}

.game-info {
    background-color: rgba(44, 62, 80, 0.9);
    padding: 20px;
    border-radius: 10px;
    text-align: left;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.controls h3 {
    margin-bottom: 15px;
    color: #1abc9c;
    font-size: 1.3rem;
}

.controls p {
    margin: 10px 0;
    color: #ecf0f1;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls p:before {
    content: '🎮';
    font-size: 1.5rem;
}

/* 页脚样式 */
.game-footer {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: rgba(44, 62, 80, 0.9);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-footer a {
    color: #f1c40f;
    text-decoration: none;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.5);
}

.game-footer a:hover {
    color: #e67e22;
    text-decoration: underline;
    transform: scale(1.05);
    display: inline-block;
}

/* 移动端触摸控制样式 */
.mobile-controls {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(44, 62, 80, 0.9);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.direction-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.dir-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    margin: 5px;
}

.dir-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.middle-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.bomb-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    display: block;
    margin: 0 auto;
}

.bomb-btn:active {
    transform: scale(0.95);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* 响应式设计 - 针对移动设备 */
@media (max-width: 768px) {
    body {
        padding: 10px 0;
    }
    
    .game-container {
        padding: 10px;
    }
    
    .game-title {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .game-header {
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .game-header div {
        padding: 10px 20px;
        min-width: 100px;
    }
    
    #gameCanvas {
        max-height: 50vh;
    }
    
    .screen {
        padding: 30px 20px;
        width: 90%;
        max-width: 400px;
    }
    
    .start-screen h2,
    .game-over-screen h2 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .game-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .game-info {
        padding: 15px;
        margin-top: 15px;
    }
    
    .controls h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .controls p {
        font-size: 0.9rem;
    }
    
    .game-footer {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 16px;
        font-size: 0.8rem;
        margin-top: 0;
        z-index: 90;
        background-color: rgba(44, 62, 80, 0.8);
        border-radius: 20px;
    }
    
    /* 确保游戏页脚在控制按钮下方 */
    .mobile-controls {
        bottom: 60px;
    }
    
    .game-footer {
        bottom: 10px;
        background-color: rgba(44, 62, 80, 0.9);
    }
    
    /* 显示移动端控制 */
    .mobile-controls {
        display: block;
    }
}