:root {
    --tile-size: 50px;
    --grid-cols: 15;
    --grid-rows: 13;
    --bg-color: #2c3e50;
    --wall-color: #2c3e50;
    --hard-wall: #7f8c8d;
    --soft-wall: #d35400;
    --floor-color: #27ae60;
    --player-color: #3498db;
    --enemy-color: #e74c3c;
    --bomb-color: #2c3e50;
    --explosion-color: #f1c40f;
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #1a1a1a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

#game-container {
    position: relative;
    padding: 20px;
    background: #34495e;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

#ui-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#ui-header h1 { margin: 0; font-size: 24px; color: #f1c40f; }

.stats, .timer { font-size: 18px; font-weight: bold; }

#game-board {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), var(--tile-size));
    grid-template-rows: repeat(var(--grid-rows), var(--tile-size));
    background-color: var(--floor-color);
    border: 5px solid #2c3e50;
    position: relative;
}

.cell {
    width: var(--tile-size);
    height: var(--tile-size);
    box-sizing: border-box;
}

.wall-hard {
    background-color: var(--hard-wall);
    border: 2px solid #95a5a6;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.wall-soft {
    background-color: var(--soft-wall);
    border: 3px solid #e67e22;
    border-radius: 4px;
    background-image: linear-gradient(45deg, rgba(0,0,0,0.1) 25%, transparent 25%);
    background-size: 10px 10px;
}

/* 角色样式 */
.entity {
    position: absolute;
    width: calc(var(--tile-size) * 0.8);
    height: calc(var(--tile-size) * 0.8);
    transition: all 0.1s linear;
    z-index: 10;
    border-radius: 50%;
    transform: translate(10%, 10%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
}

.player-0 { background-color: #3498db; border: 3px solid #2980b9; }
.player-1 { background-color: #e74c3c; border: 3px solid #c0392b; }
.player-2 { background-color: #2ecc71; border: 3px solid #27ae60; }
.player-3 { background-color: #f1c40f; border: 3px solid #f39c12; }

.enemy { background-color: #95a5a6; border: 3px solid #7f8c8d; }

/* 炸弹样式 */
.bomb {
    position: absolute;
    width: var(--tile-size);
    height: var(--tile-size);
    background-color: var(--bomb-color);
    border-radius: 50%;
    z-index: 5;
    animation: pulse 0.5s infinite alternate;
}

.bomb::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    width: 4px;
    height: 10px;
    background: #e67e22;
    transform: translateX(-50%);
}

@keyframes pulse {
    from { transform: scale(0.8); }
    to { transform: scale(0.95); }
}

/* 爆炸样式 */
.explosion {
    position: absolute;
    width: var(--tile-size);
    height: var(--tile-size);
    background-color: var(--explosion-color);
    z-index: 15;
    opacity: 0.8;
    animation: explode-anim 0.4s forwards;
}

@keyframes explode-anim {
    0% { transform: scale(0.1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
    100% { transform: scale(1); opacity: 0; }
}

/* 道具样式 */
.powerup {
    position: absolute;
    width: calc(var(--tile-size) * 0.7);
    height: calc(var(--tile-size) * 0.7);
    z-index: 8;
    transform: translate(20%, 20%);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    color: white;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translate(20%, 20%) scale(1); }
    to { transform: translate(20%, 20%) scale(1.1); }
}

.powerup.range { background: #e67e22; } /* 增加爆炸范围 */
.powerup.speed { background: #9b59b6; } /* 增加移速 */
.powerup.bombCount { background: #34495e; } /* 增加炸弹上限 */

.powerup::after {
    content: '';
}

.powerup.range::after { content: '🔥'; }
.powerup.speed::after { content: '👟'; }
.powerup.bombCount::after { content: '💣'; }

/* 遮罩层 */
#overlay, #start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
}

/* 开始界面增强 */
#start-screen {
    background: rgba(44, 62, 80, 0.95);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 30px;
}

.mode-selection {
    margin: 20px 0;
    display: flex;
    gap: 15px;
}

.mode-btn {
    padding: 10px 20px;
    font-size: 18px;
    background: #34495e;
    color: white;
    border: 2px solid #7f8c8d;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.mode-btn.selected {
    background: #f1c40f;
    color: #2c3e50;
    border-color: white;
    transform: scale(1.1);
}

.character-selection {
    display: flex;
    gap: 40px;
    margin: 20px 0;
}

.p-selection h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.char-list {
    display: flex;
    gap: 10px;
}

.char-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 20px;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.char-option.selected {
    border-color: white;
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(255,255,255,0.5);
}

.controls-hint {
    margin: 15px 0;
    font-size: 14px;
    color: #bdc3c7;
}

.hidden { display: none !important; }

.p-info {
    padding: 5px 10px;
    border-radius: 4px;
    margin-right: 10px;
    display: inline-block;
}

#p1-info { background: rgba(52, 152, 219, 0.3); border: 1px solid #3498db; }
#p2-info { background: rgba(231, 76, 60, 0.3); border: 1px solid #e74c3c; }

button {
    padding: 12px 30px;
    font-size: 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

button:hover { background: #2ecc71; }
